@g1cloud/bpmn-modeler-next 5.0.0-beta.20 → 5.0.0-beta.22

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,29 +1,29 @@
1
- (function(Q,ge){typeof exports=="object"&&typeof module<"u"?ge(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ge):(Q=typeof globalThis<"u"?globalThis:Q||self,ge(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,ge){"use strict";var s5=Object.defineProperty;var c5=(Q,ge,po)=>ge in Q?s5(Q,ge,{enumerable:!0,configurable:!0,writable:!0,value:po}):Q[ge]=po;var ui=(Q,ge,po)=>c5(Q,typeof ge!="symbol"?ge+"":ge,po);const po=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],dc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function pm(e){return po.includes(e)}function fm(e){return dc.includes(e)}const hc=["timer"],mc={timer:"bpmn:TimerEventDefinition"};function dm(e){return typeof e=="string"&&hc.includes(e)}function cp(e){if(e.length===1)return hc.find(t=>mc[t]===e[0])}const gc=["ko","en","ja","zh"];function S1(e){return typeof e=="string"&&gc.includes(e)}const hm="http://g1project.net/spec/bpmn/bwl/1.0",lp="bwl",up=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],yc="bwl:ReviewRequest",mm={name:"bwl-hints",uri:hm,prefix:lp,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:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]},{name:"ReviewRequest",superClass:["Element"],properties:[{name:"locale",isAttr:!0,type:"String"},{name:"sourceLocale",isAttr:!0,type:"String"},{name:"previous",isBody:!0,type:"String"}]}]},pp="bwl.undoEpisode",gm=new WeakSet;function R1(e){gm.has(e)||(e.register(pp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),gm.add(e))}function ym(e,t){R1(e);const n={run:t};if(e.execute(pp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function fp(e){return Array.prototype.concat.apply([],e)}const Ya=Object.prototype.toString,C1=Object.prototype.hasOwnProperty;function fo(e){return e===void 0}function pn(e){return e!==void 0}function Uo(e){return e==null}function $e(e){return Ya.call(e)==="[object Array]"}function fn(e){return Ya.call(e)==="[object Object]"}function Fe(e){return Ya.call(e)==="[object Number]"}function yn(e){const t=Ya.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Xn(e){return Ya.call(e)==="[object String]"}function M1(e){if(!$e(e))throw new Error("must supply array")}function Zn(e,t){return!Uo(e)&&C1.call(e,t)}function kt(e,t){const n=bc(t);let i;return H(e,function(r,o){if(n(r,o))return i=r,!1}),i}function vm(e,t){const n=bc(t);let i=$e(e)?-1:void 0;return H(e,function(r,o){if(n(r,o))return i=o,!1}),i}function it(e,t){const n=bc(t);let i=[];return H(e,function(r,o){n(r,o)&&i.push(r)}),i}function H(e,t){let n,i;if(fo(e))return;const r=$e(e)?O1:k1;for(let o in e)if(Zn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function A1(e,t){if(fo(e))return[];M1(e);const n=bc(t);return e.filter(function(i,r){return!n(i,r)})}function Qn(e,t,n){return H(e,function(i,r){n=t(n,i,r)}),n}function Mr(e,t){return!!Qn(e,function(n,i,r){return n&&t(i,r)},!0)}function Ar(e,t){return!!kt(e,t)}function Bn(e,t){let n=[];return H(e,function(i,r){n.push(t(i,r))}),n}function vc(e){return e&&Object.keys(e)||[]}function P1(e){return vc(e).length}function qo(e){return Bn(e,t=>t)}function Yo(e,t,n={}){return t=dp(t),H(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function bm(e,...t){e=dp(e);let n={};return H(t,r=>Yo(r,e,n)),Bn(n,function(r,o){return r[0]})}const T1=bm;function Hi(e,t){t=dp(t);let n=[];return H(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)}),Bn(n,i=>i.v)}function Ko(e){return function(t){return Mr(e,function(n,i){return t[i]===n})}}function dp(e){return yn(e)?e:t=>t[e]}function bc(e){return yn(e)?e:t=>t===e}function k1(e){return e}function O1(e){return Number(e)}function hp(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function l(){n&&a(!0),c()}function u(...p){o=Date.now(),i=p,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function qn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function D1(e,t,n){let i=e;return H(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];pn(a)&&Uo(s)&&(s=i[r]=isNaN(+a)?{}:[]),fo(a)?fo(n)?delete i[r]:i[r]=n:i=s}),e}function Li(e,t){let n={},i=Object(e);return H(t,function(r){r in i&&(n[r]=e[r])}),n}function zi(e,t){let n={},i=Object(e);return H(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function M(e,t){var n=de(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function tt(e,t){return Ar(t,function(n){return M(e,n)})}function de(e){return e&&e.businessObject||e}function ut(e){return e&&e.di}const L1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",xm="i18n",Xo="i18n:Translation";function ho(e){if(e){if(M(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(M(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Zo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Xo)})}function Nn(e){return e.get("xml:lang")}function Pr(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,yc)})}function Ka(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,r,o)=>i!==t&&o.indexOf(i)===r)]}function mp(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function gp(e,t,n){const i=ho(e);if(!i)return{};const r=i.target[i.key]??"",o=Zo(e).filter(u=>Nn(u)),a=u=>u.body??"",s=r?o.filter(u=>a(u)===r).map(Nn):[],c=r?s.length?s:[n??t.designLocale]:[],l={};for(const u of Ka(t)){if(c.includes(u)){l[u]=r;continue}const p=o.find(f=>Nn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const xc="bwl.updateTranslation";class yp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:r,locales:o,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=ho(c),u=[];t.undo=u;const p=Zo(c).filter($=>Nn($)),f=s??(l?l.target[l.key]??"":""),d=a??r,h=($=>{if(!$)return[];const N=p.filter(L=>L.body===$).map(Nn);return N.length?N:[d]})(f),y=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,_=$=>{var N;return((N=p.find(L=>Nn(L)===$&&L.body))==null?void 0:N.body)??(h.includes($)?f:"")},x=$=>Pr(c).some(N=>N.locale===$),m=_(y);if(m===i)return[];const v=!!m&&!x(y),E=v?o.filter($=>$!==y&&_($)&&!x($)):[],S=()=>{let $=c.extensionElements;return $||($=this.moddle.create("bpmn:ExtensionElements",{values:[]}),$.$parent=c,c.extensionElements=$,u.push(()=>delete c.extensionElements)),$.get("values")},P=($,N)=>{const L=S();let z=L.find(X=>{var oe;return((oe=X.$instanceOf)==null?void 0:oe.call(X,Xo))&&Nn(X)===$});if(z){const X=z.body;z.body=N,u.push(()=>z.body=X)}else z=this.moddle.create(Xo,{body:N}),z.set("xml:lang",$),z.$parent=c.extensionElements,L.push(z),u.push(()=>L.splice(L.indexOf(z),1))},k=$=>{const N=S(),L=N.indexOf($);N.splice(L,1),u.push(()=>N.splice(L,0,$))};if(s===void 0){if(y===r&&l){if(f&&!p.some(N=>N.body===f)){const N=a&&a!==r?a:void 0;N&&P(N,f)}const $=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{$?l.target[l.key]=f:delete l.target[l.key]})}P(y,i)}else(p.some($=>Nn($)===y)||!f&&y!==d)&&P(y,i);if(!v)for(const $ of Pr(c).filter(N=>N.locale===y))k($);for(const $ of E){const N=S(),L=this.moddle.create(yc,{locale:$,sourceLocale:y,previous:m});L.$parent=c.extensionElements,N.push(L),u.push(()=>N.splice(N.indexOf(L),1))}for(const $ of Pr(c).filter(N=>N.sourceLocale===y&&(N.previous??"")===i))k($);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ui(yp,"$inject",["moddle"]);const vp="bwl.setTranslations",I1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class bp{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:r=[],designLocale:o,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!ho(l))return[];const p=()=>{let _=l.extensionElements;return _||(_=this.moddle.create("bpmn:ExtensionElements",{values:[]}),_.$parent=l,l.extensionElements=_,u.push(()=>delete l.extensionElements)),_.get("values")},f=_=>{const x=p(),m=x.indexOf(_);m<0||(x.splice(m,1),u.push(()=>x.splice(m,0,_)))},d=_=>Zo(l).find(x=>Nn(x)===_);if(i===null)for(const _ of a){const x=d(_);x&&f(x)}else if(i)for(const _ of a){const x=i[_];if(x===void 0)continue;const m=d(_);if(m){if(m.body===x)continue;const S=m.body;m.body=x,u.push(()=>m.body=S);continue}if(_===o&&(s??o)===o)continue;const v=p(),E=this.moddle.create(Xo,{body:x});E.set("xml:lang",_),E.$parent=l.extensionElements,v.push(E),u.push(()=>v.splice(v.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(_=>!r.includes(_.locale)&&!(i&&i[_.locale]!==void 0&&i[_.locale]!==c.texts[_.locale])&&!(i&&_.sourceLocale&&i[_.sourceLocale]===_.previous))];for(const _ of Pr(l)){const x=h.findIndex(m=>I1(_,m));x>=0?h.splice(x,1):f(_)}for(const _ of h){const x=p(),m=this.moddle.create(yc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});m.$parent=l.extensionElements,x.push(m),u.push(()=>x.splice(x.indexOf(m),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ui(bp,"$inject",["moddle"]);function xp(e){return Pr(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class _p{constructor(t){t.registerHandler(xc,yp),t.registerHandler(vp,bp)}}ui(_p,"$inject",["commandStack"]);const wp={__init__:["translationCommands"],translationCommands:["type",_p]},_m=["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","translation.confirm","element.remove"],B1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},N1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(gc.map(e=>[e,{type:"string"}])),additionalProperties:!1},$1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},F1={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},j1={type:"string",enum:[...hc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},H1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...dc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},z1={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},G1={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},V1={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id","source","target"],additionalProperties:!1},W1={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},U1={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},q1={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},Y1={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},K1={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},X1={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...up]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function An(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Z1={"participant.add":An("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":An("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":An("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":An("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lane:{type:"string"},type:{type:"string",enum:[...dc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":An("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":An("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":An("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":An("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":An("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":An("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":An("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":An("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":An("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":An("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":An("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":An("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":An("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...gc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":An("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},wm={anyOf:_m.map(e=>Z1[e])},Q1={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라. 문서에 문서 언어 설정이 있으면(describe 의 i18n) 문구는 평문 name/text 가 아니라 names/texts 로 문서 언어 전부를 준다.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:$1,irParticipant:F1,irNode:H1,irFlowCondition:z1,irSequenceFlow:G1,irMessageFlow:V1,irDataStore:W1,irDataAssociation:U1,irTextAnnotation:q1,irAssociation:Y1,irGroup:K1,bwlPlacement:X1,eventDefinition:j1,localeTexts:N1,nullableString:B1,symbolicOp:wm}};function Ep(){}Ep.prototype.get=function(e){return this.$model.properties.get(this,e)},Ep.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Em(e,t){this.model=e,this.properties=t}Em.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ep.prototype);H(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}),H(a,qn(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 J1=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Sm=V(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 Sp(e,t){var n=Sm[e];return n?n(t):t}function Rp(e){return!!J1[e]}function Rm(e){return!!Sm[e]}function $n(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 pi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}pi.prototype.build=function(){return Li(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},pi.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)},pi.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},pi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=$n(r[0],i),a=$n(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},pi.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},pi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},pi.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},pi.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},pi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},pi.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")},pi.prototype.hasProperty=function(e){return this.propertiesByName[e]},pi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(H(e.properties,qn(function(o){o=V({},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 Tr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,H(e,qn(this.registerPackage,this))}Tr.prototype.getPackage=function(e){return this.packageMap[e]},Tr.prototype.getPackages=function(){return this.packages},Tr.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Cm(t,e,"prefix"),Cm(t,e,"uri"),H(e.types,qn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Tr.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=$n(e.name,t.prefix),i=n.name,r=Object.create(null);H(e.properties,qn(function(o){var a=$n(o.name,n.prefix),s=a.name;Rp(o.type)||(o.type=$n(o.type,a.prefix).name),V(o,{ns:a,name:s}),r[s]=o},this)),V(e,{ns:n,name:i,propertiesByName:r}),H(e.extends,qn(function(o){var a=$n(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},Tr.prototype.mapTypes=function(e,t,n){var i=Rp(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=$n(c,Rp(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");H(i.superClass,n?a:s),t(i,!n),H(i.traits,a)},Tr.prototype.getEffectiveDescriptor=function(e){var t=$n(e),n=new pi(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},Tr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Cm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function mo(e){this.model=e}mo.prototype.set=function(e,t,n){if(!Xn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;eS(n)?i?delete e[r]:delete e.$attrs[Cp(t)]:i?r in e?e[r]=n:Mm(e,i,n):e.$attrs[Cp(t)]=n},mo.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Cp(t)];var i=n.name;return!e[i]&&n.isMany&&Mm(e,n,[]),e[i]},mo.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},mo.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},mo.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},mo.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 eS(e){return typeof e>"u"}function Mm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Cp(e){return e.replace(/^:/,"")}function vi(e,t={}){this.properties=new mo(this),this.factory=new Em(this,this.properties),this.registry=new Tr(e,this.properties),this.typeCache=Object.create(null),this.config=t}vi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},vi.prototype.getType=function(e){var t=this.typeCache,n=Xn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},vi.prototype.createAny=function(e,t,n){var i=$n(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){D1(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}),H(n,function(a,s){fn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},vi.prototype.getPackage=function(e){return this.registry.getPackage(e)},vi.prototype.getPackages=function(){return this.registry.getPackages()},vi.prototype.getElementDescriptor=function(e){return e.$descriptor},vi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},vi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},vi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Am=String.fromCharCode,tS=Object.prototype.hasOwnProperty,nS=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Xa={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Xa).forEach(function(e){Xa[e.toUpperCase()]=Xa[e]});function iS(e,t,n,i){return i?tS.call(Xa,i)?Xa[i]:"&"+i+";":Am(t||parseInt(n,16))}function go(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(nS,iS):e}var Pm="non-whitespace outside of root node";function kr(e){return new Error(e)}function rS(e){return"missing namespace for prefix <"+e+">"}function _c(e){return{get:e,enumerable:!0}}function oS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Tm=Symbol("nameCache");function Mp(e){return e+"$uri"}function aS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Mp(i)]=n;return t}function wc(){return{line:0,column:0}}function sS(e){throw e}function km(e){if(!this)return new km(e);var t=e&&e.proxy,n,i,r,o,a=sS,s,c,l,u,p=wc,f=!1,d=!1,g="",h=!1,y=!1,_=null,x=!1,m,v,E,S;function P(L){L instanceof Error||(L=kr(L)),_=L,a(L,p)}function k(L){s&&(L instanceof Error||(L=kr(L)),s(L,p))}this.on=function(L,z){if(typeof z!="function")throw kr("required args <name, cb>");switch(L){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":u=z;break;case"question":l=z;break;case"comment":c=z;break;default:throw kr("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw kr("required args <nsMap={}>");var z=Object.create(null),X;for(X in L)z[X]=L[X];return y=!0,S=z,this};function $(){m=y?[]:null,v=y?aS(S):null,E=[],p=wc,x=!1,_=null,d=!1,g=""}this.parse=function(L){if(typeof L!="string")throw kr("required args <xml=string>");if(f)throw kr("parse during stream; call end() first");return $(),N(L),p=wc,x=!1,_},this.write=function(L){if(typeof L!="string")throw kr("required args <xml=string>");return f||($(),f=!0),_||(g=N(g+L,!0)||""),this},this.end=function(){return f||$(),f=!1,_||N(g),g="",p=wc,x=!1,_},this.stop=function(){x=!0};function N(L,z=!1){var X=null,oe=null,te,Ge=0,qe=!1,Ve=!1,Re=0,Z=0,ie,W,Y,ae,me,Te,B,C,w,G="",q=0,ne;function Me(Rt,gn){var Rn=Rt.indexOf(":");if(Rn===-1)return Rt;var Vn=v[Rt.substring(0,Rn)];return Vn?gn===Vn?Rt.substr(Rn+1):Vn+Rt.substr(Rn):(k(rS(Rt.substring(0,Rn))),null)}function Xe(){if(ne!==null)return ne;var Rt,gn,Rn=y&&v.xmlns,Vn=y&&h?[]:null,Mt=q,Qt=G,_n=Qt.length,za,Wn,$i,si,nn,No={},Ga=new Set,Cn,dt,wt;e:for(;Mt<_n;Mt++)if(Cn=!1,dt=Qt.charCodeAt(Mt),!(dt===32||dt<14&&dt>8)){for((dt<65||dt>122||dt>90&&dt<97)&&dt!==95&&dt!==58&&(k("illegal first char attribute name"),Cn=!0),wt=Mt+1;wt<_n;wt++)if(dt=Qt.charCodeAt(wt),!(dt>96&&dt<123||dt>64&&dt<91||dt>47&&dt<59||dt===46||dt===45||dt===95)){if(dt===32||dt<14&&dt>8){k("missing attribute value"),Mt=wt;continue e}if(dt===61)break;k("illegal attribute name char"),Cn=!0}if(nn=Qt.substring(Mt,wt),nn==="xmlns:xmlns"&&(k("illegal declaration of xmlns"),Cn=!0),dt=Qt.charCodeAt(wt+1),dt===34)wt=Qt.indexOf('"',Mt=wt+2),wt===-1&&(wt=Qt.indexOf("'",Mt),wt!==-1&&(k("attribute value quote missmatch"),Cn=!0));else if(dt===39)wt=Qt.indexOf("'",Mt=wt+2),wt===-1&&(wt=Qt.indexOf('"',Mt),wt!==-1&&(k("attribute value quote missmatch"),Cn=!0));else for(k("missing attribute value quotes"),Cn=!0,wt=wt+1;wt<_n&&(dt=Qt.charCodeAt(wt+1),!(dt===32||dt<14&&dt>8));wt++);for(wt===-1&&(k("missing closing quotes"),wt=_n,Cn=!0),Cn||($i=Qt.substring(Mt,wt)),Mt=wt;wt+1<_n&&(dt=Qt.charCodeAt(wt+1),!(dt===32||dt<14&&dt>8));wt++)Mt===wt&&(k("illegal character after attribute end"),Cn=!0);if(Mt=wt+1,Cn)continue e;if(Ga.has(nn)){k("attribute <"+nn+"> already defined");continue}if(Ga.add(nn),!y){No[nn]=$i;continue}if(h){if(Wn=nn==="xmlns"?"xmlns":nn.charCodeAt(0)===120&&nn.substr(0,6)==="xmlns:"?nn.substr(6):null,Wn!==null){if(Rt=go($i),gn=Mp(Wn),si=S[Rt],!si){if(Wn==="xmlns"||gn in v&&v[gn]!==Rt)do si="ns"+Ge++;while(typeof v[si]<"u");else si=Wn;S[Rt]=si}v[Wn]!==si&&(za||(v=oS(v),za=!0),v[Wn]=si,Wn==="xmlns"&&(v[Mp(si)]=Rt,Rn=si),v[gn]=Rt),No[nn]=$i;continue}Vn.push(nn,$i);continue}nn=Me(nn,Rn),nn!==null&&(No[nn]=$i)}if(h)for(Mt=0,_n=Vn.length;Mt<_n;Mt++)nn=Me(Vn[Mt++],Rn),$i=Vn[Mt],nn!==null&&(No[nn]=$i);return ne=No}function mt(){for(var Rt=/(\r\n|\r|\n)/g,gn=0,Rn=0,Vn=0,Mt=Z,Qt,_n;Re>=Vn&&(Qt=Rt.exec(L),!(!Qt||(Mt=Qt[0].length+Qt.index,Mt>Re)));)gn+=1,Vn=Mt;return Re==-1?(Rn=Mt,_n=L.substring(Z)):Z===0?_n=L.substring(Z,Re):(Rn=Re-Vn,_n=Z==-1?L.substring(Re):L.substring(Re,Z+1)),{data:_n,line:gn,column:Rn}}for(p=mt,t&&(w=Object.create({},{name:_c(function(){return B}),originalName:_c(function(){return C}),attrs:_c(Xe),ns:_c(function(){return v})}));Z!==-1;){if(L.charCodeAt(Z)===60?Re=Z:Re=L.indexOf("<",Z),Re===-1){if(z)return L.substring(Z);if(E.length)return P("unexpected end of file");if(!d)return P("missing start tag");Z<L.length&&L.substring(Z).trim()&&k(Pm);return}if(d||(d=!0),Z!==Re){if(E.length){if(n&&(n(L.substring(Z,Re),go,p),x))return}else if(L.substring(Z,Re).trim()&&(k(Pm),x))return}if(ae=L.charCodeAt(Re+1),ae===33){if(Y=L.charCodeAt(Re+2),Y===91&&L.substr(Re+3,6)==="CDATA["){if(Z=L.indexOf("]]>",Re),Z===-1)return z?L.substring(Re):P("unclosed cdata");if(o&&(o(L.substring(Re+9,Z),p),x))return;Z+=3;continue}if(Y===45&&L.charCodeAt(Re+3)===45){if(Z=L.indexOf("-->",Re),Z===-1)return z?L.substring(Re):P("unclosed comment");if(c&&(c(L.substring(Re+4,Z),go,p),x))return;Z+=3;continue}}if(ae===63){if(Z=L.indexOf("?>",Re),Z===-1)return z?L.substring(Re):P("unclosed question");if(l&&(l(L.substring(Re,Z+2),p),x))return;Z+=2;continue}for(ie=Re+1;;ie++){if(me=L.charCodeAt(ie),isNaN(me))return z?L.substring(Re):(Z=-1,P("unclosed tag"));if(me===34)Y=L.indexOf('"',ie+1),ie=Y!==-1?Y:ie;else if(me===39)Y=L.indexOf("'",ie+1),ie=Y!==-1?Y:ie;else if(me===62){Z=ie;break}}if(ae===33){if(u&&(u(L.substring(Re,Z+1),go,p),x))return;Z+=1;continue}if(ne={},ae===47){if(qe=!1,Ve=!0,!E.length)return P("missing open tag");if(ie=B=E.pop(),Y=Re+2+ie.length,L.substring(Re+2,Y)!==ie)return P("closing tag mismatch");for(;Y<Z;Y++)if(ae=L.charCodeAt(Y),!(ae===32||ae>8&&ae<14))return P("close tag")}else{if(L.charCodeAt(Z-1)===47?(ie=B=L.substring(Re+1,Z-1),qe=!0,Ve=!0):(ie=B=L.substring(Re+1,Z),qe=!0,Ve=!1),!(ae>96&&ae<123||ae>64&&ae<91||ae===95||ae===58))return P("illegal first char nodeName");for(Y=1,W=ie.length;Y<W;Y++)if(ae=ie.charCodeAt(Y),!(ae>96&&ae<123||ae>64&&ae<91||ae>47&&ae<59||ae===45||ae===95||ae==46)){if(ae===32||ae<14&&ae>8){B=ie.substring(0,Y),ne=null;break}return P("invalid nodeName")}Ve||E.push(B)}if(y){te=v,qe&&(Ve||m.push(te),ne===null&&(h=ie.indexOf("xmlns",Y)!==-1)&&(q=Y,G=ie,Xe(),h=!1)),C=B,oe!==v&&(X=v[Tm],X===void 0&&(X=v[Tm]=Object.create(null)),oe=v);var qt=X[B];if(qt!==void 0)B=qt;else{if(ae=B.indexOf(":"),ae!==-1){if(Te=v[B.substring(0,ae)],!Te)return P("missing namespace on <"+C+">");B=B.substr(ae+1)}else Te=v.xmlns;Te&&(B=Te+":"+B),X[C]=B}}if(qe&&(q=Y,G=ie,i&&(t?i(w,go,Ve,p):i(B,Xe,go,Ve,p),x)))return;if(Ve){if(r&&(r(t?w:B,go,qe,p),x))return;y&&(qe?v=te:v=m.pop())}Z+=1}}}function Om(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Ap={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Dm="property";function Lm(e){return e.xml&&e.xml.serialize}function cS(e){const t=Lm(e);return t!==Dm&&(t||null)}function lS(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Im(e,t){return Om(t)?e.prefix+":"+lS(e.localName):e.name}function uS(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 pS(e,t,n){const i=$n(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=$n(r);var a=n.getPackage(o.prefix);return uS(o,a)}function Or(e){return new Error(e)}function cr(e){return e.$descriptor}function fS(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Or("expected element");var n=this.elementsById,i=cr(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 Or("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Za(){}Za.prototype.handleEnd=function(){},Za.prototype.handleText=function(){},Za.prototype.handleNode=function(){};function Pp(){}Pp.prototype=Object.create(Za.prototype),Pp.prototype.handleNode=function(){return this};function Qo(){}Qo.prototype=Object.create(Za.prototype),Qo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Qa(e,t){this.property=e,this.context=t}Qa.prototype=Object.create(Qo.prototype),Qa.prototype.handleNode=function(e){if(this.element)throw Or("expected no sub nodes");return this.element=this.createReference(e),this},Qa.prototype.handleEnd=function(){this.element.id=this.body},Qa.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Tp(e,t){this.element=t,this.propertyDesc=e}Tp.prototype=Object.create(Qo.prototype),Tp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Sp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ec(){}Ec.prototype=Object.create(Qo.prototype),Ec.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function Hn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Hn.prototype=Object.create(Ec.prototype),Hn.prototype.addReference=function(e){this.context.addReference(e)},Hn.prototype.handleText=function(e){var t=this.element,n=cr(t),i=n.bodyProperty;if(!i)throw Or("unexpected body text <"+e+">");Qo.prototype.handleText.call(this,e)},Hn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=cr(t),i=n.bodyProperty;i&&e!==void 0&&(e=Sp(i.type,e),t.set(i.name,e))},Hn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=cr(n),r=this.context,o=new n({}),a=this.model,s;return H(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),H(p,function(f){r.addReference({element:o,property:u.ns.name,id:f})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=Sp(u.type,c):l==="xmlns"?l=":"+l:(s=$n(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},Hn.prototype.getPropertyForNode=function(e){var t=e.name,n=$n(t),i=this.type,r=this.model,o=cr(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=cS(s);if(l){const u=e.attributes[l];if(u){const p=pS(u,e.ns,r),f=r.getType(p);return V({},s,{effectiveType:cr(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=Im(n,c),u=r.getType(l);if(s=kt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return V({},s,{effectiveType:cr(u).name})}else if(s=kt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Or("unrecognized element <"+n.name+">")},Hn.prototype.toString=function(){return"ElementDescriptor["+cr(this.type).name+"]"},Hn.prototype.valueHandler=function(e,t){return new Tp(e,t)},Hn.prototype.referenceHandler=function(e){return new Qa(e,this.context)},Hn.prototype.handler=function(e){return e==="Element"?new Jo(this.model,e,this.context):new Hn(this.model,e,this.context)},Hn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Rm(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?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function kp(e,t,n){Hn.call(this,e,t,n)}kp.prototype=Object.create(Hn.prototype),kp.prototype.createElement=function(e){var t=e.name,n=$n(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Im(n,o)||t;if(!r.hasType(a))throw Or("unexpected element <"+e.originalName+">");return Hn.prototype.createElement.call(this,e)};function Jo(e,t,n){this.model=e,this.context=n}Jo.prototype=Object.create(Ec.prototype),Jo.prototype.createElement=function(e){var t=e.name,n=$n(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Jo.prototype.handleChild=function(e){var t=new Jo(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},Jo.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Op(e){e instanceof vi&&(e={model:e}),V(this,{lax:!1},e)}Op.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Hn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new fS(V({},t,{rootHandler:i})),s=new km({proxy:!0}),c=dS();i.context=a,c.push(i);function l(E,S,P){var k=S(),$=k.line,N=k.column,L=k.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var z="unparsable content "+(L?L+" ":"")+`detected
2
- line: `+$+`
3
- column: `+N+`
4
- nested error: `+E.message;if(P)return a.addWarning({message:z,error:E}),!0;throw Or(z)}function u(E,S){return l(E,S,!0)}function p(){var E=a.elementsById,S=a.references,P,k;for(P=0;k=S[P];P++){var $=k.element,N=E[k.id],L=cr($).propertiesByName[k.property];if(N||a.addWarning({message:"unresolved reference <"+k.id+">",element:k.element,property:k.property,value:k.id}),L.isMany){var z=$.get(L.name),X=z.indexOf(k);X===-1&&(X=z.length),N?z[X]=N:z.splice(X,1)}else $.set(L.name,N)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(E){if(d.test(E)){var S=g.exec(E),P=S&&S[1];!P||h.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function _(E,S){var P=c.peek();try{c.push(P.handleNode(E))}catch(k){l(k,S,o)&&c.push(new Pp)}}function x(E,S){try{c.peek().handleText(E)}catch(P){u(P,S)}}function m(E,S){E.trim()&&x(E,S)}var v=r.getPackages().reduce(function(E,S){return E[S.uri]=S.prefix,E},Object.entries(Ap).reduce(function(E,[S,P]){return E[P]=S,E},r.config&&r.config.nsMap||{}));return s.ns(v).on("openTag",function(E,S,P,k){var $=E.attrs||{},N=Object.keys($).reduce(function(z,X){var oe=S($[X]);return z[X]=oe,z},{}),L={name:E.name,originalName:E.originalName,attributes:N,ns:E.ns};_(L,k)}).on("question",y).on("closeTag",f).on("cdata",x).on("text",function(E,S,P){m(S(E),P)}).on("error",l).on("warn",u),new Promise(function(E,S){var P;try{s.parse(e),p()}catch(z){P=z}var k=i.element;!P&&!k&&(P=Or("failed to parse document as <"+i.type.$descriptor.name+">"));var $=a.warnings,N=a.references,L=a.elementsById;return P?(P.warnings=$,S(P)):E({rootElement:k,elementsById:L,references:N,warnings:$})})},Op.prototype.handler=function(e){return new kp(this.model,e)};function dS(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var hS=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,mS=/<|>|'|"|&|\n\r|\n/g,Bm=/<|>|&/g;function Gi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Gi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Gi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Gi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Gi.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)},Gi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Gi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Gi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Gi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Gi.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 gS(e){return e.charAt(0).toLowerCase()+e.slice(1)}function yS(e,t){return Om(t)?gS(e):e}function Nm(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function $m(e){return Xn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function vS(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 bS(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:yS(t.ns.localName,t.$pkg)},e)}function xS(e,t){return V({localName:t.ns.localName},e)}function _S(e){var t=e.$descriptor;return it(t.properties,function(n){var i=n.name;if(n.isVirtual||!Zn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var wS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ES={"<":"lt",">":"gt","&":"amp"};function Fm(e,t,n){return e=Xn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function SS(e){return Fm(e,mS,wS)}function RS(e){return Fm(e,Bm,ES)}function CS(e){return it(e,function(t){return t.isAttr})}function MS(e){return it(e,function(t){return!t.isAttr})}function Dp(e){this.tagName=e}Dp.prototype.build=function(e){return this.element=e,this},Dp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function yo(){}yo.prototype.serializeValue=yo.prototype.serializeTo=function(e){e.append(this.escape?RS(this.value):this.value)},yo.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Bm)!==-1&&(this.escape=!0),this};function Lp(e){this.tagName=e}Nm(Lp,yo),Lp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ht.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=_S(e),this.parseAttributes(CS(r)),this.parseContainments(MS(r))),this.parseGenericAttributes(e,i),this},Ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return bS(t,e)},Ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return xS(t,e)},Ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ht.prototype.nsAttributeName=function(e){var t;if(Xn(e)?t=$n(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}:V({localName:t.localName},n)},Ht.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}))},Ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new yo().build({type:"String"},t));var n=e.$children;n&&H(n,i=>{this.body.push(new Ht(this).build(i))})},Ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=$n(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)}},Ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return H(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Ht.prototype.parseGenericAttributes=function(e,t){var n=this;H(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)}})},Ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;H(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new yo().build(r,o[0]));else if(Rm(r.type))H(o,function(l){n.push(new Lp(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)H(o,function(l){n.push(new Dp(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=Lm(r);H(o,function(l){var u;c?c===Dm?u=new Ht(t,r):u=new Sc(t,r,c):u=new Ht(t),n.push(u.build(l))})}})},Ht.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Gi(i):t=i),t},Ht.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},Ht.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},Ht.prototype.parseAttributes=function(e){var t=this,n=this.element;H(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];H(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Ht.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),$m(e)},Ht.prototype.addAttribute=function(e,t){var n=this.attrs;Xn(t)&&(t=SS(t));var i=vm(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)},Ht.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=vS(n).concat(t)),H(t,function(i){e.append(" ").append($m(i.name)).append('="').append(i.value).append('"')})},Ht.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==yo;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),H(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Sc(e,t,n){Ht.call(this,e,t),this.serialization=n}Nm(Sc,Ht),Sc.prototype.parseNsAttributes=function(e){var t=Ht.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},Sc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function AS(){this.value="",this.write=function(e){this.value+=e}}function PS(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 TS(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new AS,o=new PS(r,e.format);e.preamble&&o.append(hS);var a=new Ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(kS(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function kS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Ap)n[i]=Ap[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 Rc(e,t){vi.call(this,e,t)}Rc.prototype=Object.create(vi.prototype),Rc.prototype.fromXML=function(e,t,n){Xn(t)||(n=t,t="bpmn:Definitions");var i=new Op(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Rc.prototype.toXML=function(e,t){var n=new TS(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var OS="BPMN20",DS="http://www.omg.org/spec/BPMN/20100524/MODEL",LS="bpmn",IS=[],BS=[{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"}]}],NS=[{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"}]}],$S={tagAlias:"lowerCase",typePrefix:"t"},FS={name:OS,uri:DS,prefix:LS,associations:IS,types:BS,enumerations:NS,xml:$S},jS="BPMNDI",HS="http://www.omg.org/spec/BPMN/20100524/DI",zS="bpmndi",GS=[{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"]}],VS=[{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"}]}],WS=[],US={name:jS,uri:HS,prefix:zS,types:GS,enumerations:VS,associations:WS},qS="DC",YS="http://www.omg.org/spec/DD/20100524/DC",KS="dc",XS=[{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}]}],ZS=[],QS={name:qS,uri:YS,prefix:KS,types:XS,associations:ZS},JS="DI",eR="http://www.omg.org/spec/DD/20100524/DI",tR="di",nR=[{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"}]}],iR=[],rR={tagAlias:"lowerCase"},oR={name:JS,uri:eR,prefix:tR,types:nR,associations:iR,xml:rR},aR="bpmn.io colors for BPMN",sR="http://bpmn.io/schema/bpmn/biocolor/1.0",cR="bioc",lR=[{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"}]}],uR=[],pR=[],fR={name:aR,uri:sR,prefix:cR,types:lR,enumerations:uR,associations:pR},dR="BPMN in Color",hR="http://www.omg.org/spec/BPMN/non-normative/color/1.0",mR="color",gR=[{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"}]}],yR=[],vR=[],bR={name:dR,uri:hR,prefix:mR,types:gR,enumerations:yR,associations:vR};const xR={bpmn:FS,bpmndi:US,dc:QS,di:oR,bioc:fR,color:bR};function jm(e,t){const n=V({},xR,e);return new Rc(n,t)}const _R={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"}},Cc={[xm]:_R,[lp]:mm};function Hm(){return jm(Cc)}const zm=Hm();async function ea(e){const{rootElement:t,warnings:n}=await zm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function wR(e){const{xml:t}=await zm.toXML(e,{format:!0});return t}function Ip(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ta={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},ER=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function SR(e){const t=ta;return ER.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 na(e,t){let n=0;for(const i of e)n+=t*SR(i);return n}function Gm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&RR(e),CR(e),MR(e),AR(e)}function RR(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:na(r,o),fontBoundingBoxAscent:o*ta.ascentEm,fontBoundingBoxDescent:o*ta.descentEm,actualBoundingBoxAscent:o*ta.ascentEm,actualBoundingBoxDescent:o*ta.descentEm}}};t.getContext=()=>n}function CR(e){if(e.SVGMatrix)return;class t{constructor(){ui(this,"a",1);ui(this,"b",0);ui(this,"c",0);ui(this,"d",1);ui(this,"e",0);ui(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 MR(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,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},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 AR(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:na(n,12),height:14}})}const Mc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),PR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),TR=1,Ac=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),kR=2;function pt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Vm=20,Pc=5,Wm=3,OR=8,ia=15,Bp=50,Um=12,DR=Um*1.2;function Np(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>na(o,Um))),r=n.length*DR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const qm=1;function vn(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 ra(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of vn(e))for(const s of vn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>qm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=Vm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function $p(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Ym(e,t){const n=ra(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function LR(e,t){let n=0;for(const i of t)i.id!==e.id&&Ym(e,i)&&n++;return n}function fi(e,t){let n=0;for(const i of t)i.id!==e.id&&ra(e,i)&&n++;return n}const Km=15,Xm=20;function IR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Xm||t.at>n[1]+Xm)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 Fp=20;function Tc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>qm)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Vm||n.push([r-Fp,o+Fp])}return n}function kc(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of vn(e)){const o=IR(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Tc(r,vn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const BR=10,NR=1,$R=(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 FR(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,l=t.y-e.y;let u=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,l)&&f(e.y-s,-l)&&p>u}function jp(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 jR=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,oa=1;function Vi(e,t){const n=e.x+oa,i=e.x+e.width-oa,r=e.y+oa,o=e.y+e.height-oa;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 aa(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 Zm(e,t){const n=e.label;if(!n)return null;if(vn(e).some(i=>Vi(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(vn(i).some(r=>Vi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(aa(i).some(r=>Vi(n,r)))return i.id;return null}function bn(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(FR(e.waypoints[o],e.waypoints[o+1],r,kR)){i.push(r);break}}return i}const Ja=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},HR=(e,t,n,i)=>Jm(e,t,n,i)?0:Math.min(Ja(e,n,i),Ja(t,n,i),Ja(n,e,t),Ja(i,e,t)),Qm=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function es(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,Ja({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(Qm(e,s)||Qm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,HR(e,t,s[l],s[(l+1)%s.length]));return c}function Jm(e,t,n,i){const r=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.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 eg=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ts(e,t){let n=0;for(const i of t){if(i.id===e.id||eg(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++)Jm(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function di(e,t){let n=0;for(const i of t)i.id===e.id||eg(e,i)||ts(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function tg(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++)ts(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Oc(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ts(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 ng(e){const t=Oc(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?r++:u==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:zR(e)}}function zR(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(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function ig(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Ac.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 rg(e){var n;const t=(n=$t(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=$t(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 og=e=>e?{members:e}:{},hi=e=>e.shapes.filter(t=>!t.container);function GR(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&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function VR(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function ag(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(vn(i).some(r=>Vi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(aa(i).some(r=>Vi(n,r)))return i.id;return null}function vo(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}const sg=3;function cg(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function ns(e,t){const n=[];for(const i of t.shapes){if(i.container||Ac.has(i.type))continue;const r=cg(e,i);r>=sg&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function ht(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of bn(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const r=e.shapes.filter(m=>m.container&&PR.has(m.type));if(r.length){const m=(v,E)=>{const S=e.shapes.find(P=>P.id===E);return!!S&&S.x>=v.x&&S.y>=v.y&&S.x+S.width<=v.x+v.width&&S.y+S.height<=v.y+v.height};for(const v of e.edges)for(const E of bn(v,r))v.endpoints.includes(E.id)||v.endpoints.some(S=>m(E,S))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:E.id})}for(const m of e.edges){if(m.waypoints.length<2)continue;const v=[[m.source,m.waypoints[0]],[m.target,m.waypoints[m.waypoints.length-1]]];for(const[E,S]of v){if(!E)continue;const P=e.shapes.find(L=>L.id===E);if(!P||P.container)continue;const k=Math.max(P.x-S.x,S.x-(P.x+P.width),0),$=Math.max(P.y-S.y,S.y-(P.y+P.height),0),N=Math.hypot(k,$);N>BR&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:E,distance:Math.round(N)})}}const o=e.shapes.filter(m=>m.type==="bpmn:Participant");for(let m=0;m<o.length;m++)for(let v=m+1;v<o.length;v++){const E=o[m],S=o[v];if(E.x+E.width<=S.x||S.x+S.width<=E.x||E.y+E.height<=S.y||S.y+S.height<=E.y)continue;const P=(k,$)=>k.x<=$.x&&k.y<=$.y&&k.x+k.width>=$.x+$.width&&k.y+k.height>=$.y+$.height;n.push({kind:"pool-overlap",pools:[E.id,S.id],contained:P(E,S)||P(S,E)})}const a=i.filter(m=>!m.attached);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const E=a[m],S=a[v];if(!jp(E,S,TR))continue;const P=E.id<S.id?[E.id,S.id]:[S.id,E.id];n.push({kind:"shape-overlap",shapes:P,identical:jR(E,S)})}const s=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<s.length;m++)for(let v=m+1;v<s.length;v++){const E=s[m],S=s[v],P=Math.min(E.x+E.width,S.x+S.width)-Math.max(E.x,S.x),k=Math.min(E.y+E.height,S.y+S.height)-Math.max(E.y,S.y);if(P<=Pc||k<=Pc)continue;const $=E.id<S.id?[E.id,S.id]:[S.id,E.id],N=new Set(S.members);if(E.members.some(z=>N.has(z))){const z=ig(e,s,{x:Math.max(E.x,S.x),y:Math.max(E.y,S.y),right:Math.min(E.x+E.width,S.x+S.width),bottom:Math.min(E.y+E.height,S.y+S.height)});z.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:$,shapes:z});continue}const L=E.x<=S.x&&E.y<=S.y&&E.x+E.width>=S.x+S.width&&E.y+E.height>=S.y+S.height?E.id:S.x<=E.x&&S.y<=E.y&&S.x+S.width>=E.x+E.width&&S.y+S.height>=E.y+E.height?S.id:void 0;n.push({kind:"group-overlap-unintended",groups:$,...L?{container:L}:{}})}const c=new Set(s.flatMap(m=>[...m.members])),l=m=>e.shapes.filter(v=>!v.container&&!Ac.has(v.type)&&v.x>=m.x&&v.y>=m.y&&v.x+v.width<=m.x+m.width&&v.y+v.height<=m.y+m.height);for(const m of s){const v=l(m);if(!v.length)continue;const E=new Set(m.members),S=v.filter(P=>!E.has(P.id));S.some(P=>c.has(P.id))&&(S.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:S.map(P=>P.id).sort()}))}for(const m of s){const v=new Set(l(m).map(N=>N.id)),E=new Set(m.members),S=new Set([...v].filter(N=>!E.has(N)&&c.has(N)));if(!S.size)continue;let P=!1,k=!1,$=!1;for(const N of e.edges){if(N.type!=="bpmn:SequenceFlow"||!N.source||!N.target)continue;const L=S.has(N.source),z=S.has(N.target);!L&&z&&!v.has(N.source)?P=!0:L&&!z&&!v.has(N.target)?k=!0:L&&z&&($=!0)}P&&k&&$&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...S].sort()})}const u=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<u.length;m++)for(let v=m+1;v<u.length;v++)for(let E=v+1;E<u.length;E++){const S=[u[m],u[v],u[E]],P={x:Math.max(...S.map(N=>N.x)),y:Math.max(...S.map(N=>N.y)),right:Math.min(...S.map(N=>N.x+N.width)),bottom:Math.min(...S.map(N=>N.y+N.height))};if(P.right-P.x<=Pc||P.bottom-P.y<=Pc)continue;const k=ig(e,[],P);if(!k.length)continue;const $=S.map(N=>N.id).sort();n.push({kind:"group-stack-unreadable",groups:$,shapes:k})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Ac.has(v.type)||v.width<=0||v.height<=0)continue;const E=[["top",m.y,"h",m.x,m.x+m.width],["bottom",m.y+m.height,"h",m.x,m.x+m.width],["left",m.x,"v",m.y,m.y+m.height],["right",m.x+m.width,"v",m.y,m.y+m.height]];for(const[S,P,k,$,N]of E){const L=k==="h"?v.x:v.y,z=k==="h"?v.x+v.width:v.y+v.height;if(!(L<N&&$<z))continue;const X=k==="h"?v.y:v.x,oe=k==="h"?v.y+v.height:v.x+v.width;if(!(X<P&&P<oe))continue;const te=Math.min(P-X,oe-P);te<OR||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:S,depth:te})}}const p=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(p.length){const m=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const E=vn(v);if(E.length)for(const S of p){const P=S.x+S.width,k=S.y+S.height,$=v.endpoints.some(L=>{const z=m.get(L);return!!z&&S.x<z.x&&z.x<P&&S.y<z.y&&z.y<k});let N=null;for(const L of E){const[z,X,oe]=L.axis==="v"?[S.y,k,[["left",S.x],["right",P]]]:[S.x,P,[["top",S.y],["bottom",k]]],te=Math.min(L.hi,X)-Math.max(L.lo,z);if(te<Bp)continue;const Ge=L.axis==="v"?S.x<L.at&&L.at<P:S.y<L.at&&L.at<k;if(!(Ge&&$))for(const[qe,Ve]of oe){const Re=Math.abs(L.at-Ve);Re<=ia&&(!N||Re<N.distance)&&(N={side:qe,inside:Ge,distance:Re,length:te})}}N&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:S.id,side:N.side,inside:N.inside,distance:Math.round(N.distance),length:Math.round(N.length)})}}}const f=e.shapes.filter(m=>m.container&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Lane");for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const E=m.x<v.x+v.width&&v.x<m.x+m.width,S=m.y<v.y+v.height&&v.y<m.y+m.height,P=[["top",m.y,v.y,E],["bottom",m.y+m.height,v.y+v.height,E],["left",m.x,v.x,S],["right",m.x+m.width,v.x+v.width,S]];for(const[k,$,N,L]of P)L&&Math.abs($-N)<=Wm&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:k})}const d=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<d.length;m++)for(let v=m+1;v<d.length;v++){const E=d[m],S=d[v],P=E.x<S.x+S.width&&S.x<E.x+E.width,k=E.y<S.y+S.height&&S.y<E.y+E.height,$=[["x",E.x+E.width,S.x,k],["x",S.x+S.width,E.x,k],["y",E.y+E.height,S.y,P],["y",S.y+S.height,E.y,P]];for(const[N,L,z,X]of $)if(X&&Math.abs(L-z)<=Wm){n.push({kind:"group-on-group-boundary",groups:E.id<S.id?[E.id,S.id]:[S.id,E.id],axis:N});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const E=e.edges[m],S=e.edges[v],P=ra(E,S);if(!P)continue;const k=E.id<S.id?[E.id,S.id]:[S.id,E.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:k,axis:P.axis,length:Math.round(P.length)})}for(const m of e.edges){if(!m.label)continue;const v=kc(m,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:m.id,other:v.other,axis:v.axis})}for(const m of e.edges){if(!m.label)continue;const v=Zm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}if(t.includeObservationOnly){for(const m of e.edges)if(!(!m.label||m.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:E}of ns(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(E)})}const g=new Set(i.map(m=>m.id)),h=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...h.filter(v=>!g.has(v.id))]){if(!m.label)continue;const v=ag(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const y=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of h)for(const{owner:v,rect:E}of vo(e))v===m.id||y.has(v)||jp(m.label,E,oa)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const _=vo(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:E}of _)v!==m.id&&jp(m,E,oa)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const x=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??GR(m,e,x);if(!v)continue;const E=x.get(v);!E||!E.container||$R(E,m,NR)||m.type==="bpmn:TextAnnotation"&&!VR(m,E,e)||n.push({kind:"shape-outside-container",shape:m.id,container:E.id})}return n.sort((m,v)=>pt(m).localeCompare(pt(v)))}const $t=e=>typeof e=="object"&&e!==null?e:void 0,Xt=e=>typeof e=="number"?e:0,lr=e=>{const t=$t(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function WR(e){const t=$t(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=lr(o);a&&n.push(a)}}return n}function UR(e){const t=$t(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:lr(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:lr(t.targetRef);return n&&i?{source:n,target:i}:{}}function qR(e,t){const n=$t(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=lr(n);return r?t.get(r):void 0}if(Mc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return lr(n)}function lg(e){var a,s,c,l,u;const t=[],n=[],i=((a=$t(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=$t(e))==null?void 0:s.rootElements)??[]){const f=$t(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=$t(d),h=lr(g),y=lr(g==null?void 0:g.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const p of i){const f=$t((c=$t(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=$t(g);if(!h)continue;const y=$t(h.bpmnElement),_=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!_)continue;const x=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",m=$t(h.bounds);if(m){const E=h.isExpanded===!1&&x!=="bpmn:Participant",S=$t((l=$t(h.label))==null?void 0:l.bounds),P={id:_,type:x,x:Xt(m.x),y:Xt(m.y),width:Xt(m.width),height:Xt(m.height),container:Mc.has(x)&&!E,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:qR(y,r)}:{},...S?{label:{x:Xt(S.x),y:Xt(S.y),width:Xt(S.width),height:Xt(S.height)}}:{},...x==="bpmn:Group"?og(rg(y)):{}},k=h.isHorizontal!==!1,$=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(_)&&k&&$&&(P.label=Np(P,$)),t.push(P);continue}const v=h.waypoint;if(Array.isArray(v)){const E=$t((u=$t(h.label))==null?void 0:u.bounds);n.push({id:_,type:x,waypoints:v.map(S=>{var P,k;return{x:Xt((P=$t(S))==null?void 0:P.x),y:Xt((k=$t(S))==null?void 0:k.y)}}),endpoints:WR(y),...UR(y),...E?{label:{x:Xt(E.x),y:Xt(E.y),width:Xt(E.width),height:Xt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function ug(e){return ht(lg(e),{includeObservationOnly:!0})}async function YR(e){const{definitions:t,warnings:n}=await ea(e);return{findings:ug(t),warnings:n}}function Ue(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=$t(o.label),y=lr(o.source),_=lr(o.target);n.push({id:o.id,type:a,waypoints:s.map(x=>({x:Xt(x.x),y:Xt(x.y)})),endpoints:[y,_].filter(x=>!!x),...y&&_?{source:y,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Xt(h.y),width:Xt(h.width),height:Xt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=$t(o.businessObject),l=$t(o.label);let u=$t(o.parent);for(;u&&u.type==="bpmn:Lane";)u=$t(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Mc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Xt(o.width),height:Xt(o.height),container:Mc.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Xt(l.y),width:Xt(l.width),height:Xt(l.height)}}:{},...a==="bpmn:Group"?og(rg(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=$t(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Np(d,g)),t.push(d)}return{shapes:t,edges:n}}const KR={"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 XR(e,t){const n=KR[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function pg(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function fg(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 XR(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&pg(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?pg(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}},eventDefinitionOf:n=>{var o;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const r=(((o=i.businessObject)==null?void 0:o.eventDefinitions)??[]).map(a=>a.$type);return cp(r)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Pr(i.businessObject).map(r=>r.locale)}}}const Hp=20,ZR=4,It=(e,t)=>Math.abs(e-t)<.5;function Dc(e,t,n,i=Hp){if(It(e.y,t.y)&&!It(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=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(It(e.x,t.x)&&!It(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=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function dg(e,t,n,i=Hp){if(n.length<2)return null;if(It(e.y,t.y)&&!It(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(It(e.x,t.x)&&!It(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function hg(e,t,n=Hp){if(e.length!==4)return null;const[i,r,o,a]=e;if(It(i.y,r.y)&&It(r.x,o.x)&&It(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(It(i.x,r.x)&&It(r.y,o.y)&&It(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 Lc(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const mg=30,QR=[0,-25,25,-40,40];function JR(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+mg:s-mg,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return QR.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>bn({...e,endpoints:[],waypoints:f},[n]).length===0)}const zp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],sa=(e,t,n)=>bn({...e,waypoints:t},n).length;function Gp(e,t,n,i){let r=[...e.waypoints],o=sa(e,r,t);if(o===0)return null;let a=!1;for(const p of Lc(e,t))if(sa(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(vn),c=p=>vn({...e,waypoints:p}).some(f=>Tc(f,s).length>0),l=JR(e,t).filter(p=>sa(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&It(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(It(d[0].y,d[1].y)&&!It(d[0].x,d[1].x)){const g=t.filter(x=>!e.endpoints.includes(x.id)&&bn({...e,waypoints:d},[x]).length>0),h=g.length>=2?dg(d[0],d[1],g):null,_=(h?h.map(x=>[d[0],...x,d[1]]):g.length===1?(Dc(d[0],d[1],g[0])??[]).map(x=>[d[0],...x,d[1]]):g.length===0?[d]:[]).filter(x=>sa(e,x,t)===0&&x.length<=r.length).sort((x,m)=>Number(u(m))-Number(u(x)));if(_.length)return _.find(x=>!c(x))??_[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&bn({...e,waypoints:[f,d]},[_]).length>0);if(g.length<2)continue;const h=dg(f,d,g);if(!h)continue;const y=h.map(_=>zp(r,p,_)).filter(_=>sa(e,_,t)===0).sort((_,x)=>Number(u(x))-Number(u(_)));if(y.length)return y.find(_=>!c(_))??y[0]}for(let p=0;p<ZR&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const g=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||bn({...e,waypoints:[g,h]},[y]).length===0)continue;const _=Dc(g,h,y),x=_?_.map(v=>zp(r,d,v)):hg(r,y)??[];if(!x.length)continue;const m=[...x].sort((v,E)=>Number(u(E))-Number(u(v)));for(const v of m){const E=sa(e,v,t);if(E<o){r=v,o=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Vp(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=hi(o),s=new Set,c=ht(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(pt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=o.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=bn(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const y=Gp(p,a,g,o.edges);if(!y){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const _=o.edges.filter(v=>v.id!==u),x=fi(p,_);fi({...p,waypoints:y},_)>x||r.updateWaypoints(f,y)}return s}const eC=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},Wp=(e,t)=>ts(e,[t])>0;function gg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=hi(o);let s=o;const c=new Set(ht(o).map(pt));for(const[l,u]of Oc(o))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find($=>$.id===p),g=s.edges.find($=>$.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const y=h.parent,_=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,x=eC(g),m=[...Lc(d,a)??[]],v=Gp(d,[...a,...x],_,o.edges);v&&m.push(v);for(let $=0;$+1<d.waypoints.length;$++)for(const N of x)for(const L of Dc(d.waypoints[$],d.waypoints[$+1],N)??[])m.push(zp(d.waypoints,$,L));const E=s.edges.filter($=>$.id!==p),S=$=>({...s,edges:s.edges.map(N=>N.id===p?{...N,waypoints:$}:N)}),P=$=>!_||$.every(N=>N.x>=_.x&&N.x<=_.x+_.width&&N.y>=_.y&&N.y<=_.y+_.height),k=m.find($=>{const N={...d,waypoints:$};return Wp(N,g)||!P($)||E.some(L=>L.id!==f&&!Wp(d,L)&&Wp(N,L))?!1:ht(S($)).every(L=>c.has(pt(L)))});if(k){r.updateWaypoints(h,k),s=S(k);break}}}const tC=10;function yg(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 vg(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=yg(i,n),a=yg(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=l.y).sort((z,X)=>z.y-X.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,y=s?g:d,_=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],m=hi(t),v=t.edges.filter(z=>z.id!==e.id),E=di(e,v),S=bn(e,m).length;if(E===0&&S===0||S===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(z=>z.x)),k=Math.max(...u.map(z=>z.x+z.width)),$=(_.x+x.x)/2,N=z=>z.filter((X,oe)=>oe===0||!(It(X.x,z[oe-1].x)&&It(X.y,z[oe-1].y)));let L;for(let z=P;z<=k;z+=tC){const X=N([_,{x:_.x,y:h},{x:z,y:h},{x:z,y},{x:x.x,y},x]),oe={...e,waypoints:X};if(bn(oe,m).length>0)continue;const te=di(oe,v),Ge=Math.abs(z-$);(!L||te<L.cross||te===L.cross&&Ge<L.detour)&&(L={pts:X,cross:te,detour:Ge})}return L&&(S>0?L.cross<=E:L.cross<E)?L.pts:null}function bg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ue(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ue(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=vg(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Wi=[25,-25,40,-40],ca=35;function nC(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-ca:Math.max(e.y+e.height,t.y+t.height)+ca;for(const l of[0,...Wi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Wi]){if(Math.abs(u)>=t.width/2-5)continue;const p=n+l,f=i+u;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function Ic(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 nC(n,i);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,l=s?n.y:n.y+n.height,u=s?n.y-ca:n.y+n.height+ca,p=[];for(const x of[0,...Wi]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;p.push({pts:[{x:n.x,y:r},{x:m,y:r},{x:m,y:c}],cost:Math.abs(x)});for(const v of[0,...Wi]){if(Math.abs(v)>=n.width/2-5)continue;const E=a+v;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:m,y:u},{x:m,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const x of[0,...Wi]){if(Math.abs(x)>=n.width/2-5)continue;const m=a+x;p.push({pts:[{x:m,y:g},{x:m,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,y=s?i.y+i.height:i.y,_=s?i.y+i.height+ca:i.y-ca;for(const x of[0,...Wi]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;for(const v of[0,...Wi]){if(Math.abs(v)>=n.width/2-5)continue;const E=a+v;p.push({pts:[{x:E,y:g},{x:E,y:_},{x:m,y:_},{x:m,y}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const Bc=30;function xg(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=It(i.y,r.y)&&!It(i.x,r.x),a=It(i.x,r.x)&&!It(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)<Bc||Math.abs(i.y-(s.y+s.height))<Bc)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)<Bc||Math.abs(i.x-(s.x+s.width))<Bc)return!0}}return!1}const Nc=40;function iC(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Nc,a=r.x+r.width+Nc,s=r.y-Nc,c=r.y+r.height+Nc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function _g(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(S=>S.container),i=new Map(t.shapes.map(S=>[S.id,S])),r=hi(t),o=t.edges.filter(S=>S.id!==e.id),a=fi(e,o),s=di(e,o),c=S=>iC(S,t.shapes,e.endpoints)+(xg(S,n)?1:0),l=c(e.waypoints),u=S=>{if(!S)return;const P=S.x+S.width/2,k=S.y+S.height/2;return n.find($=>$.type==="bpmn:Lane"&&P>=$.x&&P<=$.x+$.width&&k>=$.y&&k<=$.y+$.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=S=>{if(!d||!f)return!1;for(let P=1;P<S.length-2;P++){const k=S[P],$=S[P+1];if(It(k.y,$.y)&&!It(k.x,$.x)&&k.y>f.y&&k.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),_=(S=>{if(!S)return;const P=S.x+S.width/2,k=S.y+S.height/2;return n.filter($=>$.type==="bpmn:Participant"&&P>=$.x&&P<=$.x+$.width&&k>=$.y&&k<=$.y+$.height).sort(($,N)=>$.width*$.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),x=S=>{if(!_)return 0;let P=0;for(let k=1;k<S.length-1;k++){const $=S[k];($.x<_.x||$.x>_.x+_.width||$.y<_.y||$.y>_.y+_.height)&&P++}return P},m=x(e.waypoints);if(!xg(e.waypoints,n)&&!(d&&!h)&&m===0)return null;const v=S=>S.reduce((P,k,$)=>$?P+Math.abs(k.x-S[$-1].x)+Math.abs(k.y-S[$-1].y):0,0);let E;for(const{pts:S,cost:P}of Ic(e,i)){const k={...e,waypoints:S};if(bn(k,r).length>0)continue;const $=fi(k,o);if($>a)continue;const N=x(S);if(N>m)continue;const L=N<m&&$===0;if(!L&&di(k,o)>s)continue;const z=c(S),X=g(S);if(!L&&!(X&&!h)&&z>=l)continue;const te=X?0:1,Ge=v(S);(!E||N<E.out||N===E.out&&(te<E.lane||te===E.lane&&($<E.opp||$===E.opp&&(z<E.sc||z===E.sc&&(P<E.cost||P===E.cost&&Ge<E.len)))))&&(E={pts:S,out:N,sc:z,lane:te,opp:$,cost:P,len:Ge})}return(E==null?void 0:E.pts)??null}function rC(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,r=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),o=r.filter(p=>p.endpoints[1]===i),a=r.filter(p=>p.endpoints[0]===i);if(o.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function oC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of o){const s=Ue(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=hi(s),u=s.edges.filter(y=>y.id!==a),p=bn(c,l).length,f=fi(c,u),d=di(c,u),g=n.has(a)?new Set(ht(s).map(pt)):null,h=Lc(c,s.shapes);h.length===2&&rC(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const _={...c,waypoints:y};if(bn(_,l).length>p||fi(_,u)>f||di(_,u)>d)continue;if(g){const m=new Set(ht({...s,edges:s.edges.map(S=>S.id===a?_:S)}).map(pt)),v=[...m].filter(S=>!g.has(S)).length,E=[...g].filter(S=>!m.has(S)).length;if(v>E)continue}const x=i.get(a);x&&r.updateWaypoints(x,y);break}}}function wg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ue(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ue(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=_g(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function Up(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=It(n[0].x,n[1].x)&&!It(n[0].y,n[1].y),s=It(n[n.length-1].x,n[n.length-2].x)&&!It(n[n.length-1].y,n[n.length-2].y);for(const c of Wi){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function aC(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const _ of[0,...Wi])Math.abs(_)<i.width/2-5&&y.push({pts:[{x:f,y:l},{x:u+_,y:l},{x:u+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:p+_},{x:g,y:p+_}],cost:Math.abs(_)});return y}function qp(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(r+o)/2,p=[];for(const f of[0,...Wi]){const d=u+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function Eg(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=hi(t),r=t.edges.filter(d=>d.id!==e.id),o=fi(e,r);if(o===0)return null;const a=di(e,r);let s;const c=d=>d.reduce((g,h,y)=>y?g+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],y=Math.hypot(h.x-g.x,h.y-g.y);return y>=1&&c(d)/y>=l?1:0},p=u(e.waypoints),f=[...Ic(e,n),...qp(e,n),...Up(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(bn(h,i).length>0)continue;const y=fi(h,r),_=di(h,r),x=o-y+(p-u(d));if(y>=o||_-a>x)continue;const m=c(d);(!s||y<s.opposite||y===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&m<s.len)))&&(s={pts:d,opposite:y,cross:_,cost:g,len:m})}return(s==null?void 0:s.pts)??null}function Sg(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=ra(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function sC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=hi(t),r=t.edges.filter(f=>f.id!==e.id),o=Sg(e,r);if(o===0)return null;const a=fi(e,r),s=di(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Ic(e,n),...qp(e,n),...aC(e,n),...Up(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(bn(g,i).length>0)continue;const h=Sg(g,r);if(h>=o)continue;const y=fi(g,r);if(y-h>a-o)continue;const _=di(g,r);if(_-s>(o-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:y,cross:_,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function Rg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ht(Ue(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(pt(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=Ue(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=sC(l,c);if(!u)continue;const p=i.get(s);p&&r.updateWaypoints(p,u)}}function Cg(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function Mg(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=ra(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:Cg(e,n)&&Cg(t,n)}function Ag(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Mg(e,r,n)&&i++;return i}function cC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=hi(t),r=t.edges.filter(f=>f.id!==e.id),o=Ag(e,r,n);if(o===0)return null;const a=fi(e,r),s=di(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Ic(e,n),...qp(e,n),...Up(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(bn(g,i).length>0)continue;const h=Ag(g,r,n);if(h>=o)continue;const y=fi(g,r);if(y-h>a-o)continue;const _=di(g,r);if(_-s>(o-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:y,cross:_,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function lC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=ht(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(pt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!u||!p||!Mg(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ue(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=cC(p,u);if(!f)continue;const d=i.get(l);d&&r.updateWaypoints(d,f)}}function Pg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=ht(o).filter(u=>$p(u)&&!t.has(pt(u)));if(!a.length)return;const s=new Set;for(const u of a)if($p(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=o.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ue(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=Eg(f,p);if(!d)continue;const g=i.get(u);g&&r.updateWaypoints(g,d)}}const uC=10,pC=(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 Tg(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!kc(e,i))return null;const r=hi(t),o=i.flatMap(vn);for(const a of vn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Tc(a,o))s=s.flatMap(([h,y])=>{const _=[];return d>h&&_.push([h,Math.min(y,d)]),g<y&&_.push([Math.max(h,g),y]),_.filter(([x,m])=>m>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+uC*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Km}:{x:a.at+Pn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!kc({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&pC(f,d)))return f}return null}const Pn=8;function Yp(e,t){const n=e.label;if(!n)return null;const i=vn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,g=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(vn),...t.shapes.filter(f=>f.container).flatMap(aa)],l=f=>!c.some(d=>Vi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Pn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Pn,s.at-Pn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-Pn-n.height,s.at+Pn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const kg=30,fC=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n},Og=(e,t)=>fC({x:e.x+e.width/2,y:e.y+e.height/2},t);function dC(e,t){const n=e.label;if(!n)return null;const i=vn(e);if(!i.length)return null;const r=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(vn),...t.shapes.filter(c=>c.container).flatMap(aa)],o=vo(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!r.some(l=>Vi(c,l))&&!ns(c,t).length&&!o.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+Pn,c.at-Pn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Pn,c.at-Pn-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function Dg(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=Ue(n),o=new Set(ht(r).map(pt));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((S,P)=>S.x-u[P].x===d&&S.y-u[P].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const S=r.edges.find(L=>L.id===c);if(!(S!=null&&S.label)||!ns(S.label,r).length)continue;let P={...S.label,x:l.label.x,y:l.label.y};if((ns(P,r).length||Og(P,S.waypoints)>kg)&&(P=null),!P&&Og(S.label,S.waypoints)>kg&&(P=dC(S,r)),!P)continue;const k=P,$={...r,edges:r.edges.map(L=>L.id===c?{...L,label:k}:L)},N=ht($);if(N.some(L=>!o.has(pt(L))))continue;i.moveElements([f],{x:k.x-f.x,y:k.y-f.y}),r=$,o=new Set(N.map(pt));continue}const y=l.label.x+d-f.x,_=l.label.y+g-f.y;if(y===0&&_===0)continue;const x=r.edges.find(S=>S.id===c);if(!(x!=null&&x.label))continue;const m={...x.label,x:x.label.x+y,y:x.label.y+_},v={...r,edges:r.edges.map(S=>S.id===c?{...S,label:m}:S)},E=ht(v);E.some(S=>!o.has(pt(S)))||(i.moveElements([f],{x:y,y:_}),r=v,o=new Set(E.map(pt)))}}function Lg(e,t,n=new Set){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i);for(const a of o.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Yp(a,o);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&r.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function Ig(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=ht(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(pt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const l=Tg(c,o);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function Bg(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(vn),...t.shapes.filter(f=>f.container).flatMap(aa)],r=i.filter(f=>Vi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=vo(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Vi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of r)f.axis==="h"?l.push({...n,y:f.at-Pn-n.height},{...n,y:f.at+Pn}):l.push({...n,x:f.at-Pn-n.width},{...n,x:f.at+Pn});const u=e.x+e.width/2,p=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+Pn},{...n,x:u-n.width/2,y:e.y-Pn-n.height},{...n,x:e.x+e.width+Pn,y:p-n.height/2},{...n,x:e.x-Pn-n.width,y:p-n.height/2}),l.find(c)??null}function Ng(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ue(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Bg(o,Ue(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})}}function hC(e,t){const n=e.x,i=e.x+e.width,r=e.y,o=e.y+e.height;if(t.x<n||t.x>i||t.y<r||t.y>o)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,r),o))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-r,{x:t.x,y:r}],[o-t.y,{x:t.x,y:o}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function $g(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=Ue(n),o=new Set(ht(r).map(pt));const a=[...new Set(ht(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(pt(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,y]of u){const _=h?r.shapes.find(m=>m.id===h):void 0;if(!_)continue;const x=hC(_,l[y]);x.x===l[y].x&&x.y===l[y].y||(l[y]=x,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=ht(f);if(d.some(h=>!o.has(pt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),r=f,o=new Set(d.map(pt)))}}const Kp=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Fg(e,t){const n=(r,o,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>o?`${o}.${u}`:u;return{id:r,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((r,o)=>n(r.id,`participant.lanes[${o}]`,r))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((r,o)=>({...n(r.id,`lanes[${o}]`,r),omittedMeansRemove:(t==null?void 0:t.categoryOf(r.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function mC(e,t,n){const i=[],r=n?Ka(n):[];return e.forEach((o,a)=>{if(o.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:o.id,field:"locale"});return}if(!r.includes(o.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:o.id,field:"locale",locale:o.locale,locales:r});return}t.categoryOf(o.id)!==void 0&&!t.reviewRequestLocalesOf(o.id).includes(o.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:o.id,locale:o.locale});return}for(const s of Fg(o,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:r});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:r});continue}if(!l)continue;if(!Kp(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):r.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:r}),p=!1);if(!p)continue;const f=r.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function bi(e,t,n){const i=t==="text"?"texts":"names",{[i]:r,...o}=e;return n===void 0?o:{...o,[t]:n}}function gC(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:r}=n,o=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(Kp(c.map)){const l=c.map;return o(c.id).texts={...l},l[r]}if(c.plain===null||c.condition===null&&c.plain===void 0){o(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(o(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=o(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=Fg(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=bi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=bi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:bi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:bi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:bi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:bi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(bi(c,"text",a(l[0])));break;default:s.push(Kp(l[0].map)?bi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const yC=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,jg=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Hg={"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"]},{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}],"translation.confirm":[{path:"id",shape:null},{path:"locale",shape:null}],"element.remove":[{path:"id",shape:null}]},is=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),$c=e=>typeof e=="string"&&e!=="";function vC(e){const t=[];function n(i,r,o,a){if(a===null){$c(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!is(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)$c(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a,s;if(!is(i)||!$c(i.kind)||!(i.kind in Hg)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const c of Hg[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!is(f))break;f=f[g]}if(!is(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(r,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:r,field:c.path});continue}d.forEach((g,h)=>n(r,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;is(c)&&!$c(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:r,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const l=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!fm(l)){t.push({kind:"node-type-unsupported",opIndex:r,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!dm(p)){t.push({kind:"payload-invalid",opIndex:r,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:r,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function zg(e,t,n={}){const i=vC(e);if(i.length>0)return i;const r=[],o=new Map,a=new Map;function s(h,y,_){if(!yC.test(y)){r.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||o.has(y)){r.push({kind:"id-duplicate",opIndex:h,id:y});return}o.set(y,{..._,opIndex:h})}e.forEach((h,y)=>{var _;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(y,x.id,{category:"lane"});break;case"node.add":s(y,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(y,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,h.dataStore.id,{category:"dataStore"});for(const x of h.associations??[])x.id&&s(y,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(y,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(y,h.association.id,{category:"association"});break;case"annotation.add":s(y,h.annotation.id,{category:"annotation"}),(_=h.association)!=null&&_.id&&s(y,h.association.id,{category:"association"});break;case"group.add":s(y,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(y,x.id,{category:"lane"})}break}});const c=h=>{var y;return((y=o.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=o.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,_,x){const m=c(y);if(m===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:_});return}if(x&&!x.includes(m)){r.push({kind:"ref-category",opIndex:h,ref:y,role:_,expected:x.join("|"),actual:m});return}return m}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var _;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:x,lane:m}=h.node;if(x===void 0){(p||m!==void 0)&&r.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,x,"participant",["participant"])===void 0)break;m!==void 0&&((((_=o.get(x))==null?void 0:_.lanes)??a.get(x)??t.lanesOf(x)).includes(m)||r.push({kind:"lane-unknown",opIndex:y,lane:m,participant:x}));break}case"sequenceFlow.add":{const{id:x,source:m,target:v,name:E,condition:S}=h.flow,P=u(y,m,"source",["flowNode"]),k=u(y,v,"target",["flowNode"]);P&&k&&l(m)!==l(v)&&r.push({kind:"flow-cross-pool",opIndex:y,id:x}),E!==void 0&&S!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:x});break}case"messageFlow.add":{const{id:x,source:m,target:v}=h.flow,E=u(y,m,"source",["flowNode","participant"]),S=u(y,v,"target",["flowNode","participant"]);if(E&&S){const P=l(m),k=l(v);P!==void 0&&P===k&&r.push({kind:"message-flow-same-pool",opIndex:y,id:x})}for(const P of[m,v])d(P)&&r.push({kind:"message-flow-timer-endpoint",opIndex:y,id:x,ref:P});break}case"dataStore.add":{for(const x of h.associations??[]){if([x.source,x.target].filter(E=>E===h.dataStore.id).length!==1){r.push({kind:"data-association-ends",opIndex:y,source:x.source,target:x.target});continue}const v=x.source===h.dataStore.id?x.target:x.source;u(y,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:x,target:m}=h.association,v=u(y,x,"source"),E=u(y,m,"target");if(v&&E){const S=new Set([v,E]);S.has("dataStore")&&S.has("flowNode")||r.push({kind:"data-association-ends",opIndex:y,source:x,target:m})}break}case"association.add":{const{id:x,source:m,target:v}=h.association,E=u(y,m,"source"),S=u(y,v,"target");E&&S&&E!=="annotation"&&S!=="annotation"&&r.push({kind:"association-detached",opIndex:y,annotation:x??`${m}->${v}`});break}case"annotation.add":{if(h.association){const{source:x,target:m}=h.association;if(x!==h.annotation.id&&m!==h.annotation.id)r.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const v=x===h.annotation.id?m:x;u(y,v,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const x of h.group.members??[]){const m=u(y,x,"member");m&&jg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const x=t.lanesOf(h.id),m=h.lanes.map(E=>E.id);for(const E of x)m.includes(E)||r.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:E});for(const E of m)t.categoryOf(E)!==void 0&&!x.includes(E)&&r.push({kind:"id-duplicate",opIndex:y,id:E});const v=m.filter(E=>x.includes(E));v.length===x.length&&v.some((E,S)=>E!==x[S])&&r.push({kind:"lane-reorder-unsupported",opIndex:y,participant:h.id})}break}case"node.update":{if(g(y,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const x=t.participantOf(h.id);(x?a.get(x)??t.lanesOf(x):[]).includes(h.lane)||r.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:x??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const x=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,m=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),E=h.source??(v==null?void 0:v.source),S=h.target??(v==null?void 0:v.target);x&&m&&E!==void 0&&S!==void 0&&new Set([l(E),l(S),l(h.id)]).size>1&&r.push({kind:"flow-cross-pool",opIndex:y,id:h.id})}break}case"messageFlow.update":g(y,h.id,"messageFlow");break;case"dataStore.update":g(y,h.id,"dataStore");break;case"annotation.update":{if(g(y,h.id,"annotation")===void 0)break;h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.update":{if(g(y,h.id,"group")===void 0)break;for(const x of h.members??[]){const m=u(y,x,"member");m&&jg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&r.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),r.push(...mC(e,t,n.i18n)),r;function g(h,y,_){if(o.has(y)){r.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const x=t.categoryOf(y);if(x===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(_&&x!==_){r.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:_,actual:x});return}return x}}function Gg(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"),spaceTool:e.get("spaceTool")}}function Fc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const jc={"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]},Tn=10,bC=300,xC=160,Vg=20,Xp=100,Wg=40,_C=10,wC=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Ug(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,r=t.y+t.height/2;let o;for(const a of e.getAll()){if(a.type!=="bpmn:Lane")continue;const s=a;typeof s.x!="number"||typeof s.width!="number"||i>=s.x&&i<=s.x+s.width&&r>=s.y&&r<=s.y+s.height&&(!o||s.width*s.height<o.width*o.height)&&(o=s)}return o?{x:n.x,width:n.width,y:o.y,height:o.height}:void 0}const Hc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function zc(e,t,n,i,r){const o=n,a=Ug(e,t,i),s=a??i,c=(X,oe,te=s)=>{const[Ge,qe]=jc[X];let Ve={x:t.x+t.width/2+Ge*(t.width/2+o.width/2+oe),y:t.y+t.height/2+qe*(t.height/2+o.height/2+oe)};const Re=te.x+Tn+o.width/2,Z=te.x+te.width-Tn-o.width/2,ie=te.y+Tn+o.height/2,W=te.y+te.height-Tn-o.height/2,Y={x:Math.min(Z,Math.max(Re,Ve.x)),y:Math.min(W,Math.max(ie,Ve.y))};return(Y.x!==Ve.x||Y.y!==Ve.y)&&(Ve=Math.abs(Y.x-(t.x+t.width/2))<(t.width+o.width)/2+Tn&&Math.abs(Y.y-(t.y+t.height/2))<(t.height+o.height)/2+Tn?{x:t.x+t.width+Tn+o.width/2,y:Y.y}:Y),Ve},l=(i.children??[]).filter(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="bpmn:Lane"&&X.type!=="label"&&typeof X.x=="number"&&X.id!==r.selfId),u=Ue(e),p=X=>{var te,Ge;if(!r.selfId)return!1;const oe=e.get(X);return!!oe&&(((te=oe.source)==null?void 0:te.id)===r.selfId||((Ge=oe.target)==null?void 0:Ge.id)===r.selfId)},f=u.edges.filter(X=>!p(X.id)).flatMap(vn),d=vo(u).filter(X=>X.owner!==r.selfId).map(X=>X.rect),g=X=>({x0:X.x-o.width/2-Tn,x1:X.x+o.width/2+Tn,y0:X.y-o.height/2-Tn,y1:X.y+o.height/2+Tn}),h=X=>{const oe=g(X);return l.some(te=>oe.x0<te.x+te.width&&oe.x1>te.x&&oe.y0<te.y+te.height&&oe.y1>te.y)},y=X=>{const oe=g(X);return f.some(te=>te.axis==="h"?te.at>oe.y0&&te.at<oe.y1&&te.lo<oe.x1&&te.hi>oe.x0:te.at>oe.x0&&te.at<oe.x1&&te.lo<oe.y1&&te.hi>oe.y0)},_=X=>{const oe=g(X);return d.some(te=>oe.x0<te.x+te.width&&oe.x1>te.x&&oe.y0<te.y+te.height&&oe.y1>te.y)},x=u.shapes.filter(X=>X.type==="bpmn:Group").flatMap(X=>[{axis:"h",at:X.y,lo:X.x,hi:X.x+X.width},{axis:"h",at:X.y+X.height,lo:X.x,hi:X.x+X.width},{axis:"v",at:X.x,lo:X.y,hi:X.y+X.height},{axis:"v",at:X.x+X.width,lo:X.y,hi:X.y+X.height}]),m=X=>{const oe=g(X);return x.some(te=>te.axis==="h"?te.at>oe.y0&&te.at<oe.y1&&te.lo<oe.x1&&te.hi>oe.x0:te.at>oe.x0&&te.at<oe.x1&&te.lo<oe.y1&&te.hi>oe.y0)},v=X=>h(X)||y(X)||_(X)||m(X),E=X=>X.x-o.width/2>=i.x&&X.x+o.width/2<=i.x+i.width&&X.y-o.height/2>=i.y&&X.y+o.height/2<=i.y+i.height,S=X=>E(X)&&(!a||Hc(X,o,a));if(r.placement){const X=Re=>Re.startsWith("top")?Re.replace(/^top/,"bottom"):Re.replace(/^bottom/,"top"),oe=Re=>Re.endsWith("left")?Re.replace(/left$/,"right"):Re.replace(/right$/,"left"),te=r.placement.side,Ge=[te,X(te),oe(te),X(oe(te)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=r.placement.offset??50;let Ve=c(te,qe);if(v(Ve)||a&&!Hc(Ve,o,a)){const Re=(Z,ie)=>{const W=new Set;for(const Y of Ge){if(W.has(Y))continue;W.add(Y);const ae=c(Y,qe,Z);if(ie(ae)&&!v(ae))return Ve=ae,!0}return!1};!Re(s,S)&&a&&Re(i,E)}return Ve}const P=r.from,k=s.x+Tn+o.width/2,$=s.x+s.width-Tn-o.width/2,N=s.y+Tn+o.height/2,L=s.y+s.height-Tn-o.height/2;let z={x:Math.min($,Math.max(k,P.x)),y:Math.min(L,Math.max(N,P.y))};if(v(z)){const X=(t.width+o.width)/2+Tn,te=[{x:z.x+X,y:z.y},{x:z.x-X,y:z.y},{x:z.x,y:z.y-o.height-Tn},{x:z.x,y:z.y+o.height+Tn}].filter(S).find(Ge=>!v(Ge));te&&(z=te)}return z}function en(e,t){return e.filter(n=>n.kind===t)}class qg extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function Yg(e,t){var t1,n1,i1,r1,o1,a1,s1,c1,l1,u1,p1,f1,d1,h1,m1,g1,y1,v1,b1,x1,_1,w1,E1;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>o.get(b),f=b=>{const R=p(b);if(!R)throw new Error(`하강 참조 해소 실패: ${b}`);return R},d=b=>{let R=b.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},g=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"))g.set(b.id,{x:b.x,y:b.y});const h=en(e,"participant.add"),y=en(e,"node.add"),_=en(e,"sequenceFlow.add"),x=en(e,"messageFlow.add"),m=en(e,"dataStore.add"),v=en(e,"dataAssociation.add"),E=en(e,"annotation.add"),S=en(e,"group.add"),P=new Map(y.map(b=>[b.node.id,b])),k=(b,R,A)=>{var F;const T=b.businessObject,D=(((F=T.extensionElements)==null?void 0:F.values)??[]).filter(I=>I.$type!==R),O=A?[...D,i.create(R,A)]:D;if(!O.length){T.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:O});O.forEach(I=>{I.$parent=j}),n.updateProperties(b,{extensionElements:j})},$=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of en(e,"element.remove")){const R=p(b.id);R&&n.removeElements([R])}const N=b=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=d(R))==null?void 0:A.id)===b}).sort((R,A)=>R.y-A.y);for(const b of en(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 A=N(b.id);if(!A.length){n.splitLane(R,b.lanes.length),N(b.id).forEach((D,O)=>{const j=b.lanes[O];j&&n.updateProperties(D,{id:j.id,name:j.name})});continue}const T=new Set(A.map(D=>D.id));b.lanes.forEach((D,O)=>{if(T.has(D.id)){n.updateProperties(f(D.id),{name:D.name});return}const j=O===0?n.addLane(N(b.id)[0],"top"):n.addLane(f(b.lanes[O-1].id),"bottom");n.updateProperties(j,{id:D.id,name:D.name})})}const L=150,z=130,X=80,oe=90,te=180,Ge=30,qe=30,Ve=(b,R,A,T,D)=>{const O=A-R.width/2,j=T-R.height/2;return(b.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(D!=null&&D.has(F.id))&&typeof F.x=="number"&&O<F.x+F.width+qe&&O+R.width+qe>F.x&&j<F.y+F.height&&j+R.height>F.y)},Re=new Set;for(const b of h){Re.add(`pool:${b.participant.id}`);for(const R of b.participant.lanes??[])Re.add(R.id)}const Z=new Map;for(const b of y){const R=b.node.lane??`pool:${b.node.participant??""}`;let A=Z.get(R);A||Z.set(R,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const ie=new Map;for(const[b,R]of Z){if(!Re.has(b))continue;const A=[...R].sort((O,j)=>O-j),T=A.map((O,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),D=Math.min(...T);ie.set(b,new Map(A.map((O,j)=>[O,T[j]-D])))}{const b=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,T)=>b.set(A.id,T));for(const[R,A]of ie){if(!b.has(R)||A.size<2)continue;const T=b.get(R),D=A.get(0)??0,O=new Set;for(const ee of y){if(ee.node.lane!==R||(ee.band??0)!==0||!ee.node.type.endsWith("Gateway"))continue;const he={in:new Set,out:new Set,cross:new Set};for(const fe of _){const ye=fe.flow.source===ee.node.id;if(!ye&&fe.flow.target!==ee.node.id)continue;const Ye=P.get(ye?fe.flow.target:fe.flow.source);if(!Ye||Ye.node.participant!==ee.node.participant||!Ye.node.lane)continue;let Ae,J=!1;if(Ye.node.lane!==R){const se=b.get(Ye.node.lane);if(se===void 0)continue;Ae=se>T?"down":"up",J=!0}else{const se=A.get(Ye.band??0)??D;Ae=se>D?"down":se<D?"up":void 0}Ae&&(he[ye?"out":"in"].add(Ae),J&&he.cross.add(Ae))}for(const fe of["up","down"])he.in.has(fe)&&he.out.has(fe)&&he.cross.has(fe)&&O.add(fe)}if(O.size!==1)continue;const[j]=O,F=Math.max(...A.values()),I=j==="down"?F:0;if(D===I)continue;const U=[...A.entries()].filter(([ee])=>ee!==0).sort((ee,he)=>ee[1]-he[1]),K=[...Array(F+1).keys()].filter(ee=>ee!==I),re=new Map([[0,I]]);U.forEach(([ee],he)=>re.set(ee,K[he])),ie.set(R,re)}}const W=b=>{var R;return(((R=Z.get(b))==null?void 0:R.size)??0)>1},Y=b=>b.band??(b.node.lane||!W(`pool:${b.node.participant??""}`)?void 0:0),ae=new Map,me=b=>ae.get(b.node.id)??Y(b),Te=new Set,B=new Set;{const b=new Map;for(const T of _)b.set(T.flow.target,(b.get(T.flow.target)??0)+1);const R=T=>{const D=[],O=new Set([T]),j=[T];for(;j.length;){const F=j.shift();D.push(F);for(const I of _)I.flow.source!==F||O.has(I.flow.target)||(b.get(I.flow.target)??0)!==1||(O.add(I.flow.target),j.push(I.flow.target))}return D},A=(T,D)=>{var O;return((O=ie.get(T))==null?void 0:O.get(D))??D};for(const T of y){if(!T.node.type.endsWith("Gateway"))continue;const D=T.node.lane??`pool:${T.node.participant??""}`,O=ie.get(D);if(!O||O.size<2)continue;const j=me(T);if(j===void 0||A(D,j)!==A(D,0))continue;const F=A(D,j),I=_.filter(fe=>fe.flow.source===T.node.id).map(fe=>P.get(fe.flow.target)).filter(fe=>!!fe&&(fe.node.lane??`pool:${fe.node.participant??""}`)===D),U=I.filter(fe=>{const ye=me(fe);return ye!==void 0&&A(D,ye)===F&&(b.get(fe.node.id)??0)===1}),K=I.some(fe=>{const ye=me(fe);return ye!==void 0&&A(D,ye)>F});if(U.length!==1||!K)continue;const re=new Set(I.flatMap(fe=>R(fe.node.id)));if(!_.some(fe=>fe.flow.target===T.node.id&&re.has(fe.flow.source)))continue;const he=new Map;for(const[fe,ye]of O)he.set(fe,ye+1);he.set(-1,0),ie.set(D,he);for(const fe of R(U[0].node.id))P.has(fe)&&(ae.set(fe,-1),B.add(fe));Te.add(T.node.id)}}const C=(b,R)=>{var A;return((A=ie.get(b))==null?void 0:A.get(R))??R},w=(b,R,A,T)=>{const D=b?p(b):R?p(R):void 0;if(!D)return!1;const O=b?D.y+Math.min(D.height/2,oe):D.y+X;return Math.abs(O+C(b??`pool:${R??""}`,A)*L-T)<=L/2},G=new Map;for(const[b,R]of Z){let A=0;for(const T of R)A=Math.max(A,C(b,T));G.set(b,A)}const q=b=>te+L*b,ne=(b,R,A)=>{const T=u().children.filter(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="label"&&D.id!==R&&typeof D.y=="number"&&D.y>=b);T.length&&n.moveElements(T,{x:0,y:A})},Me=(b,R,A)=>{const T=b.type==="bpmn:Participant"?b:void 0;if(!T||T.children.some(F=>F.type==="bpmn:Lane"))return;const D=A+R.height/2+Ge-T.y;if(T.height>=D)return;const O=D-T.height,j=T.y+T.height;n.resizeShape(T,{x:T.x,y:T.y,width:T.width,height:D}),ne(j,T.id,O)},Xe=(b,R)=>{const A=R-b.height;if(A<=0)return;const T=d(b)??b,D=[],O=I=>{D.push(I);for(const U of I.children??[])O(U)};O(T);const j=b.y+b.height-10,F=l.calculateAdjustments(D,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},mt=(b,R,A)=>{if(b){const j=f(b),F=q(R);if(j.height>=F)return;const I=F-j.height,U=d(j),K=U?U.y+U.height:j.y+j.height;Xe(j,F),ne(K,U==null?void 0:U.id,I);return}if(!A)return;const T=L*(R+1);if(A.height>=T)return;const D=T-A.height,O=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:T}),ne(O,A.id,D)},qt=new Map;for(const b of _)qt.set(b.flow.target,(qt.get(b.flow.target)??0)+1);const Rt=b=>(qt.get(b)??0)<=1,gn=new Set(y.map(b=>b.node.id).filter(b=>en(e,"sequenceFlow.update").filter(R=>R.target===b).length===1&&!_.some(R=>R.flow.target===b||R.flow.source===b&&P.has(R.flow.target)))),Rn=new Map,Vn=(b,R)=>{if(!b)return;const A=p(b);if(!A||A.height>=q(R))return;const T=A.y+A.height-10,D=d(A);if(D)return new Set((D.children??[]).filter(O=>O.type!=="bpmn:Lane"&&typeof O.y=="number"&&O.y>T).map(O=>O.id))},Mt=(b,R,A)=>{if(!b)return!0;const T=p(b);return T?A-R.height/2>=T.y&&A+R.height/2<=T.y+T.height:!0},Qt=h.map((b,R)=>({op:b,declared:R}));Qt.sort((b,R)=>{const A=b.op.order??Number.POSITIVE_INFINITY,T=R.op.order??Number.POSITIVE_INFINITY;return A!==T?A-T: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 Qt){const R=b.participant,A=y.filter(ee=>ee.node.participant===R.id).length,T=((t1=R.lanes)==null?void 0:t1.length)??0,D=Math.max(1200,A*160+300),O=(R.lanes??[]).map(ee=>q(G.get(ee.id)??0)),j=O.reduce((ee,he)=>ee+he,0);T&&j<300&&(O[T-1]+=300-j);const F=Math.max(300,L*((G.get(`pool:${R.id}`)??0)+1)),I=R.blackBox||A+T===0?120:T?Math.max(300,j):F,U=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:D,height:I,isExpanded:!0}),K=n.createShape(U,{x:100+D/2,y:_n+I/2},u()),re=R.lanes??[];if(re.length&&n.splitLane(K,re.length),re.length){const ee=o.filter(he=>{var fe;return he.type==="bpmn:Lane"&&((fe=d(he))==null?void 0:fe.id)===R.id}).sort((he,fe)=>he.y-fe.y);if(ee.forEach((he,fe)=>{const ye=re[fe];ye&&n.updateProperties(he,{id:ye.id,name:ye.name})}),O.some(he=>he!==K.height/T)){let he=K.y;ee.forEach((fe,ye)=>{const Ye=O[ye];n.resizeShape(fe,{x:fe.x,y:he,width:fe.width,height:Ye}),he+=Ye})}}_n=K.y+K.height+60}const za=b=>{var T;const R=P.get(b);if(R)return R.node.participant??"";const A=p(b);return A?A.type==="bpmn:Participant"?A.id:((T=d(A))==null?void 0:T.id)??"":""},Wn=new Map,$i=b=>{let R=Wn.get(b);return R||Wn.set(b,R={nodes:[],flows:[]}),R};for(const b of y)$i(b.node.participant??"").nodes.push(b);for(const b of _)$i(za(b.flow.source)).flows.push(b);const si=b=>{var R;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((R=b.condition)==null?void 0:R.label)})},nn=(b,R,A)=>r.createShape({type:Fc(b.type),...b.eventDefinition?{eventDefinitionType:mc[b.eventDefinition]}:{},businessObject:i.create(Fc(b.type),{id:b.id,name:b.name,...R!==void 0?{"bwl:band":R}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),No=[...Qt.map(({op:b})=>b.participant.id).filter(b=>Wn.has(b)),...[...Wn.keys()].filter(b=>!h.some(R=>R.participant.id===b))],Ga=b=>b.endsWith("Gateway");for(const b of No){const R=Wn.get(b),A=b?f(b):void 0,T=A?A.x+150:250;let D=A?A.y+80:120;const O=(J,se,le)=>{if(J){const be=f(J);return be.y+Math.min(be.height/2,oe)+C(J,se??0)*L}return se!==void 0&&A?A.y+X+C(`pool:${b}`,se)*L:le},j=(J,se,le)=>{if(J){const be=f(J);return be.y+Math.min(be.height/2,oe)+se*L}return A?A.y+X+se*L:le},F=J=>J.participant?f(J.participant):u(),I=(J,se,le,be,Ze,Qe,Ot,Ft)=>{const xe=le!==void 0||be!==void 0,ve=Ie=>{const Ee=()=>mt(le,Ie,A);Ft?Ft(Ee):Ee()},ce=C(le??`pool:${b}`,be??0);if((be===void 0||w(le,b,be,Ot??Number.NaN))&&Ot!==void 0&&Mt(le,se,Ot)&&!Ve(J,se,Ze,Ot))return{x:Ze,y:Ot};if(xe)for(let Ie=0;Ie<4;Ie++){const Ee=j(le,ce+Ie,Qe);if(!Ve(J,se,Ze,Ee,Vn(le,ce+Ie)))return ve(ce+Ie),{x:Ze,y:Ee}}const _e=O(le,be,Qe);xe?ve(ce):Ft?Ft(()=>Me(J,se,se.y+se.height/2)):Me(J,se,_e);let Ne=Ze;for(let Ie=0;Ie<64;Ie++){const Ee=Ve(J,se,Ne,_e);if(!Ee)break;Ne=Ee.x+Ee.width+z+se.width/2}return{x:Ne,y:_e}},U=new Set(R.flows.map(J=>J.flow.target)),K=new Map,re=J=>{if(J===void 0)return;const se=o.get(J);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+z};for(const J of R.nodes){if(U.has(J.node.id))continue;const se=nn(J.node,J.band,J.afterColumn),le=Y(J),be=J.node.lane?`${J.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",Ze=F(J.node),Qe=K.get(be)??T,Ot=re(J.afterColumn),Ft=Ot===void 0?Qe:Math.max(Qe,Ot);let xe;const ve=I(Ze,se,J.node.lane,le,Ft,D,void 0,gn.has(J.node.id)&&J.node.participant!==void 0?ce=>xe=ce:void 0);if(xe?n.createShape(se,ve,Ze,{autoResize:!1}):n.createShape(se,ve,Ze),xe){const ce=J.node.lane?f(J.node.lane):Ze;Rn.set(J.node.id,{container:ce,relCy:ve.y-ce.y,grow:xe})}K.set(be,ve.x+se.width+z),!J.node.lane&&le===void 0&&(D+=160)}const ee=new Set,he=new Map,fe=new Map,ye=new Map;if(b&&Re.has(`pool:${b}`)){const J=new Map;for(const xe of R.flows)J.set(xe.flow.target,(J.get(xe.flow.target)??0)+1);const se=xe=>O(xe.node.lane,me(xe),Number.NaN),le=new Set,be=xe=>{var _e;const ve=(_e=P.get(xe))==null?void 0:_e.node.participant;if(ve)return p(ve);const ce=p(xe);if(ce)return ce.type==="bpmn:Participant"?ce:d(ce)},Ze=xe=>{const ve=[],ce=new Set([xe]),_e=[xe];for(;_e.length;){const Ne=_e.shift(),Ie=P.get(Ne);Ie&&ve.push(Ie);for(const Ee of R.flows)Ee.flow.source!==Ne||ce.has(Ee.flow.target)||(J.get(Ee.flow.target)??0)!==1||(ce.add(Ee.flow.target),_e.push(Ee.flow.target))}return ve},Qe=xe=>{if(!A)return;const ve=new Set(xe.map(Ne=>Ne.node.id));let ce=!1,_e=!1;for(const Ne of x){if(!ve.has(Ne.flow.source))continue;const Ie=be(Ne.flow.target);!Ie||Ie.id===A.id||(Ie.y<A.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const xe of R.nodes){if(!Ga(xe.node.type))continue;const ve=O(xe.node.lane,Y(xe),Number.NaN);if(Number.isNaN(ve))continue;const ce=[];for(const Ee of R.flows){if(Ee.flow.source!==xe.node.id)continue;const rt=P.get(Ee.flow.target);if(!rt||rt.node.lane!==xe.node.lane||(J.get(rt.node.id)??0)!==1)continue;const lt=Y(rt);if(lt===void 0)continue;const Jt=O(rt.node.lane,lt,Number.NaN);if(Number.isNaN(Jt))continue;const ci=Ze(rt.node.id),nt=Qe(ci);nt&&ce.push({subtree:ci,band:lt,row:Jt,dir:nt})}if(!ce.some(Ee=>Ee.dir==="up")||!ce.some(Ee=>Ee.dir==="down")||!ce.some(Ee=>Ee.dir==="up"&&ce.some(rt=>rt.dir==="down"&&rt.row<Ee.row)))continue;const Ne=[...ce].sort((Ee,rt)=>Ee.row-rt.row);[...ce.filter(Ee=>Ee.dir==="up"),...ce.filter(Ee=>Ee.dir==="down")].sort((Ee,rt)=>Ee.dir===rt.dir?Ee.row-rt.row:Ee.dir==="up"?-1:1).forEach((Ee,rt)=>{const lt=Ne[rt].band;if(lt!==Ee.band){le.add(xe.node.id);for(const Jt of Ee.subtree)Y(Jt)===Ee.band&&ae.set(Jt.node.id,lt)}})}const Ot=xe=>{if(!A)return;const ve=new Set(xe.map(Ne=>Ne.node.id));let ce=!1,_e=!1;for(const Ne of x){if(!ve.has(Ne.flow.target))continue;const Ie=be(Ne.flow.source);!Ie||Ie.id===A.id||(Ie.y<A.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const xe of R.nodes){if(!Ga(xe.node.type))continue;const ve=xe.node.lane??`pool:${b}`,ce=ie.get(ve);if(!ce||ce.size<2)continue;const _e=ce.get(0);if(_e===void 0)continue;const Ne=Math.max(...ce.values()),Ie=_e===Ne&&_e!==0?"down":void 0;if(!Ie)continue;const Ee=[];for(const nt of R.flows){if(nt.flow.source!==xe.node.id)continue;const zt=P.get(nt.flow.target);if(!zt||zt.node.lane!==xe.node.lane||(J.get(zt.node.id)??0)!==1)continue;const Pe=me(zt);Pe!==void 0&&Ee.push({t:zt,subtree:Ze(zt.node.id),band:Pe})}const rt=Ee.find(nt=>(ce.get(nt.band)??nt.band)===_e);if(!rt||Ot(rt.subtree)===Ie||Qe(rt.subtree)===Ie)continue;const lt=Ee.find(nt=>nt!==rt&&Ot(nt.subtree)===Ie);if(!lt)continue;const Jt=rt.band,ci=lt.band;for(const nt of rt.subtree)me(nt)===Jt&&ae.set(nt.node.id,ci);for(const nt of lt.subtree)me(nt)===ci&&ae.set(nt.node.id,Jt);le.add(xe.node.id)}for(const xe of R.nodes){if(!Ga(xe.node.type))continue;const ve=se(xe);if(Number.isNaN(ve)||E.some(Ee=>{var rt,lt;return(((rt=Ee.placement)==null?void 0:rt.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===xe.node.id&&((lt=Ee.placement)==null?void 0:lt.side.startsWith("bottom"))}))continue;let _e,Ne=!1,Ie;for(const Ee of R.flows){if(Ee.flow.source!==xe.node.id)continue;const rt=P.get(Ee.flow.target);if(!rt||!rt.node.lane&&Y(rt)===void 0)continue;const lt=se(rt);Number.isNaN(lt)||(Math.abs(lt-ve)<.5&&(Ne=!0),lt>ve?!_e||lt>_e.row?_e={id:rt.node.id,row:lt,count:1}:lt===_e.row&&_e.count++:lt<ve&&rt.node.lane===xe.node.lane&&(!Ie||lt>Ie.row?Ie={op:rt,row:lt,count:1}:lt===Ie.row&&Ie.count++))}_e&&_e.count===1&&(J.get(_e.id)??0)===1&&!le.has(xe.node.id)&&ee.add(_e.id),!Ne&&Ie&&Ie.count===1&&(J.get(Ie.op.node.id)??0)===1&&!Te.has(xe.node.id)&&he.set(Ie.op.node.id,{lane:xe.node.lane,band:me(xe)})}const Ft=new Map;for(const xe of x)Ft.set(xe.flow.target,[...Ft.get(xe.flow.target)??[],xe]);for(const xe of R.nodes){const ve=Ft.get(xe.node.id);if(!ve||ve.length!==1||!J.get(xe.node.id)||!xe.node.lane&&Y(xe)===void 0||B.has(xe.node.id))continue;const ce=(n1=P.get(ve[0].flow.source))==null?void 0:n1.node.participant,_e=ce?p(ce):void 0;if(!_e||!A||_e.id===A.id)continue;const Ne=xe.node.lane??`pool:${b}`,Ie=ie.get(Ne);if(!Ie)continue;const Ee=Ie.get(0)??0,rt=(Ie.get(me(xe)??0)??Ee)-Ee;if(rt===0)continue;const lt=_e.y<A.y;if(lt&&rt<0||!lt&&rt>0)continue;let Jt;for(const[ci,nt]of Ie){const zt=nt-Ee;(lt&&zt<0&&(!Jt||zt<Jt.row)||!lt&&zt>0&&(!Jt||zt>Jt.row))&&(Jt={band:ci,row:zt})}Jt&&fe.set(xe.node.id,{lane:xe.node.lane,band:Jt.band})}}const Ye=new Set;let Ae=0;for(;Ae++<R.nodes.length+2;){for(let le=0;le<R.nodes.length+R.flows.length+2;le++){let be=!1;for(const Ze of R.flows){const Qe=Ze.flow;if(Ye.has(Qe.id))continue;const Ot=p(Qe.source);if(!Ot)continue;const Ft=p(Qe.target),xe=P.get(Qe.target);if(!Ft&&xe){const ve=nn(xe.node,xe.band),ce=me(xe);if(xe.node.lane||ce!==void 0){const _e=F(xe.node),Ne=Ot,Ie=Ne.x+(ye.get(Qe.source)??0)+Ne.width+z,Ee=he.get(Qe.target)??fe.get(Qe.target),rt=I(_e,ve,Ee?Ee.lane:xe.node.lane,Ee?Ee.band:ce,ee.has(Qe.target)?Ne.x+Ne.width/2:Ie,Number.NaN,Ee||!Rt(Qe.target)?void 0:Ne.y+Ne.height/2),lt=n.createShape(ve,rt,_e);ee.has(Qe.target)&&ye.set(Qe.target,Ie-(lt.x+lt.width/2)),n.connect(Ot,lt,{type:"bpmn:SequenceFlow",businessObject:si(Qe)})}else s.append(Ot,ve,{connection:{type:"bpmn:SequenceFlow",businessObject:si(Qe)}})}else if(Ft)n.connect(Ot,Ft,{type:"bpmn:SequenceFlow",businessObject:si(Qe)});else continue;Ye.add(Qe.id),be=!0}if(!be)break}const J=R.nodes.filter(le=>!p(le.node.id));if(!J.length)break;const se=J[0];{const le=nn(se.node,se.band),be=F(se.node),Ze=Y(se);n.createShape(le,I(be,le,se.node.lane,Ze,T,D),be),!se.node.lane&&Ze===void 0&&(D+=160)}}}const Cn=40,dt=b=>{const R=K=>K.kind==="label-over-line"||K.kind==="label-over-shape"||K.kind==="label-on-shared-segment"?K.edge===b.id:K.kind==="annotation-over-label"||K.kind==="pool-name-over-label"?K.label===b.id:!1,A=()=>new Set(ht(Ue(o)).filter(K=>!R(K)).map(K=>pt(K))),T=A(),D=b.waypoints.map(K=>({x:K.x,y:K.y})),O=b.label,j=O&&{x:O.x,y:O.y};n.layoutConnection(b,{waypoints:[]});const F=A(),I=[...F].filter(K=>!T.has(K)).length,U=[...T].filter(K=>!F.has(K)).length;I<=U||(n.updateWaypoints(b,D),O&&j&&(O.x!==j.x||O.y!==j.y)&&n.moveElements([O],{x:j.x-O.x,y:j.y-O.y}))},wt=5,Oi=10,AE=200,sc=new Set([..._.map(b=>b.flow.id),...x.map(b=>b.flow.id),...en(e,"sequenceFlow.update").map(b=>b.id),...en(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),O$=(b,R,A,T,D,O)=>{const j=new Set(b.map(J=>J.id)),F=Math.min(...b.map(J=>J.x))+R-Oi,I=Math.max(...b.map(J=>J.x+J.width))+R+AE+Oi,U=Math.min(...b.map(J=>J.y+Math.min(0,...A)))-Oi,K=Math.max(...b.map(J=>J.y+J.height+Math.max(0,...A)))+Oi,re=o.getAll().filter(J=>{if(J.type!=="bpmn:SequenceFlow"&&J.type!=="bpmn:MessageFlow")return!1;const se=J;return sc.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(be=>!be||j.has(be.id)||be.x>=T)?!1:se.waypoints.some((be,Ze)=>{const Qe=se.waypoints[Ze+1];return!!Qe&&Math.max(be.x,Qe.x)>=F&&Math.min(be.x,Qe.x)<=I&&Math.max(be.y,Qe.y)>=U&&Math.min(be.y,Qe.y)<=K})});if(!re.length)return 0;const ee=J=>{const se=new Map;for(const le of b)for(const be of A){const Ze={id:le.id,type:le.type,x:le.x+R+J,y:le.y+be,width:le.width,height:le.height};for(const Qe of re){let Ot=1/0;for(let xe=0;xe+1<Qe.waypoints.length;xe++)Ot=Math.min(Ot,es(Qe.waypoints[xe],Qe.waypoints[xe+1],Ze));const Ft=`${Qe.id}|${le.id}`;se.set(Ft,Math.min(se.get(Ft)??1/0,Ot))}}return se},he=[...ee(0)].filter(([,J])=>J<=wt).map(([J])=>J);if(!he.length)return 0;let fe=0;for(let J=1;J<=AE;J++){const se=ee(J);if([...se.values()].every(le=>le>wt)&&he.every(le=>(se.get(le)??1/0)>=Oi)){fe=J;break}}if(!fe)return 0;const ye=Math.min(...b.map(J=>J.x))+R+fe,Ye=new Set(he.map(J=>J.slice(0,J.indexOf("|"))));return re.some(J=>J.type==="bpmn:SequenceFlow"&&Ye.has(J.id)&&J.waypoints.some((se,le)=>{const be=J.waypoints[le+1];if(!be||Math.min(se.y,be.y)>O||Math.max(se.y,be.y)<O||se.y===be.y)return!1;const Ze=se.x+(O-se.y)*(be.x-se.x)/(be.y-se.y);return Ze>D&&Ze<ye}))?0:fe},$o=(b,R=()=>!0)=>{const A=p(b);if(!A)return[];const T=[A],D=new Set([b]);for(let O=0;O<T.length;O++){const j=T[O].id;for(const F of _){const I=F.flow.target;if(F.flow.source!==j||D.has(I)||!P.has(I))continue;D.add(I);const U=p(I);U&&R(U)&&T.push(U)}}return T},D$=(b,R=()=>!0)=>{const A=p(b);if(!A)return[];const T=[A],D=new Set([b]);for(let O=0;O<T.length;O++){const j=T[O].id;for(const F of _){const I=F.flow.source;if(F.flow.target!==j||D.has(I)||!P.has(I))continue;D.add(I);const U=p(I);U&&R(U)&&T.push(U)}}return T},Di=30,Fi=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",ep=(b,R)=>Qp(n,b,R),cc=(b,R,A=!1)=>{const T=new Set(b.flatMap(I=>I.subtree.map(U=>U.id)));for(const I of b){const U=(I.pool.children??[]).filter(Fi).filter(re=>!T.has(re.id));if(I.subtree.some(re=>U.some(ee=>re.x+R<ee.x+ee.width+Di&&re.x+R+re.width+Di>ee.x&&re.y<ee.y+ee.height&&re.y+re.height>ee.y)))return null}const D=b.map(I=>I.pool.width),O=A?o.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(U=>({x:U.x,y:U.y}))})):[],j=o.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(b.flatMap(I=>I.subtree),{x:R,y:0});const F=b.map(I=>{const K=Math.max(...I.subtree.map(re=>re.x+re.width))+Kg-(I.pool.x+I.pool.width);return K>0&&ep(I.pool,I.pool.width+K),K});return()=>{n.moveElements(b.flatMap(I=>I.subtree),{x:-R,y:0}),b.forEach((I,U)=>{F[U]>0&&ep(I.pool,D[U])});for(const{c:I,wps:U}of O){const K=I.waypoints??[];K.length===U.length&&K.every((ee,he)=>Math.abs(ee.x-U[he].x)<=.5&&Math.abs(ee.y-U[he].y)<=.5)||n.updateWaypoints(I,U.map(ee=>({x:ee.x,y:ee.y})))}for(let I=0;I<3;I++){let U=0;for(const K of j){const re=K.x-K.label.x,ee=K.y-K.label.y;Math.abs(re)<=.5&&Math.abs(ee)<=.5||(n.moveElements([K.label],{x:re,y:ee}),U++)}if(!U)break}}},nm=b=>{var D,O;const R=new Map,A=new Map;for(const j of o.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(R.set(F.id,F),A.set(F.id,[]))}for(const j of o.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,I=(D=F.source)==null?void 0:D.id,U=(O=F.target)==null?void 0:O.id;I&&U&&A.has(I)&&A.get(I).push(U),I&&U&&A.has(U)&&A.get(U).push(I)}const T=[];for(const[j,F]of A)F.length&&F.every(I=>b.has(I))&&T.push(R.get(j));return T},PE=(b,R)=>{if(!b.length)return null;const A=new Set(b.map(K=>K.id)),T=o.getAll().filter(K=>K.type==="bpmn:Participant"&&!A.has(K.id)),D=Math.min(...T.filter(K=>(K.children??[]).length>0).map(K=>K.x)),O=new Set(b.filter(K=>Math.abs(K.x-D)<=2).map(K=>K.id));if(b.some(K=>{const re=O.has(K.id)?K.x:K.x+R,ee=O.has(K.id)?K.width+R:K.width;return T.some(he=>re<he.x+he.width+Di&&re+ee+Di>he.x&&K.y<he.y+he.height&&K.y+K.height>he.y)}))return null;const F=o.filter(K=>K.type==="label").map(K=>({label:K,x:K.x,y:K.y})),I=b.filter(K=>!O.has(K.id)),U=b.filter(K=>O.has(K.id)).map(K=>({pool:K,was:{x:K.x,y:K.y,width:K.width,height:K.height}}));I.length&&n.moveElements(I,{x:R,y:0});for(const{pool:K,was:re}of U)n.resizeShape(K,{...re,width:re.width+R});return()=>{for(const{pool:K,was:re}of U)n.resizeShape(K,re);I.length&&n.moveElements(I,{x:-R,y:0});for(let K=0;K<3;K++){let re=0;for(const ee of F){const he=ee.x-ee.label.x,fe=ee.y-ee.label.y;Math.abs(he)<=.5&&Math.abs(fe)<=.5||(n.moveElements([ee.label],{x:he,y:fe}),re++)}if(!re)break}}},TE=(b,R,A)=>{const T=A.x+A.width/2,D=R.y>A.y,O=D?A.y+A.height:A.y,j=D?R.y:R.y+R.height,F=b.source===R?[{x:T,y:j},{x:T,y:O}]:[{x:T,y:O},{x:T,y:j}],I=Ue(o),U={...I.edges.find(K=>K.id===b.id),waypoints:F};return bn(U,hi(I)).length?!1:(n.updateWaypoints(b,F),!0)},L$=()=>{const b=o.filter(D=>D.type==="bpmn:Participant"),R=Math.min(...b.filter(D=>(D.children??[]).length>0).map(D=>D.x)),A=D=>!!D&&D.type==="bpmn:Participant"&&!(D.children??[]).length&&Math.abs(D.x-R)<=2&&!h.some(O=>O.participant.id===D.id),T=new Set;for(const D of o.getAll()){if(D.type!=="bpmn:MessageFlow")continue;const O=D;if((O.waypoints??[]).length!==2)continue;const j=[O.source,O.target].find(I=>A(I)),F=j===O.source?O.target:O.source;j&&F&&F.type!=="bpmn:Participant"&&T.add(O.id)}return T},I$=b=>{var A;const R=new Map;for(const T of b){const D=o.get(T);if(!D||(D.waypoints??[]).length===2)continue;const O=((A=D.source)==null?void 0:A.type)==="bpmn:Participant"?D.source:D.target,j=O===D.source?D.target:D.source;if(j.x+j.width/2<=O.x+O.width)continue;const F=R.get(O.id)??{pool:O,msgs:[]};F.msgs.push({conn:D,other:j}),R.set(O.id,F)}for(const{pool:T,msgs:D}of R.values()){const O=Math.max(...D.map(({other:fe})=>fe.x+fe.width/2))+Xp;if(o.getAll().some(fe=>{if(fe.type!=="bpmn:Participant"||fe.id===T.id)return!1;const ye=fe;return T.x<ye.x+ye.width+Di&&O+Di>ye.x&&T.y<ye.y+ye.height&&T.y+T.height>ye.y}))continue;const F={x:T.x,y:T.y,width:T.width,height:T.height},I=[...T.incoming??[],...T.outgoing??[]],U=I.map(fe=>({c:fe,wps:(fe.waypoints??[]).map(ye=>({x:ye.x,y:ye.y}))})),K=I.flatMap(fe=>{const ye=fe.label;return ye?[{label:ye,x:ye.x,y:ye.y}]:[]}),re=co();n.resizeShape(T,{...F,width:O-T.x});const ee=D.filter(({conn:fe,other:ye})=>TE(fe,T,ye)).length,he=co();if(!(ee>0&&he.messages>re.messages&&he.lines>=re.lines)){n.resizeShape(T,F);for(const{c:fe,wps:ye}of U){const Ye=fe.waypoints??[];Ye.length===ye.length&&Ye.every((J,se)=>Math.abs(J.x-ye[se].x)<=.5&&Math.abs(J.y-ye[se].y)<=.5)||n.updateWaypoints(fe,ye.map(J=>({x:J.x,y:J.y})))}for(let fe=0;fe<3;fe++){let ye=0;for(const Ye of K){const Ae=Ye.x-Ye.label.x,J=Ye.y-Ye.label.y;Math.abs(Ae)<=.5&&Math.abs(J)<=.5||(n.moveElements([Ye.label],{x:Ae,y:J}),ye++)}if(!ye)break}}}},kE=()=>{let b=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let T=1;T<A.length;T++)b+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return b},OE=()=>{let b=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let T=1;T<A.length;T++)b+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return b},B$=b=>{const R=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const T=A;if(b.has(T.id))continue;const O=[...T.incoming??[],...T.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===T?I.target:I.source);if(!O.length||O.some(I=>I===void 0))continue;const j=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const U=I,K=[U.source,U.target];return K.some(re=>!re)?[]:K.map(re=>re.id)},F=O.flatMap(I=>j(I));F.length&&F.every(I=>b.has(I))&&R.push(T)}return R},DE=()=>ht(Ue(o)).filter(b=>b.kind==="edge-crosses-shape").length,LE=b=>{const R=(b.children??[]).filter(Fi);let A=0;for(let T=0;T<R.length;T++)for(let D=T+1;D<R.length;D++){const O=R[T],j=R[D];O.x<j.x+j.width&&O.x+O.width>j.x&&O.y<j.y+j.height&&O.y+O.height>j.y&&A++}return A},co=()=>{const b=Ue(o),R=A=>A.length>=2&&(A.every(T=>Math.abs(T.x-A[0].x)<.01)||A.every(T=>Math.abs(T.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>R(A.waypoints)).length}},IE=b=>{const R=new Map;for(const T of o.getAll()){if(T.type!=="bpmn:MessageFlow")continue;const D=T;if(!D.waypoints||D.waypoints.length!==2)continue;const O=D.source,j=D.target;if(!O||!j)continue;const F=b.has(O.id);if(F===b.has(j.id))continue;const I=F?j:O,U=d(I);if(!U||b.has(I.id))continue;const K=R.get(U.id);K?I.x<K.minX&&(K.minX=I.x):R.set(U.id,{pool:U,minX:I.x})}const A=[];for(const{pool:T,minX:D}of R.values()){const O=(T.children??[]).filter(j=>Fi(j)&&!b.has(j.id)&&j.x>=D);O.length&&A.push({subtree:O,pool:T})}return A},N$=(b,R,A)=>{const T=new Map(R.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),D=new Set(b);for(const j of R)for(const F of j.subtree)D.add(F.id);let O=!1;for(;;){let j=0;for(const F of IE(D)){if(F.pool===A)continue;const I=T.get(F.pool.id);I?I.subtree.push(...F.subtree):T.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const U of F.subtree)D.add(U.id);j+=F.subtree.length}if(!j)break;O=!0}return O?[...T.values()]:null},$$=(b,R)=>{const A=new Map;for(const D of o.getAll()){if(D.type!=="bpmn:DataInputAssociation"&&D.type!=="bpmn:DataOutputAssociation")continue;const O=D,j=O.waypoints;if(!j||j.length<2||!j.every(he=>Math.abs(he.x-j[0].x)<1))continue;const F=O.source,I=O.target;if(!F||!I)continue;const U=b.has(F.id);if(U===b.has(I.id))continue;const K=U?I:F,re=d(K);if(!re||re===R||re===d(U?F:I))continue;const ee=A.get(re.id);ee?K.x<ee.minX&&(ee.minX=K.x):A.set(re.id,{pool:re,minX:K.x})}const T=[];for(const{pool:D,minX:O}of A.values()){const j=(D.children??[]).filter(F=>Fi(F)&&!b.has(F.id)&&F.x>=O);j.length&&T.push({subtree:j,pool:D})}return T},BE=b=>{const R=Ue(o),A=R.shapes.filter(D=>b.has(D.id)),T=new Set;for(const D of R.edges)if(!(D.type!=="bpmn:SequenceFlow"&&D.type!=="bpmn:MessageFlow"))for(const O of bn(D,A))T.add(`${D.id}|${O.id}`);return T},NE=new Map;for(const b of en(e,"sequenceFlow.update")){if(b.target===void 0)continue;const R=P.get(b.target);if(!R)continue;const A=p(b.target),T=p(b.id);if(!A||!T)continue;const D=b.source!==void 0?p(b.source):T.source,O=T.target;if(!D||!O||O.id===A.id)continue;const j=T.waypoints&&T.waypoints.length>=3&&Math.abs(T.waypoints[0].x-T.waypoints[1].x)<1&&Math.abs(T.waypoints[0].y-T.waypoints[1].y)>1?{x:T.waypoints[0].x,y:T.waypoints[0].y}:void 0,F=j?T.waypoints[1].y:void 0,I=j&&T.label?{x:T.label.x,y:T.label.y}:void 0,U=I&&T.label&&Math.abs(I.y+T.label.height/2-F)<=L/5&&I.x+T.label.width>j.x?I.x+T.label.width+6:void 0,K=(D.outgoing??[]).filter(Pe=>Pe.type==="bpmn:SequenceFlow"&&Pe.id!==T.id&&Pe.target&&!sc.has(Pe.id)),re=new Set(K.map(Pe=>Pe.target.id)),ee=Pe=>{const Ct={type:"bpmn:Task",x:Pe.x+2,y:Pe.y+2,width:Pe.width-4,height:Pe.height-4};return K.find(bt=>(bt.waypoints??[]).some((Mn,xt)=>!!bt.waypoints[xt+1]&&es(Mn,bt.waypoints[xt+1],Ct)===0))},he=$o(b.target),fe=new Set(he.map(Pe=>Pe.id)),ye=Rn.has(b.target)?{autoResize:!1}:void 0,Ye=Math.min(...he.map(Pe=>Pe.x)),Ae=Math.max(...he.map(Pe=>Pe.x+Pe.width)),J=D.x+D.width,se=O.x+O.width<=D.x,le=(()=>{if(!se)return;const Pe=d(A),Ct=((Pe==null?void 0:Pe.children)??[]).filter(et=>Fi(et)&&!fe.has(et.id)&&et.type!=="bpmn:Group"&&et.type!=="bpmn:Participant"),bt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Mn=o.getAll().filter(et=>{if(!bt.includes(et.type))return!1;const jt=et;return jt.id===T.id||sc.has(jt.id)||!jt.waypoints||jt.waypoints.length<2?!1:![jt.source,jt.target].some(Bt=>!Bt||fe.has(Bt.id))}),xt=(et,jt)=>he.every(Bt=>{var zo;const yt={id:Bt.id,type:Bt.type,x:Bt.x+et,y:Bt.y+jt,width:Bt.width,height:Bt.height};return Pe&&(yt.x<Pe.x||yt.x+yt.width>Pe.x+Pe.width||yt.y<Pe.y||yt.y+yt.height>Pe.y+Pe.height)||!Mt((zo=P.get(Bt.id))==null?void 0:zo.node.lane,Bt,Bt.y+jt+Bt.height/2)||Ct.some(Un=>yt.x<Un.x+Un.width+Oi&&yt.x+yt.width+Oi>Un.x&&yt.y<Un.y+Un.height+Oi&&yt.y+yt.height+Oi>Un.y)?!1:Mn.every(Un=>{for(let ar=0;ar+1<Un.waypoints.length;ar++)if(es(Un.waypoints[ar],Un.waypoints[ar+1],yt)<Oi)return!1;return!0})}),ct=D.x+D.width/2,Dt=D.y+D.height/2,ke=T.waypoints??[],Et=ke.length>=2&&Math.abs(ke[0].y-ke[1].y)<1&&ke[1].x<ke[0].x;return[...F!==void 0?[{cx:ct,cy:F}]:[],...Et?[{cx:D.x-Cn-A.width/2,cy:ke[0].y}]:[],{cx:ct,cy:Dt+L},{cx:ct,cy:Dt-L}].find(et=>xt(et.cx-(A.x+A.width/2),et.cy-(A.y+A.height/2)))})(),be=se&&!le?J:O.x,Ze=A.y+A.height/2,Qe=O$(he,J+Cn-Ye,[0,D.y+D.height/2-Ze,O.y+O.height/2-Ze],be,J,D.y+D.height/2),Ot=J+Cn+Qe,Ft=(()=>{if(U===void 0)return 0;const Pe=J+Cn,Ct=D.y+D.height/2-A.height/2,bt={x:Pe,y:Ct,width:Ae-Ye,height:A.height},Mn=d(D);return((Mn==null?void 0:Mn.children)??[]).some(ct=>Fi(ct)&&!fe.has(ct.id)&&ct.id!==D.id&&ct.id!==O.id&&ct.type!=="bpmn:Group"&&ct.type!=="bpmn:Participant"&&ct.x<bt.x+bt.width&&ct.x+ct.width>bt.x&&ct.y<bt.y+bt.height&&ct.y+ct.height>bt.y)||ee(bt)?Math.max(0,U-Pe):0})(),xe=le?0:Ae-Ye+Cn*2+Qe+Ft-(se?0:O.x-J);let ve=[];if(xe>0){const Pe=d(A),Ct=(Pe==null?void 0:Pe.children)??[],bt=ke=>ke.type==="bpmn:Lane";ve=(()=>{const ke=new Set;for(const De of Ct)Fi(De)&&!fe.has(De.id)&&De.id!==D.id&&De.x>=be&&ke.add(De.id);const Et=[];for(const De of Ct){if(De.type!=="bpmn:DataStoreReference"&&De.type!=="bpmn:DataObjectReference")continue;const et=De,Bt=[...et.incoming??[],...et.outgoing??[]].filter(yt=>yt.type==="bpmn:DataInputAssociation"||yt.type==="bpmn:DataOutputAssociation").map(yt=>yt.source===et?yt.target:yt.source);Bt.length&&Bt.every(yt=>yt!==void 0&&ke.has(yt.id))&&Et.push(et)}return Et})();const xt=Ct.filter(ke=>!("waypoints"in ke&&ke.waypoints)&&!bt(ke)&&ke.type!=="label"&&!fe.has(ke.id)&&ke.id!==D.id&&ke.x>=be),ct=xt.flatMap(ke=>ke.labels??[]),Dt=Pe?[Pe,...Ct.filter(ke=>bt(ke))]:[];if(xt.length){const ke=new Set(xt.map(Ke=>Ke.id)),Et=IE(ke),De=Et.length?N$(ke,Et,Pe):null,et=Ke=>{const vt=new Set(ke);for(const Lt of Ke)for(const Cr of Lt.subtree)vt.add(Cr.id);return B$(vt)},jt=et(Et),Bt=De?et(De):jt,yt=nm(ke),zo=new Set(ke);for(const Ke of Et)for(const vt of Ke.subtree)zo.add(vt.id);const Un=Et.length?nm(zo):yt,ar=(()=>{if(!De)return[];const Ke=new Set(ke);for(const vt of De)for(const Lt of vt.subtree)Ke.add(Lt.id);return nm(Ke)})(),Ua=De??Et,Go=(()=>{const Ke=new Set(ke);for(const vt of Ua)for(const Lt of vt.subtree)Ke.add(Lt.id);return $$(Ke,Pe)})(),um=Go.length?et([...Ua,...Go]):jt,ji=new Set([...xt,...Dt].map(Ke=>Ke.id)),gt=Ct.filter(Ke=>{const vt=Ke.labelTarget;return Ke.type==="label"&&!!vt&&"waypoints"in vt&&!!vt.source&&!!vt.target&&ji.has(vt.source.id)&&ji.has(vt.target.id)}),wn=L$();n.createSpace([...xt,...ct,...gt],Dt,{x:xe,y:0},"e",be-1);const Yt=(Ke,vt,Lt)=>{const Cr=co(),op=Lt?BE(Lt):null,ap=cc(Ke,xe,!!Lt);if(!ap)return!1;const pc=vt.length?PE(vt,xe):null,sp=co(),Kt=!!Lt&&!!op&&[...BE(Lt)].some(Wo=>!op.has(Wo));return sp.messages>Cr.messages&&sp.lines>=Cr.lines&&!Kt?!0:(pc==null||pc(),ap(),!1)},li=Go.length>0&&Yt([...Ua,...Go],De?ar:Un,new Set(Go.flatMap(Ke=>Ke.subtree.map(vt=>vt.id)))),Vo=!li&&De?Yt(De,ar):!1;let sr=li||Vo;!sr&&Et.length&&(sr=Yt(Et,Un));const qa=li?um:Vo?Bt:jt;if(!sr){for(const Ke of Et){const vt=co(),Lt=cc([Ke],xe);if(!Lt)continue;const Cr=co();(Cr.messages<=vt.messages||Cr.lines<vt.lines)&&Lt()}if(yt.length){const Ke=co(),vt=PE(yt,xe);if(vt){const Lt=co();(Lt.messages<=Ke.messages||Lt.lines<Ke.lines)&&vt()}}}if(I$(wn),qa.length){const Ke=()=>new Set(ht(Ue(o)).map(Lt=>pt(Lt))),vt=Lt=>{const Cr=OE(),op=Ke(),ap=Lt.map(Kt=>({a:Kt,x:Kt.x,y:Kt.y})),pc=o.filter(Kt=>Kt.type==="label").map(Kt=>({label:Kt,x:Kt.x,y:Kt.y}));n.moveElements(Lt,{x:xe,y:0});const sp=[...Ke()].filter(Kt=>!op.has(Kt));if(OE()<Cr&&sp.length===0)return!0;for(const{a:Kt,x:Wo,y:fc}of ap)(Kt.x!==Wo||Kt.y!==fc)&&n.moveElements([Kt],{x:Wo-Kt.x,y:fc-Kt.y});for(const Kt of pc){const Wo=Kt.x-Kt.label.x,fc=Kt.y-Kt.label.y;(Wo!==0||fc!==0)&&n.moveElements([Kt.label],{x:Wo,y:fc})}return!1};if(!vt(qa)&&qa.length>1)for(const Lt of qa)vt([Lt])}}}const ce=R.node.lane!==void 0?p(R.node.lane):R.node.participant!==void 0?p(R.node.participant):void 0,_e=Pe=>{if(!ce)return!0;const Ct=Pe.y+Pe.height/2;return Ct>=ce.y&&Ct<=ce.y+ce.height},Ne=!_e(D)&&_e(O)?O:D,Ie=Ne.y+Ne.height/2,Ee=Ie-(A.y+A.height/2),rt=R.band!==void 0,lt=rt?[A]:he,Jt=(R.band===void 0||w(R.node.lane,R.node.participant,R.band,Ie))&&Rt(b.target)&&lt.every(Pe=>{var Ct;return Mt((Ct=P.get(Pe.id))==null?void 0:Ct.node.lane,Pe,Pe.y+Pe.height/2+Ee)}),ci=Pe=>Math.abs(Pe.y+Pe.height/2-(A.y+A.height/2))<=L/2;if(Jt&&rt){const Pe=Math.abs(Ee)<=L/2?he.filter(Ct=>Ct.id!==A.id&&ci(Ct)):[];if(n.moveElements(he,{x:Ot-Ye,y:0},void 0,ye),n.moveElements([A],{x:0,y:Ee},void 0,ye),Pe.length){const Ct=()=>new Set(ht(Ue(o)).map(ke=>pt(ke))),bt=Ct(),Mn=o.filter(ke=>ke.type==="label").map(ke=>({label:ke,x:ke.x,y:ke.y}));n.moveElements(Pe,{x:0,y:Ee});const xt=Ct(),ct=[...xt].filter(ke=>!bt.has(ke)).length,Dt=[...bt].filter(ke=>!xt.has(ke)).length;if(ct>Dt){n.moveElements(Pe,{x:0,y:-Ee});for(const ke of Mn){const Et=ke.x-ke.label.x,De=ke.y-ke.label.y;(Et!==0||De!==0)&&n.moveElements([ke.label],{x:Et,y:De})}}}}else n.moveElements(he,{x:Ot-Ye,y:Jt?Ee:0},void 0,ye);const nt=d(A);if(!Jt&&R.node.lane===void 0&&R.band!==void 0&&nt){const Pe=nt.y+X+C(`pool:${R.node.participant??""}`,R.band)*L,Ct=Pe-(A.y+A.height/2);Ct!==0&&!Ve(nt,A,A.x+A.width/2,Pe,fe)&&n.moveElements([A],{x:0,y:Ct},void 0,ye)}if(le)n.moveElements(he,{x:le.cx-(A.x+A.width/2),y:le.cy-(A.y+A.height/2)},void 0,ye);else if(nt){const Pe=(nt.children??[]).filter(xt=>Fi(xt)&&!fe.has(xt.id)&&xt.type!=="bpmn:Group"&&xt.type!=="bpmn:Participant"),Ct=(xt,ct,Dt,ke,Et)=>xt.x+ct<Et.x+Et.width+ke&&xt.x+ct+xt.width+ke>Et.x&&xt.y+Dt<Et.y+Et.height+ke&&xt.y+Dt+xt.height+ke>Et.y,bt=Pe.find(xt=>Ct(A,0,0,0,xt)),Mn=bt?void 0:ee(A);if(bt||Mn){const xt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],ct=o.getAll().filter(gt=>{if(!xt.includes(gt.type))return!1;const wn=gt;return sc.has(wn.id)||!wn.waypoints||wn.waypoints.length<2?!1:![wn.source,wn.target].some(Yt=>!Yt||fe.has(Yt.id))}),Dt=(gt,wn,Yt)=>{var li;return Mt((li=P.get(gt.id))==null?void 0:li.node.lane,gt,gt.y+Yt+gt.height/2)&&gt.x+wn>=nt.x&&gt.x+wn+gt.width<=nt.x+nt.width&&gt.y+Yt>=nt.y&&gt.y+Yt+gt.height<=nt.y+nt.height},ke=(gt,wn)=>he.every(Yt=>Dt(Yt,gt,wn)&&!Pe.some(li=>Ct(Yt,gt,wn,Oi,li))&&ct.every(li=>{const Vo={id:Yt.id,type:Yt.type,x:Yt.x+gt,y:Yt.y+wn,width:Yt.width,height:Yt.height};for(let sr=0;sr+1<li.waypoints.length;sr++)if(es(li.waypoints[sr],li.waypoints[sr+1],Vo)<Oi)return!1;return!0})),Et=A.y+A.height/2,De=[F,O.y+O.height/2].filter(gt=>gt!==void 0&&Math.abs(gt-Et)>=1),et=bt&&re.has(bt.id)?bt:Mn==null?void 0:Mn.target,jt=et?et.x-A.x:0,Bt=Math.max(...he.map(gt=>gt.x+gt.width)),yt=[...jt!==0?[jt]:[],...Qe!==0?[-Qe]:[],0],zo=U===void 0?[]:yt.map(gt=>Math.max(gt,U-A.x)),Un=gt=>Bt+gt+Cn<=O.x,ar=[...new Set([...zo,...yt])].filter(Un),Ua=bt&&re.has(bt.id)?[bt.x+bt.width+Cn-A.x]:[],Go=U===void 0?[]:Ua.map(gt=>Math.max(gt,U-A.x)),um=[...new Set([...Go,...Ua])].filter(gt=>Un(gt)&&!ar.includes(gt));let ji;for(const gt of[ar,um]){for(const wn of De){for(const Yt of gt)if(ke(Yt,wn-Et)){ji={dx:Yt,dy:wn-Et};break}if(ji)break}if(ji)break}if(ji){const gt=Ke=>{const vt=Ke;return[vt.edge,vt.other,...Array.isArray(vt.edges)?vt.edges:[]].some(Lt=>typeof Lt=="string"&&sc.has(Lt))},wn=()=>new Set(ht(Ue(o)).filter(Ke=>!gt(Ke)).map(Ke=>pt(Ke))),Yt=wn(),li=o.filter(Ke=>Ke.type==="label").map(Ke=>({label:Ke,x:Ke.x,y:Ke.y}));n.moveElements(he,{x:ji.dx,y:ji.dy},void 0,ye);const Vo=wn(),sr=[...Vo].filter(Ke=>!Yt.has(Ke)).length,qa=[...Yt].filter(Ke=>!Vo.has(Ke)).length;if(sr>qa){n.moveElements(he,{x:-ji.dx,y:-ji.dy},void 0,ye);for(const Ke of li){const vt=Ke.x-Ke.label.x,Lt=Ke.y-Ke.label.y;(vt!==0||Lt!==0)&&n.moveElements([Ke.label],{x:vt,y:Lt})}}else j&&NE.set(T.id,{exit:j,channelY:F,label:I})}}}{const Pe=new Set(he.map(ct=>ct.id)),Ct=new Set(_.map(ct=>ct.flow.id)),bt=20,Mn=ct=>{const Dt=ct.source,ke=ct.target,Et=Math.min(Dt.x,ke.x)-bt,De=Math.max(Dt.x+Dt.width,ke.x+ke.width)+bt,et=Math.min(Dt.y,ke.y)-bt,jt=Math.max(Dt.y+Dt.height,ke.y+ke.height)+bt;return ct.waypoints.some(Bt=>Bt.x<Et||Bt.x>De||Bt.y<et||Bt.y>jt)},xt=new Map;for(const ct of he)for(const Dt of[...ct.incoming??[],...ct.outgoing??[]])Dt.id!==b.id&&Ct.has(Dt.id)&&!(Pe.has(Dt.source.id)&&Pe.has(Dt.target.id))&&xt.set(Dt.id,Dt);for(const ct of xt.values())Mn(ct)&&dt(ct)}const zt=ve.length?d(ve[0]):void 0;if(zt){const Pe={assoc:kE(),overlaps:LE(zt),crosses:DE()},Ct=ve.map(De=>({st:De,x:De.x})),bt=o.filter(De=>De.type==="label").map(De=>({label:De,x:De.x,y:De.y})),Mn=Math.min(...ve.flatMap(De=>[...De.incoming??[],...De.outgoing??[]].filter(et=>et.type==="bpmn:DataInputAssociation"||et.type==="bpmn:DataOutputAssociation").map(et=>(et.source===De?et.target:et.source).x))),xt=new Set(ve.map(De=>De.id)),ct=(zt.children??[]).filter(Fi).filter(De=>!xt.has(De.id));let Dt=Mn;for(const De of[...ve].sort((et,jt)=>et.x-jt.x)){let et=Dt;for(let jt=0;jt<100;jt++){const Bt=ct.find(yt=>et<yt.x+yt.width+Di&&et+De.width+Di>yt.x&&De.y<yt.y+yt.height&&De.y+De.height>yt.y);if(!Bt)break;et=Bt.x+Bt.width+Di}et!==De.x&&n.moveElements([De],{x:et-De.x,y:0}),Dt=et+De.width+Di}const ke=Dt+150-(zt.x+zt.width);ke>0&&ep(zt,zt.width+ke);const Et={assoc:kE(),overlaps:LE(zt),crosses:DE()};if(Et.assoc>=Pe.assoc||Et.overlaps>Pe.overlaps||Et.crosses>Pe.crosses){for(const{st:De,x:et}of Ct)De.x!==et&&n.moveElements([De],{x:et-De.x,y:0});ke>0&&ep(zt,zt.width-ke);for(const De of bt){const et=De.x-De.label.x,jt=De.y-De.label.y;(et!==0||jt!==0)&&n.moveElements([De.label],{x:et,y:jt})}}}}for(const[b,R]of Rn){const A=p(b);if(!A)continue;const T=R.container,D=Math.abs(A.y+A.height/2-T.y-R.relCy)>=.5,O=A.label,j=Math.min(A.y,O&&!O.hidden?O.y:A.y),F=Math.max(A.y+A.height,O&&!O.hidden?O.y+O.height:0);if(D&&j>=T.y&&F<=T.y+T.height)continue;const I=A.y;R.grow(),A.y!==I&&n.moveElements([A],{x:0,y:I-A.y},void 0,{autoResize:!1})}const $E=(b,R)=>{const A=R.target===b,T=f(R.source),D=f(R.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(T,D,R.id?{type:O,businessObject:i.create(O,{id:R.id})}:{type:O})},FE=b=>{for(const R of h){if(!R.participant.blackBox)continue;const A=p(R.participant.id);if(!A)continue;const T=[];for(const O of x){const j=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&T.push(F)}if(!T.length)continue;if(!b&&R.order===void 0){const O=(()=>{var F;const j=new Map;for(const I of T){const U=d(I);if(!U)continue;const K=j.get(U.id);K?K.n+=1:j.set(U.id,{shape:U,n:1})}return(F=[...j.values()].sort((I,U)=>U.n-I.n)[0])==null?void 0:F.shape})();if(O){const j=U=>U.reduce((K,re)=>K+re,0)/U.length,F=j(T.map(U=>U.y+U.height/2))<O.y+O.height/2,I=o.filter(U=>U.type==="bpmn:Participant"&&U.id!==R.participant.id&&U.id!==O.id).filter(U=>F?U.y+U.height<=O.y+5:U.y>=O.y+O.height-5);if(I.length){const U=[...I.reduce((le,be)=>le.set(be.y,(le.get(be.y)??0)+1),new Map)].sort((le,be)=>be[1]-le[1]||(F?be[0]-le[0]:le[0]-be[0]))[0][0],K=Math.min(A.width,bC),re=xC,ee=T.map(le=>le.x+le.width/2),he=Math.round(j(ee)-K/2),fe=Math.max(...ee)+Xp,ye=le=>({x:le,width:Math.max(K,fe-le)}),Ye=I.filter(le=>Math.min(le.y+le.height,U+re)-Math.max(le.y,U)>0),Ae=le=>{const be=ye(le);return Ye.some(Ze=>Ze.x<be.x+be.width&&be.x<Ze.x+Ze.width)},J=le=>{const be=ye(le);return ee.filter(Ze=>Ze>=be.x+10&&Ze<=be.x+be.width-10).length},se=(()=>{if(!Ae(he))return he;const le=J(he);return Ye.flatMap(be=>[be.x+be.width+Vg,be.x-Vg-K]).map(be=>Math.round(be)).filter(be=>!Ae(be)&&J(be)>=le).sort((be,Ze)=>Math.abs(be-he)-Math.abs(Ze-he))[0]??he})();if(se!==A.x||U!==A.y||K!==A.width||re!==A.height){const le=()=>new Set(ht(Ue(o)).map(xe=>pt(xe))),be=le(),Ze={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:se,y:U,width:K,height:re});const Qe=le(),Ot=[...Qe].filter(xe=>!be.has(xe)).length,Ft=[...be].filter(xe=>!Qe.has(xe)).length;Ot>Ft&&n.resizeShape(A,Ze)}}}}const D=Math.max(...T.map(O=>O.x+O.width/2))+Xp;if(D>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:D-A.x,height:A.height}),!!b)for(const O of x){const j=p(O.flow.id),F=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,I=F?p(F):void 0;if(!j||!I||I.type==="bpmn:Participant")continue;const U=I.x+I.width/2;U<A.x+10||U>A.x+A.width-10||TE(j,A,I)}}};FE(!1);for(const b of x){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 A=new Set([..._.map(I=>I.flow.id),...x.map(I=>I.flow.id)].filter(I=>!!I)),T=o.filter(I=>!!I.waypoints),D=(I,U)=>Math.abs(U.x-I.x)<2?"L":Math.abs(U.x-(I.x+I.width))<2?"R":Math.abs(U.y-I.y)<2?"T":Math.abs(U.y-(I.y+I.height))<2?"B":void 0,O=new Map,j=(I,U,K)=>{if(!I||!U||typeof I.x!="number")return;const re=D(I,U);if(!re)return;let ee=O.get(I.id);ee||O.set(I.id,ee=new Map),ee.set(re,[...ee.get(re)??[],K])};for(const I of T){const U=I.waypoints;!U||U.length<2||(j(I.source,U[0],{id:I.id,dir:"out"}),j(I.target,U[U.length-1],{id:I.id,dir:"in"}))}const F=new Set;for(const[I,U]of O){const K=p(I);if(!K||typeof K.x!="number"||![...U.values()].some(Ae=>{const J=Ae.filter(se=>se.dir==="in");return Ae.length>=3&&J.length>=1&&Ae.some(se=>se.dir==="out")&&J.some(se=>A.has(se.id))}))continue;const ee=d(K);if(!ee||F.has(ee.id)||(ee.children??[]).some(Ae=>Ae.type==="bpmn:Lane"))continue;const he=(i1=U.get("T"))!=null&&i1.length?(r1=U.get("B"))!=null&&r1.length?void 0:"B":"T";if(!he||(he==="T"?K.y-ee.y:ee.y+ee.height-(K.y+K.height))>=L)continue;const ye=(ee.children??[]).filter(Ae=>!("waypoints"in Ae&&Ae.waypoints)&&Ae.type!=="label"&&typeof Ae.x=="number"),Ye=ee.y+ee.height;n.resizeShape(ee,{x:ee.x,y:ee.y,width:ee.width,height:ee.height+L}),ne(Ye,ee.id,L),he==="T"&&ye.length&&n.moveElements(ye,{x:0,y:L}),F.add(ee.id)}}const im=20,jE=4,F$=3,j$=2,H$=[10,30,80],lo=()=>{const b=Ue(o);return{bad:ht(b).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:tg(b),straight:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Va=b=>{const R=Ue(o),A=R.edges.find(T=>T.id===b);return A?bn(A,hi(R)).length:0},tp=b=>Va(b)>0,np=b=>Ue(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==b&&R.waypoints.length===2).length,z$=(b,R,A)=>cc([{subtree:b,pool:R}],A),HE=(b,R)=>R.bad>b.bad||R.crossings>b.crossings&&R.straight<=b.straight&&R.bad>=b.bad,Wa=(b,R)=>HE(b,R)||R.straight<b.straight,Fo=(b,R,A=()=>!0,T=HE,D=!1)=>{const O=lo(),j=cc(b,R,D);if(!j)return!1;const F=lo();return T(O,F)||!A()?(j(),!1):!0},G$=(b,R,A,T=()=>!0)=>Fo([{subtree:b,pool:R}],A,T),jo=b=>{var R;return!!((R=P.get(b))!=null&&R.node.participant)},lc=new Map;for(const b of x){if(!jo(b.flow.target))continue;const R=lc.get(b.flow.target)??[];R.push(b),lc.set(b.flow.target,R)}const ip=[...lc.keys()],rm=new Set(_.map(b=>b.flow.target)),zE=b=>Qt.findIndex(({op:R})=>R.participant.id===b);ip.sort((b,R)=>{var D,O;const A=rm.has(b)?1:0,T=rm.has(R)?1:0;return A!==T?A-T:zE((D=P.get(b))==null?void 0:D.node.participant)-zE((O=P.get(R))==null?void 0:O.node.participant)});const uo=b=>b.x+b.width/2,V$=b=>{const R=new Map;for(const D of o.getAll()){const O=D;if(!O.waypoints||!O.source||!O.target)continue;(R.get(O.source.id)??R.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([b]),T=[b];for(let D=0;D<T.length;D++)for(const O of R.get(T[D])??[])A.has(O)||(A.add(O),T.push(O));return A},W$=(b,R)=>{const A=V$(R);let T;for(const D of o.getAll()){const O=D;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==b||A.has(O.source.id))continue;const j=O.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=uo(j);(T===void 0||F>T)&&(T=F)}return T},om=(b,R)=>{const A=p(b.flow.source);if(A)return A.type==="bpmn:Participant"?W$(A.id,R):uo(A)},GE=b=>{let R;for(const A of lc.get(b)??[]){const T=om(A,b);T!==void 0&&(!R||T>R.cx)&&(R={op:A,cx:T})}return R==null?void 0:R.op},U$=b=>{const R=GE(b),A=p(b),T=R?om(R,b):void 0;return A&&T!==void 0?T-uo(A):void 0},q$=b=>{const R=U$(b);return R!==void 0&&Math.abs(R)<im},am=(b,R,A,T,D)=>{var O;for(let j=!0;j;){j=!1;for(const F of x){if(F.flow.id===A)continue;const I=R.has(F.flow.source),U=R.has(F.flow.target);if(I===U||T(I?F.flow.source:F.flow.target))continue;const K=I?F.flow.target:F.flow.source;if(D(K)||!jo(K))continue;const re=p(F.flow.id);if(!(re!=null&&re.waypoints)||re.waypoints.length!==2)continue;const ee=p(K),he=(O=P.get(K))==null?void 0:O.node.participant;if(!ee||!he)continue;const fe=$o(K,ye=>ye.x>=ee.x).filter(ye=>!R.has(ye.id));if(!(!fe.length||fe.some(ye=>D(ye.id)))){for(const ye of fe)R.add(ye.id);b.set(he,[...b.get(he)??[],...fe]),j=!0}}}return[...b].map(([j,F])=>({subtree:F,pool:f(j)}))},VE=(b,R,A,T,D)=>am(new Map([[R,[...b]]]),new Set(b.map(O=>O.id)),T,O=>O===A,O=>O===D),sm=b=>{const R=GE(b);if(!R)return null;const A=p(b),T=p(R.flow.source),D=om(R,b);if(!A||!T||D===void 0)return null;const O=D-uo(A);if(O>=im){const j=P.get(b).node.participant,F=$o(b,I=>I.x>=A.x);return{groups:VE(F,j,b,R.flow.id,R.flow.source),dx:O}}if(-O>=im&&jo(R.flow.source)){const j=P.get(R.flow.source).node.participant,F=$o(R.flow.source,I=>I.x>=T.x&&!q$(I.id));return{groups:VE(F,j,R.flow.source,R.flow.id,b),dx:-O}}return null},WE=()=>ip.map(b=>({id:b,plan:sm(b)})).filter(b=>!!b.plan).sort((b,R)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))).map(b=>b.id);for(let b=0;b<3;b++){const R=lo(),A=[];for(const D of WE()){const O=sm(D);if(!O)continue;const j=cc(O.groups,O.dx);j&&A.push(j)}if(!A.length)break;if(!Wa(R,lo()))continue;for(const D of A.reverse())D();let T=!1;for(const D of WE()){const O=sm(D);O&&Fo(O.groups,O.dx,()=>!0,Wa)&&(T=!0)}if(!T)break}for(const b of ip){if(rm.has(b))continue;const R=P.get(b);if(!R||R.node.lane!==void 0)continue;const A=Y(R);if(A===void 0)continue;const T=p(b),D=T?d(T):void 0;if(!T||!D)continue;const O=D.y+X+C(`pool:${R.node.participant??""}`,A)*L,j=O-(T.y+T.height/2);j!==0&&!Ve(D,T,T.x+T.width/2,O)&&n.moveElements([T],{x:0,y:j})}const UE=new Set;for(let b=0,R=!0;R&&b<F$;b++){R=!1;for(const A of ip.flatMap(T=>lc.get(T)??[])){if(UE.has(A.flow.id)||!tp(A.flow.id))continue;const T=p(A.flow.target);if(!T)continue;const D=f(P.get(A.flow.target).node.participant),O=$o(A.flow.target,U=>U.x>=T.x),j=T.width+z,F=Va(A.flow.id),I=np(A.flow.id);for(let U=1;U<=jE;U++){const K=()=>Va(A.flow.id)<F&&np(A.flow.id)>=I;if(G$(O,D,j*U,K)){UE.add(A.flow.id),R=!0;break}}}}const cm=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),qE=new Set(cm.map(b=>b.id));for(const b of o.filter(R=>R.type==="bpmn:MessageFlow"))qE.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&cm.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of cm){if(!tp(b.id))continue;const R=p(b.source),A=p(b.target);if(!R||!A)continue;let T,D,O;if(b.preexisting){const[F,I]=R.type==="bpmn:Participant"?[A,R]:[R,A];if(T=uo(F),T<I.x||T>I.x+I.width)continue;[D,O]=F.y<I.y?[F.y+F.height,I.y]:[I.y+I.height,F.y]}else{if(R.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(T=R.x+R.width/2,Math.abs(T-(A.x+A.width/2))>15))continue;[D,O]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y]}const j=[...P.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==R.id&&F.id!==A.id).filter(F=>F.x<=T&&T<=F.x+F.width&&F.y+F.height>D&&F.y<O).sort((F,I)=>F.x-I.x);for(const F of j){const I=(o1=P.get(F.id))==null?void 0:o1.node.participant,U=I?p(I):void 0;if(!I||!U)continue;const K=[...P.values()].filter(se=>se.node.participant===I).map(se=>se.node.id),re=se=>se.map(le=>p(le)).filter(le=>!!le),he=[D$(F.id,se=>{var le;return((le=P.get(se.id))==null?void 0:le.node.participant)===I}),re(K)].filter(se=>se.length).map(se=>[{subtree:se,pool:U}]);if(b.preexisting){const se=re(K);se.length&&he.push(am(new Map([[I,[...se]]]),new Set(se.map(le=>le.id)),b.id,()=>!1,le=>le===R.id||le===A.id))}const fe=F.width+z,ye=Va(b.id),Ye=np(b.id),Ae=()=>Va(b.id)<ye&&np(b.id)>=Ye;let J=!1;for(const se of he){for(let le=1;le<=jE;le++)if(Fo(se,fe*le,Ae)){J=!0;break}if(J)break}if(!tp(b.id))break}}const rp=()=>{var R;const b=new Set;for(const A of ht(Ue(o)))A.kind!=="edge-crosses-shape"||qE.has(A.edge)||((R=p(A.edge))==null?void 0:R.type)==="bpmn:MessageFlow"&&b.add(`${A.edge}>${A.shape}`);return b},Y$=(b,R)=>lo().bad>=b&&[...rp()].some(A=>!R.has(A)),YE=b=>{var R,A;return Va(b)===0&&((A=(R=p(b))==null?void 0:R.waypoints)==null?void 0:A.length)===2},K$=(b,R,A)=>{const T=new Set(b.flatMap(O=>O.subtree.map(j=>j.id))),D=[...rp()].filter(O=>!A.has(O)).map(O=>O.split(">")[1]);return[...new Set(D)].filter(O=>T.has(O)&&O!==R.source&&O!==R.target)},X$=(b,R,A,T,D)=>{const O=b.map(U=>({...U,subtree:U.subtree.filter(K=>!D.includes(K.id))})).filter(U=>U.subtree.length),j=new Set(O.flatMap(U=>U.subtree.map(K=>K.id))),F=()=>D.every(U=>{const K=p(U);return!!K&&_.filter(re=>re.flow.target===U&&j.has(re.flow.source)).every(re=>{const ee=p(re.flow.source);return!!ee&&ee.x+ee.width<=K.x})});return Fo(O,R,()=>YE(A.id)&&[...rp()].every(U=>T.has(U))&&F(),Wa,!0)};for(const b of x){if(!tp(b.flow.id))continue;const R=p(b.flow.id);if(((a1=R==null?void 0:R.waypoints)==null?void 0:a1.length)!==2)continue;const A=p(b.flow.source),T=p(b.flow.target);if(!A||!T||A.type==="bpmn:Participant"||T.type==="bpmn:Participant"||!jo(b.flow.source)||!jo(b.flow.target)||Math.abs(uo(A)-uo(T))>j$)continue;const D=uo(A),O=R.waypoints.map(ye=>ye.y),[j,F]=[Math.min(...O),Math.max(...O)],I=hi(Ue(o)).filter(ye=>ye.id!==A.id&&ye.id!==T.id&&ye.x<D&&D<ye.x+ye.width&&j<ye.y+ye.height&&ye.y<F);if(!I.length)continue;const U=(s1=P.get(b.flow.source))==null?void 0:s1.node.participant,K=(c1=P.get(b.flow.target))==null?void 0:c1.node.participant;if(!U||!K)continue;const re=new Map;for(const[ye,Ye,Ae]of[[b.flow.source,A,U],[b.flow.target,T,K]]){const J=re.get(Ae)??[],se=$o(ye,le=>le.x>=Ye.x).filter(le=>!J.some(be=>be.id===le.id));re.set(Ae,[...J,...se])}const ee=new Set([...re.values()].flat().map(ye=>ye.id)),he=am(re,ee,b.flow.id,ye=>ye===b.flow.source||ye===b.flow.target,()=>!1),fe=Math.max(...I.map(ye=>ye.x+ye.width));for(const ye of H$){const Ye=fe+ye-D;if(Ye<=0)continue;const Ae=lo().bad,J=rp();let se=[],le=!0;const be=()=>!YE(b.flow.id)||le&&(se=K$(he,b.flow,J),se.length)?!1:!Y$(Ae,J);if(Fo(he,Ye,be,Wa))break;if(se.length&&(X$(he,Ye,b.flow,J,se)||(le=!1,Fo(he,Ye,be,Wa))))break}}{const b=A=>A.y+A.height/2,R=[];for(const A of P.keys()){if(!jo(A))continue;const T=_.filter(j=>j.flow.target===A);if(T.length!==1)continue;const D=p(T[0].flow.source),O=p(A);!D||!O||!P.has(D.id)||Math.abs(b(D)-b(O))>1||O.x-(D.x+D.width)<=z+1||R.push({id:A,pred:D,node:O})}R.sort((A,T)=>A.node.x-T.node.x);for(const{id:A}of R){const T=P.get(A),D=p(A),O=p(_.find(ee=>ee.flow.target===A).flow.source);if(!D||!O)continue;const j=D.x-(O.x+O.width);if(j<=z+1)continue;const F=f(T.node.participant),I=$o(A,ee=>ee.x>=D.x),U=lo(),K=z$(I,F,-(j-z));if(!K)continue;const re=lo();(re.bad>U.bad||re.crossings>=U.crossings||re.straight<U.straight)&&K()}}FE(!0);const Z$=10,Q$=400,J$=b=>[...b.incoming??[],...b.outgoing??[]].filter(R=>R.type==="bpmn:DataInputAssociation"||R.type==="bpmn:DataOutputAssociation").map(R=>R.source===b?R.target:R.source).filter(R=>!!R&&typeof R.y=="number"),e5=o.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),t5=(b,R)=>{const A=b.x+b.width/2,T=b.y+b.height/2;let D;for(const O of e5){if((d(O)??u())!==R||O.y<b.y+b.height)continue;const j=Math.abs(O.x+O.width/2-A);j>Q$||j<O.width||!J$(O).some(I=>I.height===b.height&&Math.abs(I.y+I.height/2-T)<=Z$&&O.y>=I.y+I.height)||(!D||j<D.dx||j===D.dx&&O.id<D.id)&&(D={dx:j,id:O.id,cy:O.y+O.height/2})}return D==null?void 0:D.cy};for(const b of m){const R=b.associations??[],A=R.map(O=>O.source===b.dataStore.id?O.target:O.source).map(p).find(Boolean),T=A?d(A)??u():u(),D=A?{x:A.x+A.width/2,y:t5(A,T)??A.y+A.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})},D,T);for(const O of R)$E(b.dataStore.id,O)}for(const b of v){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;$E(A,b.association)}let KE=0;const Ho=10,XE=40,n5=(b,R)=>{const A=R.map(I=>d(I)).filter(I=>!!I);for(const I of A){const U=Ho,K=I.y,re=I.y+I.height,ee=I.x,he=I.x+I.width;if(Math.abs(b.y-K)<U){const fe=K+U-b.y;b.y+=fe,b.height-=fe}if(Math.abs(b.y+b.height-re)<U&&(b.height=re-U-b.y),Math.abs(b.x-ee)<U){const fe=ee+U-b.x;b.x+=fe,b.width-=fe}Math.abs(b.x+b.width-he)<U&&(b.width=he-U-b.x)}if(!A.length)return;const T=Math.min(...A.map(I=>I.y)),D=Math.max(...A.map(I=>I.y+I.height)),O=T-b.y,j=b.y+b.height-D,F=XE-Ho;if(O>0!=j>0)if(O>0&&O<F){const I=O+Ho;b.y+=I,b.height-=I}else j>0&&j<F&&(b.height-=j+Ho)},i5=(b,R)=>{const A=Ho,T=30,D=o.filter(O=>O.type==="bpmn:Group"&&O.id!==R);for(const O of D){const j=O.x,F=O.x+O.width,I=O.y,U=O.y+O.height,K=b.y<U&&I<b.y+b.height,re=b.x<F&&j<b.x+b.width;if(K){if(Math.abs(b.x-F)<A){const ee=Math.min(F+A-b.x,T);ee>0&&b.width-ee>0&&(b.x+=ee,b.width-=ee)}if(Math.abs(b.x+b.width-j)<A){const ee=Math.min(b.x+b.width-(j-A),T);ee>0&&b.width-ee>0&&(b.width-=ee)}}if(re){if(Math.abs(b.y-U)<A){const ee=Math.min(U+A-b.y,T);ee>0&&b.height-ee>0&&(b.y+=ee,b.height-=ee)}if(Math.abs(b.y+b.height-I)<A){const ee=Math.min(b.y+b.height-(I-A),T);ee>0&&b.height-ee>0&&(b.height-=ee)}}}},lm=(b,R)=>{const A=XE,T=Math.min(...b.map(I=>I.x))-A,D=Math.min(...b.map(I=>I.y))-A,O=Math.max(...b.map(I=>I.x+I.width))+A,j=Math.max(...b.map(I=>I.y+I.height))+A,F={x:T,y:D,width:O-T,height:j-D};return n5(F,b),i5(F,R),F};for(const b of S){const R=(b.group.members??[]).map(p).filter(D=>!!D);let A;R.length?A=lm(R,b.group.id):(A={x:300+KE*350,y:40,width:300,height:200},KE++);const T=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(T,b.group.name),(l1=b.group.members)!=null&&l1.length&&k(T,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(D=>!!D.waypoints),R=new Map,A=(D,O)=>{!D||!O||(R.has(D)||R.set(D,new Set),R.get(D).add(O))};for(const D of b){const O=(u1=D.source)==null?void 0:u1.id,j=(p1=D.target)==null?void 0:p1.id;A(O,j),((f1=D.type)!=null&&f1.includes("DataOutputAssociation")||(d1=D.type)!=null&&d1.includes("DataInputAssociation")||D.type==="bpmn:Association")&&A(j,O)}const T=o.filter(D=>D.type==="bpmn:Group");for(const D of T){const j=(((h1=D.businessObject.extensionElements)==null?void 0:h1.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const I=new Set(F),U=[...F];for(;U.length;){const Ae=U.shift();for(const J of R.get(Ae)??[])I.has(J)||(I.add(J),U.push(J))}const K=D.x,re=D.x+D.width,ee=D.y,he=D.y+D.height,fe=Ae=>_.filter(J=>J.flow.target===Ae).length,ye=Ae=>{var se;const J=((se=p(Ae))==null?void 0:se.type)??"";if(J==="bpmn:StartEvent"&&fe(Ae)===0)return!1;if(J.endsWith("Gateway")){const le=_.filter(be=>be.flow.target===Ae).map(be=>be.flow.source);if(le.length&&le.every(be=>{var Ze;return((Ze=p(be))==null?void 0:Ze.type)==="bpmn:StartEvent"&&fe(be)===0}))return!1}return!0},Ye=o.filter(Ae=>Fi(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!I.has(Ae.id)&&jo(Ae.id)&&ye(Ae.id)&&Ae.x<re&&Ae.x+Ae.width>K&&Ae.y<he&&Ae.y+Ae.height>ee);if(Ye.length)for(const Ae of[-1,1]){const J=Ye.filter(ve=>(ve.x+ve.width-K<=re-ve.x?-1:1)===Ae);if(!J.length)continue;const se=[];for(const ve of J){const ce=se.find(_e=>_e.some(Ne=>ve.y<Ne.y+Ne.height&&ve.y+ve.height>Ne.y));ce?ce.push(ve):se.push([ve])}const le=new Map;for(const ve of se){let ce=Ae<0?K-Ho:re+Ho;for(const _e of[...ve].sort((Ne,Ie)=>Ae<0?Ie.x-Ne.x:Ne.x-Ie.x)){const Ne=Ae<0?Math.min(_e.x,ce-_e.width):Math.max(_e.x,ce);ce=Ae<0?Ne-Di:Ne+_e.width+Di,Ne!==_e.x&&Math.sign(Ne-_e.x)===Ae&&le.set(_e.id,Ne-_e.x)}}const be=new Map,Ze=ve=>be.get(ve)===ve||!be.get(ve)?ve:Ze(be.get(ve));for(const ve of J)be.set(ve.id,ve.id);for(const ve of x){const ce=le.has(ve.flow.source)?ve.flow.source:void 0,_e=le.has(ve.flow.target)?ve.flow.target:void 0;if(!ce||!_e)continue;const Ne=p(ve.flow.id);((m1=Ne==null?void 0:Ne.waypoints)==null?void 0:m1.length)===2&&be.set(Ze(ce),Ze(_e))}const Qe=new Map;for(const ve of J){if(!le.has(ve.id))continue;const ce=Ze(ve.id);Qe.set(ce,[...Qe.get(ce)??[],ve])}const Ot=[...Qe.values()].sort((ve,ce)=>Ae<0?Math.min(...ve.map(_e=>_e.x))-Math.min(...ce.map(_e=>_e.x)):Math.max(...ce.map(_e=>_e.x))-Math.max(...ve.map(_e=>_e.x))),Ft=[];let xe=!0;for(const ve of Ot){const ce=ve.map(Ie=>le.get(Ie.id)??0).reduce((Ie,Ee)=>Math.abs(Ee)>Math.abs(Ie)?Ee:Ie,0),_e=new Map;let Ne=!0;for(const Ie of ve){const Ee=d(Ie);if(!Ee){Ne=!1;break}_e.has(Ee.id)||_e.set(Ee.id,{subtree:[],pool:Ee}),_e.get(Ee.id).subtree.push(Ie)}Ne&&Fo([..._e.values()],ce,()=>!0,Wa)?Ft.push({shapes:ve,dx:ce}):xe=!1}if(!xe)for(const ve of Ft.reverse())n.moveElements(ve.shapes,{x:-ve.dx,y:0})}}}{const b=new Set([...S.map(R=>R.group.id),...en(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(b.has(R.id))continue;const T=(((g1=R.businessObject.extensionElements)==null?void 0:g1.values)??[]).find(F=>F.$type==="bwl:Members"),D=((T==null?void 0:T.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!D.length||!D.some(F=>{const I=g.get(F.id);return!I||I.x!==F.x||I.y!==F.y})||!D.some(F=>F.x<R.x||F.y<R.y||F.x+F.width>R.x+R.width||F.y+F.height>R.y+R.height)||n.resizeShape(R,lm(D,R.id))}}{const R=new Map(vo(Ue(o)).map(F=>[F.owner,F.rect])),A=o.filter(F=>!!F.waypoints),T=new Map,D=(F,I)=>{!F||!I||(T.has(F)||T.set(F,new Set),T.get(F).add(I))};for(const F of A){const I=(y1=F.source)==null?void 0:y1.id,U=(v1=F.target)==null?void 0:v1.id;D(I,U),((b1=F.type)!=null&&b1.includes("DataOutputAssociation")||(x1=F.type)!=null&&x1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&D(U,I)}const O=F=>_.filter(I=>I.flow.target===F).length,j=F=>{var U;const I=((U=p(F))==null?void 0:U.type)??"";if(I==="bpmn:StartEvent"&&O(F)===0)return!1;if(I.endsWith("Gateway")){const K=_.filter(re=>re.flow.target===F).map(re=>re.flow.source);if(K.length&&K.every(re=>{var ee;return((ee=p(re))==null?void 0:ee.type)==="bpmn:StartEvent"&&O(re)===0}))return!1}return!0};for(const F of o.filter(I=>I.type==="bpmn:Group")){const U=(((_1=F.businessObject.extensionElements)==null?void 0:_1.values)??[]).find(ce=>ce.$type==="bwl:Members"),K=((U==null?void 0:U.refs)??"").split(" ").filter(Boolean);if(!K.length)continue;const re=K.map(p).filter(ce=>!!ce);if(!re.length||!(S.some(ce=>ce.group.id===F.id)||en(e,"group.update").some(ce=>ce.id===F.id)||re.some(ce=>{const _e=g.get(ce.id);return!_e||_e.x!==ce.x||_e.y!==ce.y})))continue;const he=new Set(K),fe=[...K];for(;fe.length;){const ce=fe.shift();for(const _e of T.get(ce)??[])he.has(_e)||(he.add(_e),fe.push(_e))}const ye=F.x,Ye=F.x+F.width,Ae=F.y,J=F.y+F.height,se=ce=>{const _e=R.get(ce.id),Ne={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return _e?[Ne,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[Ne]},le=re.flatMap(se),be=Math.min(...le.map(ce=>ce.x)),Ze=Math.max(...le.map(ce=>ce.x+ce.width)),Qe=Math.min(...le.map(ce=>ce.y)),Ot=Math.max(...le.map(ce=>ce.y+ce.height)),Ft={L:be-ye,R:Ye-Ze,T:Qe-Ae,B:J-Ot},xe=o.filter(ce=>Fi(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!he.has(ce.id)&&j(ce.id)&&ce.x<Ye&&ce.x+ce.width>ye&&ce.y<J&&ce.y+ce.height>Ae);if(!xe.length)continue;const ve={L:0,R:0,T:0,B:0};for(const ce of xe){const _e=se(ce),Ne=Math.min(..._e.map(nt=>nt.x)),Ie=Math.max(..._e.map(nt=>nt.x+nt.width)),Ee=Math.min(..._e.map(nt=>nt.y)),rt=Math.max(..._e.map(nt=>nt.y+nt.height)),lt={L:Ie-ye,R:Ye-Ne,T:rt-Ae,B:J-Ee},Jt=["L","R","T","B"].filter(nt=>lt[nt]<=Ft[nt]+.001);if(!Jt.length)continue;const ci=Jt.reduce((nt,zt)=>lt[zt]<lt[nt]?zt:nt,Jt[0]);ve[ci]=Math.max(ve[ci],Math.min(lt[ci]+10,Ft[ci]))}!ve.L&&!ve.R&&!ve.T&&!ve.B||n.resizeShape(F,{x:F.x+ve.L,y:F.y+ve.T,width:F.width-ve.L-ve.R,height:F.height-ve.T-ve.B})}}const ZE=b=>{const R=b.waypoints;if(R!=null&&R.length){const T=R[Math.floor((R.length-1)/2)];return{x:T.x,y:T.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let uc=0;const QE=12,JE=14,r5=15,o5=300,a5=b=>{const R=b.split(`
7
- `),A=Math.max(...R.map(O=>na(O,QE))),T=Math.max(100,Math.min(o5,Math.ceil(A)+JE)),D=R.reduce((O,j)=>O+Math.max(1,Math.ceil((na(j,QE)+JE)/T)),0);return{width:T,height:Math.max(30,D*r5+10)}};for(const b of E){const R=b.association,A=((w1=b.placement)==null?void 0:w1.anchor)??(R?R.source===b.annotation.id?R.target:R.source:void 0),T=A?p(A):void 0,D=T?ZE(T):void 0,O=a5(b.annotation.text??"");let j;if(D&&b.placement){const[K,re]=jc[b.placement.side],ee=b.placement.offset??50;j={x:D.x+D.width/2+K*(D.width/2+O.width/2+ee),y:D.y+D.height/2+re*(D.height/2+O.height/2+ee)}}else D?(j={x:D.x+D.width/2+180+uc%3*260,y:D.y-110-uc%2*95},uc++):(j={x:300+uc*260,y:60},uc++);const F=T?d(T)??u():u(),I=F;D&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(j=zc(o,D,O,I,b.placement?{placement:b.placement}:{from:j}));const U=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},j,F);if(R){const K=re=>re===b.annotation.id?U:f(re);n.connect(K(R.source),K(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}b.placement&&k(U,"bwl:Placement",$(b.placement))}for(const b of en(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"})}const e1=()=>new Set(o.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of en(e,"node.update")){let R=f(b.id);if(b.type&&Fc(b.type)!==R.type){const A=R.x+R.width/2,T=R.y+R.height/2,D=e1();R=c.replaceElement(R,{type:Fc(b.type),...b.eventDefinition?{eventDefinitionType:mc[b.eventDefinition]}:{}});const O=e1(),j=[...D].filter(U=>U!==b.id&&!O.has(U));if(j.length)throw new qg({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:j});const F=Math.round(A-(R.x+R.width/2)),I=Math.round(T-(R.y+R.height/2));if(F!==0||I!==0){n.moveShape(R,{x:F,y:I});for(const U of[...R.incoming??[],...R.outgoing??[]])dt(U)}}if(b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(R,{"bwl:band":b.band});const A=R.y+R.height/2,T=d(R),D=b.lane?f(b.lane):((T==null?void 0:T.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);b.band!==void 0&&mt(D==null?void 0:D.id,b.band,T);const O=D?D.y+(b.band===void 0?D.height/2:Math.min(D.height/2,oe)+C(D.id,b.band)*L):b.band!==void 0&&T?T.y+X+C(`pool:${T.id}`,b.band)*L:void 0;if(O!==void 0){const j=O-A;j!==0&&n.moveElements([R],{x:0,y:j})}}}for(const b of en(e,"sequenceFlow.update")){const R=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=R,T=b.source!==void 0?f(b.source):A.source,D=b.target!==void 0?f(b.target):A.target,O=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(A,T,D,[O(T),O(D)]);const j=NE.get(A.id),F=D.y+D.height/2;if(j&&D.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:D.x,y:F}]);const I=A.label;if(I&&j.label){const K=Math.abs(j.label.y+I.height/2-j.channelY)<=L/5&&j.label.x+I.width>j.exit.x,re=j.exit.x+6,ee=D.x-6-I.width,he=K?ee>=re?{x:Math.max(re,Math.min(j.label.x,ee)),y:j.label.y+(F-j.channelY)}:void 0:j.label;he&&(he.x!==I.x||he.y!==I.y)&&n.moveElements([I],{x:he.x-I.x,y:he.y-I.y})}}else Math.abs(F-(T.y+T.height/2))>1&&dt(A)}b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(R,{name:((E1=b.condition)==null?void 0:E1.label)??void 0})}for(const b of en(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"annotation.update")){const R=f(b.id);if(b.text!==void 0&&n.updateProperties(R,{text:b.text}),b.placement===null)k(R,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),T=ZE(A),D=d(A)??u(),O=typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant",[j,F]=jc[b.placement.side],I=b.placement.offset??50,U={x:T.x+T.width/2+j*(T.width/2+R.width/2+I),y:T.y+T.height/2+F*(T.height/2+R.height/2+I)},K=O?zc(o,T,{width:R.width,height:R.height},D,{placement:b.placement,selfId:b.id}):U;n.moveElements([R],{x:K.x-(R.x+R.width/2),y:K.y-(R.y+R.height/2)}),k(R,"bwl:Placement",$(b.placement))}}for(const b of en(e,"group.update")){const R=f(b.id);if(b.name!==void 0&&n.updateLabel(R,b.name??""),b.members){const A=b.members.map(p).filter(T=>!!T);A.length&&n.resizeShape(R,lm(A,b.id)),k(R,"bwl:Members",{refs:b.members.join(" ")})}}}function Zp(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 EC(e,t,n){var u,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>ht(f).filter(d=>!t.has(pt(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ue(i),c=o(s),l=[...new Set(c.flatMap(Zp))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const te=d.x+d.width/2,Ge=d.y+d.height/2;h=i.getAll().find(qe=>{if(qe.type!=="bpmn:Participant")return!1;const Ve=qe;return typeof Ve.x=="number"&&typeof Ve.width=="number"&&te>=Ve.x&&te<=Ve.x+Ve.width&&Ge>=Ve.y&&Ge<=Ve.y+Ve.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(te=>te.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(te=>te.type==="bpmn:Association"),m=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!m)continue;const v=m.waypoints,E=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:m.x,y:m.y,width:m.width,height:m.height},S={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},k=_==null?void 0:_.side,$=Ug(i,E,h),N=[];if(k&&k in jc&&N.push(zc(i,E,S,h,{placement:{side:k,offset:(_==null?void 0:_.offset)??null},selfId:f})),$&&!Hc(P,S,$))for(const te of wC)N.push(zc(i,E,S,h,{placement:{side:te,offset:null},selfId:f}));for(const[te,Ge]of[[-1,0],[1,0],[0,-1],[0,1]])for(let qe=1;qe<=_C;qe++)N.push({x:P.x+te*Wg*qe,y:P.y+Ge*Wg*qe});const L={...s,edges:s.edges.filter(te=>te.id!==(x==null?void 0:x.id))},z=o(L),X=z.filter(te=>Zp(te).includes(f)).length;if(!X)continue;let oe;for(const te of N){const Ge=te.x-P.x,qe=te.y-P.y;if(!Ge&&!qe||te.x-S.width/2<h.x||te.x+S.width/2>h.x+h.width||te.y-S.height/2<h.y||te.y+S.height/2>h.y+h.height||$&&!Hc(te,S,$))continue;const Ve={...L,shapes:L.shapes.map(W=>W.id===f?{...W,x:W.x+Ge,y:W.y+qe}:W)},Re=o(Ve),Z=Re.filter(W=>Zp(W).includes(f)).length;if(Z>=X||Re.length>z.length)continue;const ie=Math.abs(Ge)+Math.abs(qe);if((!oe||Z<oe.mine||Z===oe.mine&&(Re.length<oe.all||Re.length===oe.all&&ie<oe.dist))&&(oe={x:te.x,y:te.y,mine:Z,all:Re.length,dist:ie}),oe.mine===0&&oe.all<z.length)break}oe&&r.moveElements([d],{x:oe.x-P.x,y:oe.y-P.y})}}const SC=60;function Qp(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function RC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>ht(u).filter(p=>!t.has(pt(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const _ of n.shapes)_.type!=="bpmn:Group"||f.has(_.id)||[...d].some(x=>{const m=s.get(x);return m&&c(_,m)})&&(f.add(_.id),y=!0);for(const _ of n.shapes)_.type!=="bpmn:Participant"||d.has(_.id)||[...f].some(x=>{const m=s.get(x);return m&&c(m,_)})&&(d.add(_.id),y=!0);if(!y)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(y=>{const _=s.get(y);return _&&c(_,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Ue(i),f=o(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[E,S]=v.pools,P=g.get(E),k=g.get(S);if(!P||!k)continue;const[$,N]=P.x<=k.x?[P,k]:[k,P];if(v.contained)continue;const L=s.get($.id),z=s.get(N.id),X=L&&z?Math.max(z.x-(L.x+L.width),0):SC,oe=$.x+$.width+X-N.x;if(oe<=0)continue;const te=l(N.id).filter(Ge=>i.get(Ge));te.length&&(!h||oe>h.dx)&&(h={movers:te,dx:oe})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const _=f.length,x=d.length;r.moveElements(y,{x:h.dx,y:0});const m=o(Ue(i));if(!(a(m).length<x&&m.length<=_)){r.moveElements(y,{x:-h.dx,y:0});return}}}const Gc=.5,Kg=150;function CC(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(m=>m.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(m=>m.x+m.width),a=Math.max(...o);if(a-Math.min(...o)>Gc)return;const s=r.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(s.length<2)return;const c=new Map(r.map(m=>[m.id,m.x]));if(s.some(m=>Math.abs(m.x-c.get(m.id))>Gc))return;const l=s.map(m=>m.x+m.width);if(Math.max(...l)-Math.min(...l)<=Gc)return;const u=m=>m.x+m.width,p=m=>!!m&&typeof m.width=="number",f=m=>{const v={shapes:[],edges:[],lanes:[]},E=S=>{for(const P of S.children??[]){if("waypoints"in P&&P.waypoints){v.edges.push(P);continue}P.type!=="label"&&(P.type==="bpmn:Lane"?v.lanes.push(P):v.shapes.push(P),E(P))}};return E(m),v},d=new Map(s.map(m=>[m.id,f(m)]));let g=a;for(const m of s){const{shapes:v}=d.get(m.id),E=v.flatMap(S=>[u(S),...p(S.label)?[u(S.label)]:[]]);E.length&&(g=Math.max(g,Math.max(...E)+Kg))}const h=s.filter(m=>Math.abs(u(m)-g)>Gc);if(!h.length)return;for(const m of h){const v=u(m),{shapes:E,edges:S,lanes:P}=d.get(m.id);if([...E.flatMap(N=>[u(N),...p(N.label)?[u(N.label)]:[]]),...S.flatMap(N=>[...N.waypoints.map(L=>L.x),...p(N.label)?[u(N.label)]:[]])].some(N=>N>g)||[...(m.incoming??[]).map(N=>N.waypoints[N.waypoints.length-1]),...(m.outgoing??[]).map(N=>N.waypoints[0])].some(N=>!N||N.x>g||Math.abs(N.x-v)<1))return;if(g>v){const N={x:v,y:m.y,width:g-v,height:m.height},L=new Set([m.id,...E.map(X=>X.id),...S.map(X=>X.id),...P.map(X=>X.id)]);if(n.getAll().some(X=>{var Ge;if("waypoints"in X&&X.waypoints||X.type==="bpmn:Group"||!p(X))return!1;const oe=X.type==="label"?(Ge=X.labelTarget)==null?void 0:Ge.id:X.id;if(!oe||L.has(oe)||L.has(X.id))return!1;const te=X;return te.x<N.x+N.width&&te.x+te.width>N.x&&te.y<N.y+N.height&&te.y+te.height>N.y}))return}}const y=()=>new Set(ht(Ue(n)).map(pt)),_=y(),x=h.map(m=>m.width);for(const m of h)Qp(i,m,g-m.x,{layout:!1});[...y()].every(m=>_.has(m))||h.forEach((m,v)=>Qp(i,m,x[v],{layout:!1}))}function MC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>ht(l).filter(u=>!t.has(pt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(S=>S.id!==l.id&&S.type!=="bpmn:Group"&&a(l,S));if(!p.length)continue;const f=p.map(S=>i.get(S.id)).filter(S=>!!S&&typeof S.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),y=g.t+(l.y-d.t),_=g.r+(l.x+l.width-d.r),x=g.b+(l.y+l.height-d.b),m={x:h,y,width:_-h,height:x-y};if(m.width<=0||m.height<=0||Math.abs(m.x-u.x)<1&&Math.abs(m.y-u.y)<1&&Math.abs(m.width-u.width)<1&&Math.abs(m.height-u.height)<1)continue;const v=o(Ue(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,m),o(Ue(i)).length>v&&r.resizeShape(u,E)}}const Vc=20,Wc=10;function AC(e,t,n,i){var p,f;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(ht(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(pt)),s=Ue(r),c=ht(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(pt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const x=h.members.map(Te=>r.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!x.length)continue;const m=Math.min(...x.map(Te=>Te.x)),v=Math.min(...x.map(Te=>Te.y)),E=Math.max(...x.map(Te=>Te.x+Te.width)),S=Math.max(...x.map(Te=>Te.y+Te.height)),P=h.x,k=h.y,$=h.x+h.width,N=h.y+h.height;let L=P,z=k,X=$,oe=N;for(const Te of g){const B=s.edges.find(w=>w.id===Te.edge);if(!B)continue;const C=B.endpoints.some(w=>{const G=s.shapes.find(Me=>Me.id===w);if(!G||G.container)return!1;const q=G.x+G.width/2,ne=G.y+G.height/2;return P<q&&q<$&&k<ne&&ne<N});for(const w of vn(B)){const G=w.axis==="v"?[k,N]:[P,$];Math.min(w.hi,G[1])-Math.max(w.lo,G[0])<Bp||(w.axis==="v"?P<w.at&&w.at<$:k<w.at&&w.at<N)&&C||(w.axis==="v"?(Math.abs(w.at-P)<=ia&&(L=Math.max(L,w.at+Vc)),Math.abs(w.at-$)<=ia&&(X=Math.min(X,w.at-Vc))):(Math.abs(w.at-k)<=ia&&(z=Math.max(z,w.at+Vc)),Math.abs(w.at-N)<=ia&&(oe=Math.min(oe,w.at-Vc))))}}if(L>m-Wc&&(L=P),z>v-Wc&&(z=k),X<E+Wc&&(X=$),oe<S+Wc&&(oe=N),L===P&&z===k&&X===$&&oe===N)continue;const te=r.get(d),Ge={x:te.x,y:te.y,width:te.width,height:te.height},qe=Ue(r),Ve=new Set(ht(qe).map(pt)),Re=a(qe);o.resizeShape(te,{x:L,y:z,width:X-L,height:oe-z});let Z=Ue(r),ie=ht(Z).filter(Te=>!Ve.has(pt(Te)));const W=[];if(ie.length>0&&ie.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&Z.edges.some(B=>B.id===Te.edge))){for(const Te of ie){if(Te.kind!=="label-over-line")continue;const B=Z.edges.find(ne=>ne.id===Te.edge),C=B&&Yp(B,Z),w=(f=r.get(Te.edge))==null?void 0:f.label;if(!C||!w)continue;const G=C.x-w.x,q=C.y-w.y;o.moveElements([w],{x:G,y:q}),W.push({label:w,dx:G,dy:q})}Z=Ue(r),ie=ht(Z).filter(Te=>!Ve.has(pt(Te)))}const ae=a(Z),me=[...ae].some(Te=>!Re.has(Te));if(ie.length||me||ae.size>=Re.size){for(const Te of W.reverse())o.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});o.resizeShape(te,Ge)}}}function PC(e,t,n,i){var c;const r=n.getRootElement().businessObject,o=mp((r==null?void 0:r.$parent)??r),a=Ka(i),s=new Map;for(const l of e.keys()){const u=(c=t.get(l))==null?void 0:c.businessObject;s.set(l,u?{texts:gp(u,i,o),requests:xp(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...o?{rootLang:o}:{},before:s.get(l)}]:[]})}}function Xg(e,t,n={}){var $,N;const{i18n:i,lower:r=Yg}=n,o=Gg(e),a=fg(o.elementRegistry),s=zg(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=gC(t,a,i),u=i&&l.writes.size?PC(l.writes,o.elementRegistry,o.canvas,i):void 0,p=Ue(o.elementRegistry),f=new Set(ht(p).map(pt)),d=new Set(ht(p,{includeObservationOnly:!0}).map(pt)),g=new Set(p.edges.map(L=>L.id)),h=new Set(t.flatMap(L=>L.kind==="sequenceFlow.update"&&(L.source!==void 0||L.target!==void 0)?[L.id]:[])),y=new Set(p.shapes.map(L=>L.id)),_=Oc(p),x=_.length,m=new Set(_.map(([L,z])=>`${L}|${z}`)),v=new Map;for(const L of o.elementRegistry.filter(z=>"waypoints"in z&&!!z.waypoints))L.label&&v.set(L.id,{wps:L.waypoints.map(z=>({x:z.x,y:z.y})),label:{x:L.label.x,y:L.label.y},source:($=L.source)==null?void 0:$.id,target:(N=L.target)==null?void 0:N.id});const E=e.get("commandStack");try{ym(E,()=>{r(l.ops,o);for(const z of(u==null?void 0:u.contexts())??[])E.execute(vp,z);RC(o,f,p),CC(o,p),MC(o,f,p),bg(o,g);const L=Vp(o,f);gg(o,m,g),Pg(o,f,g),wg(o,g),oC(o,g,h),Rg(o,f,g),lC(o,f,g),Ig(o,f,g),Lg(o,g,h),Ng(o,y),EC(o,f,y),Vp(o,f,L),AC(o,d,p,g),$g(o,f),Dg(o,v)})}catch(L){return{ok:!1,issues:[L instanceof qg?L.issue:{kind:"lower-failed",message:L instanceof Error?L.message:String(L)}],findings:[],stats:c}}const S=Ue(o.elementRegistry),P=ht(S,{includeObservationOnly:!0}).filter(L=>!d.has(pt(L))),k=ng(S);return{ok:!0,issues:[],findings:P,stats:{edgeCrossings:{before:x,after:k.pairs.length,pairs:k.pairs,solidPairs:k.solidPairs,dashedPairs:k.dashedPairs,mixedPairs:k.mixedPairs,crossPoolMessages:k.crossPoolMessages}}}}function TC(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Zg(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Qg(e,t){const n=Zg(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Jg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function kC(e){return typeof e=="string"&&up.includes(e)}function Ii(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function ey(e,t={}){const n=e.rootElements??[],i=n.find(Z=>Z.$type==="bpmn:Collaboration"),r=new Map(n.filter(Z=>Z.$type==="bpmn:Process").map(Z=>[Z.id,Z])),o=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],y=[],_=[],x=[],m=new Map,v=new Set,E=new Set,S=Z=>{Z&&v.add(Z)},P=Z=>{v.add(Z),E.add(Z)},k=Z=>{const ie=Jg(Z,"bwl:Placement");if(!ie)return;const W=typeof ie.anchor=="string"?ie.anchor:void 0;if(!W||!kC(ie.side))return;const Y=typeof ie.offset=="number"?ie.offset:void 0;y.push({owner:Z.id,anchor:W,side:ie.side,...Y!==void 0?{offset:Y}:{}})},$=Z=>{const ie=Jg(Z,"bwl:Members"),W=typeof(ie==null?void 0:ie.refs)=="string"?ie.refs.split(/\s+/).filter(Boolean):[];W.length&&x.push({owner:Z.id,refs:W})},N=Z=>{var ie;for(const W of Z)switch(S(W.id),W.$type){case"bpmn:TextAnnotation":P(W.id),m.set(W.id,W),c.push({id:W.id,text:typeof W.text=="string"?W.text:""}),k(W);break;case"bpmn:Association":g.push({id:W.id,type:W.$type,source:Ii(W.sourceRef),target:Ii(W.targetRef)});break;case"bpmn:Group":{P(W.id),m.set(W.id,W);const Y=(ie=W.categoryValueRef)==null?void 0:ie.value;l.push({id:W.id,...typeof Y=="string"&&Y?{name:Y}:{}}),$(W);break}default:u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"})}},L=Z=>{for(const ie of Z.flowElements??[])S(ie.id),u.push({id:ie.id,type:ie.$type,reason:"inside-container"}),(ie.flowElements??[]).length&&L(ie);for(const ie of Z.artifacts??[])S(ie.id),u.push({id:ie.id,type:ie.$type,reason:"inside-container"})},z=(Z,ie)=>{const W=Z.flowElements??[],Y=(Z.laneSets??[]).flatMap(me=>me.lanes??[]),ae=new Map;for(const me of Y){S(me.id),m.set(me.id,me);for(const Te of me.flowNodeRef??[]){const B=Ii(Te);B&&ae.set(B,me.id)}}for(const me of W){if(S(me.id),m.set(me.id,me),me.$type==="bpmn:SequenceFlow"){f.push({id:me.id,source:Ii(me.sourceRef),target:Ii(me.targetRef),...typeof me.name=="string"&&me.name?{name:me.name}:{}});continue}if(me.$type==="bpmn:DataStoreReference"){P(me.id),s.push({id:me.id,...me.name?{name:me.name}:{}});continue}const Te=TC(me.$type),B=Te==="intermediateCatchEvent"?cp((me.eventDefinitions??[]).map(q=>q.$type)):void 0;if(!pm(Te)||Te==="intermediateCatchEvent"&&!B){u.push({id:me.id,type:me.$type,reason:"type-outside-mvp"});continue}P(me.id);const C=Te==="boundaryEvent"?Ii(me.attachedToRef):void 0;a.push({id:me.id,type:Te,...me.name?{name:me.name}:{},...ie?{participant:ie}:{},...ae.has(me.id)?{lane:ae.get(me.id)}:{},...C?{attachedTo:C}:{},...B?{eventDefinition:B}:{}}),Te==="subProcess"&&L(me);const w=Qg(me,"bwl:band");w!==void 0&&(p.bands[me.id]=w);const G=Zg(me,"bwl:afterColumn");typeof G=="string"&&G!==""&&_.push([me.id,G]);for(const q of me.dataOutputAssociations??[])S(q.id),h.push({id:q.id,type:q.$type,source:me.id,target:Ii(q.targetRef)});for(const q of me.dataInputAssociations??[])S(q.id),h.push({id:q.id,type:q.$type,source:Ii((q.sourceRef??[])[0]),target:me.id})}N(Z.artifacts??[])};if(i){const Z=new Set;for(const ie of i.participants??[]){P(ie.id),m.set(ie.id,ie);const W=Ii(ie.processRef);W&&Z.add(W);const Y=W?r.get(W):void 0,ae=((Y==null?void 0:Y.laneSets)??[]).flatMap(C=>C.lanes??[]),me=ae.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of me)P(C.id);const Te=!Y||(Y.flowElements??[]).length===0&&ae.length===0&&(Y.artifacts??[]).length===0;o.push({id:ie.id,...ie.name?{name:ie.name}:{},...Te?{blackBox:!0}:{},...me.length?{lanes:me}:{}});const B=Qg(ie,"bwl:poolOrder");B!==void 0&&(p.poolOrders[ie.id]=B),Y&&z(Y,ie.id)}for(const ie of i.messageFlows??[])S(ie.id),m.set(ie.id,ie),d.push({id:ie.id,source:Ii(ie.sourceRef),target:Ii(ie.targetRef),...typeof ie.name=="string"&&ie.name?{name:ie.name}:{}});N(i.artifacts??[]);for(const[ie,W]of r)!Z.has(ie)&&(W.flowElements??[]).length>0&&u.push({id:ie,type:W.$type,reason:"unreachable-process"})}else for(const Z of r.values())z(Z);const X=[],oe=[],te=[],Ge=[],qe=(Z,ie)=>!!Z&&!!ie&&E.has(Z)&&E.has(ie);for(const Z of f){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}X.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),E.add(Z.id)}for(const Z of d){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}oe.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),E.add(Z.id)}for(const Z of h){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}Ge.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target}),Z.id&&E.add(Z.id)}for(const Z of g){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}te.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target})}const Ve=new Map(l.map(Z=>[Z.id,Z]));for(const{owner:Z,refs:ie}of x){const W=ie.filter(ae=>v.has(ae)),Y=Ve.get(Z);Y&&W.length&&(Y.members=W)}for(const Z of y)v.has(Z.anchor)&&(p.placements[Z.owner]={anchor:Z.anchor,side:Z.side,...Z.offset!==void 0?{offset:Z.offset}:{}});for(const[Z,ie]of _)v.has(ie)&&(p.afterColumns[Z]=ie);const Re={...o.length?{participants:o}:{},nodes:a,sequenceFlows:X,...oe.length?{messageFlows:oe}:{},...s.length?{dataStores:s}:{},...Ge.length?{dataAssociations:Ge}:{},...c.length?{annotations:c}:{},...te.length?{associations:te}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Re,hints:p,omitted:u,i18n:OC(Re,m,e,t.i18n)}:{definition:Re,hints:p,omitted:u}}function OC(e,t,n,i){const r=mp(n),o=Ka(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=gp(u,i,r);Object.keys(p).length&&(c[l]=p);for(const f of xp(u))o.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:o.slice(1),reviewRequests:a}}async function DC(e,t={}){const{definitions:n,warnings:i}=await ea(e);return{...ey(n,t),warnings:i}}const LC=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Jp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function IC(e){return Jp(e.processRef)!==void 0}function BC(e){const t=new Set,n=r=>{const o=Jp(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function NC(e){const t=[],n=i=>{for(const r of i.flowElements??[])LC.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function $C(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function ef(e){const t=[],n=e.rootElements??[],i=BC(e);for(const o of NC(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])IC(s)&&$C(o.get(Jp(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function FC(e){const{definitions:t,warnings:n}=await ea(e);return{issues:ef(t),warnings:n}}const jC=.5,HC=8,zC=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),la=e=>typeof e=="number"?e:Number(e??NaN),Uc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function GC(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${Uc(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${Uc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Uc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function VC(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[la(s.x),la(s.y),la(s.width),la(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Uc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[la(f.x),la(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function ty(e){const t=VC(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!zC.has(s)&&n.set(c,{type:s,props:GC(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function ny(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function iy(e,t,n={}){const i=n.moveTolerance??jC,r=ty(e),o=ty(t),a=[],s=[],c=[];for(const[l,u]of o){const p=r.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||ny(p.geometry,u.geometry,i)||ny(p.label,u.label,n.labelTolerance??HC))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function WC(e,t,n={}){const[i,r]=await Promise.all([ea(e),ea(t)]);return{...iy(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function UC(e){return new Set([...e.added,...e.modified])}function qC(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function ry(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=Xg(e,t.ops,{i18n:i});if(!r.ok)return{status:"rejected",issues:r.issues};const{xml:o}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:o??"",findings:r.findings,stats:r.stats}}const YC=new Set(["lasso","lasso.selection","hand","hand.move"]),oy=1e4,KC="bwl-edit-locked",ay=new WeakMap;function XC(e){const t=ay.get(e);if(t)return t;const n=e.get("eventBus"),i=e.get("dragging",!1);let r=!1,o=!1;n.on("drag.init",oy,()=>{var s;if(r)return YC.has((s=i==null?void 0:i.context())==null?void 0:s.prefix)?void 0:!1}),n.on(["contextPad.open.allowed","contextPad.trigger","palette.trigger","element.dblclick"],oy,()=>r?!1:void 0);const a={get locked(){return r},set(s){var l,u,p;if(s===r)return;r=s,e.get("canvas").getContainer().classList.toggle(KC,s);const c=e.get("keyboard",!1);s?(i==null||i.cancel(),(l=e.get("contextPad",!1))==null||l.close(),(u=e.get("popupMenu",!1))==null||u.close(),(p=e.get("directEditing",!1))==null||p.complete(),o=!!(c!=null&&c.getBinding()),c==null||c.unbind()):o&&(c.bind(),o=!1)}};return ay.set(e,a),a}const ZC=Symbol("bpmn-editor"),tf={geometry:[],semantic:[]};function QC(){const e=ge.ref(!1),t=ge.ref(!0),n=ge.ref(!1),i=ge.shallowRef(tf),r=ge.shallowRef(void 0),o=ge.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=tf;return}const _=ht(Ue(c.get("elementRegistry")),{includeObservationOnly:!0}),x=c.getDefinitions();i.value={geometry:_,semantic:x?ef(x):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const _=u();if(!_||!a){o.value=void 0;return}const x=_.locales(),m={};for(const v of x)m[v]={untranslated:_.untranslatedCount(v),reviewRequested:_.reviewRequestedCount(v)};o.value={designLocale:a.designLocale,locales:x,displayLocale:_.getDisplayLocale()??a.designLocale,counts:m}}function f(){const _=u();_&&(_.configure(a),a&&s&&(s=_.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(_,x){XC(_).set(!x)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function y(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:r,i18n:o,configureI18n(_){a=_,f(),p()},setDisplayLocale(_){var m;s=_;const x=(m=u())==null?void 0:m.setDisplayLocale(_);x&&(s=x),p()},setChangeScope(_){r.value=_===void 0?void 0:new Set(_)},requestFocus(_){if(!c)return;const x=c.get("elementRegistry").get(_);x&&(c.get("canvas").scrollToElement(x,180),c.get("selection").select(x))},describeElement(_){const x=c==null?void 0:c.get("elementRegistry").get(_),m=x==null?void 0:x.businessObject;if(!m)return;const v=typeof m.name=="string"&&m.name.trim()!==""?m.name:m.text;return{name:typeof v=="string"&&v.trim()!==""?v.trim():void 0,type:typeof m.$type=="string"?m.$type:""}},attach(_){c&&this.detach(),c=_,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=tf,r.value=void 0,o.value=void 0},setEditable(_){t.value=_,c&&g(c,_)},async applyAgentBatch(_,x){const m=h();n.value=!0;try{const v=await ry(m,_,{currentVersion:x,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return v.status==="applied"&&(e.value=!1),v}finally{n.value=!1}},async importXml(_){const{warnings:x}=await h().importXML(_);return e.value=!1,r.value=void 0,l(),{warnings:Ip(x)}},async saveXml(){const{xml:_}=await h().saveXML({format:!0});return e.value=!1,_??""},undo:()=>{var _;return(_=y())==null?void 0:_.undo()},redo:()=>{var _;return(_=y())==null?void 0:_.redo()},canUndo:()=>{var _;return((_=y())==null?void 0:_.canUndo())??!1},canRedo:()=>{var _;return((_=y())==null?void 0:_.canRedo())??!1}}}const JC=new RegExp("\\p{Script=Hangul}","u"),eM=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,tM=new RegExp("\\p{Script=Han}","u");function nf(e){const t=JC.test(e),n=eM.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:tM.test(e)?"han":"other"}}function sy(e){var t,n;return((t=e==null?void 0:e.get)==null?void 0:t.call(e,"xml:lang"))??((n=e==null?void 0:e.$attrs)==null?void 0:n["xml:lang"])}function cy(e){var i;const t=new Set,n=[];for(const r of(e==null?void 0:e.diagrams)??[])for(const o of((i=r==null?void 0:r.plane)==null?void 0:i.planeElement)??[]){const a=o==null?void 0:o.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=ho(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Zo(a).filter(l=>Nn(l))})}return n}const rs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function nM(e){const t=sy(e),n=cy(e);let i;const r={},o=[],a=[],s=[];for(const g of n){const h=g.trs.filter(y=>(y.body??"")===g.name).map(Nn);if(h.length){const y=[...h].sort().join("+");r[y]=(r[y]??0)+1,i=i?new Set([...i].filter(_=>h.includes(_))):new Set(h)}else g.trs.some(y=>y.body)?o.push(rs(g)):s.push({e:g,inference:nf(g.name)});for(const y of g.trs){const _=Nn(y),x=y.body??"",m=nf(x);m.locale&&m.locale!==_?a.push({...rs(g),locale:_,script:m.script}):_==="ko"&&m.script==="han"&&g.trs.some(v=>v!==y&&v.body===x)&&a.push({...rs(g),locale:_,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...rs(g),locale:h.locale}):d.push({...rs(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:o,matchedBy:r,scriptMismatch:a}}function iM(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!sy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const r=new Map(cy(e).map(o=>[o.bo.id,o]));for(const{id:o,name:a,locale:s}of t.additions){const c=r.get(o);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>Nn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Xo,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ce(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function rM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rf={exports:{}},ly;function oM(){if(ly)return rf.exports;ly=1;var e=rf.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 l=parseInt(a,n);return l!==1/0&&l>=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},rf.exports}var aM=oM(),sM=rM(aM);function Ui(e){if(!(this instanceof Ui))return new Ui(e);e=e||[128,36,1],this._seed=e.length?sM.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 dn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};dn.td=dn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],dn.option=dn.optgroup=[1,'<select multiple="multiple">',"</select>"],dn.thead=dn.tbody=dn.colgroup=dn.caption=dn.tfoot=[1,"<table>","</table>"],dn.polyline=dn.ellipse=dn.polygon=dn.circle=dn.text=dn.line=dn.path=dn.rect=dn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Nt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[r,o,a]=Object.hasOwn(dn,i)?dn[i]:dn._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function cM(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 zn(e,...t){const n=e.style;return H(t,function(i){i&&H(i,function(r,o){n[o]=r})}),e}function En(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const lM=Object.prototype.toString;function St(e){return new Dr(e)}function Dr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Dr.prototype.add=function(e){return this.list.add(e),this},Dr.prototype.remove=function(e){return lM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Dr.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},Dr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Dr.prototype.array=function(){return Array.from(this.list)},Dr.prototype.has=Dr.prototype.contains=function(e){return this.list.contains(e)};function qc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function bo(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function uM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yc={},uy;function pM(){if(uy)return Yc;uy=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Yc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Yc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Yc}var py=pM(),fM=uM(py),Le=cM({__proto__:null,default:fM},[py]),fy=["focus","blur"];function dM(e,t,n,i,r){return fy.indexOf(n)!==-1&&(r=!0),Le.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=bo(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function hM(e,t,n,i){return fy.indexOf(t)!==-1&&(i=!0),Le.unbind(e,t,n,i)}var Jn={bind:dM,unbind:hM};function of(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function _t(e,t){return t=t||document,t.querySelector(e)}function os(e,t){return t=t||document,t.querySelectorAll(e)}function qi(e){e.parentNode&&e.parentNode.removeChild(e)}function mM(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function gM(e,t){return t.appendChild(mM(e,t))}function ze(e,t){return gM(t,e),e}var af=2,dy={"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":af,"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":af,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function yM(e,t){return dy[t]?e.style[t]:e.getAttributeNS(null,t)}function hy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=dy[i];r?(r===af&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function vM(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)hy(e,r,t[r])}function we(e,t,n){if(typeof t=="string")if(n!==void 0)hy(e,t,n);else return yM(e,t);else vM(e,t);return e}const bM=Object.prototype.toString;function at(e){return new Lr(e)}function Lr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Lr.prototype.add=function(e){return this.list.add(e),this},Lr.prototype.remove=function(e){return bM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Lr.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},Lr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Lr.prototype.array=function(){return Array.from(this.list)},Lr.prototype.has=Lr.prototype.contains=function(e){return this.list.contains(e)};function as(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function sf(e){return e.cloneNode(!0)}var cf={svg:"http://www.w3.org/2000/svg"},my='<svg xmlns="'+cf.svg+'"';function xM(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(cf.svg)===-1&&(e=my+e.substring(4)):(e=my+">"+e+"</svg>",t=!0);var n=_M(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function _M(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=xM(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(cf.svg,e),t&&we(n,t),n}var lf=null;function gy(){return lf===null&&(lf=Oe("svg")),lf}function yy(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function wM(e,t,n,i,r,o){var a=gy().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return yy(a,e);case 6:return yy(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function ss(e){return gy().createSVGTransform()}var vy=/([&<>]{1})/g,EM=/([&<>\n\r"]{1})/g,SM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function uf(e,t){function n(i,r){return SM[r]||r}return e.replace(t,n)}function by(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(uf(e.textContent,vy));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,'="',uf(o.value,EM),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)by(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",uf(e.nodeValue,vy),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function RM(e){for(var t=e.firstChild,n=[];t;)by(t,n),t=t.nextSibling;return n.join("")}function xy(e,t){return RM(e)}function rn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function CM(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function MM(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(CM(e,i))}function cs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),MM(n,t)),n.consolidate()}const AM=/^class[ {]/;function PM(e){return AM.test(e.toString())}function pf(e){return Array.isArray(e)}function ff(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Kc(...e){e.length===1&&pf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const TM=/constructor\s*[^(]*\(\s*([^)]*)\)/m,kM=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,OM=/\/\*([^*]*)\*\//m;function DM(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(PM(e)?TM:kM);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(OM);return(r&&r[1]||i).trim()})||[]}function _y(e,t){const n=t||{get:function(m,v){if(i.push(m),v===!1)return null;throw s(`No provider for "${m}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(m){const v=i.join(" -> ");return i.length=0,new Error(v?`${m} (Resolving: ${v})`:m)};function c(m,v){if(!r[m]&&m.includes(".")){const E=m.split(".");let S=c(E.shift());for(;E.length;)S=S[E.shift()];return S}if(ff(o,m))return o[m];if(ff(r,m)){if(i.indexOf(m)!==-1)throw i.push(m),s("Cannot resolve circular dependency!");return i.push(m),o[m]=r[m][0](r[m][1]),i.pop(),o[m]}return n.get(m,v)}function l(m,v){if(typeof v>"u"&&(v={}),typeof m!="function")if(pf(m))m=Kc(m.slice());else throw s(`Cannot invoke "${m}". Expected a function!`);const S=(m.$inject||DM(m)).map(P=>ff(v,P)?v[P]:c(P));return{fn:m,dependencies:S}}function u(m){const{fn:v,dependencies:E}=l(m),S=Function.prototype.bind.call(v,null,...E);return new S}function p(m,v,E){const{fn:S,dependencies:P}=l(m,E);return S.apply(v,P)}function f(m){return Kc(v=>m.get(v))}function d(m,v){if(v&&v.length){const E=Object.create(null),S=Object.create(null),P=[],k=[],$=[];let N,L,z,X;for(let oe in r)N=r[oe],v.indexOf(oe)!==-1&&(N[2]==="private"?(L=P.indexOf(N[3]),L===-1?(z=N[3].createChild([],v),X=f(z),P.push(N[3]),k.push(z),$.push(X),E[oe]=[X,oe,"private",z]):E[oe]=[$[L],oe,"private",k[L]]):E[oe]=[N[2],N[1]],S[oe]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&v.forEach(te=>{N[1].$scope.indexOf(te)!==-1&&(E[oe]=[N[2],N[1]],S[te]=!0)});v.forEach(oe=>{if(!S[oe])throw new Error('No provider for "'+oe+'". Cannot use provider from the parent!')}),m.unshift(E)}return new _y(m,a)}const g={factory:p,type:u,value:function(m){return m}};function h(m,v){const E=m.__init__||[];return function(){E.forEach(S=>{typeof S=="string"?v.get(S):v.invoke(S)})}}function y(m){const v=m.__exports__;if(v){const E=m.__modules__,S=Object.keys(m).reduce((L,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(L[z]=m[z]),L),Object.create(null)),P=(E||[]).concat(S),k=d(P),$=Kc(function(L){return k.get(L)});v.forEach(function(L){r[L]=[$,L,"private",k]});const N=(m.__init__||[]).slice();return N.unshift(function(){k.init()}),m=Object.assign({},m,{__init__:N}),h(m,k)}return Object.keys(m).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const S=m[E];if(S[2]==="private"){r[E]=S;return}const P=S[0],k=S[1];r[E]=[g[P],LM(P,k),P]}),h(m,a)}function _(m,v){return m.indexOf(v)!==-1||(m=(v.__depends__||[]).reduce(_,m),m.indexOf(v)!==-1)?m:m.concat(v)}function x(m){const v=m.reduce(_,[]).map(y);let E=!1;return function(){E||(E=!0,v.forEach(S=>S()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function LM(e,t){return e!=="value"&&pf(t)&&(t=Kc(t.slice())),t}var IM=1e3;function ur(e,t){var n=this;t=t||IM,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)})}ur.prototype.canRender=function(e){},ur.prototype.drawShape=function(e,t){},ur.prototype.drawConnection=function(e,t){},ur.prototype.getShapePath=function(e){},ur.prototype.getConnectionPath=function(e){};function xo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function BM(e){return["M",e.x,e.y]}function df(e){return["L",e.x,e.y]}function NM(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function $M(e,t){const n=e.length,i=[BM(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(df(a));continue}const c=Math.min(t,hf(a.x-o.x,a.y-o.y),hf(s.x-a.x,s.y-a.y));if(!c){i.push(df(a));continue}const l=Xc(a,o,c),u=Xc(a,o,c*.5),p=Xc(a,s,c),f=Xc(a,s,c*.5);i.push(df(l)),i.push(NM(u,f,p))}return i}function Xc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=hf(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function hf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ls(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),mf(i,e)}function mf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return we(e,{d:xo($M(t,n))}),e}function Zc(e){var t=new Set(e);return it(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function _o(e,t,n){n=n||0,$e(e)||(e=[e]),H(e,function(i,r){var o=t(i,r,n);$e(o)&&o.length&&_o(o,t,n+1)})}function gf(e,t,n){var i=new Set,r=new Set;return _o(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 us(e,t){return gf(e)}function FM(e,t,n){fo(t)&&(t=!0),fn(t)&&(n=t,t=!0),n=n||{};var i=ps(n.allShapes),r=ps(n.allConnections),o=ps(n.enclosedElements),a=ps(n.enclosedConnections),s=ps(n.topLevel,t&&Yo(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,H(u.incoming,c),H(u.outgoing,c),u.children}return _o(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function on(e,t){t=!!t,$e(e)||(e=[e]);var n,i,r,o;return H(e,function(a){var s=a;a.waypoints&&!t&&(s=on(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>r||r===void 0)&&(r=c+p),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function ua(e,t){var n={};return H(e,function(i){var r=i;r.waypoints&&(r=on(r)),!Fe(t.y)&&r.x>t.x&&(n[i.id]=i),!Fe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Fe(t.width)&&Fe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function wy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Ey(e){return!!(e&&e.isFrame)}function ps(e,t){return V({},e||{},t||{})}var jM=1;function Ir(e,t){ur.call(this,e,jM),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})}Ce(Ir,ur),Ir.prototype.canRender=function(){return!0},Ir.prototype.drawShape=function(t,n,i){var r=Oe("rect");return we(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Ey(n)?we(r,V({},this.FRAME_STYLE,i||{})):we(r,V({},this.SHAPE_STYLE,i||{})),ze(t,r),r},Ir.prototype.drawConnection=function(t,n,i){var r=ls(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return ze(t,r),r},Ir.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 xo(a)},Ir.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 xo(o)},Ir.$inject=["eventBus","styles"];function HM(){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 V(o,{class:n})},this.style=function(n,i){!$e(n)&&!i&&(i=n,n=[]);var r=Qn(n,function(o,a){return V(o,e[a]||{})},{});return i?V(r,i):r},this.computeStyle=function(n,i,r){return $e(i)||(r=i,i=[]),t.style(i||[],V({},r,n||{}))}}const zM={__init__:["defaultRenderer"],defaultRenderer:["type",Ir],styles:["type",HM]};function Zt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function tn(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 yf(e,t){return!e||!t?-1:e.indexOf(t)}function fs(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vf(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=fs(e,t);return Math.abs(r/o)<=i}var GM=2;function pr(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(VM(r,n))return o;return!1}function VM(e,t){const n=t[0];return Mr(t,function(i){return Math.abs(n[e]-i[e])<=GM})}function Sy(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 bf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var WM=/,?([a-z]),?/gi,Ry=parseFloat,an=Math,Br=an.PI,Yi=an.min,Ki=an.max,Cy=an.pow,Nr=an.abs,UM=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,qM=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,My=Array.isArray||function(e){return e instanceof Array};function YM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function KM(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 XM(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 YM(r,i)?(KM(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function ZM(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(UM,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(qM,function(c,l){l&&a.push(+l)}),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=_f,n}function QM(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 JM(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 xf(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 _f(){return this.join(",").replace(WM,"$1")}function eA(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=_f,t}function Ay(e,t,n,i,r,o,a,s,c){var l=1-c,u=Cy(l,3),p=Cy(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*r+d*a,h=u*t+p*3*c*i+l*3*c*c*o+d*s;return{x:Qc(g),y:Qc(h)}}function Py(e){var t=aA(...e);return xf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function $r(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function tA(e,t){return e=xf(e),t=xf(t),$r(t,e.x,e.y)||$r(t,e.x2,e.y)||$r(t,e.x,e.y2)||$r(t,e.x2,e.y2)||$r(e,t.x,t.y)||$r(e,t.x2,t.y)||$r(e,t.x,t.y2)||$r(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 Ty(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 ky(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<u;g++){var h=l*p[g]+l,y=Ty(h,e,n,r,a),_=Ty(h,t,i,o,s),x=y*y+_*_;d+=f[g]*an.sqrt(x)}return l*d}function nA(e,t,n,i,r,o,a,s){if(!(Ki(e,n)<Yi(r,a)||Yi(e,n)>Ki(r,a)||Ki(t,i)<Yi(o,s)||Yi(t,i)>Ki(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var p=Qc(c/u),f=Qc(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Yi(e,n).toFixed(2)||d>+Ki(e,n).toFixed(2)||d<+Yi(r,a).toFixed(2)||d>+Ki(r,a).toFixed(2)||g<+Yi(t,i).toFixed(2)||g>+Ki(t,i).toFixed(2)||g<+Yi(o,s).toFixed(2)||g>+Ki(o,s).toFixed(2)))return{x:p,y:f}}}}function Qc(e){return Math.round(e*1e11)/1e11}function iA(e,t,n){var i=Py(e),r=Py(t);if(!tA(i,r))return[];var o=ky(...e),a=ky(...t),s=Dy(e)?1:~~(o/5)||1,c=Dy(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=Ay(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=Ay(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var y=l[d],_=l[d+1],x=u[g],m=u[g+1],v=Nr(_.x-y.x)<.01?"y":"x",E=Nr(m.x-x.x)<.01?"y":"x",S=nA(y.x,y.y,_.x,_.y,x.x,x.y,m.x,m.y),P;if(S){if(P=S.x.toFixed(9)+"#"+S.y.toFixed(9),p[P])continue;p[P]=!0;var k=y.t+Nr((S[v]-y[v])/(_[v]-y[v]))*(_.t-y.t),$=x.t+Nr((S[E]-x[E])/(m[E]-x[E]))*(m.t-x.t);k>=0&&k<=1&&$>=0&&$<=1&&f.push({x:S.x,y:S.y,t1:k,t2:$})}}return f}function Oy(e,t,n){e=By(e),t=By(t);for(var i,r,o,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(p=[i,r,...y.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var _=0,x=t.length;_<x;_++){var m=t[_];if(m[0]=="M")o=l=m[1],a=u=m[2];else{m[0]=="C"?(f=[o,a,...m.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,l,u,l,u],o=l,a=u);var v=iA(p,f);{for(var E=0,S=v.length;E<S;E++)v[E].segment1=g,v[E].segment2=_,v[E].bez1=p,v[E].bez2=f;d=d.concat(v)}}}}}return d}function rA(e){return My(e)&&My(e[0])}function oA(e){if(QM(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,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=_f,t}function Dy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Jc(e,t,n,i){return[e,t,n,i,n,i]}function Ly(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 Iy(e,t,n,i,r,o,a,s,c,l){var u=Br*120/180,p=Br/180*(+r||0),f=[],d,g=XM(function(B,C,w){var G=B*an.cos(w)-C*an.sin(w),q=B*an.sin(w)+C*an.cos(w);return{x:G,y:q}});if(l)P=l[0],k=l[1],E=l[2],S=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,_=h*h/(n*n)+y*y/(i*i);_>1&&(_=an.sqrt(_),n=_*n,i=_*i);var x=n*n,m=i*i,v=(o==a?-1:1)*an.sqrt(Nr((x*m-x*y*y-m*h*h)/(x*y*y+m*h*h))),E=v*n*y/i+(e+s)/2,S=v*-i*h/n+(t+c)/2,P=an.asin(((t-S)/i).toFixed(9)),k=an.asin(((c-S)/i).toFixed(9));P=e<E?Br-P:P,k=s<E?Br-k:k,P<0&&(P=Br*2+P),k<0&&(k=Br*2+k),a&&P>k&&(P=P-Br*2),!a&&k>P&&(k=k-Br*2)}var $=k-P;if(Nr($)>u){var N=k,L=s,z=c;k=P+u*(a&&k>P?1:-1),s=E+n*an.cos(k),c=S+i*an.sin(k),f=Iy(s,c,n,i,r,0,a,L,z,[k,N,E,S])}$=k-P;var X=an.cos(P),oe=an.sin(P),te=an.cos(k),Ge=an.sin(k),qe=an.tan($/4),Ve=4/3*n*qe,Re=4/3*i*qe,Z=[e,t],ie=[e+Ve*oe,t-Re*X],W=[s+Ve*Ge,c-Re*te],Y=[s,c];if(ie[0]=2*Z[0]-ie[0],ie[1]=2*Z[1]-ie[1],l)return[ie,W,Y].concat(f);f=[ie,W,Y].concat(f).join().split(",");for(var ae=[],me=0,Te=f.length;me<Te;me++)ae[me]=me%2?g(f[me-1],f[me],p).y:g(f[me],f[me+1],p).x;return ae}function aA(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,y,_,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,f=3*i-3*t),Nr(u)<1e-12){if(Nr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}y=p*p-4*f*u,_=an.sqrt(y),!(y<0)&&(g=(-p+_)/(2*u),0<g&&g<1&&c.push(g),h=(-p-_)/(2*u),0<h&&h<1&&c.push(h))}for(var m=c.length,v=m,E;m--;)d=c[m],E=1-d,l[0][m]=E*E*E*e+3*E*E*d*n+3*E*d*d*r+d*d*d*a,l[1][m]=E*E*E*t+3*E*E*d*i+3*E*d*d*o+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Yi(...l[0]),y0:Yi(...l[1]),x1:Ki(...l[0]),y1:Ki(...l[1])}}function By(e){if(rA(e)||(e=ZM(e)),JM(e))return e;for(var t=eA(oA(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,y;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Iy(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),f=["C",h,y,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Ly(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Ly(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Jc(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Jc(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Jc(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Jc(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)o[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;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 u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Ry(u[p-4])||n.x,n.by=Ry(u[p-3])||n.y}return t}function At(e){return fn(e)&&Zn(e,"waypoints")}function Je(e){return fn(e)&&Zn(e,"labelTarget")}function sA(e){return fn(e)&&Uo(e.parent)}function Ny(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function fr(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function el(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function cA(e){return fr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function lA(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=fA(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.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 je(e){return At(e)?lA(e):cA(e)}function kn(e,t,n){n=n||0,fn(n)||(n={x:n,y:n});var i=Be(e),r=Be(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function ds(e,t,n){var i=uA(e,t);return i.length===1||i.length===2&&fs(i[0],i[1])<1?fr(i[0]):i.length>1?(i=Hi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),fr(i[n?0:i.length-1])):null}function uA(e,t){return Oy(e,t)}function pA(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],fs(n,r)===0||vf(i,r,n)?e.splice(t,1):t++;return e}function fA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function tl(e,t){return Math.round(e*t)/t}function $y(e){return Fe(e)?e+"px":e}function dA(e){for(;e.parent;)e=e.parent;return e}function hA(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),zn(n,{position:"relative",overflow:"hidden",width:$y(e.width),height:$y(e.height)}),t.appendChild(n),n}function Fy(e,t,n){const i=Oe("g");at(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const mA="base",jy=0,gA=1,yA={shape:["x","y","width","height"],connection:["waypoints"]};function He(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||{})}He.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],He.prototype._init=function(e){const t=this._eventBus,n=this._container=hA(e),i=this._svg=Oe("svg");we(i,{width:"100%",height:"100%"}),En(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")}),ze(n,i);const r=this._viewport=Fy(i,"viewport");e.deferUpdate&&(this._viewboxChanged=hp(this._viewboxChanged,300)),this._restoreFocus=hp(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)},He.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},He.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},He.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=wy(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},He.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},He.prototype.restoreFocus=function(){this._restoreFocus()},He.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},He.prototype.isFocused=function(){return this._focused},He.prototype.getDefaultLayer=function(){return this.getLayer(mA,jy)},He.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},He.prototype._getChildIndex=function(e){return Qn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},He.prototype._createLayer=function(e,t){typeof t>"u"&&(t=gA);const n=this._getChildIndex(t);return{group:Fy(this._viewport,"layer-"+e,n),index:t,visible:!0}},He.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},He.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&&(rn(n),t.visible=!1),n},He.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],rn(t.group))},He.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},He.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(dA(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},He.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},He.prototype._findPlaneForRoot=function(e){return kt(this._planes,function(t){return t.rootElement===e})},He.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},He.prototype._resolveElements=function(e){return $e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},He.prototype.getContainer=function(){return this._container},He.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&&(H([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),at(r).add(t)):(e.markers.delete(t),at(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},He.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},He.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},He.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},He.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},He.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},He.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,jy);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},He.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},He.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},He.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)},He.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})},He.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})},He.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=yA[e];if(!Mr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},He.prototype._setParent=function(e,t,n){tn(t.children,e,n),e.parent=t},He.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},He.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},He.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},He.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),Zt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},He.prototype.removeShape=function(e){return this._removeElement(e,"shape")},He.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},He.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},He.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},He.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},He.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,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);cs(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=cs(t),r=a?a.matrix:wM(),s=tl(r.a,1e3),c=tl(-r.e||0,1e3),l=tl(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/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},He.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Hy(t,n)}),{x:n.e,y:n.f}},He.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=on(o),s=Be(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Be(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),y=Math.max(0,s.bottom-f.bottom),_=Math.min(0,s.top-f.top);u=g||h,p=y||_}this.scroll({dx:-u*l,dy:-p*l})},He.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)}),tl(i.a,1e3)};function Hy(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}He.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},He.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=V(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),Hy(this._viewport,u),u},He.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},He.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}},He.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var pa="data-element-id";function mi(e){this._elements={},this._eventBus=e}mi.$inject=["eventBus"],mi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),we(t,pa,i),n&&we(n,pa,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},mi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(we(i.gfx,pa,""),i.secondaryGfx&&we(i.secondaryGfx,pa,""),delete t[n])},mi.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)},mi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&we(t,pa,i),t},mi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&we(e,pa);var n=this._elements[t];return n&&n.element},mi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},mi.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}},mi.prototype.getAll=function(){return this.filter(function(e){return e})},mi.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)})},mi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},mi.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 vA(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 bA(e){return e.__refs_collection===!0}function xA(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function zy(e,t,n){var i=vA(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 _A(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 xi(e,t){if(!(this instanceof xi))return new xi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}xi.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?zy(this,t,e):_A(this,t,e)},xi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return bA(n)||zy(this,t,e),n},xi.prototype.ensureBound=function(e,t){xA(e,t)||this.bind(e,t)},xi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},xi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var wf=new xi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Gy=new xi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Vy=new xi({name:"attachers",collection:!0},{name:"host"}),Wy=new xi({name:"outgoing",collection:!0},{name:"source"}),Uy=new xi({name:"incoming",collection:!0},{name:"target"});function fa(){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)}}),wf.bind(this,"parent"),Gy.bind(this,"labels"),Wy.bind(this,"outgoing"),Uy.bind(this,"incoming")}function hs(){fa.call(this),wf.bind(this,"children"),Vy.bind(this,"host"),Vy.bind(this,"attachers")}Ce(hs,fa);function qy(){fa.call(this),wf.bind(this,"children")}Ce(qy,hs);function Yy(){hs.call(this),Gy.bind(this,"labelTarget")}Ce(Yy,hs);function Ky(){fa.call(this),Wy.bind(this,"source"),Uy.bind(this,"target")}Ce(Ky,fa);var wA={connection:Ky,shape:hs,label:Yy,root:qy};function EA(e,t){var n=wA[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function SA(e){return e instanceof fa}function dr(){this._uid=12}dr.prototype.createRoot=function(e){return this.create("root",e)},dr.prototype.createLabel=function(e){return this.create("label",e)},dr.prototype.createShape=function(e){return this.create("shape",e)},dr.prototype.createConnection=function(e){return this.create("connection",e)},dr.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),EA(e,t)};var nl="__fn",Xy=1e3,RA=Array.prototype.slice;function ei(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ei.prototype.on=function(e,t,n,i){if(e=$e(e)?e:[e],yn(t)&&(i=n,n=t,t=Xy),!Fe(t))throw new Error("priority must be a number");var r=n;i&&(r=qn(n,i),r[nl]=n[nl]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},ei.prototype.once=function(e,t,n,i){var r=this;if(yn(t)&&(i=n,n=t,t=Xy),!Fe(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[nl]=n,this.on(e,t,o)},ei.prototype.off=function(e,t){e=$e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ei.prototype.createEvent=function(e){var t=new ms;return t.init(e),t},ei.prototype.fire=function(e,t){var n,i,r,o;if(o=RA.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 ms?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}},ei.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ei.prototype._destroy=function(){this._listeners={}},ei.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ei.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=CA(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},ei.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},ei.prototype._getListeners=function(e){return this._listeners[e]},ei.prototype._setListeners=function(e,t){this._listeners[e]=t},ei.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[nl]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ms(){}ms.prototype.stopPropagation=function(){this.cancelBubble=!0},ms.prototype.preventDefault=function(){this.defaultPrevented=!0},ms.prototype.init=function(e){V(this,e||{})};function CA(e,t){return e.apply(null,t)}function Fr(e){return e.childNodes[0]}function MA(e){return e.parentNode.childNodes[1]}function il(e,t,n,i,r){var o=ss();o.setTranslate(t,n);var a=ss();a.setRotate(i||0,0,0);var s=ss();s.setScale(1,1),cs(e,[o,a,s])}function On(e,t,n){var i=ss();i.setTranslate(t,n),cs(e,i)}function Zy(e,t){var n=ss();n.setRotate(t,0,0),cs(e,n)}function gi(e,t){this._eventBus=e,this._elementRegistry=t}gi.$inject=["eventBus","elementRegistry"],gi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=MA(t),n||(n=Oe("g"),at(n).add("djs-children"),ze(t.parentNode,n))):n=t,n},gi.prototype._clear=function(e){var t=Fr(e);return qc(t),t},gi.prototype._createContainer=function(e,t,n,i){var r=Oe("g");at(r).add("djs-group"),typeof n<"u"?AA(r,t,t.childNodes[n]):ze(t,r);var o=Oe("g");at(o).add("djs-element"),at(o).add("djs-"+e),i&&at(o).add("djs-frame"),ze(r,o);var a=Oe("g");return at(a).add("djs-visual"),ze(o,a),o},gi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Ey(t))},gi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Qn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),H(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;H(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},gi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},gi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},gi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},gi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},gi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),On(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?we(n,"display","none"):we(n,"display","block")}},gi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);rn(t.parentNode)};function AA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const PA={__depends__:[zM],__init__:["canvas"],canvas:["type",He],elementRegistry:["type",mi],elementFactory:["type",dr],eventBus:["type",ei],graphicsFactory:["type",gi]};function TA(e){var t=new _y(e);return t.init(),t}function kA(e){e=e||{};var t={config:["value",e]},n=[t,PA].concat(e.modules||[]);return TA(n)}function jr(e,t){this._injector=t||kA(e),this.get("eventBus").fire("diagram.init")}jr.prototype.get=function(e,t){return this._injector.get(e,t)},jr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},jr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},jr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Fn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Yn(e,t){return e.$instanceOf(t)}function OA(e){return kt(e.rootElements,function(t){return Yn(t,"bpmn:Process")||Yn(t,"bpmn:Collaboration")})}function DA(e){var t={},n=[],i={};function r(W,Y){return function(ae){W(ae,Y)}}function o(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var ae=W.gfx;if(ae)throw new Error(`already rendered ${Fn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function l(W,Y){try{var ae=i[W.id]&&s(W,Y);return o(W),ae}catch(me){u(me.message,{element:W,error:me}),console.error(`failed to import ${Fn(W)}`,me)}}function u(W,Y){e.error(W,Y)}var p=this.registerDi=function(Y){var ae=Y.bpmnElement;ae?i[ae.id]?u(`multiple DI elements defined for ${Fn(ae)}`,{element:ae}):i[ae.id]=Y:u(`no bpmnElement referenced in ${Fn(Y)}`,{element:Y})};function f(W){d(W.plane)}function d(W){p(W),H(W.planeElement,g)}function g(W){p(W)}this.handleDefinitions=function(Y,ae){var me=Y.diagrams;if(ae&&me.indexOf(ae)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ae&&me&&me.length&&(ae=me[0]),!ae)throw new Error("no diagram to display");i={},f(ae);var Te=ae.plane;if(!Te)throw new Error(`no plane for ${Fn(ae)}`);var B=Te.bpmnElement;if(!B)if(B=OA(Y),B)u(`correcting missing bpmnElement on ${Fn(Te)} to ${Fn(B)}`),Te.bpmnElement=B,p(Te);else throw new Error("no process or collaboration to display");var C=c(B,Te);if(Yn(B,"bpmn:Process")||Yn(B,"bpmn:SubProcess"))y(B,C);else if(Yn(B,"bpmn:Collaboration"))Z(B,C),_(Y.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Fn(Te)}: ${Fn(B)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function y(W,Y){qe(W,Y),$(W.ioSpecification,Y),k(W.artifacts,Y),o(W)}function _(W,Y){var ae=it(W,function(me){return!a(me)&&Yn(me,"bpmn:Process")&&me.laneSets});ae.forEach(r(y,Y))}function x(W,Y){l(W,Y)}function m(W,Y){H(W,r(x,Y))}function v(W,Y){l(W,Y)}function E(W,Y){l(W,Y)}function S(W,Y){l(W,Y)}function P(W,Y){l(W,Y)}function k(W,Y){H(W,function(ae){Yn(ae,"bpmn:Association")?n.push(function(){P(ae,Y)}):P(ae,Y)})}function $(W,Y){W&&(H(W.dataInputs,r(E,Y)),H(W.dataOutputs,r(S,Y)))}var N=this.handleSubProcess=function(Y,ae){qe(Y,ae),k(Y.artifacts,ae)};function L(W,Y){var ae=l(W,Y);Yn(W,"bpmn:SubProcess")&&N(W,ae||Y),Yn(W,"bpmn:Activity")&&$(W.ioSpecification,Y),n.push(function(){H(W.dataInputAssociations,r(v,Y)),H(W.dataOutputAssociations,r(v,Y))})}function z(W,Y){l(W,Y)}function X(W,Y){l(W,Y)}function oe(W,Y){n.push(function(){var ae=l(W,Y);W.childLaneSet&&te(W.childLaneSet,ae||Y),ie(W)})}function te(W,Y){H(W.lanes,r(oe,Y))}function Ge(W,Y){H(W,r(te,Y))}function qe(W,Y){Ve(W.flowElements,Y),W.laneSets&&Ge(W.laneSets,Y)}function Ve(W,Y){H(W,function(ae){Yn(ae,"bpmn:SequenceFlow")?n.push(function(){z(ae,Y)}):Yn(ae,"bpmn:BoundaryEvent")?n.unshift(function(){L(ae,Y)}):Yn(ae,"bpmn:FlowNode")?L(ae,Y):Yn(ae,"bpmn:DataObject")||(Yn(ae,"bpmn:DataStoreReference")||Yn(ae,"bpmn:DataObjectReference")?X(ae,Y):u(`unrecognized flowElement ${Fn(ae)} in context ${Fn(Y&&Y.businessObject)}`,{element:ae,context:Y}))})}function Re(W,Y){var ae=l(W,Y),me=W.processRef;me&&y(me,ae||Y)}function Z(W,Y){H(W.participants,r(Re,Y)),n.push(function(){m(W.messageFlows,Y)}),k(W.artifacts,Y)}function ie(W){H(W.flowNodeRef,function(Y){var ae=Y.get("lanes");ae&&ae.push(W)})}}function LA(e,t,n){var i,r,o,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,_){return i.add(h,y,_)},error:function(h,y){s.push({message:h,context:y})}},f=new DA(p);u=u||l.diagrams&&l.diagrams[0];var d=IA(l,u);if(!d)throw new Error("no diagram to display");H(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(l,u){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}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function IA(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=BA(n));var r;M(i,"bpmn:Collaboration")?r=i:r=kt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return kt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=Bn(r.participants,function(l){return l.processRef}),o.push(r));var a=Qy(o),s=[t],c=[n];return H(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function Qy(e){var t=[];return H(e,function(n){n&&(t.push(n),t=t.concat(Qy(n.flowElements)))}),t}function BA(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var NA='<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>',Jy=NA,ev={verticalAlign:"middle"},tv={color:"#404040"},$A={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},FA={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},jA={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"},HA='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Jy+'</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>',Xi;function zA(){Xi=Nt(HA),zn(Xi,$A),zn(_t("svg",Xi),ev),zn(_t(".backdrop",Xi),FA),zn(_t(".notice",Xi),jA),zn(_t(".link",Xi),tv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function GA(){Xi||(zA(),Jn.bind(Xi,".backdrop","click",function(e){document.body.removeChild(Xi)})),document.body.appendChild(Xi)}const rl=5,nv="djs-outline-hidden";function Gt(e){e=V({},WA,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),qA(this._container)}Ce(Gt,jr),Gt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),ol(s,o),s=VA(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw ol(o,[]),o}if(typeof t=="string"&&(i=UA(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw ol(o,[]),o}try{this.clear()}catch(o){throw ol(o,[]),o}const{warnings:r}=await LA(this,n,i);return{warnings:r}},Gt.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},Gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=_t(":scope > defs",i._svg),a=xy(r),s=o?"<defs>"+xy(o)+"</defs>":"",c=i.getContainer();St(c).add(nv);let l;try{l=r.getBBox()}finally{St(c).remove(nv)}const u=l.x-rl,p=l.y-rl,f=l.width+rl*2,d=l.height+rl*2;t=`<?xml version="1.0" encoding="utf-8"?>
1
+ (function(J,me){typeof exports=="object"&&typeof module<"u"?me(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],me):(J=typeof globalThis<"u"?globalThis:J||self,me(J.BpmnModeler={},J.Vue))})(this,(function(J,me){"use strict";var S5=Object.defineProperty;var R5=(J,me,dr)=>me in J?S5(J,me,{enumerable:!0,configurable:!0,writable:!0,value:dr}):J[me]=dr;var ui=(J,me,dr)=>R5(J,typeof me!="symbol"?me+"":me,dr);const dr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],yc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function yg(e){return dr.includes(e)}function vg(e){return yc.includes(e)}const vc=["timer"],bc={timer:"bpmn:TimerEventDefinition"};function bg(e){return typeof e=="string"&&vc.includes(e)}function pp(e){if(e.length===1)return vc.find(t=>bc[t]===e[0])}const xc=["ko","en","ja","zh"];function O1(e){return typeof e=="string"&&xc.includes(e)}const xg="http://g1project.net/spec/bpmn/bwl/1.0",fp="bwl",dp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],_c="bwl:ReviewRequest",_g={name:"bwl-hints",uri:xg,prefix:fp,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:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]},{name:"ReviewRequest",superClass:["Element"],properties:[{name:"locale",isAttr:!0,type:"String"},{name:"sourceLocale",isAttr:!0,type:"String"},{name:"previous",isBody:!0,type:"String"}]}]},hp="bwl.undoEpisode",wg=new WeakSet;function D1(e){wg.has(e)||(e.register(hp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),wg.add(e))}function Eg(e,t){D1(e);const n={run:t};if(e.execute(hp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function gp(e){return Array.prototype.concat.apply([],e)}const Xa=Object.prototype.toString,L1=Object.prototype.hasOwnProperty;function hr(e){return e===void 0}function pn(e){return e!==void 0}function Yr(e){return e==null}function $e(e){return Xa.call(e)==="[object Array]"}function fn(e){return Xa.call(e)==="[object Object]"}function Fe(e){return Xa.call(e)==="[object Number]"}function yn(e){const t=Xa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Xn(e){return Xa.call(e)==="[object String]"}function I1(e){if(!$e(e))throw new Error("must supply array")}function Zn(e,t){return!Yr(e)&&L1.call(e,t)}function Ot(e,t){const n=Ec(t);let i;return z(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Sg(e,t){const n=Ec(t);let i=$e(e)?-1:void 0;return z(e,function(o,r){if(n(o,r))return i=r,!1}),i}function it(e,t){const n=Ec(t);let i=[];return z(e,function(o,r){n(o,r)&&i.push(o)}),i}function z(e,t){let n,i;if(hr(e))return;const o=$e(e)?j1:F1;for(let r in e)if(Zn(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function B1(e,t){if(hr(e))return[];I1(e);const n=Ec(t);return e.filter(function(i,o){return!n(i,o)})}function Qn(e,t,n){return z(e,function(i,o){n=t(n,i,o)}),n}function Ao(e,t){return!!Qn(e,function(n,i,o){return n&&t(i,o)},!0)}function Po(e,t){return!!Ot(e,t)}function Bn(e,t){let n=[];return z(e,function(i,o){n.push(t(i,o))}),n}function wc(e){return e&&Object.keys(e)||[]}function N1(e){return wc(e).length}function Kr(e){return Bn(e,t=>t)}function Xr(e,t,n={}){return t=mp(t),z(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Rg(e,...t){e=mp(e);let n={};return z(t,o=>Xr(o,e,n)),Bn(n,function(o,r){return o[0]})}const $1=Rg;function Hi(e,t){t=mp(t);let n=[];return z(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Bn(n,i=>i.v)}function Zr(e){return function(t){return Ao(e,function(n,i){return t[i]===n})}}function mp(e){return yn(e)?e:t=>t[e]}function Ec(e){return yn(e)?e:t=>t===e}function F1(e){return e}function j1(e){return Number(e)}function yp(e,t){let n,i,o,r;function a(p){let f=Date.now(),d=p?0:r+t-f;if(d>0)return s(d);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function qn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function H1(e,t,n){let i=e;return z(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];pn(a)&&Yr(s)&&(s=i[o]=isNaN(+a)?{}:[]),hr(a)?hr(n)?delete i[o]:i[o]=n:i=s}),e}function Li(e,t){let n={},i=Object(e);return z(t,function(o){o in i&&(n[o]=e[o])}),n}function zi(e,t){let n={},i=Object(e);return z(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function M(e,t){var n=de(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function tt(e,t){return Po(t,function(n){return M(e,n)})}function de(e){return e&&e.businessObject||e}function ft(e){return e&&e.di}const z1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Cg="i18n",Qr="i18n:Translation";function gr(e){if(e){if(M(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(M(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Jr(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Qr)})}function Nn(e){return e.get("xml:lang")}function To(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,_c)})}function Za(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function vp(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function bp(e,t,n){const i=gr(e);if(!i)return{};const o=i.target[i.key]??"",r=Jr(e).filter(u=>Nn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Nn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of Za(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Nn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Sc="bwl.updateTranslation";class xp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:o,locales:r,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=gr(c),u=[];t.undo=u;const p=Jr(c).filter(D=>Nn(D)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(D=>{if(!D)return[];const $=p.filter(N=>N.body===D).map(Nn);return $.length?$:[d]})(f),y=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,_=D=>{var $;return(($=p.find(N=>Nn(N)===D&&N.body))==null?void 0:$.body)??(h.includes(D)?f:"")},x=D=>To(c).some($=>$.locale===D),m=_(y);if(m===i)return[];const v=!!m&&!x(y),w=v?r.filter(D=>D!==y&&_(D)&&!x(D)):[],S=()=>{let D=c.extensionElements;return D||(D=this.moddle.create("bpmn:ExtensionElements",{values:[]}),D.$parent=c,c.extensionElements=D,u.push(()=>delete c.extensionElements)),D.get("values")},P=(D,$)=>{const N=S();let H=N.find(X=>{var Q;return((Q=X.$instanceOf)==null?void 0:Q.call(X,Qr))&&Nn(X)===D});if(H){const X=H.body;H.body=$,u.push(()=>H.body=X)}else H=this.moddle.create(Qr,{body:$}),H.set("xml:lang",D),H.$parent=c.extensionElements,N.push(H),u.push(()=>N.splice(N.indexOf(H),1))},T=D=>{const $=S(),N=$.indexOf(D);$.splice(N,1),u.push(()=>$.splice(N,0,D))};if(s===void 0){if(y===o&&l){if(f&&!p.some($=>$.body===f)){const $=a&&a!==o?a:void 0;$&&P($,f)}const D=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{D?l.target[l.key]=f:delete l.target[l.key]})}P(y,i)}else(p.some(D=>Nn(D)===y)||!f&&y!==d)&&P(y,i);if(!v)for(const D of To(c).filter($=>$.locale===y))T(D);for(const D of w){const $=S(),N=this.moddle.create(_c,{locale:D,sourceLocale:y,previous:m});N.$parent=c.extensionElements,$.push(N),u.push(()=>$.splice($.indexOf(N),1))}for(const D of To(c).filter($=>$.sourceLocale===y&&($.previous??"")===i))T(D);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ui(xp,"$inject",["moddle"]);const _p="bwl.setTranslations",G1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class wp{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:o=[],designLocale:r,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!gr(l))return[];const p=()=>{let _=l.extensionElements;return _||(_=this.moddle.create("bpmn:ExtensionElements",{values:[]}),_.$parent=l,l.extensionElements=_,u.push(()=>delete l.extensionElements)),_.get("values")},f=_=>{const x=p(),m=x.indexOf(_);m<0||(x.splice(m,1),u.push(()=>x.splice(m,0,_)))},d=_=>Jr(l).find(x=>Nn(x)===_);if(i===null)for(const _ of a){const x=d(_);x&&f(x)}else if(i)for(const _ of a){const x=i[_];if(x===void 0)continue;const m=d(_);if(m){if(m.body===x)continue;const S=m.body;m.body=x,u.push(()=>m.body=S);continue}if(_===r&&(s??r)===r)continue;const v=p(),w=this.moddle.create(Qr,{body:x});w.set("xml:lang",_),w.$parent=l.extensionElements,v.push(w),u.push(()=>v.splice(v.indexOf(w),1))}const h=[...i===null?[]:c.requests.filter(_=>!o.includes(_.locale)&&!(i&&i[_.locale]!==void 0&&i[_.locale]!==c.texts[_.locale])&&!(i&&_.sourceLocale&&i[_.sourceLocale]===_.previous))];for(const _ of To(l)){const x=h.findIndex(m=>G1(_,m));x>=0?h.splice(x,1):f(_)}for(const _ of h){const x=p(),m=this.moddle.create(_c,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});m.$parent=l.extensionElements,x.push(m),u.push(()=>x.splice(x.indexOf(m),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ui(wp,"$inject",["moddle"]);function Ep(e){return To(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Sp{constructor(t){t.registerHandler(Sc,xp),t.registerHandler(_p,wp)}}ui(Sp,"$inject",["commandStack"]);const Rp={__init__:["translationCommands"],translationCommands:["type",Sp]},Mg=["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","translation.confirm","element.remove"],V1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},W1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(xc.map(e=>[e,{type:"string"}])),additionalProperties:!1},U1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},q1={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},Y1={type:"string",enum:[...vc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},K1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...yc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},X1={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Z1={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},Q1={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id","source","target"],additionalProperties:!1},J1={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},eS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},tS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},nS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},iS={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},oS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...dp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function An(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const rS={"participant.add":An("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":An("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":An("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":An("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lane:{type:"string"},type:{type:"string",enum:[...yc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":An("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":An("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":An("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":An("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":An("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":An("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":An("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":An("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":An("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":An("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":An("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":An("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":An("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...xc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":An("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Ag={anyOf:Mg.map(e=>rS[e])},aS={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라. 문서에 문서 언어 설정이 있으면(describe 의 i18n) 문구는 평문 name/text 가 아니라 names/texts 로 문서 언어 전부를 준다.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:U1,irParticipant:q1,irNode:K1,irFlowCondition:X1,irSequenceFlow:Z1,irMessageFlow:Q1,irDataStore:J1,irDataAssociation:eS,irTextAnnotation:tS,irAssociation:nS,irGroup:iS,bwlPlacement:oS,eventDefinition:Y1,localeTexts:W1,nullableString:V1,symbolicOp:Ag}};function Cp(){}Cp.prototype.get=function(e){return this.$model.properties.get(this,e)},Cp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Pg(e,t){this.model=e,this.properties=t}Pg.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Cp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),z(a,qn(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var sS=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Tg=V(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 Mp(e,t){var n=Tg[e];return n?n(t):t}function Ap(e){return!!sS[e]}function kg(e){return!!Tg[e]}function $n(e,t){var n=e.split(/:/),i,o;if(n.length===1)i=e,o=t;else if(n.length===2)i=n[1],o=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(o?o+":":"")+i,{name:e,prefix:o,localName:i}}function pi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}pi.prototype.build=function(){return Li(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},pi.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)},pi.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=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=o.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");o.splice(s,1),this.addProperty(t,n?void 0:s,a),r[i.name]=r[i.localName]=t},pi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=$n(o[0],i),a=$n(o[1],r.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},pi.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},pi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},pi.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},pi.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},pi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},pi.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")},pi.prototype.hasProperty=function(e){return this.propertiesByName[e]},pi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(z(e.properties,qn(function(r){r=V({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function ko(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,qn(this.registerPackage,this))}ko.prototype.getPackage=function(e){return this.packageMap[e]},ko.prototype.getPackages=function(){return this.packages},ko.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Og(t,e,"prefix"),Og(t,e,"uri"),z(e.types,qn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},ko.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=$n(e.name,t.prefix),i=n.name,o=Object.create(null);z(e.properties,qn(function(r){var a=$n(r.name,n.prefix),s=a.name;Ap(r.type)||(r.type=$n(r.type,a.prefix).name),V(r,{ns:a,name:s}),o[s]=r},this)),V(e,{ns:n,name:i,propertiesByName:o}),z(e.extends,qn(function(r){var a=$n(r,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},ko.prototype.mapTypes=function(e,t,n){var i=Ap(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=$n(c,Ap(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},ko.prototype.getEffectiveDescriptor=function(e){var t=$n(e),n=new pi(t);this.mapTypes(t,function(o,r){n.addTrait(o,r)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},ko.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Og(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function mr(e){this.model=e}mr.prototype.set=function(e,t,n){if(!Xn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;cS(n)?i?delete e[o]:delete e.$attrs[Pp(t)]:i?o in e?e[o]=n:Dg(e,i,n):e.$attrs[Pp(t)]=n},mr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Pp(t)];var i=n.name;return!e[i]&&n.isMany&&Dg(e,n,[]),e[i]},mr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},mr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},mr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},mr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(typeof o<"u"){const r=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw r;typeof console<"u"&&console.warn(r)}return null};function cS(e){return typeof e>"u"}function Dg(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Pp(e){return e.replace(/^:/,"")}function vi(e,t={}){this.properties=new mr(this),this.factory=new Pg(this,this.properties),this.registry=new ko(e,this.properties),this.typeCache=Object.create(null),this.config=t}vi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},vi.prototype.getType=function(e){var t=this.typeCache,n=Xn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},vi.prototype.createAny=function(e,t,n){var i=$n(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){H1(this,[a],s)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),z(n,function(a,s){fn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},vi.prototype.getPackage=function(e){return this.registry.getPackage(e)},vi.prototype.getPackages=function(){return this.registry.getPackages()},vi.prototype.getElementDescriptor=function(e){return e.$descriptor},vi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},vi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},vi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Lg=String.fromCharCode,lS=Object.prototype.hasOwnProperty,uS=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Qa={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Qa).forEach(function(e){Qa[e.toUpperCase()]=Qa[e]});function pS(e,t,n,i){return i?lS.call(Qa,i)?Qa[i]:"&"+i+";":Lg(t||parseInt(n,16))}function yr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(uS,pS):e}var Ig="non-whitespace outside of root node";function Oo(e){return new Error(e)}function fS(e){return"missing namespace for prefix <"+e+">"}function Rc(e){return{get:e,enumerable:!0}}function dS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Bg=Symbol("nameCache");function Tp(e){return e+"$uri"}function hS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Tp(i)]=n;return t}function Cc(){return{line:0,column:0}}function gS(e){throw e}function Ng(e){if(!this)return new Ng(e);var t=e&&e.proxy,n,i,o,r,a=gS,s,c,l,u,p=Cc,f=!1,d=!1,g="",h=!1,y=!1,_=null,x=!1,m,v,w,S;function P(N){N instanceof Error||(N=Oo(N)),_=N,a(N,p)}function T(N){s&&(N instanceof Error||(N=Oo(N)),s(N,p))}this.on=function(N,H){if(typeof H!="function")throw Oo("required args <name, cb>");switch(N){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":o=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":r=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw Oo("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw Oo("required args <nsMap={}>");var H=Object.create(null),X;for(X in N)H[X]=N[X];return y=!0,S=H,this};function D(){m=y?[]:null,v=y?hS(S):null,w=[],p=Cc,x=!1,_=null,d=!1,g=""}this.parse=function(N){if(typeof N!="string")throw Oo("required args <xml=string>");if(f)throw Oo("parse during stream; call end() first");return D(),$(N),p=Cc,x=!1,_},this.write=function(N){if(typeof N!="string")throw Oo("required args <xml=string>");return f||(D(),f=!0),_||(g=$(g+N,!0)||""),this},this.end=function(){return f||D(),f=!1,_||$(g),g="",p=Cc,x=!1,_},this.stop=function(){x=!0};function $(N,H=!1){var X=null,Q=null,ee,Ve=0,qe=!1,Ge=!1,Re=0,Z=0,oe,W,Y,ae,ge,Te,B,C,E,G="",q=0,ie;function Me(Ct,mn){var Rn=Ct.indexOf(":");if(Rn===-1)return Ct;var Vn=v[Ct.substring(0,Rn)];return Vn?mn===Vn?Ct.substr(Rn+1):Vn+Ct.substr(Rn):(T(fS(Ct.substring(0,Rn))),null)}function Xe(){if(ie!==null)return ie;var Ct,mn,Rn=y&&v.xmlns,Vn=y&&h?[]:null,At=q,Qt=G,_n=Qt.length,Va,Wn,$i,si,nn,Fr={},Wa=new Set,Cn,ht,Et;e:for(;At<_n;At++)if(Cn=!1,ht=Qt.charCodeAt(At),!(ht===32||ht<14&&ht>8)){for((ht<65||ht>122||ht>90&&ht<97)&&ht!==95&&ht!==58&&(T("illegal first char attribute name"),Cn=!0),Et=At+1;Et<_n;Et++)if(ht=Qt.charCodeAt(Et),!(ht>96&&ht<123||ht>64&&ht<91||ht>47&&ht<59||ht===46||ht===45||ht===95)){if(ht===32||ht<14&&ht>8){T("missing attribute value"),At=Et;continue e}if(ht===61)break;T("illegal attribute name char"),Cn=!0}if(nn=Qt.substring(At,Et),nn==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Cn=!0),ht=Qt.charCodeAt(Et+1),ht===34)Et=Qt.indexOf('"',At=Et+2),Et===-1&&(Et=Qt.indexOf("'",At),Et!==-1&&(T("attribute value quote missmatch"),Cn=!0));else if(ht===39)Et=Qt.indexOf("'",At=Et+2),Et===-1&&(Et=Qt.indexOf('"',At),Et!==-1&&(T("attribute value quote missmatch"),Cn=!0));else for(T("missing attribute value quotes"),Cn=!0,Et=Et+1;Et<_n&&(ht=Qt.charCodeAt(Et+1),!(ht===32||ht<14&&ht>8));Et++);for(Et===-1&&(T("missing closing quotes"),Et=_n,Cn=!0),Cn||($i=Qt.substring(At,Et)),At=Et;Et+1<_n&&(ht=Qt.charCodeAt(Et+1),!(ht===32||ht<14&&ht>8));Et++)At===Et&&(T("illegal character after attribute end"),Cn=!0);if(At=Et+1,Cn)continue e;if(Wa.has(nn)){T("attribute <"+nn+"> already defined");continue}if(Wa.add(nn),!y){Fr[nn]=$i;continue}if(h){if(Wn=nn==="xmlns"?"xmlns":nn.charCodeAt(0)===120&&nn.substr(0,6)==="xmlns:"?nn.substr(6):null,Wn!==null){if(Ct=yr($i),mn=Tp(Wn),si=S[Ct],!si){if(Wn==="xmlns"||mn in v&&v[mn]!==Ct)do si="ns"+Ve++;while(typeof v[si]<"u");else si=Wn;S[Ct]=si}v[Wn]!==si&&(Va||(v=dS(v),Va=!0),v[Wn]=si,Wn==="xmlns"&&(v[Tp(si)]=Ct,Rn=si),v[mn]=Ct),Fr[nn]=$i;continue}Vn.push(nn,$i);continue}nn=Me(nn,Rn),nn!==null&&(Fr[nn]=$i)}if(h)for(At=0,_n=Vn.length;At<_n;At++)nn=Me(Vn[At++],Rn),$i=Vn[At],nn!==null&&(Fr[nn]=$i);return ie=Fr}function gt(){for(var Ct=/(\r\n|\r|\n)/g,mn=0,Rn=0,Vn=0,At=Z,Qt,_n;Re>=Vn&&(Qt=Ct.exec(N),!(!Qt||(At=Qt[0].length+Qt.index,At>Re)));)mn+=1,Vn=At;return Re==-1?(Rn=At,_n=N.substring(Z)):Z===0?_n=N.substring(Z,Re):(Rn=Re-Vn,_n=Z==-1?N.substring(Re):N.substring(Re,Z+1)),{data:_n,line:mn,column:Rn}}for(p=gt,t&&(E=Object.create({},{name:Rc(function(){return B}),originalName:Rc(function(){return C}),attrs:Rc(Xe),ns:Rc(function(){return v})}));Z!==-1;){if(N.charCodeAt(Z)===60?Re=Z:Re=N.indexOf("<",Z),Re===-1){if(H)return N.substring(Z);if(w.length)return P("unexpected end of file");if(!d)return P("missing start tag");Z<N.length&&N.substring(Z).trim()&&T(Ig);return}if(d||(d=!0),Z!==Re){if(w.length){if(n&&(n(N.substring(Z,Re),yr,p),x))return}else if(N.substring(Z,Re).trim()&&(T(Ig),x))return}if(ae=N.charCodeAt(Re+1),ae===33){if(Y=N.charCodeAt(Re+2),Y===91&&N.substr(Re+3,6)==="CDATA["){if(Z=N.indexOf("]]>",Re),Z===-1)return H?N.substring(Re):P("unclosed cdata");if(r&&(r(N.substring(Re+9,Z),p),x))return;Z+=3;continue}if(Y===45&&N.charCodeAt(Re+3)===45){if(Z=N.indexOf("-->",Re),Z===-1)return H?N.substring(Re):P("unclosed comment");if(c&&(c(N.substring(Re+4,Z),yr,p),x))return;Z+=3;continue}}if(ae===63){if(Z=N.indexOf("?>",Re),Z===-1)return H?N.substring(Re):P("unclosed question");if(l&&(l(N.substring(Re,Z+2),p),x))return;Z+=2;continue}for(oe=Re+1;;oe++){if(ge=N.charCodeAt(oe),isNaN(ge))return H?N.substring(Re):(Z=-1,P("unclosed tag"));if(ge===34)Y=N.indexOf('"',oe+1),oe=Y!==-1?Y:oe;else if(ge===39)Y=N.indexOf("'",oe+1),oe=Y!==-1?Y:oe;else if(ge===62){Z=oe;break}}if(ae===33){if(u&&(u(N.substring(Re,Z+1),yr,p),x))return;Z+=1;continue}if(ie={},ae===47){if(qe=!1,Ge=!0,!w.length)return P("missing open tag");if(oe=B=w.pop(),Y=Re+2+oe.length,N.substring(Re+2,Y)!==oe)return P("closing tag mismatch");for(;Y<Z;Y++)if(ae=N.charCodeAt(Y),!(ae===32||ae>8&&ae<14))return P("close tag")}else{if(N.charCodeAt(Z-1)===47?(oe=B=N.substring(Re+1,Z-1),qe=!0,Ge=!0):(oe=B=N.substring(Re+1,Z),qe=!0,Ge=!1),!(ae>96&&ae<123||ae>64&&ae<91||ae===95||ae===58))return P("illegal first char nodeName");for(Y=1,W=oe.length;Y<W;Y++)if(ae=oe.charCodeAt(Y),!(ae>96&&ae<123||ae>64&&ae<91||ae>47&&ae<59||ae===45||ae===95||ae==46)){if(ae===32||ae<14&&ae>8){B=oe.substring(0,Y),ie=null;break}return P("invalid nodeName")}Ge||w.push(B)}if(y){ee=v,qe&&(Ge||m.push(ee),ie===null&&(h=oe.indexOf("xmlns",Y)!==-1)&&(q=Y,G=oe,Xe(),h=!1)),C=B,Q!==v&&(X=v[Bg],X===void 0&&(X=v[Bg]=Object.create(null)),Q=v);var qt=X[B];if(qt!==void 0)B=qt;else{if(ae=B.indexOf(":"),ae!==-1){if(Te=v[B.substring(0,ae)],!Te)return P("missing namespace on <"+C+">");B=B.substr(ae+1)}else Te=v.xmlns;Te&&(B=Te+":"+B),X[C]=B}}if(qe&&(q=Y,G=oe,i&&(t?i(E,yr,Ge,p):i(B,Xe,yr,Ge,p),x)))return;if(Ge){if(o&&(o(t?E:B,yr,qe,p),x))return;y&&(qe?v=ee:v=m.pop())}Z+=1}}}function $g(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var kp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Fg="property";function jg(e){return e.xml&&e.xml.serialize}function mS(e){const t=jg(e);return t!==Fg&&(t||null)}function yS(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Hg(e,t){return $g(t)?e.prefix+":"+yS(e.localName):e.name}function vS(e,t){var n=e.name,i=e.localName,o=t&&t.xml&&t.xml.typePrefix;return o&&i.indexOf(o)===0?e.prefix+":"+i.slice(o.length):n}function bS(e,t,n){const i=$n(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=$n(o);var a=n.getPackage(r.prefix);return vS(r,a)}function Do(e){return new Error(e)}function co(e){return e.$descriptor}function xS(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Do("expected element");var n=this.elementsById,i=co(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw Do("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ja(){}Ja.prototype.handleEnd=function(){},Ja.prototype.handleText=function(){},Ja.prototype.handleNode=function(){};function Op(){}Op.prototype=Object.create(Ja.prototype),Op.prototype.handleNode=function(){return this};function ea(){}ea.prototype=Object.create(Ja.prototype),ea.prototype.handleText=function(e){this.body=(this.body||"")+e};function es(e,t){this.property=e,this.context=t}es.prototype=Object.create(ea.prototype),es.prototype.handleNode=function(e){if(this.element)throw Do("expected no sub nodes");return this.element=this.createReference(e),this},es.prototype.handleEnd=function(){this.element.id=this.body},es.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Dp(e,t){this.element=t,this.propertyDesc=e}Dp.prototype=Object.create(ea.prototype),Dp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Mp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Mc(){}Mc.prototype=Object.create(ea.prototype),Mc.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function Hn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Hn.prototype=Object.create(Mc.prototype),Hn.prototype.addReference=function(e){this.context.addReference(e)},Hn.prototype.handleText=function(e){var t=this.element,n=co(t),i=n.bodyProperty;if(!i)throw Do("unexpected body text <"+e+">");ea.prototype.handleText.call(this,e)},Hn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=co(t),i=n.bodyProperty;i&&e!==void 0&&(e=Mp(i.type,e),t.set(i.name,e))},Hn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=co(n),o=this.context,r=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){o.addReference({element:r,property:u.ns.name,id:f})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Mp(u.type,c):l==="xmlns"?l=":"+l:(s=$n(l,i.ns.prefix),a.getPackage(s.prefix)&&o.addWarning({message:"unknown attribute <"+l+">",element:r,property:l,value:c})),r.set(l,c))}),r},Hn.prototype.getPropertyForNode=function(e){var t=e.name,n=$n(t),i=this.type,o=this.model,r=co(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=mS(s);if(l){const u=e.attributes[l];if(u){const p=bS(u,e.ns,o),f=o.getType(p);return V({},s,{effectiveType:co(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Hg(n,c),u=o.getType(l);if(s=Ot(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return V({},s,{effectiveType:co(u).name})}else if(s=Ot(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Do("unrecognized element <"+n.name+">")},Hn.prototype.toString=function(){return"ElementDescriptor["+co(this.type).name+"]"},Hn.prototype.valueHandler=function(e,t){return new Dp(e,t)},Hn.prototype.referenceHandler=function(e){return new es(e,this.context)},Hn.prototype.handler=function(e){return e==="Element"?new ta(this.model,e,this.context):new Hn(this.model,e,this.context)},Hn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,kg(n))return this.valueHandler(t,i);t.isReference?o=this.referenceHandler(t).handleNode(e):o=this.handler(n).handleNode(e);var r=o.element;return r!==void 0&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(V(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Lp(e,t,n){Hn.call(this,e,t,n)}Lp.prototype=Object.create(Hn.prototype),Lp.prototype.createElement=function(e){var t=e.name,n=$n(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Hg(n,r)||t;if(!o.hasType(a))throw Do("unexpected element <"+e.originalName+">");return Hn.prototype.createElement.call(this,e)};function ta(e,t,n){this.model=e,this.context=n}ta.prototype=Object.create(Mc.prototype),ta.prototype.createElement=function(e){var t=e.name,n=$n(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ta.prototype.handleChild=function(e){var t=new ta(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,o;return i!==void 0&&(o=n.$children=n.$children||[],o.push(i),i.$parent=n),t},ta.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Ip(e){e instanceof vi&&(e={model:e}),V(this,{lax:!1},e)}Ip.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Hn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var o=this.model,r=this.lax,a=new xS(V({},t,{rootHandler:i})),s=new Ng({proxy:!0}),c=_S();i.context=a,c.push(i);function l(w,S,P){var T=S(),D=T.line,$=T.column,N=T.data;N.charAt(0)==="<"&&N.indexOf(" ")!==-1&&(N=N.slice(0,N.indexOf(" "))+">");var H="unparsable content "+(N?N+" ":"")+`detected
2
+ line: `+D+`
3
+ column: `+$+`
4
+ nested error: `+w.message;if(P)return a.addWarning({message:H,error:w}),!0;throw Do(H)}function u(w,S){return l(w,S,!0)}function p(){var w=a.elementsById,S=a.references,P,T;for(P=0;T=S[P];P++){var D=T.element,$=w[T.id],N=co(D).propertiesByName[T.property];if($||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),N.isMany){var H=D.get(N.name),X=H.indexOf(T);X===-1&&(X=H.length),$?H[X]=$:H.splice(X,1)}else D.set(N.name,$)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(w){if(d.test(w)){var S=g.exec(w),P=S&&S[1];!P||h.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function _(w,S){var P=c.peek();try{c.push(P.handleNode(w))}catch(T){l(T,S,r)&&c.push(new Op)}}function x(w,S){try{c.peek().handleText(w)}catch(P){u(P,S)}}function m(w,S){w.trim()&&x(w,S)}var v=o.getPackages().reduce(function(w,S){return w[S.uri]=S.prefix,w},Object.entries(kp).reduce(function(w,[S,P]){return w[P]=S,w},o.config&&o.config.nsMap||{}));return s.ns(v).on("openTag",function(w,S,P,T){var D=w.attrs||{},$=Object.keys(D).reduce(function(H,X){var Q=S(D[X]);return H[X]=Q,H},{}),N={name:w.name,originalName:w.originalName,attributes:$,ns:w.ns};_(N,T)}).on("question",y).on("closeTag",f).on("cdata",x).on("text",function(w,S,P){m(S(w),P)}).on("error",l).on("warn",u),new Promise(function(w,S){var P;try{s.parse(e),p()}catch(H){P=H}var T=i.element;!P&&!T&&(P=Do("failed to parse document as <"+i.type.$descriptor.name+">"));var D=a.warnings,$=a.references,N=a.elementsById;return P?(P.warnings=D,S(P)):w({rootElement:T,elementsById:N,references:$,warnings:D})})},Ip.prototype.handler=function(e){return new Lp(this.model,e)};function _S(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var wS=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,ES=/<|>|'|"|&|\n\r|\n/g,zg=/<|>|&/g;function Gi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Gi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Gi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Gi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Gi.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)},Gi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Gi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Gi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Gi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Gi.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 SS(e){return e.charAt(0).toLowerCase()+e.slice(1)}function RS(e,t){return $g(t)?SS(e):e}function Gg(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Vg(e){return Xn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function CS(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 MS(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:RS(t.ns.localName,t.$pkg)},e)}function AS(e,t){return V({localName:t.ns.localName},e)}function PS(e){var t=e.$descriptor;return it(t.properties,function(n){var i=n.name;if(n.isVirtual||!Zn(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var TS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},kS={"<":"lt",">":"gt","&":"amp"};function Wg(e,t,n){return e=Xn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function OS(e){return Wg(e,ES,TS)}function DS(e){return Wg(e,zg,kS)}function LS(e){return it(e,function(t){return t.isAttr})}function IS(e){return it(e,function(t){return!t.isAttr})}function Bp(e){this.tagName=e}Bp.prototype.build=function(e){return this.element=e,this},Bp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function vr(){}vr.prototype.serializeValue=vr.prototype.serializeTo=function(e){e.append(this.escape?DS(this.value):this.value)},vr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(zg)!==-1&&(this.escape=!0),this};function Np(e){this.tagName=e}Gg(Np,vr),Np.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ht.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,o,r=t.isGeneric;return r?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),r?this.parseGenericContainments(e):(o=PS(e),this.parseAttributes(LS(o)),this.parseContainments(IS(o))),this.parseGenericAttributes(e,i),this},Ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return MS(t,e)},Ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return AS(t,e)},Ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ht.prototype.nsAttributeName=function(e){var t;if(Xn(e)?t=$n(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}:V({localName:t.localName},n)},Ht.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}))},Ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new vr().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Ht(this).build(i))})},Ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=$n(t),r;if(o.prefix==="xmlns"&&(r={prefix:o.localName,uri:n}),!o.prefix&&o.localName==="xmlns"&&(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},Ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ht.prototype.parseGenericAttributes=function(e,t){var n=this;z(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(o){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,o)}})},Ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new vr().build(o,r[0]));else if(kg(o.type))z(r,function(l){n.push(new Np(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)z(r,function(l){n.push(new Bp(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=jg(o);z(r,function(l){var u;c?c===Fg?u=new Ht(t,o):u=new Ac(t,o,c):u=new Ht(t),n.push(u.build(l))})}})},Ht.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Gi(i):t=i),t},Ht.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix,a=i.byUri(o);return(!a||n)&&i.add(e,t),i.mapPrefix(r,o),e},Ht.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,o=e.uri,r,a,s;if(!i&&!o)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),o=o||s||n.uriByPrefix(i),!o)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(o),!e&&!i&&(e=this.logNamespace({uri:o},s===o,!0)),!e){for(r=i,a=1;n.uriByPrefix(r);)r=i+"_"+a++;e=this.logNamespace({prefix:r,uri:o},s===o)}return i&&n.mapPrefix(i,o),e},Ht.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];z(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Ht.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Vg(e)},Ht.prototype.addAttribute=function(e,t){var n=this.attrs;Xn(t)&&(t=OS(t));var i=Sg(n,function(r){return r.name.localName===e.localName&&r.name.uri===e.uri&&r.name.prefix===e.prefix}),o={name:e,value:t};i!==-1?n.splice(i,1,o):n.push(o)},Ht.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=CS(n).concat(t)),z(t,function(i){e.append(" ").append(Vg(i.name)).append('="').append(i.value).append('"')})},Ht.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==vr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),z(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Ac(e,t,n){Ht.call(this,e,t),this.serialization=n}Gg(Ac,Ht),Ac.prototype.parseNsAttributes=function(e){var t=Ht.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 o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},Ac.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function BS(){this.value="",this.write=function(e){this.value+=e}}function NS(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 $S(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new BS,r=new NS(o,e.format);e.preamble&&r.append(wS);var a=new Ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(FS(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function FS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in kp)n[i]=kp[i];for(const i in t){const o=t[i];n[o]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Pc(e,t){vi.call(this,e,t)}Pc.prototype=Object.create(vi.prototype),Pc.prototype.fromXML=function(e,t,n){Xn(t)||(n=t,t="bpmn:Definitions");var i=new Ip(V({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Pc.prototype.toXML=function(e,t){var n=new $S(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var jS="BPMN20",HS="http://www.omg.org/spec/BPMN/20100524/MODEL",zS="bpmn",GS=[],VS=[{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"}]}],WS=[{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"}]}],US={tagAlias:"lowerCase",typePrefix:"t"},qS={name:jS,uri:HS,prefix:zS,associations:GS,types:VS,enumerations:WS,xml:US},YS="BPMNDI",KS="http://www.omg.org/spec/BPMN/20100524/DI",XS="bpmndi",ZS=[{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"]}],QS=[{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"}]}],JS=[],eR={name:YS,uri:KS,prefix:XS,types:ZS,enumerations:QS,associations:JS},tR="DC",nR="http://www.omg.org/spec/DD/20100524/DC",iR="dc",oR=[{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}]}],rR=[],aR={name:tR,uri:nR,prefix:iR,types:oR,associations:rR},sR="DI",cR="http://www.omg.org/spec/DD/20100524/DI",lR="di",uR=[{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"}]}],pR=[],fR={tagAlias:"lowerCase"},dR={name:sR,uri:cR,prefix:lR,types:uR,associations:pR,xml:fR},hR="bpmn.io colors for BPMN",gR="http://bpmn.io/schema/bpmn/biocolor/1.0",mR="bioc",yR=[{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"}]}],vR=[],bR=[],xR={name:hR,uri:gR,prefix:mR,types:yR,enumerations:vR,associations:bR},_R="BPMN in Color",wR="http://www.omg.org/spec/BPMN/non-normative/color/1.0",ER="color",SR=[{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"}]}],RR=[],CR=[],MR={name:_R,uri:wR,prefix:ER,types:SR,enumerations:RR,associations:CR};const AR={bpmn:qS,bpmndi:eR,dc:aR,di:dR,bioc:xR,color:MR};function Ug(e,t){const n=V({},AR,e);return new Pc(n,t)}const PR={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"}},Tc={[Cg]:PR,[fp]:_g};function qg(){return Ug(Tc)}const Yg=qg();async function na(e){const{rootElement:t,warnings:n}=await Yg.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function TR(e){const{xml:t}=await Yg.toXML(e,{format:!0});return t}function $p(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ia={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},kR=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function OR(e){const t=ia;return kR.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 oa(e,t){let n=0;for(const i of e)n+=t*OR(i);return n}function Kg(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&DR(e),LR(e),IR(e),BR(e)}function DR(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(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:oa(o,r),fontBoundingBoxAscent:r*ia.ascentEm,fontBoundingBoxDescent:r*ia.descentEm,actualBoundingBoxAscent:r*ia.ascentEm,actualBoundingBoxDescent:r*ia.descentEm}}};t.getContext=()=>n}function LR(e){if(e.SVGMatrix)return;class t{constructor(){ui(this,"a",1);ui(this,"b",0);ui(this,"c",0);ui(this,"d",1);ui(this,"e",0);ui(this,"f",0)}static of(i,o,r,a,s,c){return Object.assign(new t,{a:i,b:o,c:r,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,o){return this.multiply(t.of(1,0,0,1,i,o))}scale(i,o=i){return this.multiply(t.of(i,0,0,o,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 IR(e){var r;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,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(r=e.SVGSVGElement)==null?void 0:r.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 o=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(o,"transform")||Object.defineProperty(o,"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 BR(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:oa(n,12),height:14}})}const kc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),NR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),$R=1,Oc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),FR=2;function ct(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Xg=20,Dc=5,Zg=3,jR=8,ra=15,Fp=50,Qg=12,HR=Qg*1.2;function jp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>oa(r,Qg))),o=n.length*HR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Jg=1;function vn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function br(e,t){let n=null;const i=e.type!==t.type,r=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of vn(e))for(const s of vn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Jg)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":r?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=Xg&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Hp(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function em(e,t){const n=br(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function zR(e,t){let n=0;for(const i of t)i.id!==e.id&&em(e,i)&&n++;return n}function fi(e,t){let n=0;for(const i of t)i.id!==e.id&&br(e,i)&&n++;return n}const tm=15,nm=20;function GR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-nm||t.at>n[1]+nm)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],o=Math.max(i[0],t.lo),r=Math.min(i[1],t.hi);return r>o?[o,r]:null}const zp=20;function Lc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Jg)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<Xg||n.push([o-zp,r+zp])}return n}function Ic(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of vn(e)){const r=GR(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Lc(o,vn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const VR=10,WR=1,UR=(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 qR(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(o-e.x,c)&&f(e.x-a,-c)&&f(r-e.y,l)&&f(e.y-s,-l)&&p>u}function Gp(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 YR=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,aa=1;function Vi(e,t){const n=e.x+aa,i=e.x+e.width-aa,o=e.y+aa,r=e.y+e.height-aa;return t.axis==="h"?t.at>o&&t.at<r&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<r&&t.hi>o}function sa(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 im(e,t){const n=e.label;if(!n)return null;if(vn(e).some(i=>Vi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(vn(i).some(o=>Vi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(sa(i).some(o=>Vi(n,o)))return i.id;return null}function bn(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(qR(e.waypoints[r],e.waypoints[r+1],o,FR)){i.push(o);break}}return i}const ts=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},KR=(e,t,n,i)=>rm(e,t,n,i)?0:Math.min(ts(e,n,i),ts(t,n,i),ts(n,e,t),ts(i,e,t)),om=(e,t)=>{let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const r=t[i],a=t[o];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n};function ns(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,ts({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+a}];if(om(e,s)||om(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,KR(e,t,s[l],s[(l+1)%s.length]));return c}function rm(e,t,n,i){const o=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.x),r=o(n,i,e),a=o(n,i,t),s=o(e,t,n),c=o(e,t,i);return r*a<0&&s*c<0}const Vp=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function am(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(rm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function is(e,t){let n=0;for(const i of t)i.id===e.id||Vp(e,i)||am(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id===e.id||Vp(e,i)||is(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function sm(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)is(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function ca(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(is(n[i],[n[o]])>0){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function Lo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Vp(n[i],n[o])&&am(n[i],n[o])){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function cm(e){const t=ca(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:XR(e)}}function XR(e){const t=e.shapes.filter(o=>o.type==="bpmn:Participant");if(t.length<3)return 0;const n=o=>{const r=e.shapes.find(a=>a.id===o);if(r)return t.find(a=>r.x>=a.x&&r.y>=a.y&&r.x+r.width<=a.x+a.width&&r.y+r.height<=a.y+a.height)};let i=0;for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.endpoints.length<2)continue;const r=n(o.endpoints[0]),a=n(o.endpoints[1]);if(!r||!a||r.id===a.id)continue;const s=Math.min(r.y,a.y),c=Math.max(r.y+r.height,a.y+a.height);t.some(l=>l.id!==r.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function lm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Oc.has(o.type)&&!i.has(o.id)&&o.x>=n.x&&o.y>=n.y&&o.x+o.width<=n.right&&o.y+o.height<=n.bottom).map(o=>o.id).sort()}function um(e){var n;const t=(n=$t(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=$t(i);if((o==null?void 0:o.$type)!=="bwl:Members"||typeof o.refs!="string")continue;const r=o.refs.split(/\s+/).filter(Boolean);return r.length?r:void 0}}const pm=e=>e?{members:e}:{},hi=e=>e.shapes.filter(t=>!t.container);function ZR(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 o=i.endpoints.find(a=>a!==e.id),r=o?n.get(o):void 0;if(r&&r.type!=="bpmn:Group"){if(r.container)return r.id;if(r.parent)return r.parent}}}function QR(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const o=e.x+e.width/2,r=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&o>=a.x&&o<=a.x+a.width&&r>=a.y&&r<=a.y+a.height)}function fm(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((o,r)=>o.id.localeCompare(r.id)))if(vn(i).some(o=>Vi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(sa(i).some(o=>Vi(n,o)))return i.id;return null}function xr(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}const dm=3;function hm(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const o=/Event$/.test(t.type);if(!o&&!/Gateway$/.test(t.type))return Math.min(n,i);const r=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(r,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(o)return Math.max(0,t.width/2-Math.hypot(s-r,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-r)/l+Math.abs(c-a)/u))*Math.min(l,u))}function os(e,t){const n=[];for(const i of t.shapes){if(i.container||Oc.has(i.type))continue;const o=hm(e,i);o>=dm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function ut(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of bn(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const o=e.shapes.filter(m=>m.container&&NR.has(m.type));if(o.length){const m=(v,w)=>{const S=e.shapes.find(P=>P.id===w);return!!S&&S.x>=v.x&&S.y>=v.y&&S.x+S.width<=v.x+v.width&&S.y+S.height<=v.y+v.height};for(const v of e.edges)for(const w of bn(v,o))v.endpoints.includes(w.id)||v.endpoints.some(S=>m(w,S))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:w.id})}for(const m of e.edges){if(m.waypoints.length<2)continue;const v=[[m.source,m.waypoints[0]],[m.target,m.waypoints[m.waypoints.length-1]]];for(const[w,S]of v){if(!w)continue;const P=e.shapes.find(N=>N.id===w);if(!P||P.container)continue;const T=Math.max(P.x-S.x,S.x-(P.x+P.width),0),D=Math.max(P.y-S.y,S.y-(P.y+P.height),0),$=Math.hypot(T,D);$>VR&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:w,distance:Math.round($)})}}const r=e.shapes.filter(m=>m.type==="bpmn:Participant");for(let m=0;m<r.length;m++)for(let v=m+1;v<r.length;v++){const w=r[m],S=r[v];if(w.x+w.width<=S.x||S.x+S.width<=w.x||w.y+w.height<=S.y||S.y+S.height<=w.y)continue;const P=(T,D)=>T.x<=D.x&&T.y<=D.y&&T.x+T.width>=D.x+D.width&&T.y+T.height>=D.y+D.height;n.push({kind:"pool-overlap",pools:[w.id,S.id],contained:P(w,S)||P(S,w)})}const a=i.filter(m=>!m.attached);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const w=a[m],S=a[v];if(!Gp(w,S,$R))continue;const P=w.id<S.id?[w.id,S.id]:[S.id,w.id];n.push({kind:"shape-overlap",shapes:P,identical:YR(w,S)})}const s=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<s.length;m++)for(let v=m+1;v<s.length;v++){const w=s[m],S=s[v],P=Math.min(w.x+w.width,S.x+S.width)-Math.max(w.x,S.x),T=Math.min(w.y+w.height,S.y+S.height)-Math.max(w.y,S.y);if(P<=Dc||T<=Dc)continue;const D=w.id<S.id?[w.id,S.id]:[S.id,w.id],$=new Set(S.members);if(w.members.some(H=>$.has(H))){const H=lm(e,s,{x:Math.max(w.x,S.x),y:Math.max(w.y,S.y),right:Math.min(w.x+w.width,S.x+S.width),bottom:Math.min(w.y+w.height,S.y+S.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:D,shapes:H});continue}const N=w.x<=S.x&&w.y<=S.y&&w.x+w.width>=S.x+S.width&&w.y+w.height>=S.y+S.height?w.id:S.x<=w.x&&S.y<=w.y&&S.x+S.width>=w.x+w.width&&S.y+S.height>=w.y+w.height?S.id:void 0;n.push({kind:"group-overlap-unintended",groups:D,...N?{container:N}:{}})}const c=new Set(s.flatMap(m=>[...m.members])),l=m=>e.shapes.filter(v=>!v.container&&!Oc.has(v.type)&&v.x>=m.x&&v.y>=m.y&&v.x+v.width<=m.x+m.width&&v.y+v.height<=m.y+m.height);for(const m of s){const v=l(m);if(!v.length)continue;const w=new Set(m.members),S=v.filter(P=>!w.has(P.id));S.some(P=>c.has(P.id))&&(S.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:S.map(P=>P.id).sort()}))}for(const m of s){const v=new Set(l(m).map($=>$.id)),w=new Set(m.members),S=new Set([...v].filter($=>!w.has($)&&c.has($)));if(!S.size)continue;let P=!1,T=!1,D=!1;for(const $ of e.edges){if($.type!=="bpmn:SequenceFlow"||!$.source||!$.target)continue;const N=S.has($.source),H=S.has($.target);!N&&H&&!v.has($.source)?P=!0:N&&!H&&!v.has($.target)?T=!0:N&&H&&(D=!0)}P&&T&&D&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...S].sort()})}const u=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<u.length;m++)for(let v=m+1;v<u.length;v++)for(let w=v+1;w<u.length;w++){const S=[u[m],u[v],u[w]],P={x:Math.max(...S.map($=>$.x)),y:Math.max(...S.map($=>$.y)),right:Math.min(...S.map($=>$.x+$.width)),bottom:Math.min(...S.map($=>$.y+$.height))};if(P.right-P.x<=Dc||P.bottom-P.y<=Dc)continue;const T=lm(e,[],P);if(!T.length)continue;const D=S.map($=>$.id).sort();n.push({kind:"group-stack-unreadable",groups:D,shapes:T})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Oc.has(v.type)||v.width<=0||v.height<=0)continue;const w=[["top",m.y,"h",m.x,m.x+m.width],["bottom",m.y+m.height,"h",m.x,m.x+m.width],["left",m.x,"v",m.y,m.y+m.height],["right",m.x+m.width,"v",m.y,m.y+m.height]];for(const[S,P,T,D,$]of w){const N=T==="h"?v.x:v.y,H=T==="h"?v.x+v.width:v.y+v.height;if(!(N<$&&D<H))continue;const X=T==="h"?v.y:v.x,Q=T==="h"?v.y+v.height:v.x+v.width;if(!(X<P&&P<Q))continue;const ee=Math.min(P-X,Q-P);ee<jR||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:S,depth:ee})}}const p=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(p.length){const m=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const w=vn(v);if(w.length)for(const S of p){const P=S.x+S.width,T=S.y+S.height,D=v.endpoints.some(N=>{const H=m.get(N);return!!H&&S.x<H.x&&H.x<P&&S.y<H.y&&H.y<T});let $=null;for(const N of w){const[H,X,Q]=N.axis==="v"?[S.y,T,[["left",S.x],["right",P]]]:[S.x,P,[["top",S.y],["bottom",T]]],ee=Math.min(N.hi,X)-Math.max(N.lo,H);if(ee<Fp)continue;const Ve=N.axis==="v"?S.x<N.at&&N.at<P:S.y<N.at&&N.at<T;if(!(Ve&&D))for(const[qe,Ge]of Q){const Re=Math.abs(N.at-Ge);Re<=ra&&(!$||Re<$.distance)&&($={side:qe,inside:Ve,distance:Re,length:ee})}}$&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:S.id,side:$.side,inside:$.inside,distance:Math.round($.distance),length:Math.round($.length)})}}}const f=e.shapes.filter(m=>m.container&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Lane");for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const w=m.x<v.x+v.width&&v.x<m.x+m.width,S=m.y<v.y+v.height&&v.y<m.y+m.height,P=[["top",m.y,v.y,w],["bottom",m.y+m.height,v.y+v.height,w],["left",m.x,v.x,S],["right",m.x+m.width,v.x+v.width,S]];for(const[T,D,$,N]of P)N&&Math.abs(D-$)<=Zg&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:T})}const d=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<d.length;m++)for(let v=m+1;v<d.length;v++){const w=d[m],S=d[v],P=w.x<S.x+S.width&&S.x<w.x+w.width,T=w.y<S.y+S.height&&S.y<w.y+w.height,D=[["x",w.x+w.width,S.x,T],["x",S.x+S.width,w.x,T],["y",w.y+w.height,S.y,P],["y",S.y+S.height,w.y,P]];for(const[$,N,H,X]of D)if(X&&Math.abs(N-H)<=Zg){n.push({kind:"group-on-group-boundary",groups:w.id<S.id?[w.id,S.id]:[S.id,w.id],axis:$});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const w=e.edges[m],S=e.edges[v],P=br(w,S);if(!P)continue;const T=w.id<S.id?[w.id,S.id]:[S.id,w.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:P.axis,length:Math.round(P.length)})}for(const m of e.edges){if(!m.label)continue;const v=Ic(m,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:m.id,other:v.other,axis:v.axis})}for(const m of e.edges){if(!m.label)continue;const v=im(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}if(t.includeObservationOnly){for(const m of e.edges)if(!(!m.label||m.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:w}of os(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(w)})}const g=new Set(i.map(m=>m.id)),h=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...h.filter(v=>!g.has(v.id))]){if(!m.label)continue;const v=fm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const y=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of h)for(const{owner:v,rect:w}of xr(e))v===m.id||y.has(v)||Gp(m.label,w,aa)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const _=xr(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:w}of _)v!==m.id&&Gp(m,w,aa)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const x=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??ZR(m,e,x);if(!v)continue;const w=x.get(v);!w||!w.container||UR(w,m,WR)||m.type==="bpmn:TextAnnotation"&&!QR(m,w,e)||n.push({kind:"shape-outside-container",shape:m.id,container:w.id})}return n.sort((m,v)=>ct(m).localeCompare(ct(v)))}const $t=e=>typeof e=="object"&&e!==null?e:void 0,Xt=e=>typeof e=="number"?e:0,lo=e=>{const t=$t(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function JR(e){const t=$t(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const o=t[i];for(const r of Array.isArray(o)?o:[o]){const a=lo(r);a&&n.push(a)}}return n}function eC(e){const t=$t(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:lo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:lo(t.targetRef);return n&&i?{source:n,target:i}:{}}function tC(e,t){const n=$t(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=lo(n);return o?t.get(o):void 0}if(kc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return lo(n)}function gm(e){var a,s,c,l,u;const t=[],n=[],i=((a=$t(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=$t(e))==null?void 0:s.rootElements)??[]){const f=$t(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=$t(d),h=lo(g),y=lo(g==null?void 0:g.processRef);h&&y?o.set(y,h):h&&r.add(h)}}for(const p of i){const f=$t((c=$t(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=$t(g);if(!h)continue;const y=$t(h.bpmnElement),_=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!_)continue;const x=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",m=$t(h.bounds);if(m){const w=h.isExpanded===!1&&x!=="bpmn:Participant",S=$t((l=$t(h.label))==null?void 0:l.bounds),P={id:_,type:x,x:Xt(m.x),y:Xt(m.y),width:Xt(m.width),height:Xt(m.height),container:kc.has(x)&&!w,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:tC(y,o)}:{},...S?{label:{x:Xt(S.x),y:Xt(S.y),width:Xt(S.width),height:Xt(S.height)}}:{},...x==="bpmn:Group"?pm(um(y)):{}},T=h.isHorizontal!==!1,D=typeof(y==null?void 0:y.name)=="string"?y.name:"";r.has(_)&&T&&D&&(P.label=jp(P,D)),t.push(P);continue}const v=h.waypoint;if(Array.isArray(v)){const w=$t((u=$t(h.label))==null?void 0:u.bounds);n.push({id:_,type:x,waypoints:v.map(S=>{var P,T;return{x:Xt((P=$t(S))==null?void 0:P.x),y:Xt((T=$t(S))==null?void 0:T.y)}}),endpoints:JR(y),...eC(y),...w?{label:{x:Xt(w.x),y:Xt(w.y),width:Xt(w.width),height:Xt(w.height)}}:{}})}}}return{shapes:t,edges:n}}function mm(e){return ut(gm(e),{includeObservationOnly:!0})}async function nC(e){const{definitions:t,warnings:n}=await na(e);return{findings:mm(t),warnings:n}}function We(e){var i;const t=[],n=[];for(const o of e.getAll()){const r=o;if(r.type==="label"||r.labelTarget)continue;const a=typeof r.type=="string"?r.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=r.waypoints;if(s){const h=$t(r.label),y=lo(r.source),_=lo(r.target);n.push({id:r.id,type:a,waypoints:s.map(x=>({x:Xt(x.x),y:Xt(x.y)})),endpoints:[y,_].filter(x=>!!x),...y&&_?{source:y,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Xt(h.y),width:Xt(h.width),height:Xt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=$t(r.businessObject),l=$t(r.label);let u=$t(r.parent);for(;u&&u.type==="bpmn:Lane";)u=$t(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&kc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:r.id,type:a,x:r.x,y:r.y,width:Xt(r.width),height:Xt(r.height),container:kc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Xt(l.y),width:Xt(l.width),height:Xt(l.height)}}:{},...a==="bpmn:Group"?pm(um(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=$t(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=jp(d,g)),t.push(d)}return{shapes:t,edges:n}}const iC={"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 oC(e,t){const n=iC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function ym(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function vm(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 oC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&ym(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?ym(i):void 0},endpointsOf:n=>{var o,r;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(o=i.source)==null?void 0:o.id,target:(r=i.target)==null?void 0:r.id}},eventDefinitionOf:n=>{var r;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const o=(((r=i.businessObject)==null?void 0:r.eventDefinitions)??[]).map(a=>a.$type);return pp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:To(i.businessObject).map(o=>o.locale)}}}const Wp=20,rC=4,_t=(e,t)=>Math.abs(e-t)<.5;function Bc(e,t,n,i=Wp){if(_t(e.y,t.y)&&!_t(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x);if(!(o<n.x-i&&n.x+n.width+i<r))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=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(_t(e.x,t.x)&&!_t(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y);if(!(o<n.y-i&&n.y+n.height+i<r))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=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function bm(e,t,n,i=Wp){if(n.length<2)return null;if(_t(e.y,t.y)&&!_t(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(o<a&&s<r))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(_t(e.x,t.x)&&!_t(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(o<a&&s<r))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function xm(e,t,n=Wp){if(e.length!==4)return null;const[i,o,r,a]=e;if(_t(i.y,o.y)&&_t(o.x,r.x)&&_t(r.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(_t(i.x,o.x)&&_t(o.y,r.y)&&_t(r.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 Nc(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(o>=i.y&&o<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=o>r,l=[{x:n.x+n.width,y:o},{x:a,y:o},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:r},{x:i.x,y:r}];return[l,u]}const $c=30,aC=[0,-25,25,-40,40];function sC(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+$c:s-$c,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return aC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>bn({...e,endpoints:[],waypoints:f},[n]).length===0)}const Up=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],la=(e,t,n)=>bn({...e,waypoints:t},n).length;function qp(e,t,n,i){let o=[...e.waypoints],r=la(e,o,t);if(r===0)return null;let a=!1;for(const p of Nc(e,t))if(la(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(vn),c=p=>vn({...e,waypoints:p}).some(f=>Lc(f,s).length>0),l=sC(e,t).filter(p=>la(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&_t(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(_t(d[0].y,d[1].y)&&!_t(d[0].x,d[1].x)){const g=t.filter(x=>!e.endpoints.includes(x.id)&&bn({...e,waypoints:d},[x]).length>0),h=g.length>=2?bm(d[0],d[1],g):null,_=(h?h.map(x=>[d[0],...x,d[1]]):g.length===1?(Bc(d[0],d[1],g[0])??[]).map(x=>[d[0],...x,d[1]]):g.length===0?[d]:[]).filter(x=>la(e,x,t)===0&&x.length<=o.length).sort((x,m)=>Number(u(m))-Number(u(x)));if(_.length)return _.find(x=>!c(x))??_[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&bn({...e,waypoints:[f,d]},[_]).length>0);if(g.length<2)continue;const h=bm(f,d,g);if(!h)continue;const y=h.map(_=>Up(o,p,_)).filter(_=>la(e,_,t)===0).sort((_,x)=>Number(u(x))-Number(u(_)));if(y.length)return y.find(_=>!c(_))??y[0]}for(let p=0;p<rC&&r>0;p++){let f=!1;for(let d=0;d+1<o.length&&!f;d++){const g=o[d],h=o[d+1];for(const y of t){if(e.endpoints.includes(y.id)||bn({...e,waypoints:[g,h]},[y]).length===0)continue;const _=Bc(g,h,y),x=_?_.map(v=>Up(o,d,v)):xm(o,y)??[];if(!x.length)continue;const m=[...x].sort((v,w)=>Number(u(w))-Number(u(v)));for(const v of m){const w=la(e,v,t);if(w<r){o=v,r=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function Yp(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=hi(r),s=new Set,c=ut(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ct(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=r.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=bn(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const y=qp(p,a,g,r.edges);if(!y){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const _=r.edges.filter(v=>v.id!==u),x=fi(p,_);fi({...p,waypoints:y},_)>x||o.updateWaypoints(f,y)}return s}const cC=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,o.x)-1,y:Math.min(i.y,o.y)-1,width:Math.max(2,Math.abs(o.x-i.x)+2),height:Math.max(2,Math.abs(o.y-i.y)+2),container:!1,attached:!1})}return t};function Kp(e){const t=e.parent;return t&&typeof t.x=="number"&&typeof t.width=="number"?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0}const Xp=(e,t)=>!t||e.every(n=>n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height),Zp=(e,t)=>is(e,[t])>0;function _m(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=hi(r);let s=r;const c=new Set(ut(r).map(ct));for(const[l,u]of ca(r))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(P=>P.id===p),g=s.edges.find(P=>P.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const y=Kp(h),_=cC(g),x=[...Nc(d,a)??[]],m=qp(d,[...a,..._],y,r.edges);m&&x.push(m);for(let P=0;P+1<d.waypoints.length;P++)for(const T of _)for(const D of Bc(d.waypoints[P],d.waypoints[P+1],T)??[])x.push(Up(d.waypoints,P,D));const v=s.edges.filter(P=>P.id!==p),w=P=>({...s,edges:s.edges.map(T=>T.id===p?{...T,waypoints:P}:T)}),S=x.find(P=>{const T={...d,waypoints:P};return Zp(T,g)||!Xp(P,y)||v.some(D=>D.id!==f&&!Zp(d,D)&&Zp(T,D))?!1:ut(w(P)).every(D=>c.has(ct(D)))});if(S){o.updateWaypoints(h,S),s=w(S);break}}}const lC=["top","bottom","left","right"],wm={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},rs=20,uC=20;function pC(e,t){const n=e.x>=t.x-.5&&e.x<=t.x+t.width+.5,i=e.y>=t.y-.5&&e.y<=t.y+t.height+.5,o=[];return n&&_t(e.y,t.y)&&o.push("top"),n&&_t(e.y,t.y+t.height)&&o.push("bottom"),i&&_t(e.x,t.x)&&o.push("left"),i&&_t(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const fC=(e,t)=>t==="top"?{x:e.x+e.width/2,y:e.y}:t==="bottom"?{x:e.x+e.width/2,y:e.y+e.height}:t==="left"?{x:e.x,y:e.y+e.height/2}:{x:e.x+e.width,y:e.y+e.height/2};function Em(e,t,n,i){const o=wm[t],r=wm[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",f=a?"x":"y",d=o[p],g=r[p];if(_t(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=rs?[e,n]:null;let h;if(d===-g){const _=e[p]+d*rs,x=n[p]-d*rs;if(d*(x-_)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+$c:Math.min(e[p],n[p])-$c;const y=(_,x)=>a?{x,y:_}:{x:_,y:x};return[e,y(h,e[f]),y(h,n[f]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=rs&&u>=rs?[e,c,n]:null}function dC(e,t,n){const i=e.waypoints;if(i.length<2||!e.source||!e.target||e.source===e.target)return[];const o=e.source===t.id,r=n.get(o?e.target:e.source),a=o?i[i.length-1]:i[0],s=r?pC(a,r):null;if(!s)return[];const c=[];for(const l of lC){const u=fC(t,l),p=o?Em(u,l,a,s):Em(a,s,u,l);p&&c.push(p)}return c}const Sm=e=>e.slice(1).reduce((t,n,i)=>t+Math.abs(n.x-e[i].x)+Math.abs(n.y-e[i].y),0);function hC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ut(r).map(ct));let c=r;for(const[l,u]of Lo(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(D=>D.id===l),f=c.edges.find(D=>D.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Lo({edges:[p,f]}).length)continue;const d=p.endpoints.find(D=>f.endpoints.includes(D)),g=d?a.get(d):void 0;if(!g||g.container)continue;const h=i.get(l),y=i.get(u);if(!h||!y)continue;const _=D=>n.has(D.id)?[D.waypoints]:[D.waypoints,...dC(D,g,a)],x=D=>D.length-2,m=_(p).flatMap(D=>_(f).map($=>({pa:D,pb:$}))).filter(({pa:D,pb:$})=>D!==p.waypoints||$!==f.waypoints).map(D=>({...D,cost:Sm(D.pa)+Sm(D.pb)+uC*(x(D.pa)+x(D.pb))})).sort((D,$)=>D.cost-$.cost),v=Kp(h),w=Kp(y),S=Lo(c).length,P=new Set(ca(c).map(([D,$])=>`${D}|${$}`)),T=m.find(({pa:D,pb:$})=>{const N={...p,waypoints:D},H={...f,waypoints:$};if(Lo({edges:[N,H]}).length||br(N,H)||!Xp(D,v)||!Xp($,w))return!1;const X={...c,edges:c.edges.map(Q=>Q.id===l?N:Q.id===u?H:Q)};return Lo(X).length>=S||ca(X).some(([Q,ee])=>!P.has(`${Q}|${ee}`))?!1:ut(X).every(Q=>s.has(ct(Q)))});T&&(T.pa!==p.waypoints&&o.updateWaypoints(h,T.pa),T.pb!==f.waypoints&&o.updateWaypoints(y,T.pb),c={...c,edges:c.edges.map(D=>D.id===l?{...p,waypoints:T.pa}:D.id===u?{...f,waypoints:T.pb}:D)})}}const gC=10;function Rm(e,t){if(e.parent){const o=t.find(r=>r.id===e.parent);if(o)return o}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(o=>n>=o.x&&n<=o.x+o.width&&i>=o.y&&i<=o.y+o.height)}function Cm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),o=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!o)return null;const r=Rm(i,n),a=Rm(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(H=>H.id!==r.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,X)=>H.y-X.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,y=s?g:d,_=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],m=hi(t),v=t.edges.filter(H=>H.id!==e.id),w=di(e,v),S=bn(e,m).length;if(w===0&&S===0||S===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(H=>H.x)),T=Math.max(...u.map(H=>H.x+H.width)),D=(_.x+x.x)/2,$=H=>H.filter((X,Q)=>Q===0||!(_t(X.x,H[Q-1].x)&&_t(X.y,H[Q-1].y)));let N;for(let H=P;H<=T;H+=gC){const X=$([_,{x:_.x,y:h},{x:H,y:h},{x:H,y},{x:x.x,y},x]),Q={...e,waypoints:X};if(bn(Q,m).length>0)continue;const ee=di(Q,v),Ve=Math.abs(H-D);(!N||ee<N.cross||ee===N.cross&&Ve<N.detour)&&(N={pts:X,cross:ee,detour:Ve})}return N&&(S>0?N.cross<=w:N.cross<w)?N.pts:null}function Mm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=We(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Cm(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Wi=[25,-25,40,-40],ua=35;function mC(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,o=[];for(const r of[!0,!1]){const a=r?e.y:e.y+e.height,s=r?t.y:t.y+t.height,c=r?Math.min(e.y,t.y)-ua:Math.max(e.y+e.height,t.y+t.height)+ua;for(const l of[0,...Wi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Wi]){if(Math.abs(u)>=t.width/2-5)continue;const p=n+l,f=i+u;o.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return o}function Fc(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 o=n.y+n.height/2;if(o>=i.y&&o<=i.y+i.height)return mC(n,i);const r=i.x+i.width/2,a=n.x+n.width/2,s=o<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-ua:n.y+n.height+ua,p=[];for(const x of[0,...Wi]){if(Math.abs(x)>=i.width/2-5)continue;const m=r+x;p.push({pts:[{x:n.x,y:o},{x:m,y:o},{x:m,y:c}],cost:Math.abs(x)});for(const v of[0,...Wi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;p.push({pts:[{x:w,y:l},{x:w,y:u},{x:m,y:u},{x:m,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const x of[0,...Wi]){if(Math.abs(x)>=n.width/2-5)continue;const m=a+x;p.push({pts:[{x:m,y:g},{x:m,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,y=s?i.y+i.height:i.y,_=s?i.y+i.height+ua:i.y-ua;for(const x of[0,...Wi]){if(Math.abs(x)>=i.width/2-5)continue;const m=r+x;for(const v of[0,...Wi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;p.push({pts:[{x:w,y:g},{x:w,y:_},{x:m,y:_},{x:m,y}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const jc=30;function Am(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=_t(i.y,o.y)&&!_t(i.x,o.x),a=_t(i.x,o.x)&&!_t(i.y,o.y);if(!(!r&&!a))for(const s of t)if(r){const c=Math.min(i.x,o.x);if(Math.max(i.x,o.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<jc||Math.abs(i.y-(s.y+s.height))<jc)return!0}else{const c=Math.min(i.y,o.y);if(Math.max(i.y,o.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<jc||Math.abs(i.x-(s.x+s.width))<jc)return!0}}return!1}const Hc=40;function yC(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-Hc,a=o.x+o.width+Hc,s=o.y-Hc,c=o.y+o.height+Hc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>r&&f.y<c&&d.y>s){i++;break}}}return i}function Pm(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(S=>S.container),i=new Map(t.shapes.map(S=>[S.id,S])),o=hi(t),r=t.edges.filter(S=>S.id!==e.id),a=fi(e,r),s=di(e,r),c=S=>yC(S,t.shapes,e.endpoints)+(Am(S,n)?1:0),l=c(e.waypoints),u=S=>{if(!S)return;const P=S.x+S.width/2,T=S.y+S.height/2;return n.find(D=>D.type==="bpmn:Lane"&&P>=D.x&&P<=D.x+D.width&&T>=D.y&&T<=D.y+D.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=S=>{if(!d||!f)return!1;for(let P=1;P<S.length-2;P++){const T=S[P],D=S[P+1];if(_t(T.y,D.y)&&!_t(T.x,D.x)&&T.y>f.y&&T.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),_=(S=>{if(!S)return;const P=S.x+S.width/2,T=S.y+S.height/2;return n.filter(D=>D.type==="bpmn:Participant"&&P>=D.x&&P<=D.x+D.width&&T>=D.y&&T<=D.y+D.height).sort((D,$)=>D.width*D.height-$.width*$.height)[0]})(i.get(e.endpoints[0]??"")),x=S=>{if(!_)return 0;let P=0;for(let T=1;T<S.length-1;T++){const D=S[T];(D.x<_.x||D.x>_.x+_.width||D.y<_.y||D.y>_.y+_.height)&&P++}return P},m=x(e.waypoints);if(!Am(e.waypoints,n)&&!(d&&!h)&&m===0)return null;const v=S=>S.reduce((P,T,D)=>D?P+Math.abs(T.x-S[D-1].x)+Math.abs(T.y-S[D-1].y):0,0);let w;for(const{pts:S,cost:P}of Fc(e,i)){const T={...e,waypoints:S};if(bn(T,o).length>0)continue;const D=fi(T,r);if(D>a)continue;const $=x(S);if($>m)continue;const N=$<m&&D===0;if(!N&&di(T,r)>s)continue;const H=c(S),X=g(S);if(!N&&!(X&&!h)&&H>=l)continue;const ee=X?0:1,Ve=v(S);(!w||$<w.out||$===w.out&&(ee<w.lane||ee===w.lane&&(D<w.opp||D===w.opp&&(H<w.sc||H===w.sc&&(P<w.cost||P===w.cost&&Ve<w.len)))))&&(w={pts:S,out:$,sc:H,lane:ee,opp:D,cost:P,len:Ve})}return(w==null?void 0:w.pts)??null}function vC(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,o=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),r=o.filter(p=>p.endpoints[1]===i),a=o.filter(p=>p.endpoints[0]===i);if(r.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function bC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=We(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=hi(s),u=s.edges.filter(y=>y.id!==a),p=bn(c,l).length,f=fi(c,u),d=di(c,u),g=n.has(a)?new Set(ut(s).map(ct)):null,h=Nc(c,s.shapes);h.length===2&&vC(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const _={...c,waypoints:y};if(bn(_,l).length>p||fi(_,u)>f||di(_,u)>d)continue;if(g){const m=new Set(ut({...s,edges:s.edges.map(S=>S.id===a?_:S)}).map(ct)),v=[...m].filter(S=>!g.has(S)).length,w=[...g].filter(S=>!m.has(S)).length;if(v>w)continue}const x=i.get(a);x&&o.updateWaypoints(x,y);break}}}function Tm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=We(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=Pm(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Qp(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],o=t.get(e.endpoints[0]??""),r=t.get(e.endpoints[1]??""),a=_t(n[0].x,n[1].x)&&!_t(n[0].y,n[1].y),s=_t(n[n.length-1].x,n[n.length-2].x)&&!_t(n[n.length-1].y,n[n.length-2].y);for(const c of Wi){if(a&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function xC(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,y=[];for(const _ of[0,...Wi])Math.abs(_)<i.width/2-5&&y.push({pts:[{x:f,y:l},{x:u+_,y:l},{x:u+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:p+_},{x:g,y:p+_}],cost:Math.abs(_)});return y}function Jp(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const o=Math.max(n.x,i.x),r=Math.min(n.x+n.width,i.x+i.width);if(r-o<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(o+r)/2,p=[];for(const f of[0,...Wi]){const d=u+f;d<=o||d>=r||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function km(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=hi(t),o=t.edges.filter(d=>d.id!==e.id),r=fi(e,o);if(r===0)return null;const a=di(e,o);let s;const c=d=>d.reduce((g,h,y)=>y?g+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],y=Math.hypot(h.x-g.x,h.y-g.y);return y>=1&&c(d)/y>=l?1:0},p=u(e.waypoints),f=[...Fc(e,n),...Jp(e,n),...Qp(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(bn(h,i).length>0)continue;const y=fi(h,o),_=di(h,o),x=r-y+(p-u(d));if(y>=r||_-a>x)continue;const m=c(d);(!s||y<s.opposite||y===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&m<s.len)))&&(s={pts:d,opposite:y,cross:_,cost:g,len:m})}return(s==null?void 0:s.pts)??null}function Om(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=br(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function _C(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=hi(t),o=t.edges.filter(f=>f.id!==e.id),r=Om(e,o);if(r===0)return null;const a=fi(e,o),s=di(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Fc(e,n),...Jp(e,n),...xC(e,n),...Qp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(bn(g,i).length>0)continue;const h=Om(g,o);if(h>=r)continue;const y=fi(g,o);if(y-h>a-r)continue;const _=di(g,o);if(_-s>(r-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:y,cross:_,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function Dm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ut(We(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ct(s)));if(!r.length)return;const a=new Set;for(const s of r)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=We(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=_C(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Lm(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function Im(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=br(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,o]=e.endpoints,[r,a]=t.endpoints,s=[i,o].filter(u=>u&&(u===r||u===a)).length;return!(!!o&&o===r||!!a&&a===i)||s!==1?!1:Lm(e,n)&&Lm(t,n)}function Bm(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Im(e,o,n)&&i++;return i}function wC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=hi(t),o=t.edges.filter(f=>f.id!==e.id),r=Bm(e,o,n);if(r===0)return null;const a=fi(e,o),s=di(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Fc(e,n),...Jp(e,n),...Qp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(bn(g,i).length>0)continue;const h=Bm(g,o,n);if(h>=r)continue;const y=fi(g,o);if(y-h>a-r)continue;const _=di(g,o);if(_-s>(r-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:y,cross:_,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function EC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ut(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ct(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!Im(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=We(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=wC(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function Nm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=ut(r).filter(u=>Hp(u)&&!t.has(ct(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Hp(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=r.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=We(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=km(f,p);if(!d)continue;const g=i.get(u);g&&o.updateWaypoints(g,d)}}const SC=10,RC=(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 $m(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ic(e,i))return null;const o=hi(t),r=i.flatMap(vn);for(const a of vn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Lc(a,r))s=s.flatMap(([h,y])=>{const _=[];return d>h&&_.push([h,Math.min(y,d)]),g<y&&_.push([Math.max(h,g),y]),_.filter(([x,m])=>m>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+SC*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-tm}:{x:a.at+Pn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Ic({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&RC(f,d)))return f}return null}const Pn=8;function ef(e,t){const n=e.label;if(!n)return null;const i=vn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=f=>{const d=f.axis==="h"?o:r,g=f.axis==="h"?r-f.at:o-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(vn),...t.shapes.filter(f=>f.container).flatMap(sa)],l=f=>!c.some(d=>Vi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Pn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Pn,s.at-Pn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-Pn-n.height,s.at+Pn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const Fm=30,CC=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const o=t[i],r=t[i+1],a=r.x-o.x,s=r.y-o.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-o.x)*a+(e.y-o.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(o.x+l*a),e.y-(o.y+l*s)))}return n},jm=(e,t)=>CC({x:e.x+e.width/2,y:e.y+e.height/2},t);function MC(e,t){const n=e.label;if(!n)return null;const i=vn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(vn),...t.shapes.filter(c=>c.container).flatMap(sa)],r=xr(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!o.some(l=>Vi(c,l))&&!os(c,t).length&&!r.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+Pn,c.at-Pn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Pn,c.at-Pn-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function Hm(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let o=We(n),r=new Set(ut(o).map(ct));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((S,P)=>S.x-u[P].x===d&&S.y-u[P].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const S=o.edges.find(N=>N.id===c);if(!(S!=null&&S.label)||!os(S.label,o).length)continue;let P={...S.label,x:l.label.x,y:l.label.y};if((os(P,o).length||jm(P,S.waypoints)>Fm)&&(P=null),!P&&jm(S.label,S.waypoints)>Fm&&(P=MC(S,o)),!P)continue;const T=P,D={...o,edges:o.edges.map(N=>N.id===c?{...N,label:T}:N)},$=ut(D);if($.some(N=>!r.has(ct(N))))continue;i.moveElements([f],{x:T.x-f.x,y:T.y-f.y}),o=D,r=new Set($.map(ct));continue}const y=l.label.x+d-f.x,_=l.label.y+g-f.y;if(y===0&&_===0)continue;const x=o.edges.find(S=>S.id===c);if(!(x!=null&&x.label))continue;const m={...x.label,x:x.label.x+y,y:x.label.y+_},v={...o,edges:o.edges.map(S=>S.id===c?{...S,label:m}:S)},w=ut(v);w.some(S=>!r.has(ct(S)))||(i.moveElements([f],{x:y,y:_}),o=v,r=new Set(w.map(ct)))}}function zm(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=We(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=ef(a,r);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&o.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function Gm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=ut(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ct(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=$m(c,r);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&o.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function Vm(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(vn),...t.shapes.filter(f=>f.container).flatMap(sa)],o=i.filter(f=>Vi(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=xr(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Vi(f,d))&&!r.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of o)f.axis==="h"?l.push({...n,y:f.at-Pn-n.height},{...n,y:f.at+Pn}):l.push({...n,x:f.at-Pn-n.width},{...n,x:f.at+Pn});const u=e.x+e.width/2,p=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+Pn},{...n,x:u-n.width/2,y:e.y-Pn-n.height},{...n,x:e.x+e.width+Pn,y:p-n.height/2},{...n,x:e.x-Pn-n.width,y:p-n.height/2}),l.find(c)??null}function Wm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=Vm(r,We(n));if(!a)continue;const s=n.get(r.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function AC(e,t){const n=e.x,i=e.x+e.width,o=e.y,r=e.y+e.height;if(t.x<n||t.x>i||t.y<o||t.y>r)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,o),r))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-o,{x:t.x,y:o}],[r-t.y,{x:t.x,y:r}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function Um(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=We(n),r=new Set(ut(o).map(ct));const a=[...new Set(ut(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,y]of u){const _=h?o.shapes.find(m=>m.id===h):void 0;if(!_)continue;const x=AC(_,l[y]);x.x===l[y].x&&x.y===l[y].y||(l[y]=x,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=ut(f);if(d.some(h=>!r.has(ct(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(ct)))}}const tf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function qm(e,t){const n=(o,r,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>r?`${r}.${u}`:u;return{id:o,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((o,r)=>n(o.id,`participant.lanes[${r}]`,o))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((o,r)=>({...n(o.id,`lanes[${r}]`,o),omittedMeansRemove:(t==null?void 0:t.categoryOf(o.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function PC(e,t,n){const i=[],o=n?Za(n):[];return e.forEach((r,a)=>{if(r.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:r.id,field:"locale"});return}if(!o.includes(r.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:r.id,field:"locale",locale:r.locale,locales:o});return}t.categoryOf(r.id)!==void 0&&!t.reviewRequestLocalesOf(r.id).includes(r.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:r.id,locale:r.locale});return}for(const s of qm(r,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:o});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:o});continue}if(!l)continue;if(!tf(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):o.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:o}),p=!1);if(!p)continue;const f=o.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function bi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function TC(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:o}=n,r=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(tf(c.map)){const l=c.map;return r(c.id).texts={...l},l[o]}if(c.plain===null||c.condition===null&&c.plain===void 0){r(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(r(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=r(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=qm(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=bi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=bi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:bi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:bi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:bi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:bi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(bi(c,"text",a(l[0])));break;default:s.push(tf(l[0].map)?bi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const kC=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Ym=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Km={"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"]},{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}],"translation.confirm":[{path:"id",shape:null},{path:"locale",shape:null}],"element.remove":[{path:"id",shape:null}]},as=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),zc=e=>typeof e=="string"&&e!=="";function OC(e){const t=[];function n(i,o,r,a){if(a===null){zc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!as(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)zc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!as(i)||!zc(i.kind)||!(i.kind in Km)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of Km[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!as(f))break;f=f[g]}if(!as(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(o,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}d.forEach((g,h)=>n(o,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;as(c)&&!zc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!vg(l)){t.push({kind:"node-type-unsupported",opIndex:o,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!bg(p)){t.push({kind:"payload-invalid",opIndex:o,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:o,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function Xm(e,t,n={}){const i=OC(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,y,_){if(!kC.test(y)){o.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||r.has(y)){o.push({kind:"id-duplicate",opIndex:h,id:y});return}r.set(y,{..._,opIndex:h})}e.forEach((h,y)=>{var _;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(y,x.id,{category:"lane"});break;case"node.add":s(y,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(y,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,h.dataStore.id,{category:"dataStore"});for(const x of h.associations??[])x.id&&s(y,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(y,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(y,h.association.id,{category:"association"});break;case"annotation.add":s(y,h.annotation.id,{category:"annotation"}),(_=h.association)!=null&&_.id&&s(y,h.association.id,{category:"association"});break;case"group.add":s(y,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(y,x.id,{category:"lane"})}break}});const c=h=>{var y;return((y=r.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=r.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,_,x){const m=c(y);if(m===void 0){o.push({kind:"ref-missing",opIndex:h,ref:y,role:_});return}if(x&&!x.includes(m)){o.push({kind:"ref-category",opIndex:h,ref:y,role:_,expected:x.join("|"),actual:m});return}return m}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var _;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:x,lane:m}=h.node;if(x===void 0){(p||m!==void 0)&&o.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,x,"participant",["participant"])===void 0)break;m!==void 0&&((((_=r.get(x))==null?void 0:_.lanes)??a.get(x)??t.lanesOf(x)).includes(m)||o.push({kind:"lane-unknown",opIndex:y,lane:m,participant:x}));break}case"sequenceFlow.add":{const{id:x,source:m,target:v,name:w,condition:S}=h.flow,P=u(y,m,"source",["flowNode"]),T=u(y,v,"target",["flowNode"]);P&&T&&l(m)!==l(v)&&o.push({kind:"flow-cross-pool",opIndex:y,id:x}),w!==void 0&&S!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:x});break}case"messageFlow.add":{const{id:x,source:m,target:v}=h.flow,w=u(y,m,"source",["flowNode","participant"]),S=u(y,v,"target",["flowNode","participant"]);if(w&&S){const P=l(m),T=l(v);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:y,id:x})}for(const P of[m,v])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:y,id:x,ref:P});break}case"dataStore.add":{for(const x of h.associations??[]){if([x.source,x.target].filter(w=>w===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:y,source:x.source,target:x.target});continue}const v=x.source===h.dataStore.id?x.target:x.source;u(y,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:x,target:m}=h.association,v=u(y,x,"source"),w=u(y,m,"target");if(v&&w){const S=new Set([v,w]);S.has("dataStore")&&S.has("flowNode")||o.push({kind:"data-association-ends",opIndex:y,source:x,target:m})}break}case"association.add":{const{id:x,source:m,target:v}=h.association,w=u(y,m,"source"),S=u(y,v,"target");w&&S&&w!=="annotation"&&S!=="annotation"&&o.push({kind:"association-detached",opIndex:y,annotation:x??`${m}->${v}`});break}case"annotation.add":{if(h.association){const{source:x,target:m}=h.association;if(x!==h.annotation.id&&m!==h.annotation.id)o.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const v=x===h.annotation.id?m:x;u(y,v,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const x of h.group.members??[]){const m=u(y,x,"member");m&&Ym.has(m)&&o.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const x=t.lanesOf(h.id),m=h.lanes.map(w=>w.id);for(const w of x)m.includes(w)||o.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:w});for(const w of m)t.categoryOf(w)!==void 0&&!x.includes(w)&&o.push({kind:"id-duplicate",opIndex:y,id:w});const v=m.filter(w=>x.includes(w));v.length===x.length&&v.some((w,S)=>w!==x[S])&&o.push({kind:"lane-reorder-unsupported",opIndex:y,participant:h.id})}break}case"node.update":{if(g(y,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const x=t.participantOf(h.id);(x?a.get(x)??t.lanesOf(x):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:x??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const x=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,m=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),w=h.source??(v==null?void 0:v.source),S=h.target??(v==null?void 0:v.target);x&&m&&w!==void 0&&S!==void 0&&new Set([l(w),l(S),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:y,id:h.id})}break}case"messageFlow.update":g(y,h.id,"messageFlow");break;case"dataStore.update":g(y,h.id,"dataStore");break;case"annotation.update":{if(g(y,h.id,"annotation")===void 0)break;h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.update":{if(g(y,h.id,"group")===void 0)break;for(const x of h.members??[]){const m=u(y,x,"member");m&&Ym.has(m)&&o.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...PC(e,t,n.i18n)),o;function g(h,y,_){if(r.has(y)){o.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const x=t.categoryOf(y);if(x===void 0){o.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(_&&x!==_){o.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:_,actual:x});return}return x}}function Zm(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"),spaceTool:e.get("spaceTool")}}function Gc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Vc={"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]},Tn=10,DC=300,LC=160,Qm=20,nf=100,Jm=40,IC=10,BC=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function ey(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,o=t.y+t.height/2;let r;for(const a of e.getAll()){if(a.type!=="bpmn:Lane")continue;const s=a;typeof s.x!="number"||typeof s.width!="number"||i>=s.x&&i<=s.x+s.width&&o>=s.y&&o<=s.y+s.height&&(!r||s.width*s.height<r.width*r.height)&&(r=s)}return r?{x:n.x,width:n.width,y:r.y,height:r.height}:void 0}const Wc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function Uc(e,t,n,i,o){const r=n,a=ey(e,t,i),s=a??i,c=(X,Q,ee=s)=>{const[Ve,qe]=Vc[X];let Ge={x:t.x+t.width/2+Ve*(t.width/2+r.width/2+Q),y:t.y+t.height/2+qe*(t.height/2+r.height/2+Q)};const Re=ee.x+Tn+r.width/2,Z=ee.x+ee.width-Tn-r.width/2,oe=ee.y+Tn+r.height/2,W=ee.y+ee.height-Tn-r.height/2,Y={x:Math.min(Z,Math.max(Re,Ge.x)),y:Math.min(W,Math.max(oe,Ge.y))};return(Y.x!==Ge.x||Y.y!==Ge.y)&&(Ge=Math.abs(Y.x-(t.x+t.width/2))<(t.width+r.width)/2+Tn&&Math.abs(Y.y-(t.y+t.height/2))<(t.height+r.height)/2+Tn?{x:t.x+t.width+Tn+r.width/2,y:Y.y}:Y),Ge},l=(i.children??[]).filter(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="bpmn:Lane"&&X.type!=="label"&&typeof X.x=="number"&&X.id!==o.selfId),u=We(e),p=X=>{var ee,Ve;if(!o.selfId)return!1;const Q=e.get(X);return!!Q&&(((ee=Q.source)==null?void 0:ee.id)===o.selfId||((Ve=Q.target)==null?void 0:Ve.id)===o.selfId)},f=u.edges.filter(X=>!p(X.id)).flatMap(vn),d=xr(u).filter(X=>X.owner!==o.selfId).map(X=>X.rect),g=X=>({x0:X.x-r.width/2-Tn,x1:X.x+r.width/2+Tn,y0:X.y-r.height/2-Tn,y1:X.y+r.height/2+Tn}),h=X=>{const Q=g(X);return l.some(ee=>Q.x0<ee.x+ee.width&&Q.x1>ee.x&&Q.y0<ee.y+ee.height&&Q.y1>ee.y)},y=X=>{const Q=g(X);return f.some(ee=>ee.axis==="h"?ee.at>Q.y0&&ee.at<Q.y1&&ee.lo<Q.x1&&ee.hi>Q.x0:ee.at>Q.x0&&ee.at<Q.x1&&ee.lo<Q.y1&&ee.hi>Q.y0)},_=X=>{const Q=g(X);return d.some(ee=>Q.x0<ee.x+ee.width&&Q.x1>ee.x&&Q.y0<ee.y+ee.height&&Q.y1>ee.y)},x=u.shapes.filter(X=>X.type==="bpmn:Group").flatMap(X=>[{axis:"h",at:X.y,lo:X.x,hi:X.x+X.width},{axis:"h",at:X.y+X.height,lo:X.x,hi:X.x+X.width},{axis:"v",at:X.x,lo:X.y,hi:X.y+X.height},{axis:"v",at:X.x+X.width,lo:X.y,hi:X.y+X.height}]),m=X=>{const Q=g(X);return x.some(ee=>ee.axis==="h"?ee.at>Q.y0&&ee.at<Q.y1&&ee.lo<Q.x1&&ee.hi>Q.x0:ee.at>Q.x0&&ee.at<Q.x1&&ee.lo<Q.y1&&ee.hi>Q.y0)},v=X=>h(X)||y(X)||_(X)||m(X),w=X=>X.x-r.width/2>=i.x&&X.x+r.width/2<=i.x+i.width&&X.y-r.height/2>=i.y&&X.y+r.height/2<=i.y+i.height,S=X=>w(X)&&(!a||Wc(X,r,a));if(o.placement){const X=Re=>Re.startsWith("top")?Re.replace(/^top/,"bottom"):Re.replace(/^bottom/,"top"),Q=Re=>Re.endsWith("left")?Re.replace(/left$/,"right"):Re.replace(/right$/,"left"),ee=o.placement.side,Ve=[ee,X(ee),Q(ee),X(Q(ee)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=o.placement.offset??50;let Ge=c(ee,qe);if(v(Ge)||a&&!Wc(Ge,r,a)){const Re=(Z,oe)=>{const W=new Set;for(const Y of Ve){if(W.has(Y))continue;W.add(Y);const ae=c(Y,qe,Z);if(oe(ae)&&!v(ae))return Ge=ae,!0}return!1};!Re(s,S)&&a&&Re(i,w)}return Ge}const P=o.from,T=s.x+Tn+r.width/2,D=s.x+s.width-Tn-r.width/2,$=s.y+Tn+r.height/2,N=s.y+s.height-Tn-r.height/2;let H={x:Math.min(D,Math.max(T,P.x)),y:Math.min(N,Math.max($,P.y))};if(v(H)){const X=(t.width+r.width)/2+Tn,ee=[{x:H.x+X,y:H.y},{x:H.x-X,y:H.y},{x:H.x,y:H.y-r.height-Tn},{x:H.x,y:H.y+r.height+Tn}].filter(S).find(Ve=>!v(Ve));ee&&(H=ee)}return H}function en(e,t){return e.filter(n=>n.kind===t)}class ty extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function ny(e,t){var l1,u1,p1,f1,d1,h1,g1,m1,y1,v1,b1,x1,_1,w1,E1,S1,R1,C1,M1,A1,P1,T1,k1;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>r.get(b),f=b=>{const R=p(b);if(!R)throw new Error(`하강 참조 해소 실패: ${b}`);return R},d=b=>{let R=b.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},g=new Map;for(const b of r.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=en(e,"participant.add"),y=en(e,"node.add"),_=en(e,"sequenceFlow.add"),x=en(e,"messageFlow.add"),m=en(e,"dataStore.add"),v=en(e,"dataAssociation.add"),w=en(e,"annotation.add"),S=en(e,"group.add"),P=new Map(y.map(b=>[b.node.id,b])),T=(b,R,A)=>{var F;const k=b.businessObject,L=(((F=k.extensionElements)==null?void 0:F.values)??[]).filter(I=>I.$type!==R),O=A?[...L,i.create(R,A)]:L;if(!O.length){k.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:O});O.forEach(I=>{I.$parent=j}),n.updateProperties(b,{extensionElements:j})},D=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of en(e,"element.remove")){const R=p(b.id);R&&n.removeElements([R])}const $=b=>r.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=d(R))==null?void 0:A.id)===b}).sort((R,A)=>R.y-A.y);for(const b of en(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 A=$(b.id);if(!A.length){n.splitLane(R,b.lanes.length),$(b.id).forEach((L,O)=>{const j=b.lanes[O];j&&n.updateProperties(L,{id:j.id,name:j.name})});continue}const k=new Set(A.map(L=>L.id));b.lanes.forEach((L,O)=>{if(k.has(L.id)){n.updateProperties(f(L.id),{name:L.name});return}const j=O===0?n.addLane($(b.id)[0],"top"):n.addLane(f(b.lanes[O-1].id),"bottom");n.updateProperties(j,{id:L.id,name:L.name})})}const N=150,H=130,X=80,Q=90,ee=180,Ve=30,qe=30,Ge=(b,R,A,k,L)=>{const O=A-R.width/2,j=k-R.height/2;return(b.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(L!=null&&L.has(F.id))&&typeof F.x=="number"&&O<F.x+F.width+qe&&O+R.width+qe>F.x&&j<F.y+F.height&&j+R.height>F.y)},Re=new Set;for(const b of h){Re.add(`pool:${b.participant.id}`);for(const R of b.participant.lanes??[])Re.add(R.id)}const Z=new Map;for(const b of y){const R=b.node.lane??`pool:${b.node.participant??""}`;let A=Z.get(R);A||Z.set(R,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const oe=new Map;for(const[b,R]of Z){if(!Re.has(b))continue;const A=[...R].sort((O,j)=>O-j),k=A.map((O,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),L=Math.min(...k);oe.set(b,new Map(A.map((O,j)=>[O,k[j]-L])))}{const b=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,k)=>b.set(A.id,k));for(const[R,A]of oe){if(!b.has(R)||A.size<2)continue;const k=b.get(R),L=A.get(0)??0,O=new Set;for(const ne of y){if(ne.node.lane!==R||(ne.band??0)!==0||!ne.node.type.endsWith("Gateway"))continue;const he={in:new Set,out:new Set,cross:new Set};for(const fe of _){const ye=fe.flow.source===ne.node.id;if(!ye&&fe.flow.target!==ne.node.id)continue;const Ye=P.get(ye?fe.flow.target:fe.flow.source);if(!Ye||Ye.node.participant!==ne.node.participant||!Ye.node.lane)continue;let Ae,te=!1;if(Ye.node.lane!==R){const se=b.get(Ye.node.lane);if(se===void 0)continue;Ae=se>k?"down":"up",te=!0}else{const se=A.get(Ye.band??0)??L;Ae=se>L?"down":se<L?"up":void 0}Ae&&(he[ye?"out":"in"].add(Ae),te&&he.cross.add(Ae))}for(const fe of["up","down"])he.in.has(fe)&&he.out.has(fe)&&he.cross.has(fe)&&O.add(fe)}if(O.size!==1)continue;const[j]=O,F=Math.max(...A.values()),I=j==="down"?F:0;if(L===I)continue;const U=[...A.entries()].filter(([ne])=>ne!==0).sort((ne,he)=>ne[1]-he[1]),K=[...Array(F+1).keys()].filter(ne=>ne!==I),re=new Map([[0,I]]);U.forEach(([ne],he)=>re.set(ne,K[he])),oe.set(R,re)}}const W=b=>{var R;return(((R=Z.get(b))==null?void 0:R.size)??0)>1},Y=b=>b.band??(b.node.lane||!W(`pool:${b.node.participant??""}`)?void 0:0),ae=new Map,ge=b=>ae.get(b.node.id)??Y(b),Te=new Set,B=new Set;{const b=new Map;for(const k of _)b.set(k.flow.target,(b.get(k.flow.target)??0)+1);const R=k=>{const L=[],O=new Set([k]),j=[k];for(;j.length;){const F=j.shift();L.push(F);for(const I of _)I.flow.source!==F||O.has(I.flow.target)||(b.get(I.flow.target)??0)!==1||(O.add(I.flow.target),j.push(I.flow.target))}return L},A=(k,L)=>{var O;return((O=oe.get(k))==null?void 0:O.get(L))??L};for(const k of y){if(!k.node.type.endsWith("Gateway"))continue;const L=k.node.lane??`pool:${k.node.participant??""}`,O=oe.get(L);if(!O||O.size<2)continue;const j=ge(k);if(j===void 0||A(L,j)!==A(L,0))continue;const F=A(L,j),I=_.filter(fe=>fe.flow.source===k.node.id).map(fe=>P.get(fe.flow.target)).filter(fe=>!!fe&&(fe.node.lane??`pool:${fe.node.participant??""}`)===L),U=I.filter(fe=>{const ye=ge(fe);return ye!==void 0&&A(L,ye)===F&&(b.get(fe.node.id)??0)===1}),K=I.some(fe=>{const ye=ge(fe);return ye!==void 0&&A(L,ye)>F});if(U.length!==1||!K)continue;const re=new Set(I.flatMap(fe=>R(fe.node.id)));if(!_.some(fe=>fe.flow.target===k.node.id&&re.has(fe.flow.source)))continue;const he=new Map;for(const[fe,ye]of O)he.set(fe,ye+1);he.set(-1,0),oe.set(L,he);for(const fe of R(U[0].node.id))P.has(fe)&&(ae.set(fe,-1),B.add(fe));Te.add(k.node.id)}}const C=(b,R)=>{var A;return((A=oe.get(b))==null?void 0:A.get(R))??R},E=(b,R,A,k)=>{const L=b?p(b):R?p(R):void 0;if(!L)return!1;const O=b?L.y+Math.min(L.height/2,Q):L.y+X;return Math.abs(O+C(b??`pool:${R??""}`,A)*N-k)<=N/2},G=new Map;for(const[b,R]of Z){let A=0;for(const k of R)A=Math.max(A,C(b,k));G.set(b,A)}const q=b=>ee+N*b,ie=(b,R,A)=>{const k=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==R&&typeof L.y=="number"&&L.y>=b);k.length&&n.moveElements(k,{x:0,y:A})},Me=(b,R,A)=>{const k=b.type==="bpmn:Participant"?b:void 0;if(!k||k.children.some(F=>F.type==="bpmn:Lane"))return;const L=A+R.height/2+Ve-k.y;if(k.height>=L)return;const O=L-k.height,j=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:L}),ie(j,k.id,O)},Xe=(b,R)=>{const A=R-b.height;if(A<=0)return;const k=d(b)??b,L=[],O=I=>{L.push(I);for(const U of I.children??[])O(U)};O(k);const j=b.y+b.height-10,F=l.calculateAdjustments(L,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},gt=(b,R,A)=>{if(b){const j=f(b),F=q(R);if(j.height>=F)return;const I=F-j.height,U=d(j),K=U?U.y+U.height:j.y+j.height;Xe(j,F),ie(K,U==null?void 0:U.id,I);return}if(!A)return;const k=N*(R+1);if(A.height>=k)return;const L=k-A.height,O=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:k}),ie(O,A.id,L)},qt=new Map;for(const b of _)qt.set(b.flow.target,(qt.get(b.flow.target)??0)+1);const Ct=b=>(qt.get(b)??0)<=1,mn=new Set(y.map(b=>b.node.id).filter(b=>en(e,"sequenceFlow.update").filter(R=>R.target===b).length===1&&!_.some(R=>R.flow.target===b||R.flow.source===b&&P.has(R.flow.target)))),Rn=new Map,Vn=(b,R)=>{if(!b)return;const A=p(b);if(!A||A.height>=q(R))return;const k=A.y+A.height-10,L=d(A);if(L)return new Set((L.children??[]).filter(O=>O.type!=="bpmn:Lane"&&typeof O.y=="number"&&O.y>k).map(O=>O.id))},At=(b,R,A)=>{if(!b)return!0;const k=p(b);return k?A-R.height/2>=k.y&&A+R.height/2<=k.y+k.height:!0},Qt=h.map((b,R)=>({op:b,declared:R}));Qt.sort((b,R)=>{const A=b.op.order??Number.POSITIVE_INFINITY,k=R.op.order??Number.POSITIVE_INFINITY;return A!==k?A-k:b.declared-R.declared});let _n=80;for(const b of r.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 Qt){const R=b.participant,A=y.filter(ne=>ne.node.participant===R.id).length,k=((l1=R.lanes)==null?void 0:l1.length)??0,L=Math.max(1200,A*160+300),O=(R.lanes??[]).map(ne=>q(G.get(ne.id)??0)),j=O.reduce((ne,he)=>ne+he,0);k&&j<300&&(O[k-1]+=300-j);const F=Math.max(300,N*((G.get(`pool:${R.id}`)??0)+1)),I=R.blackBox||A+k===0?120:k?Math.max(300,j):F,U=o.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:L,height:I,isExpanded:!0}),K=n.createShape(U,{x:100+L/2,y:_n+I/2},u()),re=R.lanes??[];if(re.length&&n.splitLane(K,re.length),re.length){const ne=r.filter(he=>{var fe;return he.type==="bpmn:Lane"&&((fe=d(he))==null?void 0:fe.id)===R.id}).sort((he,fe)=>he.y-fe.y);if(ne.forEach((he,fe)=>{const ye=re[fe];ye&&n.updateProperties(he,{id:ye.id,name:ye.name})}),O.some(he=>he!==K.height/k)){let he=K.y;ne.forEach((fe,ye)=>{const Ye=O[ye];n.resizeShape(fe,{x:fe.x,y:he,width:fe.width,height:Ye}),he+=Ye})}}_n=K.y+K.height+60}const Va=b=>{var k;const R=P.get(b);if(R)return R.node.participant??"";const A=p(b);return A?A.type==="bpmn:Participant"?A.id:((k=d(A))==null?void 0:k.id)??"":""},Wn=new Map,$i=b=>{let R=Wn.get(b);return R||Wn.set(b,R={nodes:[],flows:[]}),R};for(const b of y)$i(b.node.participant??"").nodes.push(b);for(const b of _)$i(Va(b.flow.source)).flows.push(b);const si=b=>{var R;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((R=b.condition)==null?void 0:R.label)})},nn=(b,R,A)=>o.createShape({type:Gc(b.type),...b.eventDefinition?{eventDefinitionType:bc[b.eventDefinition]}:{},businessObject:i.create(Gc(b.type),{id:b.id,name:b.name,...R!==void 0?{"bwl:band":R}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Fr=[...Qt.map(({op:b})=>b.participant.id).filter(b=>Wn.has(b)),...[...Wn.keys()].filter(b=>!h.some(R=>R.participant.id===b))],Wa=b=>b.endsWith("Gateway");for(const b of Fr){const R=Wn.get(b),A=b?f(b):void 0,k=A?A.x+150:250;let L=A?A.y+80:120;const O=(te,se,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,Q)+C(te,se??0)*N}return se!==void 0&&A?A.y+X+C(`pool:${b}`,se)*N:le},j=(te,se,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,Q)+se*N}return A?A.y+X+se*N:le},F=te=>te.participant?f(te.participant):u(),I=(te,se,le,be,Ze,Qe,Dt,Ft)=>{const xe=le!==void 0||be!==void 0,ve=Ie=>{const Ee=()=>gt(le,Ie,A);Ft?Ft(Ee):Ee()},ce=C(le??`pool:${b}`,be??0);if((be===void 0||E(le,b,be,Dt??Number.NaN))&&Dt!==void 0&&At(le,se,Dt)&&!Ge(te,se,Ze,Dt))return{x:Ze,y:Dt};if(xe)for(let Ie=0;Ie<4;Ie++){const Ee=j(le,ce+Ie,Qe);if(!Ge(te,se,Ze,Ee,Vn(le,ce+Ie)))return ve(ce+Ie),{x:Ze,y:Ee}}const _e=O(le,be,Qe);xe?ve(ce):Ft?Ft(()=>Me(te,se,se.y+se.height/2)):Me(te,se,_e);let Ne=Ze;for(let Ie=0;Ie<64;Ie++){const Ee=Ge(te,se,Ne,_e);if(!Ee)break;Ne=Ee.x+Ee.width+H+se.width/2}return{x:Ne,y:_e}},U=new Set(R.flows.map(te=>te.flow.target)),K=new Map,re=te=>{if(te===void 0)return;const se=r.get(te);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+H};for(const te of R.nodes){if(U.has(te.node.id))continue;const se=nn(te.node,te.band,te.afterColumn),le=Y(te),be=te.node.lane?`${te.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",Ze=F(te.node),Qe=K.get(be)??k,Dt=re(te.afterColumn),Ft=Dt===void 0?Qe:Math.max(Qe,Dt);let xe;const ve=I(Ze,se,te.node.lane,le,Ft,L,void 0,mn.has(te.node.id)&&te.node.participant!==void 0?ce=>xe=ce:void 0);if(xe?n.createShape(se,ve,Ze,{autoResize:!1}):n.createShape(se,ve,Ze),xe){const ce=te.node.lane?f(te.node.lane):Ze;Rn.set(te.node.id,{container:ce,relCy:ve.y-ce.y,grow:xe})}K.set(be,ve.x+se.width+H),!te.node.lane&&le===void 0&&(L+=160)}const ne=new Set,he=new Map,fe=new Map,ye=new Map;if(b&&Re.has(`pool:${b}`)){const te=new Map;for(const xe of R.flows)te.set(xe.flow.target,(te.get(xe.flow.target)??0)+1);const se=xe=>O(xe.node.lane,ge(xe),Number.NaN),le=new Set,be=xe=>{var _e;const ve=(_e=P.get(xe))==null?void 0:_e.node.participant;if(ve)return p(ve);const ce=p(xe);if(ce)return ce.type==="bpmn:Participant"?ce:d(ce)},Ze=xe=>{const ve=[],ce=new Set([xe]),_e=[xe];for(;_e.length;){const Ne=_e.shift(),Ie=P.get(Ne);Ie&&ve.push(Ie);for(const Ee of R.flows)Ee.flow.source!==Ne||ce.has(Ee.flow.target)||(te.get(Ee.flow.target)??0)!==1||(ce.add(Ee.flow.target),_e.push(Ee.flow.target))}return ve},Qe=xe=>{if(!A)return;const ve=new Set(xe.map(Ne=>Ne.node.id));let ce=!1,_e=!1;for(const Ne of x){if(!ve.has(Ne.flow.source))continue;const Ie=be(Ne.flow.target);!Ie||Ie.id===A.id||(Ie.y<A.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const xe of R.nodes){if(!Wa(xe.node.type))continue;const ve=O(xe.node.lane,Y(xe),Number.NaN);if(Number.isNaN(ve))continue;const ce=[];for(const Ee of R.flows){if(Ee.flow.source!==xe.node.id)continue;const ot=P.get(Ee.flow.target);if(!ot||ot.node.lane!==xe.node.lane||(te.get(ot.node.id)??0)!==1)continue;const pt=Y(ot);if(pt===void 0)continue;const Jt=O(ot.node.lane,pt,Number.NaN);if(Number.isNaN(Jt))continue;const ci=Ze(ot.node.id),nt=Qe(ci);nt&&ce.push({subtree:ci,band:pt,row:Jt,dir:nt})}if(!ce.some(Ee=>Ee.dir==="up")||!ce.some(Ee=>Ee.dir==="down")||!ce.some(Ee=>Ee.dir==="up"&&ce.some(ot=>ot.dir==="down"&&ot.row<Ee.row)))continue;const Ne=[...ce].sort((Ee,ot)=>Ee.row-ot.row);[...ce.filter(Ee=>Ee.dir==="up"),...ce.filter(Ee=>Ee.dir==="down")].sort((Ee,ot)=>Ee.dir===ot.dir?Ee.row-ot.row:Ee.dir==="up"?-1:1).forEach((Ee,ot)=>{const pt=Ne[ot].band;if(pt!==Ee.band){le.add(xe.node.id);for(const Jt of Ee.subtree)Y(Jt)===Ee.band&&ae.set(Jt.node.id,pt)}})}const Dt=xe=>{if(!A)return;const ve=new Set(xe.map(Ne=>Ne.node.id));let ce=!1,_e=!1;for(const Ne of x){if(!ve.has(Ne.flow.target))continue;const Ie=be(Ne.flow.source);!Ie||Ie.id===A.id||(Ie.y<A.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const xe of R.nodes){if(!Wa(xe.node.type))continue;const ve=xe.node.lane??`pool:${b}`,ce=oe.get(ve);if(!ce||ce.size<2)continue;const _e=ce.get(0);if(_e===void 0)continue;const Ne=Math.max(...ce.values()),Ie=_e===Ne&&_e!==0?"down":void 0;if(!Ie)continue;const Ee=[];for(const nt of R.flows){if(nt.flow.source!==xe.node.id)continue;const zt=P.get(nt.flow.target);if(!zt||zt.node.lane!==xe.node.lane||(te.get(zt.node.id)??0)!==1)continue;const Pe=ge(zt);Pe!==void 0&&Ee.push({t:zt,subtree:Ze(zt.node.id),band:Pe})}const ot=Ee.find(nt=>(ce.get(nt.band)??nt.band)===_e);if(!ot||Dt(ot.subtree)===Ie||Qe(ot.subtree)===Ie)continue;const pt=Ee.find(nt=>nt!==ot&&Dt(nt.subtree)===Ie);if(!pt)continue;const Jt=ot.band,ci=pt.band;for(const nt of ot.subtree)ge(nt)===Jt&&ae.set(nt.node.id,ci);for(const nt of pt.subtree)ge(nt)===ci&&ae.set(nt.node.id,Jt);le.add(xe.node.id)}for(const xe of R.nodes){if(!Wa(xe.node.type))continue;const ve=se(xe);if(Number.isNaN(ve)||w.some(Ee=>{var ot,pt;return(((ot=Ee.placement)==null?void 0:ot.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===xe.node.id&&((pt=Ee.placement)==null?void 0:pt.side.startsWith("bottom"))}))continue;let _e,Ne=!1,Ie;for(const Ee of R.flows){if(Ee.flow.source!==xe.node.id)continue;const ot=P.get(Ee.flow.target);if(!ot||!ot.node.lane&&Y(ot)===void 0)continue;const pt=se(ot);Number.isNaN(pt)||(Math.abs(pt-ve)<.5&&(Ne=!0),pt>ve?!_e||pt>_e.row?_e={id:ot.node.id,row:pt,count:1}:pt===_e.row&&_e.count++:pt<ve&&ot.node.lane===xe.node.lane&&(!Ie||pt>Ie.row?Ie={op:ot,row:pt,count:1}:pt===Ie.row&&Ie.count++))}_e&&_e.count===1&&(te.get(_e.id)??0)===1&&!le.has(xe.node.id)&&ne.add(_e.id),!Ne&&Ie&&Ie.count===1&&(te.get(Ie.op.node.id)??0)===1&&!Te.has(xe.node.id)&&he.set(Ie.op.node.id,{lane:xe.node.lane,band:ge(xe)})}const Ft=new Map;for(const xe of x)Ft.set(xe.flow.target,[...Ft.get(xe.flow.target)??[],xe]);for(const xe of R.nodes){const ve=Ft.get(xe.node.id);if(!ve||ve.length!==1||!te.get(xe.node.id)||!xe.node.lane&&Y(xe)===void 0||B.has(xe.node.id))continue;const ce=(u1=P.get(ve[0].flow.source))==null?void 0:u1.node.participant,_e=ce?p(ce):void 0;if(!_e||!A||_e.id===A.id)continue;const Ne=xe.node.lane??`pool:${b}`,Ie=oe.get(Ne);if(!Ie)continue;const Ee=Ie.get(0)??0,ot=(Ie.get(ge(xe)??0)??Ee)-Ee;if(ot===0)continue;const pt=_e.y<A.y;if(pt&&ot<0||!pt&&ot>0)continue;let Jt;for(const[ci,nt]of Ie){const zt=nt-Ee;(pt&&zt<0&&(!Jt||zt<Jt.row)||!pt&&zt>0&&(!Jt||zt>Jt.row))&&(Jt={band:ci,row:zt})}Jt&&fe.set(xe.node.id,{lane:xe.node.lane,band:Jt.band})}}const Ye=new Set;let Ae=0;for(;Ae++<R.nodes.length+2;){for(let le=0;le<R.nodes.length+R.flows.length+2;le++){let be=!1;for(const Ze of R.flows){const Qe=Ze.flow;if(Ye.has(Qe.id))continue;const Dt=p(Qe.source);if(!Dt)continue;const Ft=p(Qe.target),xe=P.get(Qe.target);if(!Ft&&xe){const ve=nn(xe.node,xe.band),ce=ge(xe);if(xe.node.lane||ce!==void 0){const _e=F(xe.node),Ne=Dt,Ie=Ne.x+(ye.get(Qe.source)??0)+Ne.width+H,Ee=he.get(Qe.target)??fe.get(Qe.target),ot=I(_e,ve,Ee?Ee.lane:xe.node.lane,Ee?Ee.band:ce,ne.has(Qe.target)?Ne.x+Ne.width/2:Ie,Number.NaN,Ee||!Ct(Qe.target)?void 0:Ne.y+Ne.height/2),pt=n.createShape(ve,ot,_e);ne.has(Qe.target)&&ye.set(Qe.target,Ie-(pt.x+pt.width/2)),n.connect(Dt,pt,{type:"bpmn:SequenceFlow",businessObject:si(Qe)})}else s.append(Dt,ve,{connection:{type:"bpmn:SequenceFlow",businessObject:si(Qe)}})}else if(Ft)n.connect(Dt,Ft,{type:"bpmn:SequenceFlow",businessObject:si(Qe)});else continue;Ye.add(Qe.id),be=!0}if(!be)break}const te=R.nodes.filter(le=>!p(le.node.id));if(!te.length)break;const se=te[0];{const le=nn(se.node,se.band),be=F(se.node),Ze=Y(se);n.createShape(le,I(be,le,se.node.lane,Ze,k,L),be),!se.node.lane&&Ze===void 0&&(L+=160)}}}const Cn=40,ht=b=>{const R=K=>K.kind==="label-over-line"||K.kind==="label-over-shape"||K.kind==="label-on-shared-segment"?K.edge===b.id:K.kind==="annotation-over-label"||K.kind==="pool-name-over-label"?K.label===b.id:!1,A=()=>new Set(ut(We(r)).filter(K=>!R(K)).map(K=>ct(K))),k=A(),L=b.waypoints.map(K=>({x:K.x,y:K.y})),O=b.label,j=O&&{x:O.x,y:O.y};n.layoutConnection(b,{waypoints:[]});const F=A(),I=[...F].filter(K=>!k.has(K)).length,U=[...k].filter(K=>!F.has(K)).length;I<=U||(n.updateWaypoints(b,L),O&&j&&(O.x!==j.x||O.y!==j.y)&&n.moveElements([O],{x:j.x-O.x,y:j.y-O.y}))},Et=5,Oi=10,BE=200,pc=new Set([..._.map(b=>b.flow.id),...x.map(b=>b.flow.id),...en(e,"sequenceFlow.update").map(b=>b.id),...en(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),K$=(b,R,A,k,L,O)=>{const j=new Set(b.map(te=>te.id)),F=Math.min(...b.map(te=>te.x))+R-Oi,I=Math.max(...b.map(te=>te.x+te.width))+R+BE+Oi,U=Math.min(...b.map(te=>te.y+Math.min(0,...A)))-Oi,K=Math.max(...b.map(te=>te.y+te.height+Math.max(0,...A)))+Oi,re=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const se=te;return pc.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(be=>!be||j.has(be.id)||be.x>=k)?!1:se.waypoints.some((be,Ze)=>{const Qe=se.waypoints[Ze+1];return!!Qe&&Math.max(be.x,Qe.x)>=F&&Math.min(be.x,Qe.x)<=I&&Math.max(be.y,Qe.y)>=U&&Math.min(be.y,Qe.y)<=K})});if(!re.length)return 0;const ne=te=>{const se=new Map;for(const le of b)for(const be of A){const Ze={id:le.id,type:le.type,x:le.x+R+te,y:le.y+be,width:le.width,height:le.height};for(const Qe of re){let Dt=1/0;for(let xe=0;xe+1<Qe.waypoints.length;xe++)Dt=Math.min(Dt,ns(Qe.waypoints[xe],Qe.waypoints[xe+1],Ze));const Ft=`${Qe.id}|${le.id}`;se.set(Ft,Math.min(se.get(Ft)??1/0,Dt))}}return se},he=[...ne(0)].filter(([,te])=>te<=Et).map(([te])=>te);if(!he.length)return 0;let fe=0;for(let te=1;te<=BE;te++){const se=ne(te);if([...se.values()].every(le=>le>Et)&&he.every(le=>(se.get(le)??1/0)>=Oi)){fe=te;break}}if(!fe)return 0;const ye=Math.min(...b.map(te=>te.x))+R+fe,Ye=new Set(he.map(te=>te.slice(0,te.indexOf("|"))));return re.some(te=>te.type==="bpmn:SequenceFlow"&&Ye.has(te.id)&&te.waypoints.some((se,le)=>{const be=te.waypoints[le+1];if(!be||Math.min(se.y,be.y)>O||Math.max(se.y,be.y)<O||se.y===be.y)return!1;const Ze=se.x+(O-se.y)*(be.x-se.x)/(be.y-se.y);return Ze>L&&Ze<ye}))?0:fe},jr=(b,R=()=>!0)=>{const A=p(b);if(!A)return[];const k=[A],L=new Set([b]);for(let O=0;O<k.length;O++){const j=k[O].id;for(const F of _){const I=F.flow.target;if(F.flow.source!==j||L.has(I)||!P.has(I))continue;L.add(I);const U=p(I);U&&R(U)&&k.push(U)}}return k},X$=(b,R=()=>!0)=>{const A=p(b);if(!A)return[];const k=[A],L=new Set([b]);for(let O=0;O<k.length;O++){const j=k[O].id;for(const F of _){const I=F.flow.source;if(F.flow.target!==j||L.has(I)||!P.has(I))continue;L.add(I);const U=p(I);U&&R(U)&&k.push(U)}}return k},Di=30,Fi=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",ip=(b,R)=>rf(n,b,R),fc=(b,R,A=!1)=>{const k=new Set(b.flatMap(I=>I.subtree.map(U=>U.id)));for(const I of b){const U=(I.pool.children??[]).filter(Fi).filter(re=>!k.has(re.id));if(I.subtree.some(re=>U.some(ne=>re.x+R<ne.x+ne.width+Di&&re.x+R+re.width+Di>ne.x&&re.y<ne.y+ne.height&&re.y+re.height>ne.y)))return null}const L=b.map(I=>I.pool.width),O=A?r.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(U=>({x:U.x,y:U.y}))})):[],j=r.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(b.flatMap(I=>I.subtree),{x:R,y:0});const F=b.map(I=>{const K=Math.max(...I.subtree.map(re=>re.x+re.width))+iy-(I.pool.x+I.pool.width);return K>0&&ip(I.pool,I.pool.width+K),K});return()=>{n.moveElements(b.flatMap(I=>I.subtree),{x:-R,y:0}),b.forEach((I,U)=>{F[U]>0&&ip(I.pool,L[U])});for(const{c:I,wps:U}of O){const K=I.waypoints??[];K.length===U.length&&K.every((ne,he)=>Math.abs(ne.x-U[he].x)<=.5&&Math.abs(ne.y-U[he].y)<=.5)||n.updateWaypoints(I,U.map(ne=>({x:ne.x,y:ne.y})))}for(let I=0;I<3;I++){let U=0;for(const K of j){const re=K.x-K.label.x,ne=K.y-K.label.y;Math.abs(re)<=.5&&Math.abs(ne)<=.5||(n.moveElements([K.label],{x:re,y:ne}),U++)}if(!U)break}}},cg=b=>{var L,O;const R=new Map,A=new Map;for(const j of r.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(R.set(F.id,F),A.set(F.id,[]))}for(const j of r.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,I=(L=F.source)==null?void 0:L.id,U=(O=F.target)==null?void 0:O.id;I&&U&&A.has(I)&&A.get(I).push(U),I&&U&&A.has(U)&&A.get(U).push(I)}const k=[];for(const[j,F]of A)F.length&&F.every(I=>b.has(I))&&k.push(R.get(j));return k},NE=(b,R)=>{if(!b.length)return null;const A=new Set(b.map(K=>K.id)),k=r.getAll().filter(K=>K.type==="bpmn:Participant"&&!A.has(K.id)),L=Math.min(...k.filter(K=>(K.children??[]).length>0).map(K=>K.x)),O=new Set(b.filter(K=>Math.abs(K.x-L)<=2).map(K=>K.id));if(b.some(K=>{const re=O.has(K.id)?K.x:K.x+R,ne=O.has(K.id)?K.width+R:K.width;return k.some(he=>re<he.x+he.width+Di&&re+ne+Di>he.x&&K.y<he.y+he.height&&K.y+K.height>he.y)}))return null;const F=r.filter(K=>K.type==="label").map(K=>({label:K,x:K.x,y:K.y})),I=b.filter(K=>!O.has(K.id)),U=b.filter(K=>O.has(K.id)).map(K=>({pool:K,was:{x:K.x,y:K.y,width:K.width,height:K.height}}));I.length&&n.moveElements(I,{x:R,y:0});for(const{pool:K,was:re}of U)n.resizeShape(K,{...re,width:re.width+R});return()=>{for(const{pool:K,was:re}of U)n.resizeShape(K,re);I.length&&n.moveElements(I,{x:-R,y:0});for(let K=0;K<3;K++){let re=0;for(const ne of F){const he=ne.x-ne.label.x,fe=ne.y-ne.label.y;Math.abs(he)<=.5&&Math.abs(fe)<=.5||(n.moveElements([ne.label],{x:he,y:fe}),re++)}if(!re)break}}},$E=(b,R,A)=>{const k=A.x+A.width/2,L=R.y>A.y,O=L?A.y+A.height:A.y,j=L?R.y:R.y+R.height,F=b.source===R?[{x:k,y:j},{x:k,y:O}]:[{x:k,y:O},{x:k,y:j}],I=We(r),U={...I.edges.find(K=>K.id===b.id),waypoints:F};return bn(U,hi(I)).length?!1:(n.updateWaypoints(b,F),!0)},Z$=()=>{const b=r.filter(L=>L.type==="bpmn:Participant"),R=Math.min(...b.filter(L=>(L.children??[]).length>0).map(L=>L.x)),A=L=>!!L&&L.type==="bpmn:Participant"&&!(L.children??[]).length&&Math.abs(L.x-R)<=2&&!h.some(O=>O.participant.id===L.id),k=new Set;for(const L of r.getAll()){if(L.type!=="bpmn:MessageFlow")continue;const O=L;if((O.waypoints??[]).length!==2)continue;const j=[O.source,O.target].find(I=>A(I)),F=j===O.source?O.target:O.source;j&&F&&F.type!=="bpmn:Participant"&&k.add(O.id)}return k},Q$=b=>{var A;const R=new Map;for(const k of b){const L=r.get(k);if(!L||(L.waypoints??[]).length===2)continue;const O=((A=L.source)==null?void 0:A.type)==="bpmn:Participant"?L.source:L.target,j=O===L.source?L.target:L.source;if(j.x+j.width/2<=O.x+O.width)continue;const F=R.get(O.id)??{pool:O,msgs:[]};F.msgs.push({conn:L,other:j}),R.set(O.id,F)}for(const{pool:k,msgs:L}of R.values()){const O=Math.max(...L.map(({other:fe})=>fe.x+fe.width/2))+nf;if(r.getAll().some(fe=>{if(fe.type!=="bpmn:Participant"||fe.id===k.id)return!1;const ye=fe;return k.x<ye.x+ye.width+Di&&O+Di>ye.x&&k.y<ye.y+ye.height&&k.y+k.height>ye.y}))continue;const F={x:k.x,y:k.y,width:k.width,height:k.height},I=[...k.incoming??[],...k.outgoing??[]],U=I.map(fe=>({c:fe,wps:(fe.waypoints??[]).map(ye=>({x:ye.x,y:ye.y}))})),K=I.flatMap(fe=>{const ye=fe.label;return ye?[{label:ye,x:ye.x,y:ye.y}]:[]}),re=ur();n.resizeShape(k,{...F,width:O-k.x});const ne=L.filter(({conn:fe,other:ye})=>$E(fe,k,ye)).length,he=ur();if(!(ne>0&&he.messages>re.messages&&he.lines>=re.lines)){n.resizeShape(k,F);for(const{c:fe,wps:ye}of U){const Ye=fe.waypoints??[];Ye.length===ye.length&&Ye.every((te,se)=>Math.abs(te.x-ye[se].x)<=.5&&Math.abs(te.y-ye[se].y)<=.5)||n.updateWaypoints(fe,ye.map(te=>({x:te.x,y:te.y})))}for(let fe=0;fe<3;fe++){let ye=0;for(const Ye of K){const Ae=Ye.x-Ye.label.x,te=Ye.y-Ye.label.y;Math.abs(Ae)<=.5&&Math.abs(te)<=.5||(n.moveElements([Ye.label],{x:Ae,y:te}),ye++)}if(!ye)break}}}},FE=()=>{let b=0;for(const R of r.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let k=1;k<A.length;k++)b+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return b},jE=()=>{let b=0;for(const R of r.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let k=1;k<A.length;k++)b+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return b},J$=b=>{const R=[];for(const A of r.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const k=A;if(b.has(k.id))continue;const O=[...k.incoming??[],...k.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===k?I.target:I.source);if(!O.length||O.some(I=>I===void 0))continue;const j=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const U=I,K=[U.source,U.target];return K.some(re=>!re)?[]:K.map(re=>re.id)},F=O.flatMap(I=>j(I));F.length&&F.every(I=>b.has(I))&&R.push(k)}return R},HE=()=>ut(We(r)).filter(b=>b.kind==="edge-crosses-shape").length,zE=b=>{const R=(b.children??[]).filter(Fi);let A=0;for(let k=0;k<R.length;k++)for(let L=k+1;L<R.length;L++){const O=R[k],j=R[L];O.x<j.x+j.width&&O.x+O.width>j.x&&O.y<j.y+j.height&&O.y+O.height>j.y&&A++}return A},ur=()=>{const b=We(r),R=A=>A.length>=2&&(A.every(k=>Math.abs(k.x-A[0].x)<.01)||A.every(k=>Math.abs(k.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>R(A.waypoints)).length}},GE=b=>{const R=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const L=k;if(!L.waypoints||L.waypoints.length!==2)continue;const O=L.source,j=L.target;if(!O||!j)continue;const F=b.has(O.id);if(F===b.has(j.id))continue;const I=F?j:O,U=d(I);if(!U||b.has(I.id))continue;const K=R.get(U.id);K?I.x<K.minX&&(K.minX=I.x):R.set(U.id,{pool:U,minX:I.x})}const A=[];for(const{pool:k,minX:L}of R.values()){const O=(k.children??[]).filter(j=>Fi(j)&&!b.has(j.id)&&j.x>=L);O.length&&A.push({subtree:O,pool:k})}return A},e5=(b,R,A)=>{const k=new Map(R.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),L=new Set(b);for(const j of R)for(const F of j.subtree)L.add(F.id);let O=!1;for(;;){let j=0;for(const F of GE(L)){if(F.pool===A)continue;const I=k.get(F.pool.id);I?I.subtree.push(...F.subtree):k.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const U of F.subtree)L.add(U.id);j+=F.subtree.length}if(!j)break;O=!0}return O?[...k.values()]:null},t5=(b,R)=>{const A=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const O=L,j=O.waypoints;if(!j||j.length<2||!j.every(he=>Math.abs(he.x-j[0].x)<1))continue;const F=O.source,I=O.target;if(!F||!I)continue;const U=b.has(F.id);if(U===b.has(I.id))continue;const K=U?I:F,re=d(K);if(!re||re===R||re===d(U?F:I))continue;const ne=A.get(re.id);ne?K.x<ne.minX&&(ne.minX=K.x):A.set(re.id,{pool:re,minX:K.x})}const k=[];for(const{pool:L,minX:O}of A.values()){const j=(L.children??[]).filter(F=>Fi(F)&&!b.has(F.id)&&F.x>=O);j.length&&k.push({subtree:j,pool:L})}return k},VE=b=>{const R=We(r),A=R.shapes.filter(L=>b.has(L.id)),k=new Set;for(const L of R.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const O of bn(L,A))k.add(`${L.id}|${O.id}`);return k},WE=new Map;for(const b of en(e,"sequenceFlow.update")){if(b.target===void 0)continue;const R=P.get(b.target);if(!R)continue;const A=p(b.target),k=p(b.id);if(!A||!k)continue;const L=b.source!==void 0?p(b.source):k.source,O=k.target;if(!L||!O||O.id===A.id)continue;const j=k.waypoints&&k.waypoints.length>=3&&Math.abs(k.waypoints[0].x-k.waypoints[1].x)<1&&Math.abs(k.waypoints[0].y-k.waypoints[1].y)>1?{x:k.waypoints[0].x,y:k.waypoints[0].y}:void 0,F=j?k.waypoints[1].y:void 0,I=j&&k.label?{x:k.label.x,y:k.label.y}:void 0,U=I&&k.label&&Math.abs(I.y+k.label.height/2-F)<=N/5&&I.x+k.label.width>j.x?I.x+k.label.width+6:void 0,K=(L.outgoing??[]).filter(Pe=>Pe.type==="bpmn:SequenceFlow"&&Pe.id!==k.id&&Pe.target&&!pc.has(Pe.id)),re=new Set(K.map(Pe=>Pe.target.id)),ne=Pe=>{const Mt={type:"bpmn:Task",x:Pe.x+2,y:Pe.y+2,width:Pe.width-4,height:Pe.height-4};return K.find(bt=>(bt.waypoints??[]).some((Mn,xt)=>!!bt.waypoints[xt+1]&&ns(Mn,bt.waypoints[xt+1],Mt)===0))},he=jr(b.target),fe=new Set(he.map(Pe=>Pe.id)),ye=Rn.has(b.target)?{autoResize:!1}:void 0,Ye=Math.min(...he.map(Pe=>Pe.x)),Ae=Math.max(...he.map(Pe=>Pe.x+Pe.width)),te=L.x+L.width,se=O.x+O.width<=L.x,le=(()=>{if(!se)return;const Pe=d(A),Mt=((Pe==null?void 0:Pe.children)??[]).filter(et=>Fi(et)&&!fe.has(et.id)&&et.type!=="bpmn:Group"&&et.type!=="bpmn:Participant"),bt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Mn=r.getAll().filter(et=>{if(!bt.includes(et.type))return!1;const jt=et;return jt.id===k.id||pc.has(jt.id)||!jt.waypoints||jt.waypoints.length<2?!1:![jt.source,jt.target].some(Bt=>!Bt||fe.has(Bt.id))}),xt=(et,jt)=>he.every(Bt=>{var Vr;const yt={id:Bt.id,type:Bt.type,x:Bt.x+et,y:Bt.y+jt,width:Bt.width,height:Bt.height};return Pe&&(yt.x<Pe.x||yt.x+yt.width>Pe.x+Pe.width||yt.y<Pe.y||yt.y+yt.height>Pe.y+Pe.height)||!At((Vr=P.get(Bt.id))==null?void 0:Vr.node.lane,Bt,Bt.y+jt+Bt.height/2)||Mt.some(Un=>yt.x<Un.x+Un.width+Oi&&yt.x+yt.width+Oi>Un.x&&yt.y<Un.y+Un.height+Oi&&yt.y+yt.height+Oi>Un.y)?!1:Mn.every(Un=>{for(let ao=0;ao+1<Un.waypoints.length;ao++)if(ns(Un.waypoints[ao],Un.waypoints[ao+1],yt)<Oi)return!1;return!0})}),lt=L.x+L.width/2,Lt=L.y+L.height/2,ke=k.waypoints??[],St=ke.length>=2&&Math.abs(ke[0].y-ke[1].y)<1&&ke[1].x<ke[0].x;return[...F!==void 0?[{cx:lt,cy:F}]:[],...St?[{cx:L.x-Cn-A.width/2,cy:ke[0].y}]:[],{cx:lt,cy:Lt+N},{cx:lt,cy:Lt-N}].find(et=>xt(et.cx-(A.x+A.width/2),et.cy-(A.y+A.height/2)))})(),be=se&&!le?te:O.x,Ze=A.y+A.height/2,Qe=K$(he,te+Cn-Ye,[0,L.y+L.height/2-Ze,O.y+O.height/2-Ze],be,te,L.y+L.height/2),Dt=te+Cn+Qe,Ft=(()=>{if(U===void 0)return 0;const Pe=te+Cn,Mt=L.y+L.height/2-A.height/2,bt={x:Pe,y:Mt,width:Ae-Ye,height:A.height},Mn=d(L);return((Mn==null?void 0:Mn.children)??[]).some(lt=>Fi(lt)&&!fe.has(lt.id)&&lt.id!==L.id&&lt.id!==O.id&&lt.type!=="bpmn:Group"&&lt.type!=="bpmn:Participant"&&lt.x<bt.x+bt.width&&lt.x+lt.width>bt.x&&lt.y<bt.y+bt.height&&lt.y+lt.height>bt.y)||ne(bt)?Math.max(0,U-Pe):0})(),xe=le?0:Ae-Ye+Cn*2+Qe+Ft-(se?0:O.x-te);let ve=[];if(xe>0){const Pe=d(A),Mt=(Pe==null?void 0:Pe.children)??[],bt=ke=>ke.type==="bpmn:Lane";ve=(()=>{const ke=new Set;for(const De of Mt)Fi(De)&&!fe.has(De.id)&&De.id!==L.id&&De.x>=be&&ke.add(De.id);const St=[];for(const De of Mt){if(De.type!=="bpmn:DataStoreReference"&&De.type!=="bpmn:DataObjectReference")continue;const et=De,Bt=[...et.incoming??[],...et.outgoing??[]].filter(yt=>yt.type==="bpmn:DataInputAssociation"||yt.type==="bpmn:DataOutputAssociation").map(yt=>yt.source===et?yt.target:yt.source);Bt.length&&Bt.every(yt=>yt!==void 0&&ke.has(yt.id))&&St.push(et)}return St})();const xt=Mt.filter(ke=>!("waypoints"in ke&&ke.waypoints)&&!bt(ke)&&ke.type!=="label"&&!fe.has(ke.id)&&ke.id!==L.id&&ke.x>=be),lt=xt.flatMap(ke=>ke.labels??[]),Lt=Pe?[Pe,...Mt.filter(ke=>bt(ke))]:[];if(xt.length){const ke=new Set(xt.map(Ke=>Ke.id)),St=GE(ke),De=St.length?e5(ke,St,Pe):null,et=Ke=>{const vt=new Set(ke);for(const It of Ke)for(const Mo of It.subtree)vt.add(Mo.id);return J$(vt)},jt=et(St),Bt=De?et(De):jt,yt=cg(ke),Vr=new Set(ke);for(const Ke of St)for(const vt of Ke.subtree)Vr.add(vt.id);const Un=St.length?cg(Vr):yt,ao=(()=>{if(!De)return[];const Ke=new Set(ke);for(const vt of De)for(const It of vt.subtree)Ke.add(It.id);return cg(Ke)})(),Ya=De??St,Wr=(()=>{const Ke=new Set(ke);for(const vt of Ya)for(const It of vt.subtree)Ke.add(It.id);return t5(Ke,Pe)})(),mg=Wr.length?et([...Ya,...Wr]):jt,ji=new Set([...xt,...Lt].map(Ke=>Ke.id)),mt=Mt.filter(Ke=>{const vt=Ke.labelTarget;return Ke.type==="label"&&!!vt&&"waypoints"in vt&&!!vt.source&&!!vt.target&&ji.has(vt.source.id)&&ji.has(vt.target.id)}),wn=Z$();n.createSpace([...xt,...lt,...mt],Lt,{x:xe,y:0},"e",be-1);const Yt=(Ke,vt,It)=>{const Mo=ur(),cp=It?VE(It):null,lp=fc(Ke,xe,!!It);if(!lp)return!1;const gc=vt.length?NE(vt,xe):null,up=ur(),Kt=!!It&&!!cp&&[...VE(It)].some(qr=>!cp.has(qr));return up.messages>Mo.messages&&up.lines>=Mo.lines&&!Kt?!0:(gc==null||gc(),lp(),!1)},li=Wr.length>0&&Yt([...Ya,...Wr],De?ao:Un,new Set(Wr.flatMap(Ke=>Ke.subtree.map(vt=>vt.id)))),Ur=!li&&De?Yt(De,ao):!1;let so=li||Ur;!so&&St.length&&(so=Yt(St,Un));const Ka=li?mg:Ur?Bt:jt;if(!so){for(const Ke of St){const vt=ur(),It=fc([Ke],xe);if(!It)continue;const Mo=ur();(Mo.messages<=vt.messages||Mo.lines<vt.lines)&&It()}if(yt.length){const Ke=ur(),vt=NE(yt,xe);if(vt){const It=ur();(It.messages<=Ke.messages||It.lines<Ke.lines)&&vt()}}}if(Q$(wn),Ka.length){const Ke=()=>new Set(ut(We(r)).map(It=>ct(It))),vt=It=>{const Mo=jE(),cp=Ke(),lp=It.map(Kt=>({a:Kt,x:Kt.x,y:Kt.y})),gc=r.filter(Kt=>Kt.type==="label").map(Kt=>({label:Kt,x:Kt.x,y:Kt.y}));n.moveElements(It,{x:xe,y:0});const up=[...Ke()].filter(Kt=>!cp.has(Kt));if(jE()<Mo&&up.length===0)return!0;for(const{a:Kt,x:qr,y:mc}of lp)(Kt.x!==qr||Kt.y!==mc)&&n.moveElements([Kt],{x:qr-Kt.x,y:mc-Kt.y});for(const Kt of gc){const qr=Kt.x-Kt.label.x,mc=Kt.y-Kt.label.y;(qr!==0||mc!==0)&&n.moveElements([Kt.label],{x:qr,y:mc})}return!1};if(!vt(Ka)&&Ka.length>1)for(const It of Ka)vt([It])}}}const ce=R.node.lane!==void 0?p(R.node.lane):R.node.participant!==void 0?p(R.node.participant):void 0,_e=Pe=>{if(!ce)return!0;const Mt=Pe.y+Pe.height/2;return Mt>=ce.y&&Mt<=ce.y+ce.height},Ne=!_e(L)&&_e(O)?O:L,Ie=Ne.y+Ne.height/2,Ee=Ie-(A.y+A.height/2),ot=R.band!==void 0,pt=ot?[A]:he,Jt=(R.band===void 0||E(R.node.lane,R.node.participant,R.band,Ie))&&Ct(b.target)&&pt.every(Pe=>{var Mt;return At((Mt=P.get(Pe.id))==null?void 0:Mt.node.lane,Pe,Pe.y+Pe.height/2+Ee)}),ci=Pe=>Math.abs(Pe.y+Pe.height/2-(A.y+A.height/2))<=N/2;if(Jt&&ot){const Pe=Math.abs(Ee)<=N/2?he.filter(Mt=>Mt.id!==A.id&&ci(Mt)):[];if(n.moveElements(he,{x:Dt-Ye,y:0},void 0,ye),n.moveElements([A],{x:0,y:Ee},void 0,ye),Pe.length){const Mt=()=>new Set(ut(We(r)).map(ke=>ct(ke))),bt=Mt(),Mn=r.filter(ke=>ke.type==="label").map(ke=>({label:ke,x:ke.x,y:ke.y}));n.moveElements(Pe,{x:0,y:Ee});const xt=Mt(),lt=[...xt].filter(ke=>!bt.has(ke)).length,Lt=[...bt].filter(ke=>!xt.has(ke)).length;if(lt>Lt){n.moveElements(Pe,{x:0,y:-Ee});for(const ke of Mn){const St=ke.x-ke.label.x,De=ke.y-ke.label.y;(St!==0||De!==0)&&n.moveElements([ke.label],{x:St,y:De})}}}}else n.moveElements(he,{x:Dt-Ye,y:Jt?Ee:0},void 0,ye);const nt=d(A);if(!Jt&&R.node.lane===void 0&&R.band!==void 0&&nt){const Pe=nt.y+X+C(`pool:${R.node.participant??""}`,R.band)*N,Mt=Pe-(A.y+A.height/2);Mt!==0&&!Ge(nt,A,A.x+A.width/2,Pe,fe)&&n.moveElements([A],{x:0,y:Mt},void 0,ye)}if(le)n.moveElements(he,{x:le.cx-(A.x+A.width/2),y:le.cy-(A.y+A.height/2)},void 0,ye);else if(nt){const Pe=(nt.children??[]).filter(xt=>Fi(xt)&&!fe.has(xt.id)&&xt.type!=="bpmn:Group"&&xt.type!=="bpmn:Participant"),Mt=(xt,lt,Lt,ke,St)=>xt.x+lt<St.x+St.width+ke&&xt.x+lt+xt.width+ke>St.x&&xt.y+Lt<St.y+St.height+ke&&xt.y+Lt+xt.height+ke>St.y,bt=Pe.find(xt=>Mt(A,0,0,0,xt)),Mn=bt?void 0:ne(A);if(bt||Mn){const xt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],lt=r.getAll().filter(mt=>{if(!xt.includes(mt.type))return!1;const wn=mt;return pc.has(wn.id)||!wn.waypoints||wn.waypoints.length<2?!1:![wn.source,wn.target].some(Yt=>!Yt||fe.has(Yt.id))}),Lt=(mt,wn,Yt)=>{var li;return At((li=P.get(mt.id))==null?void 0:li.node.lane,mt,mt.y+Yt+mt.height/2)&&mt.x+wn>=nt.x&&mt.x+wn+mt.width<=nt.x+nt.width&&mt.y+Yt>=nt.y&&mt.y+Yt+mt.height<=nt.y+nt.height},ke=(mt,wn)=>he.every(Yt=>Lt(Yt,mt,wn)&&!Pe.some(li=>Mt(Yt,mt,wn,Oi,li))&&lt.every(li=>{const Ur={id:Yt.id,type:Yt.type,x:Yt.x+mt,y:Yt.y+wn,width:Yt.width,height:Yt.height};for(let so=0;so+1<li.waypoints.length;so++)if(ns(li.waypoints[so],li.waypoints[so+1],Ur)<Oi)return!1;return!0})),St=A.y+A.height/2,De=[F,O.y+O.height/2].filter(mt=>mt!==void 0&&Math.abs(mt-St)>=1),et=bt&&re.has(bt.id)?bt:Mn==null?void 0:Mn.target,jt=et?et.x-A.x:0,Bt=Math.max(...he.map(mt=>mt.x+mt.width)),yt=[...jt!==0?[jt]:[],...Qe!==0?[-Qe]:[],0],Vr=U===void 0?[]:yt.map(mt=>Math.max(mt,U-A.x)),Un=mt=>Bt+mt+Cn<=O.x,ao=[...new Set([...Vr,...yt])].filter(Un),Ya=bt&&re.has(bt.id)?[bt.x+bt.width+Cn-A.x]:[],Wr=U===void 0?[]:Ya.map(mt=>Math.max(mt,U-A.x)),mg=[...new Set([...Wr,...Ya])].filter(mt=>Un(mt)&&!ao.includes(mt));let ji;for(const mt of[ao,mg]){for(const wn of De){for(const Yt of mt)if(ke(Yt,wn-St)){ji={dx:Yt,dy:wn-St};break}if(ji)break}if(ji)break}if(ji){const mt=Ke=>{const vt=Ke;return[vt.edge,vt.other,...Array.isArray(vt.edges)?vt.edges:[]].some(It=>typeof It=="string"&&pc.has(It))},wn=()=>new Set(ut(We(r)).filter(Ke=>!mt(Ke)).map(Ke=>ct(Ke))),Yt=wn(),li=r.filter(Ke=>Ke.type==="label").map(Ke=>({label:Ke,x:Ke.x,y:Ke.y}));n.moveElements(he,{x:ji.dx,y:ji.dy},void 0,ye);const Ur=wn(),so=[...Ur].filter(Ke=>!Yt.has(Ke)).length,Ka=[...Yt].filter(Ke=>!Ur.has(Ke)).length;if(so>Ka){n.moveElements(he,{x:-ji.dx,y:-ji.dy},void 0,ye);for(const Ke of li){const vt=Ke.x-Ke.label.x,It=Ke.y-Ke.label.y;(vt!==0||It!==0)&&n.moveElements([Ke.label],{x:vt,y:It})}}else j&&WE.set(k.id,{exit:j,channelY:F,label:I})}}}{const Pe=new Set(he.map(lt=>lt.id)),Mt=new Set(_.map(lt=>lt.flow.id)),bt=20,Mn=lt=>{const Lt=lt.source,ke=lt.target,St=Math.min(Lt.x,ke.x)-bt,De=Math.max(Lt.x+Lt.width,ke.x+ke.width)+bt,et=Math.min(Lt.y,ke.y)-bt,jt=Math.max(Lt.y+Lt.height,ke.y+ke.height)+bt;return lt.waypoints.some(Bt=>Bt.x<St||Bt.x>De||Bt.y<et||Bt.y>jt)},xt=new Map;for(const lt of he)for(const Lt of[...lt.incoming??[],...lt.outgoing??[]])Lt.id!==b.id&&Mt.has(Lt.id)&&!(Pe.has(Lt.source.id)&&Pe.has(Lt.target.id))&&xt.set(Lt.id,Lt);for(const lt of xt.values())Mn(lt)&&ht(lt)}const zt=ve.length?d(ve[0]):void 0;if(zt){const Pe={assoc:FE(),overlaps:zE(zt),crosses:HE()},Mt=ve.map(De=>({st:De,x:De.x})),bt=r.filter(De=>De.type==="label").map(De=>({label:De,x:De.x,y:De.y})),Mn=Math.min(...ve.flatMap(De=>[...De.incoming??[],...De.outgoing??[]].filter(et=>et.type==="bpmn:DataInputAssociation"||et.type==="bpmn:DataOutputAssociation").map(et=>(et.source===De?et.target:et.source).x))),xt=new Set(ve.map(De=>De.id)),lt=(zt.children??[]).filter(Fi).filter(De=>!xt.has(De.id));let Lt=Mn;for(const De of[...ve].sort((et,jt)=>et.x-jt.x)){let et=Lt;for(let jt=0;jt<100;jt++){const Bt=lt.find(yt=>et<yt.x+yt.width+Di&&et+De.width+Di>yt.x&&De.y<yt.y+yt.height&&De.y+De.height>yt.y);if(!Bt)break;et=Bt.x+Bt.width+Di}et!==De.x&&n.moveElements([De],{x:et-De.x,y:0}),Lt=et+De.width+Di}const ke=Lt+150-(zt.x+zt.width);ke>0&&ip(zt,zt.width+ke);const St={assoc:FE(),overlaps:zE(zt),crosses:HE()};if(St.assoc>=Pe.assoc||St.overlaps>Pe.overlaps||St.crosses>Pe.crosses){for(const{st:De,x:et}of Mt)De.x!==et&&n.moveElements([De],{x:et-De.x,y:0});ke>0&&ip(zt,zt.width-ke);for(const De of bt){const et=De.x-De.label.x,jt=De.y-De.label.y;(et!==0||jt!==0)&&n.moveElements([De.label],{x:et,y:jt})}}}}for(const[b,R]of Rn){const A=p(b);if(!A)continue;const k=R.container,L=Math.abs(A.y+A.height/2-k.y-R.relCy)>=.5,O=A.label,j=Math.min(A.y,O&&!O.hidden?O.y:A.y),F=Math.max(A.y+A.height,O&&!O.hidden?O.y+O.height:0);if(L&&j>=k.y&&F<=k.y+k.height)continue;const I=A.y;R.grow(),A.y!==I&&n.moveElements([A],{x:0,y:I-A.y},void 0,{autoResize:!1})}const UE=(b,R)=>{const A=R.target===b,k=f(R.source),L=f(R.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,L,R.id?{type:O,businessObject:i.create(O,{id:R.id})}:{type:O})},qE=b=>{for(const R of h){if(!R.participant.blackBox)continue;const A=p(R.participant.id);if(!A)continue;const k=[];for(const O of x){const j=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&k.push(F)}if(!k.length)continue;if(!b&&R.order===void 0){const O=(()=>{var F;const j=new Map;for(const I of k){const U=d(I);if(!U)continue;const K=j.get(U.id);K?K.n+=1:j.set(U.id,{shape:U,n:1})}return(F=[...j.values()].sort((I,U)=>U.n-I.n)[0])==null?void 0:F.shape})();if(O){const j=U=>U.reduce((K,re)=>K+re,0)/U.length,F=j(k.map(U=>U.y+U.height/2))<O.y+O.height/2,I=r.filter(U=>U.type==="bpmn:Participant"&&U.id!==R.participant.id&&U.id!==O.id).filter(U=>F?U.y+U.height<=O.y+5:U.y>=O.y+O.height-5);if(I.length){const U=[...I.reduce((le,be)=>le.set(be.y,(le.get(be.y)??0)+1),new Map)].sort((le,be)=>be[1]-le[1]||(F?be[0]-le[0]:le[0]-be[0]))[0][0],K=Math.min(A.width,DC),re=LC,ne=k.map(le=>le.x+le.width/2),he=Math.round(j(ne)-K/2),fe=Math.max(...ne)+nf,ye=le=>({x:le,width:Math.max(K,fe-le)}),Ye=I.filter(le=>Math.min(le.y+le.height,U+re)-Math.max(le.y,U)>0),Ae=le=>{const be=ye(le);return Ye.some(Ze=>Ze.x<be.x+be.width&&be.x<Ze.x+Ze.width)},te=le=>{const be=ye(le);return ne.filter(Ze=>Ze>=be.x+10&&Ze<=be.x+be.width-10).length},se=(()=>{if(!Ae(he))return he;const le=te(he);return Ye.flatMap(be=>[be.x+be.width+Qm,be.x-Qm-K]).map(be=>Math.round(be)).filter(be=>!Ae(be)&&te(be)>=le).sort((be,Ze)=>Math.abs(be-he)-Math.abs(Ze-he))[0]??he})();if(se!==A.x||U!==A.y||K!==A.width||re!==A.height){const le=()=>new Set(ut(We(r)).map(xe=>ct(xe))),be=le(),Ze={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:se,y:U,width:K,height:re});const Qe=le(),Dt=[...Qe].filter(xe=>!be.has(xe)).length,Ft=[...be].filter(xe=>!Qe.has(xe)).length;Dt>Ft&&n.resizeShape(A,Ze)}}}}const L=Math.max(...k.map(O=>O.x+O.width/2))+nf;if(L>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:L-A.x,height:A.height}),!!b)for(const O of x){const j=p(O.flow.id),F=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,I=F?p(F):void 0;if(!j||!I||I.type==="bpmn:Participant")continue;const U=I.x+I.width/2;U<A.x+10||U>A.x+A.width-10||$E(j,A,I)}}};qE(!1);for(const b of x){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 A=new Set([..._.map(I=>I.flow.id),...x.map(I=>I.flow.id)].filter(I=>!!I)),k=r.filter(I=>!!I.waypoints),L=(I,U)=>Math.abs(U.x-I.x)<2?"L":Math.abs(U.x-(I.x+I.width))<2?"R":Math.abs(U.y-I.y)<2?"T":Math.abs(U.y-(I.y+I.height))<2?"B":void 0,O=new Map,j=(I,U,K)=>{if(!I||!U||typeof I.x!="number")return;const re=L(I,U);if(!re)return;let ne=O.get(I.id);ne||O.set(I.id,ne=new Map),ne.set(re,[...ne.get(re)??[],K])};for(const I of k){const U=I.waypoints;!U||U.length<2||(j(I.source,U[0],{id:I.id,dir:"out"}),j(I.target,U[U.length-1],{id:I.id,dir:"in"}))}const F=new Set;for(const[I,U]of O){const K=p(I);if(!K||typeof K.x!="number"||![...U.values()].some(Ae=>{const te=Ae.filter(se=>se.dir==="in");return Ae.length>=3&&te.length>=1&&Ae.some(se=>se.dir==="out")&&te.some(se=>A.has(se.id))}))continue;const ne=d(K);if(!ne||F.has(ne.id)||(ne.children??[]).some(Ae=>Ae.type==="bpmn:Lane"))continue;const he=(p1=U.get("T"))!=null&&p1.length?(f1=U.get("B"))!=null&&f1.length?void 0:"B":"T";if(!he||(he==="T"?K.y-ne.y:ne.y+ne.height-(K.y+K.height))>=N)continue;const ye=(ne.children??[]).filter(Ae=>!("waypoints"in Ae&&Ae.waypoints)&&Ae.type!=="label"&&typeof Ae.x=="number"),Ye=ne.y+ne.height;n.resizeShape(ne,{x:ne.x,y:ne.y,width:ne.width,height:ne.height+N}),ie(Ye,ne.id,N),he==="T"&&ye.length&&n.moveElements(ye,{x:0,y:N}),F.add(ne.id)}}const lg=20,YE=4,n5=3,i5=2,o5=[10,30,80],pr=()=>{const b=We(r);return{bad:ut(b).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:sm(b),straight:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Ua=b=>{const R=We(r),A=R.edges.find(k=>k.id===b);return A?bn(A,hi(R)).length:0},op=b=>Ua(b)>0,rp=b=>We(r).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==b&&R.waypoints.length===2).length,r5=(b,R,A)=>fc([{subtree:b,pool:R}],A),KE=(b,R)=>R.bad>b.bad||R.crossings>b.crossings&&R.straight<=b.straight&&R.bad>=b.bad,qa=(b,R)=>KE(b,R)||R.straight<b.straight,Hr=(b,R,A=()=>!0,k=KE,L=!1)=>{const O=pr(),j=fc(b,R,L);if(!j)return!1;const F=pr();return k(O,F)||!A()?(j(),!1):!0},a5=(b,R,A,k=()=>!0)=>Hr([{subtree:b,pool:R}],A,k),zr=b=>{var R;return!!((R=P.get(b))!=null&&R.node.participant)},dc=new Map;for(const b of x){if(!zr(b.flow.target))continue;const R=dc.get(b.flow.target)??[];R.push(b),dc.set(b.flow.target,R)}const ap=[...dc.keys()],ug=new Set(_.map(b=>b.flow.target)),XE=b=>Qt.findIndex(({op:R})=>R.participant.id===b);ap.sort((b,R)=>{var L,O;const A=ug.has(b)?1:0,k=ug.has(R)?1:0;return A!==k?A-k:XE((L=P.get(b))==null?void 0:L.node.participant)-XE((O=P.get(R))==null?void 0:O.node.participant)});const fr=b=>b.x+b.width/2,s5=b=>{const R=new Map;for(const L of r.getAll()){const O=L;if(!O.waypoints||!O.source||!O.target)continue;(R.get(O.source.id)??R.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([b]),k=[b];for(let L=0;L<k.length;L++)for(const O of R.get(k[L])??[])A.has(O)||(A.add(O),k.push(O));return A},c5=(b,R)=>{const A=s5(R);let k;for(const L of r.getAll()){const O=L;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==b||A.has(O.source.id))continue;const j=O.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=fr(j);(k===void 0||F>k)&&(k=F)}return k},pg=(b,R)=>{const A=p(b.flow.source);if(A)return A.type==="bpmn:Participant"?c5(A.id,R):fr(A)},ZE=b=>{let R;for(const A of dc.get(b)??[]){const k=pg(A,b);k!==void 0&&(!R||k>R.cx)&&(R={op:A,cx:k})}return R==null?void 0:R.op},l5=b=>{const R=ZE(b),A=p(b),k=R?pg(R,b):void 0;return A&&k!==void 0?k-fr(A):void 0},u5=b=>{const R=l5(b);return R!==void 0&&Math.abs(R)<lg},fg=(b,R,A,k,L)=>{var O;for(let j=!0;j;){j=!1;for(const F of x){if(F.flow.id===A)continue;const I=R.has(F.flow.source),U=R.has(F.flow.target);if(I===U||k(I?F.flow.source:F.flow.target))continue;const K=I?F.flow.target:F.flow.source;if(L(K)||!zr(K))continue;const re=p(F.flow.id);if(!(re!=null&&re.waypoints)||re.waypoints.length!==2)continue;const ne=p(K),he=(O=P.get(K))==null?void 0:O.node.participant;if(!ne||!he)continue;const fe=jr(K,ye=>ye.x>=ne.x).filter(ye=>!R.has(ye.id));if(!(!fe.length||fe.some(ye=>L(ye.id)))){for(const ye of fe)R.add(ye.id);b.set(he,[...b.get(he)??[],...fe]),j=!0}}}return[...b].map(([j,F])=>({subtree:F,pool:f(j)}))},QE=(b,R,A,k,L)=>fg(new Map([[R,[...b]]]),new Set(b.map(O=>O.id)),k,O=>O===A,O=>O===L),dg=b=>{const R=ZE(b);if(!R)return null;const A=p(b),k=p(R.flow.source),L=pg(R,b);if(!A||!k||L===void 0)return null;const O=L-fr(A);if(O>=lg){const j=P.get(b).node.participant,F=jr(b,I=>I.x>=A.x);return{groups:QE(F,j,b,R.flow.id,R.flow.source),dx:O}}if(-O>=lg&&zr(R.flow.source)){const j=P.get(R.flow.source).node.participant,F=jr(R.flow.source,I=>I.x>=k.x&&!u5(I.id));return{groups:QE(F,j,R.flow.source,R.flow.id,b),dx:-O}}return null},JE=()=>ap.map(b=>({id:b,plan:dg(b)})).filter(b=>!!b.plan).sort((b,R)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))).map(b=>b.id);for(let b=0;b<3;b++){const R=pr(),A=[];for(const L of JE()){const O=dg(L);if(!O)continue;const j=fc(O.groups,O.dx);j&&A.push(j)}if(!A.length)break;if(!qa(R,pr()))continue;for(const L of A.reverse())L();let k=!1;for(const L of JE()){const O=dg(L);O&&Hr(O.groups,O.dx,()=>!0,qa)&&(k=!0)}if(!k)break}for(const b of ap){if(ug.has(b))continue;const R=P.get(b);if(!R||R.node.lane!==void 0)continue;const A=Y(R);if(A===void 0)continue;const k=p(b),L=k?d(k):void 0;if(!k||!L)continue;const O=L.y+X+C(`pool:${R.node.participant??""}`,A)*N,j=O-(k.y+k.height/2);j!==0&&!Ge(L,k,k.x+k.width/2,O)&&n.moveElements([k],{x:0,y:j})}const e1=new Set;for(let b=0,R=!0;R&&b<n5;b++){R=!1;for(const A of ap.flatMap(k=>dc.get(k)??[])){if(e1.has(A.flow.id)||!op(A.flow.id))continue;const k=p(A.flow.target);if(!k)continue;const L=f(P.get(A.flow.target).node.participant),O=jr(A.flow.target,U=>U.x>=k.x),j=k.width+H,F=Ua(A.flow.id),I=rp(A.flow.id);for(let U=1;U<=YE;U++){const K=()=>Ua(A.flow.id)<F&&rp(A.flow.id)>=I;if(a5(O,L,j*U,K)){e1.add(A.flow.id),R=!0;break}}}}const hg=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),t1=new Set(hg.map(b=>b.id));for(const b of r.filter(R=>R.type==="bpmn:MessageFlow"))t1.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&hg.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of hg){if(!op(b.id))continue;const R=p(b.source),A=p(b.target);if(!R||!A)continue;let k,L,O;if(b.preexisting){const[F,I]=R.type==="bpmn:Participant"?[A,R]:[R,A];if(k=fr(F),k<I.x||k>I.x+I.width)continue;[L,O]=F.y<I.y?[F.y+F.height,I.y]:[I.y+I.height,F.y]}else{if(R.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(k=R.x+R.width/2,Math.abs(k-(A.x+A.width/2))>15))continue;[L,O]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y]}const j=[...P.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==R.id&&F.id!==A.id).filter(F=>F.x<=k&&k<=F.x+F.width&&F.y+F.height>L&&F.y<O).sort((F,I)=>F.x-I.x);for(const F of j){const I=(d1=P.get(F.id))==null?void 0:d1.node.participant,U=I?p(I):void 0;if(!I||!U)continue;const K=[...P.values()].filter(se=>se.node.participant===I).map(se=>se.node.id),re=se=>se.map(le=>p(le)).filter(le=>!!le),he=[X$(F.id,se=>{var le;return((le=P.get(se.id))==null?void 0:le.node.participant)===I}),re(K)].filter(se=>se.length).map(se=>[{subtree:se,pool:U}]);if(b.preexisting){const se=re(K);se.length&&he.push(fg(new Map([[I,[...se]]]),new Set(se.map(le=>le.id)),b.id,()=>!1,le=>le===R.id||le===A.id))}const fe=F.width+H,ye=Ua(b.id),Ye=rp(b.id),Ae=()=>Ua(b.id)<ye&&rp(b.id)>=Ye;let te=!1;for(const se of he){for(let le=1;le<=YE;le++)if(Hr(se,fe*le,Ae)){te=!0;break}if(te)break}if(!op(b.id))break}}const sp=()=>{var R;const b=new Set;for(const A of ut(We(r)))A.kind!=="edge-crosses-shape"||t1.has(A.edge)||((R=p(A.edge))==null?void 0:R.type)==="bpmn:MessageFlow"&&b.add(`${A.edge}>${A.shape}`);return b},p5=(b,R)=>pr().bad>=b&&[...sp()].some(A=>!R.has(A)),n1=b=>{var R,A;return Ua(b)===0&&((A=(R=p(b))==null?void 0:R.waypoints)==null?void 0:A.length)===2},f5=(b,R,A)=>{const k=new Set(b.flatMap(O=>O.subtree.map(j=>j.id))),L=[...sp()].filter(O=>!A.has(O)).map(O=>O.split(">")[1]);return[...new Set(L)].filter(O=>k.has(O)&&O!==R.source&&O!==R.target)},d5=(b,R,A,k,L)=>{const O=b.map(U=>({...U,subtree:U.subtree.filter(K=>!L.includes(K.id))})).filter(U=>U.subtree.length),j=new Set(O.flatMap(U=>U.subtree.map(K=>K.id))),F=()=>L.every(U=>{const K=p(U);return!!K&&_.filter(re=>re.flow.target===U&&j.has(re.flow.source)).every(re=>{const ne=p(re.flow.source);return!!ne&&ne.x+ne.width<=K.x})});return Hr(O,R,()=>n1(A.id)&&[...sp()].every(U=>k.has(U))&&F(),qa,!0)};for(const b of x){if(!op(b.flow.id))continue;const R=p(b.flow.id);if(((h1=R==null?void 0:R.waypoints)==null?void 0:h1.length)!==2)continue;const A=p(b.flow.source),k=p(b.flow.target);if(!A||!k||A.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!zr(b.flow.source)||!zr(b.flow.target)||Math.abs(fr(A)-fr(k))>i5)continue;const L=fr(A),O=R.waypoints.map(ye=>ye.y),[j,F]=[Math.min(...O),Math.max(...O)],I=hi(We(r)).filter(ye=>ye.id!==A.id&&ye.id!==k.id&&ye.x<L&&L<ye.x+ye.width&&j<ye.y+ye.height&&ye.y<F);if(!I.length)continue;const U=(g1=P.get(b.flow.source))==null?void 0:g1.node.participant,K=(m1=P.get(b.flow.target))==null?void 0:m1.node.participant;if(!U||!K)continue;const re=new Map;for(const[ye,Ye,Ae]of[[b.flow.source,A,U],[b.flow.target,k,K]]){const te=re.get(Ae)??[],se=jr(ye,le=>le.x>=Ye.x).filter(le=>!te.some(be=>be.id===le.id));re.set(Ae,[...te,...se])}const ne=new Set([...re.values()].flat().map(ye=>ye.id)),he=fg(re,ne,b.flow.id,ye=>ye===b.flow.source||ye===b.flow.target,()=>!1),fe=Math.max(...I.map(ye=>ye.x+ye.width));for(const ye of o5){const Ye=fe+ye-L;if(Ye<=0)continue;const Ae=pr().bad,te=sp();let se=[],le=!0;const be=()=>!n1(b.flow.id)||le&&(se=f5(he,b.flow,te),se.length)?!1:!p5(Ae,te);if(Hr(he,Ye,be,qa))break;if(se.length&&(d5(he,Ye,b.flow,te,se)||(le=!1,Hr(he,Ye,be,qa))))break}}{const b=A=>A.y+A.height/2,R=[];for(const A of P.keys()){if(!zr(A))continue;const k=_.filter(j=>j.flow.target===A);if(k.length!==1)continue;const L=p(k[0].flow.source),O=p(A);!L||!O||!P.has(L.id)||Math.abs(b(L)-b(O))>1||O.x-(L.x+L.width)<=H+1||R.push({id:A,pred:L,node:O})}R.sort((A,k)=>A.node.x-k.node.x);for(const{id:A}of R){const k=P.get(A),L=p(A),O=p(_.find(ne=>ne.flow.target===A).flow.source);if(!L||!O)continue;const j=L.x-(O.x+O.width);if(j<=H+1)continue;const F=f(k.node.participant),I=jr(A,ne=>ne.x>=L.x),U=pr(),K=r5(I,F,-(j-H));if(!K)continue;const re=pr();(re.bad>U.bad||re.crossings>=U.crossings||re.straight<U.straight)&&K()}}qE(!0);const h5=10,g5=400,m5=b=>[...b.incoming??[],...b.outgoing??[]].filter(R=>R.type==="bpmn:DataInputAssociation"||R.type==="bpmn:DataOutputAssociation").map(R=>R.source===b?R.target:R.source).filter(R=>!!R&&typeof R.y=="number"),y5=r.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),v5=(b,R)=>{const A=b.x+b.width/2,k=b.y+b.height/2;let L;for(const O of y5){if((d(O)??u())!==R||O.y<b.y+b.height)continue;const j=Math.abs(O.x+O.width/2-A);j>g5||j<O.width||!m5(O).some(I=>I.height===b.height&&Math.abs(I.y+I.height/2-k)<=h5&&O.y>=I.y+I.height)||(!L||j<L.dx||j===L.dx&&O.id<L.id)&&(L={dx:j,id:O.id,cy:O.y+O.height/2})}return L==null?void 0:L.cy};for(const b of m){const R=b.associations??[],A=R.map(O=>O.source===b.dataStore.id?O.target:O.source).map(p).find(Boolean),k=A?d(A)??u():u(),L=A?{x:A.x+A.width/2,y:v5(A,k)??A.y+A.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})},L,k);for(const O of R)UE(b.dataStore.id,O)}for(const b of v){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;UE(A,b.association)}let i1=0;const Gr=10,o1=40,b5=(b,R)=>{const A=R.map(I=>d(I)).filter(I=>!!I);for(const I of A){const U=Gr,K=I.y,re=I.y+I.height,ne=I.x,he=I.x+I.width;if(Math.abs(b.y-K)<U){const fe=K+U-b.y;b.y+=fe,b.height-=fe}if(Math.abs(b.y+b.height-re)<U&&(b.height=re-U-b.y),Math.abs(b.x-ne)<U){const fe=ne+U-b.x;b.x+=fe,b.width-=fe}Math.abs(b.x+b.width-he)<U&&(b.width=he-U-b.x)}if(!A.length)return;const k=Math.min(...A.map(I=>I.y)),L=Math.max(...A.map(I=>I.y+I.height)),O=k-b.y,j=b.y+b.height-L,F=o1-Gr;if(O>0!=j>0)if(O>0&&O<F){const I=O+Gr;b.y+=I,b.height-=I}else j>0&&j<F&&(b.height-=j+Gr)},x5=(b,R)=>{const A=Gr,k=30,L=r.filter(O=>O.type==="bpmn:Group"&&O.id!==R);for(const O of L){const j=O.x,F=O.x+O.width,I=O.y,U=O.y+O.height,K=b.y<U&&I<b.y+b.height,re=b.x<F&&j<b.x+b.width;if(K){if(Math.abs(b.x-F)<A){const ne=Math.min(F+A-b.x,k);ne>0&&b.width-ne>0&&(b.x+=ne,b.width-=ne)}if(Math.abs(b.x+b.width-j)<A){const ne=Math.min(b.x+b.width-(j-A),k);ne>0&&b.width-ne>0&&(b.width-=ne)}}if(re){if(Math.abs(b.y-U)<A){const ne=Math.min(U+A-b.y,k);ne>0&&b.height-ne>0&&(b.y+=ne,b.height-=ne)}if(Math.abs(b.y+b.height-I)<A){const ne=Math.min(b.y+b.height-(I-A),k);ne>0&&b.height-ne>0&&(b.height-=ne)}}}},gg=(b,R)=>{const A=o1,k=Math.min(...b.map(I=>I.x))-A,L=Math.min(...b.map(I=>I.y))-A,O=Math.max(...b.map(I=>I.x+I.width))+A,j=Math.max(...b.map(I=>I.y+I.height))+A,F={x:k,y:L,width:O-k,height:j-L};return b5(F,b),x5(F,R),F};for(const b of S){const R=(b.group.members??[]).map(p).filter(L=>!!L);let A;R.length?A=gg(R,b.group.id):(A={x:300+i1*350,y:40,width:300,height:200},i1++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(k,b.group.name),(y1=b.group.members)!=null&&y1.length&&T(k,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=r.filter(L=>!!L.waypoints),R=new Map,A=(L,O)=>{!L||!O||(R.has(L)||R.set(L,new Set),R.get(L).add(O))};for(const L of b){const O=(v1=L.source)==null?void 0:v1.id,j=(b1=L.target)==null?void 0:b1.id;A(O,j),((x1=L.type)!=null&&x1.includes("DataOutputAssociation")||(_1=L.type)!=null&&_1.includes("DataInputAssociation")||L.type==="bpmn:Association")&&A(j,O)}const k=r.filter(L=>L.type==="bpmn:Group");for(const L of k){const j=(((w1=L.businessObject.extensionElements)==null?void 0:w1.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const I=new Set(F),U=[...F];for(;U.length;){const Ae=U.shift();for(const te of R.get(Ae)??[])I.has(te)||(I.add(te),U.push(te))}const K=L.x,re=L.x+L.width,ne=L.y,he=L.y+L.height,fe=Ae=>_.filter(te=>te.flow.target===Ae).length,ye=Ae=>{var se;const te=((se=p(Ae))==null?void 0:se.type)??"";if(te==="bpmn:StartEvent"&&fe(Ae)===0)return!1;if(te.endsWith("Gateway")){const le=_.filter(be=>be.flow.target===Ae).map(be=>be.flow.source);if(le.length&&le.every(be=>{var Ze;return((Ze=p(be))==null?void 0:Ze.type)==="bpmn:StartEvent"&&fe(be)===0}))return!1}return!0},Ye=r.filter(Ae=>Fi(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!I.has(Ae.id)&&zr(Ae.id)&&ye(Ae.id)&&Ae.x<re&&Ae.x+Ae.width>K&&Ae.y<he&&Ae.y+Ae.height>ne);if(Ye.length)for(const Ae of[-1,1]){const te=Ye.filter(ve=>(ve.x+ve.width-K<=re-ve.x?-1:1)===Ae);if(!te.length)continue;const se=[];for(const ve of te){const ce=se.find(_e=>_e.some(Ne=>ve.y<Ne.y+Ne.height&&ve.y+ve.height>Ne.y));ce?ce.push(ve):se.push([ve])}const le=new Map;for(const ve of se){let ce=Ae<0?K-Gr:re+Gr;for(const _e of[...ve].sort((Ne,Ie)=>Ae<0?Ie.x-Ne.x:Ne.x-Ie.x)){const Ne=Ae<0?Math.min(_e.x,ce-_e.width):Math.max(_e.x,ce);ce=Ae<0?Ne-Di:Ne+_e.width+Di,Ne!==_e.x&&Math.sign(Ne-_e.x)===Ae&&le.set(_e.id,Ne-_e.x)}}const be=new Map,Ze=ve=>be.get(ve)===ve||!be.get(ve)?ve:Ze(be.get(ve));for(const ve of te)be.set(ve.id,ve.id);for(const ve of x){const ce=le.has(ve.flow.source)?ve.flow.source:void 0,_e=le.has(ve.flow.target)?ve.flow.target:void 0;if(!ce||!_e)continue;const Ne=p(ve.flow.id);((E1=Ne==null?void 0:Ne.waypoints)==null?void 0:E1.length)===2&&be.set(Ze(ce),Ze(_e))}const Qe=new Map;for(const ve of te){if(!le.has(ve.id))continue;const ce=Ze(ve.id);Qe.set(ce,[...Qe.get(ce)??[],ve])}const Dt=[...Qe.values()].sort((ve,ce)=>Ae<0?Math.min(...ve.map(_e=>_e.x))-Math.min(...ce.map(_e=>_e.x)):Math.max(...ce.map(_e=>_e.x))-Math.max(...ve.map(_e=>_e.x))),Ft=[];let xe=!0;for(const ve of Dt){const ce=ve.map(Ie=>le.get(Ie.id)??0).reduce((Ie,Ee)=>Math.abs(Ee)>Math.abs(Ie)?Ee:Ie,0),_e=new Map;let Ne=!0;for(const Ie of ve){const Ee=d(Ie);if(!Ee){Ne=!1;break}_e.has(Ee.id)||_e.set(Ee.id,{subtree:[],pool:Ee}),_e.get(Ee.id).subtree.push(Ie)}Ne&&Hr([..._e.values()],ce,()=>!0,qa)?Ft.push({shapes:ve,dx:ce}):xe=!1}if(!xe)for(const ve of Ft.reverse())n.moveElements(ve.shapes,{x:-ve.dx,y:0})}}}{const b=new Set([...S.map(R=>R.group.id),...en(e,"group.update").map(R=>R.id)]);for(const R of r.filter(A=>A.type==="bpmn:Group")){if(b.has(R.id))continue;const k=(((S1=R.businessObject.extensionElements)==null?void 0:S1.values)??[]).find(F=>F.$type==="bwl:Members"),L=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!L.length||!L.some(F=>{const I=g.get(F.id);return!I||I.x!==F.x||I.y!==F.y})||!L.some(F=>F.x<R.x||F.y<R.y||F.x+F.width>R.x+R.width||F.y+F.height>R.y+R.height)||n.resizeShape(R,gg(L,R.id))}}{const R=new Map(xr(We(r)).map(F=>[F.owner,F.rect])),A=r.filter(F=>!!F.waypoints),k=new Map,L=(F,I)=>{!F||!I||(k.has(F)||k.set(F,new Set),k.get(F).add(I))};for(const F of A){const I=(R1=F.source)==null?void 0:R1.id,U=(C1=F.target)==null?void 0:C1.id;L(I,U),((M1=F.type)!=null&&M1.includes("DataOutputAssociation")||(A1=F.type)!=null&&A1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&L(U,I)}const O=F=>_.filter(I=>I.flow.target===F).length,j=F=>{var U;const I=((U=p(F))==null?void 0:U.type)??"";if(I==="bpmn:StartEvent"&&O(F)===0)return!1;if(I.endsWith("Gateway")){const K=_.filter(re=>re.flow.target===F).map(re=>re.flow.source);if(K.length&&K.every(re=>{var ne;return((ne=p(re))==null?void 0:ne.type)==="bpmn:StartEvent"&&O(re)===0}))return!1}return!0};for(const F of r.filter(I=>I.type==="bpmn:Group")){const U=(((P1=F.businessObject.extensionElements)==null?void 0:P1.values)??[]).find(ce=>ce.$type==="bwl:Members"),K=((U==null?void 0:U.refs)??"").split(" ").filter(Boolean);if(!K.length)continue;const re=K.map(p).filter(ce=>!!ce);if(!re.length||!(S.some(ce=>ce.group.id===F.id)||en(e,"group.update").some(ce=>ce.id===F.id)||re.some(ce=>{const _e=g.get(ce.id);return!_e||_e.x!==ce.x||_e.y!==ce.y})))continue;const he=new Set(K),fe=[...K];for(;fe.length;){const ce=fe.shift();for(const _e of k.get(ce)??[])he.has(_e)||(he.add(_e),fe.push(_e))}const ye=F.x,Ye=F.x+F.width,Ae=F.y,te=F.y+F.height,se=ce=>{const _e=R.get(ce.id),Ne={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return _e?[Ne,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[Ne]},le=re.flatMap(se),be=Math.min(...le.map(ce=>ce.x)),Ze=Math.max(...le.map(ce=>ce.x+ce.width)),Qe=Math.min(...le.map(ce=>ce.y)),Dt=Math.max(...le.map(ce=>ce.y+ce.height)),Ft={L:be-ye,R:Ye-Ze,T:Qe-Ae,B:te-Dt},xe=r.filter(ce=>Fi(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!he.has(ce.id)&&j(ce.id)&&ce.x<Ye&&ce.x+ce.width>ye&&ce.y<te&&ce.y+ce.height>Ae);if(!xe.length)continue;const ve={L:0,R:0,T:0,B:0};for(const ce of xe){const _e=se(ce),Ne=Math.min(..._e.map(nt=>nt.x)),Ie=Math.max(..._e.map(nt=>nt.x+nt.width)),Ee=Math.min(..._e.map(nt=>nt.y)),ot=Math.max(..._e.map(nt=>nt.y+nt.height)),pt={L:Ie-ye,R:Ye-Ne,T:ot-Ae,B:te-Ee},Jt=["L","R","T","B"].filter(nt=>pt[nt]<=Ft[nt]+.001);if(!Jt.length)continue;const ci=Jt.reduce((nt,zt)=>pt[zt]<pt[nt]?zt:nt,Jt[0]);ve[ci]=Math.max(ve[ci],Math.min(pt[ci]+10,Ft[ci]))}!ve.L&&!ve.R&&!ve.T&&!ve.B||n.resizeShape(F,{x:F.x+ve.L,y:F.y+ve.T,width:F.width-ve.L-ve.R,height:F.height-ve.T-ve.B})}}const r1=b=>{const R=b.waypoints;if(R!=null&&R.length){const k=R[Math.floor((R.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let hc=0;const a1=12,s1=14,_5=15,w5=300,E5=b=>{const R=b.split(`
7
+ `),A=Math.max(...R.map(O=>oa(O,a1))),k=Math.max(100,Math.min(w5,Math.ceil(A)+s1)),L=R.reduce((O,j)=>O+Math.max(1,Math.ceil((oa(j,a1)+s1)/k)),0);return{width:k,height:Math.max(30,L*_5+10)}};for(const b of w){const R=b.association,A=((T1=b.placement)==null?void 0:T1.anchor)??(R?R.source===b.annotation.id?R.target:R.source:void 0),k=A?p(A):void 0,L=k?r1(k):void 0,O=E5(b.annotation.text??"");let j;if(L&&b.placement){const[K,re]=Vc[b.placement.side],ne=b.placement.offset??50;j={x:L.x+L.width/2+K*(L.width/2+O.width/2+ne),y:L.y+L.height/2+re*(L.height/2+O.height/2+ne)}}else L?(j={x:L.x+L.width/2+180+hc%3*260,y:L.y-110-hc%2*95},hc++):(j={x:300+hc*260,y:60},hc++);const F=k?d(k)??u():u(),I=F;L&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(j=Uc(r,L,O,I,b.placement?{placement:b.placement}:{from:j}));const U=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},j,F);if(R){const K=re=>re===b.annotation.id?U:f(re);n.connect(K(R.source),K(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}b.placement&&T(U,"bwl:Placement",D(b.placement))}for(const b of en(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"})}const c1=()=>new Set(r.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of en(e,"node.update")){let R=f(b.id);if(b.type&&Gc(b.type)!==R.type){const A=R.x+R.width/2,k=R.y+R.height/2,L=c1();R=c.replaceElement(R,{type:Gc(b.type),...b.eventDefinition?{eventDefinitionType:bc[b.eventDefinition]}:{}});const O=c1(),j=[...L].filter(U=>U!==b.id&&!O.has(U));if(j.length)throw new ty({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:j});const F=Math.round(A-(R.x+R.width/2)),I=Math.round(k-(R.y+R.height/2));if(F!==0||I!==0){n.moveShape(R,{x:F,y:I});for(const U of[...R.incoming??[],...R.outgoing??[]])ht(U)}}if(b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(R,{"bwl:band":b.band});const A=R.y+R.height/2,k=d(R),L=b.lane?f(b.lane):((k==null?void 0:k.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);b.band!==void 0&&gt(L==null?void 0:L.id,b.band,k);const O=L?L.y+(b.band===void 0?L.height/2:Math.min(L.height/2,Q)+C(L.id,b.band)*N):b.band!==void 0&&k?k.y+X+C(`pool:${k.id}`,b.band)*N:void 0;if(O!==void 0){const j=O-A;j!==0&&n.moveElements([R],{x:0,y:j})}}}for(const b of en(e,"sequenceFlow.update")){const R=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=R,k=b.source!==void 0?f(b.source):A.source,L=b.target!==void 0?f(b.target):A.target,O=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(A,k,L,[O(k),O(L)]);const j=WE.get(A.id),F=L.y+L.height/2;if(j&&L.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:L.x,y:F}]);const I=A.label;if(I&&j.label){const K=Math.abs(j.label.y+I.height/2-j.channelY)<=N/5&&j.label.x+I.width>j.exit.x,re=j.exit.x+6,ne=L.x-6-I.width,he=K?ne>=re?{x:Math.max(re,Math.min(j.label.x,ne)),y:j.label.y+(F-j.channelY)}:void 0:j.label;he&&(he.x!==I.x||he.y!==I.y)&&n.moveElements([I],{x:he.x-I.x,y:he.y-I.y})}}else Math.abs(F-(k.y+k.height/2))>1&&ht(A)}b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(R,{name:((k1=b.condition)==null?void 0:k1.label)??void 0})}for(const b of en(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"annotation.update")){const R=f(b.id);if(b.text!==void 0&&n.updateProperties(R,{text:b.text}),b.placement===null)T(R,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),k=r1(A),L=d(A)??u(),O=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[j,F]=Vc[b.placement.side],I=b.placement.offset??50,U={x:k.x+k.width/2+j*(k.width/2+R.width/2+I),y:k.y+k.height/2+F*(k.height/2+R.height/2+I)},K=O?Uc(r,k,{width:R.width,height:R.height},L,{placement:b.placement,selfId:b.id}):U;n.moveElements([R],{x:K.x-(R.x+R.width/2),y:K.y-(R.y+R.height/2)}),T(R,"bwl:Placement",D(b.placement))}}for(const b of en(e,"group.update")){const R=f(b.id);if(b.name!==void 0&&n.updateLabel(R,b.name??""),b.members){const A=b.members.map(p).filter(k=>!!k);A.length&&n.resizeShape(R,gg(A,b.id)),T(R,"bwl:Members",{refs:b.members.join(" ")})}}}function of(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 NC(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>ut(f).filter(d=>!t.has(ct(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=We(i),c=r(s),l=[...new Set(c.flatMap(of))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const ee=d.x+d.width/2,Ve=d.y+d.height/2;h=i.getAll().find(qe=>{if(qe.type!=="bpmn:Participant")return!1;const Ge=qe;return typeof Ge.x=="number"&&typeof Ge.width=="number"&&ee>=Ge.x&&ee<=Ge.x+Ge.width&&Ve>=Ge.y&&Ve<=Ge.y+Ge.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ee=>ee.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(ee=>ee.type==="bpmn:Association"),m=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!m)continue;const v=m.waypoints,w=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:m.x,y:m.y,width:m.width,height:m.height},S={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},T=_==null?void 0:_.side,D=ey(i,w,h),$=[];if(T&&T in Vc&&$.push(Uc(i,w,S,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:f})),D&&!Wc(P,S,D))for(const ee of BC)$.push(Uc(i,w,S,h,{placement:{side:ee,offset:null},selfId:f}));for(const[ee,Ve]of[[-1,0],[1,0],[0,-1],[0,1]])for(let qe=1;qe<=IC;qe++)$.push({x:P.x+ee*Jm*qe,y:P.y+Ve*Jm*qe});const N={...s,edges:s.edges.filter(ee=>ee.id!==(x==null?void 0:x.id))},H=r(N),X=H.filter(ee=>of(ee).includes(f)).length;if(!X)continue;let Q;for(const ee of $){const Ve=ee.x-P.x,qe=ee.y-P.y;if(!Ve&&!qe||ee.x-S.width/2<h.x||ee.x+S.width/2>h.x+h.width||ee.y-S.height/2<h.y||ee.y+S.height/2>h.y+h.height||D&&!Wc(ee,S,D))continue;const Ge={...N,shapes:N.shapes.map(W=>W.id===f?{...W,x:W.x+Ve,y:W.y+qe}:W)},Re=r(Ge),Z=Re.filter(W=>of(W).includes(f)).length;if(Z>=X||Re.length>H.length)continue;const oe=Math.abs(Ve)+Math.abs(qe);if((!Q||Z<Q.mine||Z===Q.mine&&(Re.length<Q.all||Re.length===Q.all&&oe<Q.dist))&&(Q={x:ee.x,y:ee.y,mine:Z,all:Re.length,dist:oe}),Q.mine===0&&Q.all<H.length)break}Q&&o.moveElements([d],{x:Q.x-P.x,y:Q.y-P.y})}}const $C=60;function rf(e,t,n,i){const o=t.x+t.width,r=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(r.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of r)Math.abs(c.x+c.width-o)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function FC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=u=>ut(u).filter(p=>!t.has(ct(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const _ of n.shapes)_.type!=="bpmn:Group"||f.has(_.id)||[...d].some(x=>{const m=s.get(x);return m&&c(_,m)})&&(f.add(_.id),y=!0);for(const _ of n.shapes)_.type!=="bpmn:Participant"||d.has(_.id)||[...f].some(x=>{const m=s.get(x);return m&&c(m,_)})&&(d.add(_.id),y=!0);if(!y)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(y=>{const _=s.get(y);return _&&c(_,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=We(i),f=r(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[w,S]=v.pools,P=g.get(w),T=g.get(S);if(!P||!T)continue;const[D,$]=P.x<=T.x?[P,T]:[T,P];if(v.contained)continue;const N=s.get(D.id),H=s.get($.id),X=N&&H?Math.max(H.x-(N.x+N.width),0):$C,Q=D.x+D.width+X-$.x;if(Q<=0)continue;const ee=l($.id).filter(Ve=>i.get(Ve));ee.length&&(!h||Q>h.dx)&&(h={movers:ee,dx:Q})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const _=f.length,x=d.length;o.moveElements(y,{x:h.dx,y:0});const m=r(We(i));if(!(a(m).length<x&&m.length<=_)){o.moveElements(y,{x:-h.dx,y:0});return}}}const ss=.5,iy=150;function jC(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of HC(n))i.length<n.length&&i.some(r=>zC(e.elementRegistry.get(r.id)))||GC(e,i)}function HC(e){const t=[...e].sort((i,o)=>i.x+i.width-(o.x+o.width)),n=[];for(const i of t){const o=n[n.length-1],r=o==null?void 0:o[o.length-1];o&&r&&i.x+i.width-(r.x+r.width)<=ss?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function zC(e){var i,o,r;const t=(i=e==null?void 0:e.businessObject)==null?void 0:i.processRef;if(!t)return!0;const n=(t.laneSets??[]).reduce((a,s)=>{var c;return a+(((c=s.lanes)==null?void 0:c.length)??0)},0);return(((o=t.flowElements)==null?void 0:o.length)??0)+n+(((r=t.artifacts)==null?void 0:r.length)??0)===0}function GC(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(x=>x.x+x.width),r=Math.max(...o);if(r-Math.min(...o)>ss)return;const a=t.map(x=>n.get(x.id)).filter(x=>!!x&&typeof x.x=="number");if(a.length<2)return;const s=new Map(t.map(x=>[x.id,x.x]));if(a.some(x=>Math.abs(x.x-s.get(x.id))>ss))return;const c=a.map(x=>x.x+x.width);if(Math.max(...c)-Math.min(...c)<=ss)return;const l=x=>x.x+x.width,u=x=>!!x&&typeof x.width=="number",p=x=>{const m={shapes:[],edges:[],lanes:[]},v=w=>{for(const S of w.children??[]){if("waypoints"in S&&S.waypoints){m.edges.push(S);continue}S.type!=="label"&&(S.type==="bpmn:Lane"?m.lanes.push(S):m.shapes.push(S),v(S))}};return v(x),m},f=new Map(a.map(x=>[x.id,p(x)]));let d=r;for(const x of a){const{shapes:m}=f.get(x.id),v=m.flatMap(w=>[l(w),...u(w.label)?[l(w.label)]:[]]);v.length&&(d=Math.max(d,Math.max(...v)+iy))}const g=a.filter(x=>Math.abs(l(x)-d)>ss);if(!g.length)return;for(const x of g){const m=l(x),{shapes:v,edges:w,lanes:S}=f.get(x.id);if([...v.flatMap(D=>[l(D),...u(D.label)?[l(D.label)]:[]]),...w.flatMap(D=>[...D.waypoints.map($=>$.x),...u(D.label)?[l(D.label)]:[]])].some(D=>D>d)||[...(x.incoming??[]).map(D=>D.waypoints[D.waypoints.length-1]),...(x.outgoing??[]).map(D=>D.waypoints[0])].some(D=>!D||D.x>d||Math.abs(D.x-m)<1))return;if(d>m){const D={x:m,y:x.y,width:d-m,height:x.height},$=new Set([x.id,...v.map(H=>H.id),...w.map(H=>H.id),...S.map(H=>H.id)]);if(n.getAll().some(H=>{var ee;if("waypoints"in H&&H.waypoints||H.type==="bpmn:Group"||!u(H))return!1;const X=H.type==="label"?(ee=H.labelTarget)==null?void 0:ee.id:H.id;if(!X||$.has(X)||$.has(H.id))return!1;const Q=H;return Q.x<D.x+D.width&&Q.x+Q.width>D.x&&Q.y<D.y+D.height&&Q.y+Q.height>D.y}))return}}const h=()=>new Set(ut(We(n)).map(ct)),y=h(),_=g.map(x=>x.width);for(const x of g)rf(i,x,d-x.x,{layout:!1});[...h()].every(x=>y.has(x))||g.forEach((x,m)=>rf(i,x,_[m],{layout:!1}))}function VC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ut(l).filter(u=>!t.has(ct(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(S=>S.id!==l.id&&S.type!=="bpmn:Group"&&a(l,S));if(!p.length)continue;const f=p.map(S=>i.get(S.id)).filter(S=>!!S&&typeof S.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),y=g.t+(l.y-d.t),_=g.r+(l.x+l.width-d.r),x=g.b+(l.y+l.height-d.b),m={x:h,y,width:_-h,height:x-y};if(m.width<=0||m.height<=0||Math.abs(m.x-u.x)<1&&Math.abs(m.y-u.y)<1&&Math.abs(m.width-u.width)<1&&Math.abs(m.height-u.height)<1)continue;const v=r(We(i)).length,w={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,m),r(We(i)).length>v&&o.resizeShape(u,w)}}const qc=20,Yc=10;function WC(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(ut(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ct)),s=We(o),c=ut(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(ct(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const x=h.members.map(Te=>o.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!x.length)continue;const m=Math.min(...x.map(Te=>Te.x)),v=Math.min(...x.map(Te=>Te.y)),w=Math.max(...x.map(Te=>Te.x+Te.width)),S=Math.max(...x.map(Te=>Te.y+Te.height)),P=h.x,T=h.y,D=h.x+h.width,$=h.y+h.height;let N=P,H=T,X=D,Q=$;for(const Te of g){const B=s.edges.find(E=>E.id===Te.edge);if(!B)continue;const C=B.endpoints.some(E=>{const G=s.shapes.find(Me=>Me.id===E);if(!G||G.container)return!1;const q=G.x+G.width/2,ie=G.y+G.height/2;return P<q&&q<D&&T<ie&&ie<$});for(const E of vn(B)){const G=E.axis==="v"?[T,$]:[P,D];Math.min(E.hi,G[1])-Math.max(E.lo,G[0])<Fp||(E.axis==="v"?P<E.at&&E.at<D:T<E.at&&E.at<$)&&C||(E.axis==="v"?(Math.abs(E.at-P)<=ra&&(N=Math.max(N,E.at+qc)),Math.abs(E.at-D)<=ra&&(X=Math.min(X,E.at-qc))):(Math.abs(E.at-T)<=ra&&(H=Math.max(H,E.at+qc)),Math.abs(E.at-$)<=ra&&(Q=Math.min(Q,E.at-qc))))}}if(N>m-Yc&&(N=P),H>v-Yc&&(H=T),X<w+Yc&&(X=D),Q<S+Yc&&(Q=$),N===P&&H===T&&X===D&&Q===$)continue;const ee=o.get(d),Ve={x:ee.x,y:ee.y,width:ee.width,height:ee.height},qe=We(o),Ge=new Set(ut(qe).map(ct)),Re=a(qe);r.resizeShape(ee,{x:N,y:H,width:X-N,height:Q-H});let Z=We(o),oe=ut(Z).filter(Te=>!Ge.has(ct(Te)));const W=[];if(oe.length>0&&oe.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&Z.edges.some(B=>B.id===Te.edge))){for(const Te of oe){if(Te.kind!=="label-over-line")continue;const B=Z.edges.find(ie=>ie.id===Te.edge),C=B&&ef(B,Z),E=(f=o.get(Te.edge))==null?void 0:f.label;if(!C||!E)continue;const G=C.x-E.x,q=C.y-E.y;r.moveElements([E],{x:G,y:q}),W.push({label:E,dx:G,dy:q})}Z=We(o),oe=ut(Z).filter(Te=>!Ge.has(ct(Te)))}const ae=a(Z),ge=[...ae].some(Te=>!Re.has(Te));if(oe.length||ge||ae.size>=Re.size){for(const Te of W.reverse())r.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});r.resizeShape(ee,Ve)}}}function UC(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=vp((o==null?void 0:o.$parent)??o),a=Za(i),s=new Map;for(const l of e.keys()){const u=(c=t.get(l))==null?void 0:c.businessObject;s.set(l,u?{texts:bp(u,i,r),requests:Ep(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...r?{rootLang:r}:{},before:s.get(l)}]:[]})}}function oy(e,t,n={}){var H,X;const{i18n:i,lower:o=ny}=n,r=Zm(e),a=vm(r.elementRegistry),s=Xm(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0},sharedEndpointCrossings:{before:0,after:0,pairs:[]}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=TC(t,a,i),u=i&&l.writes.size?UC(l.writes,r.elementRegistry,r.canvas,i):void 0,p=We(r.elementRegistry),f=new Set(ut(p).map(ct)),d=new Set(ut(p,{includeObservationOnly:!0}).map(ct)),g=new Set(p.edges.map(Q=>Q.id)),h=new Set(t.flatMap(Q=>Q.kind==="sequenceFlow.update"&&(Q.source!==void 0||Q.target!==void 0)?[Q.id]:[])),y=new Set(p.shapes.map(Q=>Q.id)),_=ca(p),x=_.length,m=new Set(_.map(([Q,ee])=>`${Q}|${ee}`)),v=Lo(p),w=new Set(v.map(([Q,ee])=>`${Q}|${ee}`)),S=new Map;for(const Q of r.elementRegistry.filter(ee=>"waypoints"in ee&&!!ee.waypoints))Q.label&&S.set(Q.id,{wps:Q.waypoints.map(ee=>({x:ee.x,y:ee.y})),label:{x:Q.label.x,y:Q.label.y},source:(H=Q.source)==null?void 0:H.id,target:(X=Q.target)==null?void 0:X.id});const P=e.get("commandStack");try{Eg(P,()=>{o(l.ops,r);for(const ee of(u==null?void 0:u.contexts())??[])P.execute(_p,ee);FC(r,f,p),jC(r,p),VC(r,f,p),Mm(r,g);const Q=Yp(r,f);_m(r,m,g),Nm(r,f,g),Tm(r,g),bC(r,g,h),Dm(r,f,g),EC(r,f,g),hC(r,w,g),Gm(r,f,g),zm(r,g,h),Wm(r,y),NC(r,f,y),Yp(r,f,Q),WC(r,d,p,g),Um(r,f),Hm(r,S)})}catch(Q){return{ok:!1,issues:[Q instanceof ty?Q.issue:{kind:"lower-failed",message:Q instanceof Error?Q.message:String(Q)}],findings:[],stats:c}}const T=We(r.elementRegistry),D=ut(T,{includeObservationOnly:!0}).filter(Q=>!d.has(ct(Q))),$=cm(T),N=Lo(T);return{ok:!0,issues:[],findings:D,stats:{edgeCrossings:{before:x,after:$.pairs.length,pairs:$.pairs,solidPairs:$.solidPairs,dashedPairs:$.dashedPairs,mixedPairs:$.mixedPairs,crossPoolMessages:$.crossPoolMessages},sharedEndpointCrossings:{before:v.length,after:N.length,pairs:N}}}}function qC(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function ry(e,t){return typeof e.get=="function"?e.get(t):e[t]}function ay(e,t){const n=ry(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function sy(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function YC(e){return typeof e=="string"&&dp.includes(e)}function Ii(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function cy(e,t={}){const n=e.rootElements??[],i=n.find(Z=>Z.$type==="bpmn:Collaboration"),o=new Map(n.filter(Z=>Z.$type==="bpmn:Process").map(Z=>[Z.id,Z])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],y=[],_=[],x=[],m=new Map,v=new Set,w=new Set,S=Z=>{Z&&v.add(Z)},P=Z=>{v.add(Z),w.add(Z)},T=Z=>{const oe=sy(Z,"bwl:Placement");if(!oe)return;const W=typeof oe.anchor=="string"?oe.anchor:void 0;if(!W||!YC(oe.side))return;const Y=typeof oe.offset=="number"?oe.offset:void 0;y.push({owner:Z.id,anchor:W,side:oe.side,...Y!==void 0?{offset:Y}:{}})},D=Z=>{const oe=sy(Z,"bwl:Members"),W=typeof(oe==null?void 0:oe.refs)=="string"?oe.refs.split(/\s+/).filter(Boolean):[];W.length&&x.push({owner:Z.id,refs:W})},$=Z=>{var oe;for(const W of Z)switch(S(W.id),W.$type){case"bpmn:TextAnnotation":P(W.id),m.set(W.id,W),c.push({id:W.id,text:typeof W.text=="string"?W.text:""}),T(W);break;case"bpmn:Association":g.push({id:W.id,type:W.$type,source:Ii(W.sourceRef),target:Ii(W.targetRef)});break;case"bpmn:Group":{P(W.id),m.set(W.id,W);const Y=(oe=W.categoryValueRef)==null?void 0:oe.value;l.push({id:W.id,...typeof Y=="string"&&Y?{name:Y}:{}}),D(W);break}default:u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"})}},N=Z=>{for(const oe of Z.flowElements??[])S(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"}),(oe.flowElements??[]).length&&N(oe);for(const oe of Z.artifacts??[])S(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"})},H=(Z,oe)=>{const W=Z.flowElements??[],Y=(Z.laneSets??[]).flatMap(ge=>ge.lanes??[]),ae=new Map;for(const ge of Y){S(ge.id),m.set(ge.id,ge);for(const Te of ge.flowNodeRef??[]){const B=Ii(Te);B&&ae.set(B,ge.id)}}for(const ge of W){if(S(ge.id),m.set(ge.id,ge),ge.$type==="bpmn:SequenceFlow"){f.push({id:ge.id,source:Ii(ge.sourceRef),target:Ii(ge.targetRef),...typeof ge.name=="string"&&ge.name?{name:ge.name}:{}});continue}if(ge.$type==="bpmn:DataStoreReference"){P(ge.id),s.push({id:ge.id,...ge.name?{name:ge.name}:{}});continue}const Te=qC(ge.$type),B=Te==="intermediateCatchEvent"?pp((ge.eventDefinitions??[]).map(q=>q.$type)):void 0;if(!yg(Te)||Te==="intermediateCatchEvent"&&!B){u.push({id:ge.id,type:ge.$type,reason:"type-outside-mvp"});continue}P(ge.id);const C=Te==="boundaryEvent"?Ii(ge.attachedToRef):void 0;a.push({id:ge.id,type:Te,...ge.name?{name:ge.name}:{},...oe?{participant:oe}:{},...ae.has(ge.id)?{lane:ae.get(ge.id)}:{},...C?{attachedTo:C}:{},...B?{eventDefinition:B}:{}}),Te==="subProcess"&&N(ge);const E=ay(ge,"bwl:band");E!==void 0&&(p.bands[ge.id]=E);const G=ry(ge,"bwl:afterColumn");typeof G=="string"&&G!==""&&_.push([ge.id,G]);for(const q of ge.dataOutputAssociations??[])S(q.id),h.push({id:q.id,type:q.$type,source:ge.id,target:Ii(q.targetRef)});for(const q of ge.dataInputAssociations??[])S(q.id),h.push({id:q.id,type:q.$type,source:Ii((q.sourceRef??[])[0]),target:ge.id})}$(Z.artifacts??[])};if(i){const Z=new Set;for(const oe of i.participants??[]){P(oe.id),m.set(oe.id,oe);const W=Ii(oe.processRef);W&&Z.add(W);const Y=W?o.get(W):void 0,ae=((Y==null?void 0:Y.laneSets)??[]).flatMap(C=>C.lanes??[]),ge=ae.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of ge)P(C.id);const Te=!Y||(Y.flowElements??[]).length===0&&ae.length===0&&(Y.artifacts??[]).length===0;r.push({id:oe.id,...oe.name?{name:oe.name}:{},...Te?{blackBox:!0}:{},...ge.length?{lanes:ge}:{}});const B=ay(oe,"bwl:poolOrder");B!==void 0&&(p.poolOrders[oe.id]=B),Y&&H(Y,oe.id)}for(const oe of i.messageFlows??[])S(oe.id),m.set(oe.id,oe),d.push({id:oe.id,source:Ii(oe.sourceRef),target:Ii(oe.targetRef),...typeof oe.name=="string"&&oe.name?{name:oe.name}:{}});$(i.artifacts??[]);for(const[oe,W]of o)!Z.has(oe)&&(W.flowElements??[]).length>0&&u.push({id:oe,type:W.$type,reason:"unreachable-process"})}else for(const Z of o.values())H(Z);const X=[],Q=[],ee=[],Ve=[],qe=(Z,oe)=>!!Z&&!!oe&&w.has(Z)&&w.has(oe);for(const Z of f){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}X.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),w.add(Z.id)}for(const Z of d){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),w.add(Z.id)}for(const Z of h){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}Ve.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target}),Z.id&&w.add(Z.id)}for(const Z of g){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}ee.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target})}const Ge=new Map(l.map(Z=>[Z.id,Z]));for(const{owner:Z,refs:oe}of x){const W=oe.filter(ae=>v.has(ae)),Y=Ge.get(Z);Y&&W.length&&(Y.members=W)}for(const Z of y)v.has(Z.anchor)&&(p.placements[Z.owner]={anchor:Z.anchor,side:Z.side,...Z.offset!==void 0?{offset:Z.offset}:{}});for(const[Z,oe]of _)v.has(oe)&&(p.afterColumns[Z]=oe);const Re={...r.length?{participants:r}:{},nodes:a,sequenceFlows:X,...Q.length?{messageFlows:Q}:{},...s.length?{dataStores:s}:{},...Ve.length?{dataAssociations:Ve}:{},...c.length?{annotations:c}:{},...ee.length?{associations:ee}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Re,hints:p,omitted:u,i18n:KC(Re,m,e,t.i18n)}:{definition:Re,hints:p,omitted:u}}function KC(e,t,n,i){const o=vp(n),r=Za(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=bp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Ep(u))r.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:r.slice(1),reviewRequests:a}}async function XC(e,t={}){const{definitions:n,warnings:i}=await na(e);return{...cy(n,t),warnings:i}}const ZC=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function af(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function QC(e){return af(e.processRef)!==void 0}function JC(e){const t=new Set,n=o=>{const r=af(o);r&&t.add(r)},i=o=>{for(const r of o.flowElements??[]){n(r.sourceRef),n(r.targetRef),r.attachedToRef&&(n(r.attachedToRef),t.add(r.id));for(const a of r.dataOutputAssociations??[])t.add(r.id),n(a.targetRef);for(const a of r.dataInputAssociations??[]){t.add(r.id);for(const s of a.sourceRef??[])n(s)}(r.flowElements??[]).length&&i(r)}for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)};for(const o of e.rootElements??[])if(o.$type==="bpmn:Process")i(o);else if(o.$type==="bpmn:Collaboration"){for(const r of o.messageFlows??[])n(r.sourceRef),n(r.targetRef);for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)}return t}function eM(e){const t=[],n=i=>{for(const o of i.flowElements??[])ZC.has(o.$type)&&t.push(o),(o.flowElements??[]).length&&n(o)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function tM(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function sf(e){const t=[],n=e.rootElements??[],i=JC(e);for(const r of eM(e))i.has(r.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[r.id],params:{type:r.$type}});const o=n.find(r=>r.$type==="bpmn:Collaboration");if(o){const r=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of o.participants??[])QC(s)&&tM(r.get(af(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function nM(e){const{definitions:t,warnings:n}=await na(e);return{issues:sf(t),warnings:n}}const iM=.5,oM=8,rM=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),pa=e=>typeof e=="number"?e:Number(e??NaN),Kc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function aM(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${Kc(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${Kc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Kc).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function sM(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},o=a=>{const s=a;return s?[pa(s.x),pa(s.y),pa(s.width),pa(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Kc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[pa(f.x),pa(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function ly(e){const t=sM(e),n=new Map,i=new Set,o=r=>{if(Array.isArray(r))return r.forEach(o);if(!r||typeof r!="object"||i.has(r))return;i.add(r);const a=r,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!rM.has(s)&&n.set(c,{type:s,props:aM(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&o(l)};return o(e),n}function uy(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),o=t===""?[]:t.split(",").map(Number);return i.length!==o.length?!0:i.some((r,a)=>Math.abs(r-o[a])>n)}function py(e,t,n={}){const i=n.moveTolerance??iM,o=ly(e),r=ly(t),a=[],s=[],c=[];for(const[l,u]of r){const p=o.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||uy(p.geometry,u.geometry,i)||uy(p.label,u.label,n.labelTolerance??oM))&&c.push(l)}for(const l of o.keys())r.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function cM(e,t,n={}){const[i,o]=await Promise.all([na(e),na(t)]);return{...py(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function lM(e){return new Set([...e.added,...e.modified])}function uM(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function fy(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=oy(e,t.ops,{i18n:i});if(!o.ok)return{status:"rejected",issues:o.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:o.findings,stats:o.stats}}const pM=new Set(["lasso","lasso.selection","hand","hand.move"]),dy=1e4,fM="bwl-edit-locked",hy=new WeakMap;function dM(e){const t=hy.get(e);if(t)return t;const n=e.get("eventBus"),i=e.get("dragging",!1);let o=!1,r=!1;n.on("drag.init",dy,()=>{var s;if(o)return pM.has((s=i==null?void 0:i.context())==null?void 0:s.prefix)?void 0:!1}),n.on(["contextPad.open.allowed","contextPad.trigger","palette.trigger","element.dblclick"],dy,()=>o?!1:void 0);const a={get locked(){return o},set(s){var l,u,p;if(s===o)return;o=s,e.get("canvas").getContainer().classList.toggle(fM,s);const c=e.get("keyboard",!1);s?(i==null||i.cancel(),(l=e.get("contextPad",!1))==null||l.close(),(u=e.get("popupMenu",!1))==null||u.close(),(p=e.get("directEditing",!1))==null||p.complete(),r=!!(c!=null&&c.getBinding()),c==null||c.unbind()):r&&(c.bind(),r=!1)}};return hy.set(e,a),a}const hM=Symbol("bpmn-editor"),cf={geometry:[],semantic:[]};function gM(){const e=me.ref(!1),t=me.ref(!0),n=me.ref(!1),i=me.shallowRef(cf),o=me.shallowRef(void 0),r=me.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=cf;return}const _=ut(We(c.get("elementRegistry")),{includeObservationOnly:!0}),x=c.getDefinitions();i.value={geometry:_,semantic:x?sf(x):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const _=u();if(!_||!a){r.value=void 0;return}const x=_.locales(),m={};for(const v of x)m[v]={untranslated:_.untranslatedCount(v),reviewRequested:_.reviewRequestedCount(v)};r.value={designLocale:a.designLocale,locales:x,displayLocale:_.getDisplayLocale()??a.designLocale,counts:m}}function f(){const _=u();_&&(_.configure(a),a&&s&&(s=_.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(_,x){dM(_).set(!x)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function y(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:o,i18n:r,configureI18n(_){a=_,f(),p()},setDisplayLocale(_){var m;s=_;const x=(m=u())==null?void 0:m.setDisplayLocale(_);x&&(s=x),p()},setChangeScope(_){o.value=_===void 0?void 0:new Set(_)},requestFocus(_){if(!c)return;const x=c.get("elementRegistry").get(_);x&&(c.get("canvas").scrollToElement(x,180),c.get("selection").select(x))},describeElement(_){const x=c==null?void 0:c.get("elementRegistry").get(_),m=x==null?void 0:x.businessObject;if(!m)return;const v=typeof m.name=="string"&&m.name.trim()!==""?m.name:m.text;return{name:typeof v=="string"&&v.trim()!==""?v.trim():void 0,type:typeof m.$type=="string"?m.$type:""}},attach(_){c&&this.detach(),c=_,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=cf,o.value=void 0,r.value=void 0},setEditable(_){t.value=_,c&&g(c,_)},async applyAgentBatch(_,x){const m=h();n.value=!0;try{const v=await fy(m,_,{currentVersion:x,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return v.status==="applied"&&(e.value=!1),v}finally{n.value=!1}},async importXml(_){const{warnings:x}=await h().importXML(_);return e.value=!1,o.value=void 0,l(),{warnings:$p(x)}},async saveXml(){const{xml:_}=await h().saveXML({format:!0});return e.value=!1,_??""},undo:()=>{var _;return(_=y())==null?void 0:_.undo()},redo:()=>{var _;return(_=y())==null?void 0:_.redo()},canUndo:()=>{var _;return((_=y())==null?void 0:_.canUndo())??!1},canRedo:()=>{var _;return((_=y())==null?void 0:_.canRedo())??!1}}}const mM=new RegExp("\\p{Script=Hangul}","u"),yM=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,vM=new RegExp("\\p{Script=Han}","u");function lf(e){const t=mM.test(e),n=yM.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:vM.test(e)?"han":"other"}}function gy(e){var t,n;return((t=e==null?void 0:e.get)==null?void 0:t.call(e,"xml:lang"))??((n=e==null?void 0:e.$attrs)==null?void 0:n["xml:lang"])}function my(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=gr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Jr(a).filter(l=>Nn(l))})}return n}const cs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function bM(e){const t=gy(e),n=my(e);let i;const o={},r=[],a=[],s=[];for(const g of n){const h=g.trs.filter(y=>(y.body??"")===g.name).map(Nn);if(h.length){const y=[...h].sort().join("+");o[y]=(o[y]??0)+1,i=i?new Set([...i].filter(_=>h.includes(_))):new Set(h)}else g.trs.some(y=>y.body)?r.push(cs(g)):s.push({e:g,inference:lf(g.name)});for(const y of g.trs){const _=Nn(y),x=y.body??"",m=lf(x);m.locale&&m.locale!==_?a.push({...cs(g),locale:_,script:m.script}):_==="ko"&&m.script==="han"&&g.trs.some(v=>v!==y&&v.body===x)&&a.push({...cs(g),locale:_,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...cs(g),locale:h.locale}):d.push({...cs(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function xM(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!gy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(my(e).map(r=>[r.bo.id,r]));for(const{id:r,name:a,locale:s}of t.additions){const c=o.get(r);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>Nn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Qr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ce(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function _M(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var uf={exports:{}},yy;function wM(){if(yy)return uf.exports;yy=1;var e=uf.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),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,t/o))/Math.log(n)*o;for(var r=i-Math.floor(i),a="",o=0;o<Math.floor(i);o++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(r){var c=Math.pow(n,r),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var o=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(r,c));return r[c]=a,c},r=o.hats={};return o.get=function(a){return o.hats[a]},o.set=function(a,s){return o.hats[a]=s,o},o.bits=t||128,o.base=n||16,o},uf.exports}var EM=wM(),SM=_M(EM);function Ui(e){if(!(this instanceof Ui))return new Ui(e);e=e||[128,36,1],this._seed=e.length?SM.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 dn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};dn.td=dn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],dn.option=dn.optgroup=[1,'<select multiple="multiple">',"</select>"],dn.thead=dn.tbody=dn.colgroup=dn.caption=dn.tfoot=[1,"<table>","</table>"],dn.polyline=dn.ellipse=dn.polygon=dn.circle=dn.text=dn.line=dn.path=dn.rect=dn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Nt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(dn,i)?dn[i]:dn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function RM(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 o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function zn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(o,r){n[r]=o})}),e}function En(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const CM=Object.prototype.toString;function Rt(e){return new Io(e)}function Io(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Io.prototype.add=function(e){return this.list.add(e),this},Io.prototype.remove=function(e){return CM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Io.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},Io.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Io.prototype.array=function(){return Array.from(this.list)},Io.prototype.has=Io.prototype.contains=function(e){return this.list.contains(e)};function Xc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function _r(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function MM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zc={},vy;function AM(){if(vy)return Zc;vy=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Zc.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},Zc.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},Zc}var by=AM(),PM=MM(by),Le=RM({__proto__:null,default:PM},[by]),xy=["focus","blur"];function TM(e,t,n,i,o){return xy.indexOf(n)!==-1&&(o=!0),Le.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=_r(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function kM(e,t,n,i){return xy.indexOf(t)!==-1&&(i=!0),Le.unbind(e,t,n,i)}var Jn={bind:TM,unbind:kM};function pf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function wt(e,t){return t=t||document,t.querySelector(e)}function ls(e,t){return t=t||document,t.querySelectorAll(e)}function qi(e){e.parentNode&&e.parentNode.removeChild(e)}function OM(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function DM(e,t){return t.appendChild(OM(e,t))}function ze(e,t){return DM(t,e),e}var ff=2,_y={"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":ff,"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":ff,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function LM(e,t){return _y[t]?e.style[t]:e.getAttributeNS(null,t)}function wy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=_y[i];o?(o===ff&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function IM(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)wy(e,o,t[o])}function we(e,t,n){if(typeof t=="string")if(n!==void 0)wy(e,t,n);else return LM(e,t);else IM(e,t);return e}const BM=Object.prototype.toString;function at(e){return new Bo(e)}function Bo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Bo.prototype.add=function(e){return this.list.add(e),this},Bo.prototype.remove=function(e){return BM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Bo.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},Bo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Bo.prototype.array=function(){return Array.from(this.list)},Bo.prototype.has=Bo.prototype.contains=function(e){return this.list.contains(e)};function us(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function df(e){return e.cloneNode(!0)}var hf={svg:"http://www.w3.org/2000/svg"},Ey='<svg xmlns="'+hf.svg+'"';function NM(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(hf.svg)===-1&&(e=Ey+e.substring(4)):(e=Ey+">"+e+"</svg>",t=!0);var n=$M(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function $M(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=NM(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(hf.svg,e),t&&we(n,t),n}var gf=null;function Sy(){return gf===null&&(gf=Oe("svg")),gf}function Ry(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function FM(e,t,n,i,o,r){var a=Sy().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Ry(a,e);case 6:return Ry(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function ps(e){return Sy().createSVGTransform()}var Cy=/([&<>]{1})/g,jM=/([&<>\n\r"]{1})/g,HM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function mf(e,t){function n(i,o){return HM[o]||o}return e.replace(t,n)}function My(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(mf(e.textContent,Cy));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(o=e.attributes,n=0,i=o.length;n<i;++n)r=o.item(n),t.push(" ",r.name,'="',mf(r.value,jM),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)My(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",mf(e.nodeValue,Cy),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function zM(e){for(var t=e.firstChild,n=[];t;)My(t,n),t=t.nextSibling;return n.join("")}function Ay(e,t){return zM(e)}function on(e){var t=e.parentNode;return t&&t.removeChild(e),e}function GM(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function VM(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(GM(e,i))}function fs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),VM(n,t)),n.consolidate()}const WM=/^class[ {]/;function UM(e){return WM.test(e.toString())}function yf(e){return Array.isArray(e)}function vf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Qc(...e){e.length===1&&yf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const qM=/constructor\s*[^(]*\(\s*([^)]*)\)/m,YM=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,KM=/\/\*([^*]*)\*\//m;function XM(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(UM(e)?qM:YM);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(KM);return(o&&o[1]||i).trim()})||[]}function Py(e,t){const n=t||{get:function(m,v){if(i.push(m),v===!1)return null;throw s(`No provider for "${m}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(m){const v=i.join(" -> ");return i.length=0,new Error(v?`${m} (Resolving: ${v})`:m)};function c(m,v){if(!o[m]&&m.includes(".")){const w=m.split(".");let S=c(w.shift());for(;w.length;)S=S[w.shift()];return S}if(vf(r,m))return r[m];if(vf(o,m)){if(i.indexOf(m)!==-1)throw i.push(m),s("Cannot resolve circular dependency!");return i.push(m),r[m]=o[m][0](o[m][1]),i.pop(),r[m]}return n.get(m,v)}function l(m,v){if(typeof v>"u"&&(v={}),typeof m!="function")if(yf(m))m=Qc(m.slice());else throw s(`Cannot invoke "${m}". Expected a function!`);const S=(m.$inject||XM(m)).map(P=>vf(v,P)?v[P]:c(P));return{fn:m,dependencies:S}}function u(m){const{fn:v,dependencies:w}=l(m),S=Function.prototype.bind.call(v,null,...w);return new S}function p(m,v,w){const{fn:S,dependencies:P}=l(m,w);return S.apply(v,P)}function f(m){return Qc(v=>m.get(v))}function d(m,v){if(v&&v.length){const w=Object.create(null),S=Object.create(null),P=[],T=[],D=[];let $,N,H,X;for(let Q in o)$=o[Q],v.indexOf(Q)!==-1&&($[2]==="private"?(N=P.indexOf($[3]),N===-1?(H=$[3].createChild([],v),X=f(H),P.push($[3]),T.push(H),D.push(X),w[Q]=[X,Q,"private",H]):w[Q]=[D[N],Q,"private",T[N]]):w[Q]=[$[2],$[1]],S[Q]=!0),($[2]==="factory"||$[2]==="type")&&$[1].$scope&&v.forEach(ee=>{$[1].$scope.indexOf(ee)!==-1&&(w[Q]=[$[2],$[1]],S[ee]=!0)});v.forEach(Q=>{if(!S[Q])throw new Error('No provider for "'+Q+'". Cannot use provider from the parent!')}),m.unshift(w)}return new Py(m,a)}const g={factory:p,type:u,value:function(m){return m}};function h(m,v){const w=m.__init__||[];return function(){w.forEach(S=>{typeof S=="string"?v.get(S):v.invoke(S)})}}function y(m){const v=m.__exports__;if(v){const w=m.__modules__,S=Object.keys(m).reduce((N,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(N[H]=m[H]),N),Object.create(null)),P=(w||[]).concat(S),T=d(P),D=Qc(function(N){return T.get(N)});v.forEach(function(N){o[N]=[D,N,"private",T]});const $=(m.__init__||[]).slice();return $.unshift(function(){T.init()}),m=Object.assign({},m,{__init__:$}),h(m,T)}return Object.keys(m).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const S=m[w];if(S[2]==="private"){o[w]=S;return}const P=S[0],T=S[1];o[w]=[g[P],ZM(P,T),P]}),h(m,a)}function _(m,v){return m.indexOf(v)!==-1||(m=(v.__depends__||[]).reduce(_,m),m.indexOf(v)!==-1)?m:m.concat(v)}function x(m){const v=m.reduce(_,[]).map(y);let w=!1;return function(){w||(w=!0,v.forEach(S=>S()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function ZM(e,t){return e!=="value"&&yf(t)&&(t=Qc(t.slice())),t}var QM=1e3;function uo(e,t){var n=this;t=t||QM,e.on(["render.shape","render.connection"],t,function(i,o){var r=i.type,a=o.element,s=o.gfx,c=o.attrs;if(n.canRender(a))return r==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,o){if(n.canRender(o))return i.type==="render.getShapePath"?n.getShapePath(o):n.getConnectionPath(o)})}uo.prototype.canRender=function(e){},uo.prototype.drawShape=function(e,t){},uo.prototype.drawConnection=function(e,t){},uo.prototype.getShapePath=function(e){},uo.prototype.getConnectionPath=function(e){};function wr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function JM(e){return["M",e.x,e.y]}function bf(e){return["L",e.x,e.y]}function eA(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function tA(e,t){const n=e.length,i=[JM(e[0])];for(let o=1;o<n;o++){const r=e[o-1],a=e[o],s=e[o+1];if(!s||!t){i.push(bf(a));continue}const c=Math.min(t,xf(a.x-r.x,a.y-r.y),xf(s.x-a.x,s.y-a.y));if(!c){i.push(bf(a));continue}const l=Jc(a,r,c),u=Jc(a,r,c*.5),p=Jc(a,s,c),f=Jc(a,s,c*.5);i.push(bf(l)),i.push(eA(u,f,p))}return i}function Jc(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=xf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function xf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ds(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),_f(i,e)}function _f(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return we(e,{d:wr(tA(t,n))}),e}function el(e){var t=new Set(e);return it(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Er(e,t,n){n=n||0,$e(e)||(e=[e]),z(e,function(i,o){var r=t(i,o,n);$e(r)&&r.length&&Er(r,t,n+1)})}function wf(e,t,n){var i=new Set,o=new Set;return Er(e,function(r,a,s){i.add(r);var c=r.children;if(c&&!o.has(c))return o.add(c),c}),Array.from(i)}function hs(e,t){return wf(e)}function nA(e,t,n){hr(t)&&(t=!0),fn(t)&&(n=t,t=!0),n=n||{};var i=gs(n.allShapes),o=gs(n.allConnections),r=gs(n.enclosedElements),a=gs(n.enclosedConnections),s=gs(n.topLevel,t&&Xr(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,z(u.incoming,c),z(u.outgoing,c),u.children}return Er(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function rn(e,t){t=!!t,$e(e)||(e=[e]);var n,i,o,r;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=rn(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function fa(e,t){var n={};return z(e,function(i){var o=i;o.waypoints&&(o=rn(o)),!Fe(t.y)&&o.x>t.x&&(n[i.id]=i),!Fe(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Fe(t.width)&&Fe(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function Ty(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ky(e){return!!(e&&e.isFrame)}function gs(e,t){return V({},e||{},t||{})}var iA=1;function No(e,t){uo.call(this,e,iA),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})}Ce(No,uo),No.prototype.canRender=function(){return!0},No.prototype.drawShape=function(t,n,i){var o=Oe("rect");return we(o,{x:0,y:0,width:n.width||0,height:n.height||0}),ky(n)?we(o,V({},this.FRAME_STYLE,i||{})):we(o,V({},this.SHAPE_STYLE,i||{})),ze(t,o),o},No.prototype.drawConnection=function(t,n,i){var o=ds(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return ze(t,o),o},No.prototype.getShapePath=function(t){var n=t.x,i=t.y,o=t.width,r=t.height,a=[["M",n,i],["l",o,0],["l",0,r],["l",-o,0],["z"]];return wr(a)},No.prototype.getConnectionPath=function(t){var n=t.waypoints,i,o,r=[];for(i=0;o=n[i];i++)o=o.original||o,r.push([i===0?"M":"L",o.x,o.y]);return wr(r)},No.$inject=["eventBus","styles"];function oA(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,o){var r=this.style(i,o);return V(r,{class:n})},this.style=function(n,i){!$e(n)&&!i&&(i=n,n=[]);var o=Qn(n,function(r,a){return V(r,e[a]||{})},{});return i?V(o,i):o},this.computeStyle=function(n,i,o){return $e(i)||(o=i,i=[]),t.style(i||[],V({},o,n||{}))}}const rA={__init__:["defaultRenderer"],defaultRenderer:["type",No],styles:["type",oA]};function Zt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function tn(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 Ef(e,t){return!e||!t?-1:e.indexOf(t)}function ms(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Sf(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=ms(e,t);return Math.abs(o/r)<=i}var aA=2;function po(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(sA(o,n))return r;return!1}function sA(e,t){const n=t[0];return Ao(t,function(i){return Math.abs(n[e]-i[e])<=aA})}function Oy(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 Rf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var cA=/,?([a-z]),?/gi,Dy=parseFloat,an=Math,$o=an.PI,Yi=an.min,Ki=an.max,Ly=an.pow,Fo=an.abs,lA=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,uA=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Iy=Array.isArray||function(e){return e instanceof Array};function pA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fA(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 dA(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),o=t.cache=t.cache||{},r=t.count=t.count||[];return pA(o,i)?(fA(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function hA(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(lA,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(uA,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([o,...a.splice(0,2)]),s="l",o=o=="m"?"l":"L");a.length>=t[s]&&(n.push([o,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Mf,n}function gA(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 mA(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 Cf(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 Mf(){return this.join(",").replace(cA,"$1")}function yA(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var o=e[n],r=t[n]=new Array(o.length),a=0,s=o.length;a<s;a++)r[a]=o[a];return t.toString=Mf,t}function By(e,t,n,i,o,r,a,s,c){var l=1-c,u=Ly(l,3),p=Ly(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*o+d*a,h=u*t+p*3*c*i+l*3*c*c*r+d*s;return{x:tl(g),y:tl(h)}}function Ny(e){var t=EA(...e);return Cf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function jo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function vA(e,t){return e=Cf(e),t=Cf(t),jo(t,e.x,e.y)||jo(t,e.x2,e.y)||jo(t,e.x,e.y2)||jo(t,e.x2,e.y2)||jo(e,t.x,t.y)||jo(e,t.x2,t.y)||jo(e,t.x,t.y2)||jo(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 $y(e,t,n,i,o){var r=-3*t+9*n-9*i+3*o,a=e*r+6*t-12*n+6*i;return e*a-3*t+3*n}function Fy(e,t,n,i,o,r,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<u;g++){var h=l*p[g]+l,y=$y(h,e,n,o,a),_=$y(h,t,i,r,s),x=y*y+_*_;d+=f[g]*an.sqrt(x)}return l*d}function bA(e,t,n,i,o,r,a,s){if(!(Ki(e,n)<Yi(o,a)||Yi(e,n)>Ki(o,a)||Ki(t,i)<Yi(r,s)||Yi(t,i)>Ki(r,s))){var c=(e*i-t*n)*(o-a)-(e-n)*(o*s-r*a),l=(e*i-t*n)*(r-s)-(t-i)*(o*s-r*a),u=(e-n)*(r-s)-(t-i)*(o-a);if(u){var p=tl(c/u),f=tl(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Yi(e,n).toFixed(2)||d>+Ki(e,n).toFixed(2)||d<+Yi(o,a).toFixed(2)||d>+Ki(o,a).toFixed(2)||g<+Yi(t,i).toFixed(2)||g>+Ki(t,i).toFixed(2)||g<+Yi(r,s).toFixed(2)||g>+Ki(r,s).toFixed(2)))return{x:p,y:f}}}}function tl(e){return Math.round(e*1e11)/1e11}function xA(e,t,n){var i=Ny(e),o=Ny(t);if(!vA(i,o))return[];var r=Fy(...e),a=Fy(...t),s=Hy(e)?1:~~(r/5)||1,c=Hy(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=By(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=By(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var y=l[d],_=l[d+1],x=u[g],m=u[g+1],v=Fo(_.x-y.x)<.01?"y":"x",w=Fo(m.x-x.x)<.01?"y":"x",S=bA(y.x,y.y,_.x,_.y,x.x,x.y,m.x,m.y),P;if(S){if(P=S.x.toFixed(9)+"#"+S.y.toFixed(9),p[P])continue;p[P]=!0;var T=y.t+Fo((S[v]-y[v])/(_[v]-y[v]))*(_.t-y.t),D=x.t+Fo((S[w]-x[w])/(m[w]-x[w]))*(m.t-x.t);T>=0&&T<=1&&D>=0&&D<=1&&f.push({x:S.x,y:S.y,t1:T,t2:D})}}return f}function jy(e,t,n){e=Vy(e),t=Vy(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],o=c=y[2];else{y[0]=="C"?(p=[i,o,...y.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,x=t.length;_<x;_++){var m=t[_];if(m[0]=="M")r=l=m[1],a=u=m[2];else{m[0]=="C"?(f=[r,a,...m.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var v=xA(p,f);{for(var w=0,S=v.length;w<S;w++)v[w].segment1=g,v[w].segment2=_,v[w].bez1=p,v[w].bez2=f;d=d.concat(v)}}}}}return d}function _A(e){return Iy(e)&&Iy(e[0])}function wA(e){if(gA(e))return e;var t=new Array(e.length),n=0,i=0,o=0,r=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],o=n,r=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":o=+l[1]+n,r=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Mf,t}function Hy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function nl(e,t,n,i){return[e,t,n,i,n,i]}function zy(e,t,n,i,o,r){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*o+s*n,a*r+s*i,o,r]}function Gy(e,t,n,i,o,r,a,s,c,l){var u=$o*120/180,p=$o/180*(+o||0),f=[],d,g=dA(function(B,C,E){var G=B*an.cos(E)-C*an.sin(E),q=B*an.sin(E)+C*an.cos(E);return{x:G,y:q}});if(l)P=l[0],T=l[1],w=l[2],S=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,_=h*h/(n*n)+y*y/(i*i);_>1&&(_=an.sqrt(_),n=_*n,i=_*i);var x=n*n,m=i*i,v=(r==a?-1:1)*an.sqrt(Fo((x*m-x*y*y-m*h*h)/(x*y*y+m*h*h))),w=v*n*y/i+(e+s)/2,S=v*-i*h/n+(t+c)/2,P=an.asin(((t-S)/i).toFixed(9)),T=an.asin(((c-S)/i).toFixed(9));P=e<w?$o-P:P,T=s<w?$o-T:T,P<0&&(P=$o*2+P),T<0&&(T=$o*2+T),a&&P>T&&(P=P-$o*2),!a&&T>P&&(T=T-$o*2)}var D=T-P;if(Fo(D)>u){var $=T,N=s,H=c;T=P+u*(a&&T>P?1:-1),s=w+n*an.cos(T),c=S+i*an.sin(T),f=Gy(s,c,n,i,o,0,a,N,H,[T,$,w,S])}D=T-P;var X=an.cos(P),Q=an.sin(P),ee=an.cos(T),Ve=an.sin(T),qe=an.tan(D/4),Ge=4/3*n*qe,Re=4/3*i*qe,Z=[e,t],oe=[e+Ge*Q,t-Re*X],W=[s+Ge*Ve,c-Re*ee],Y=[s,c];if(oe[0]=2*Z[0]-oe[0],oe[1]=2*Z[1]-oe[1],l)return[oe,W,Y].concat(f);f=[oe,W,Y].concat(f).join().split(",");for(var ae=[],ge=0,Te=f.length;ge<Te;ge++)ae[ge]=ge%2?g(f[ge-1],f[ge],p).y:g(f[ge],f[ge+1],p).x;return ae}function EA(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,y,_,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,f=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,f=3*i-3*t),Fo(u)<1e-12){if(Fo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}y=p*p-4*f*u,_=an.sqrt(y),!(y<0)&&(g=(-p+_)/(2*u),0<g&&g<1&&c.push(g),h=(-p-_)/(2*u),0<h&&h<1&&c.push(h))}for(var m=c.length,v=m,w;m--;)d=c[m],w=1-d,l[0][m]=w*w*w*e+3*w*w*d*n+3*w*d*d*o+d*d*d*a,l[1][m]=w*w*w*t+3*w*w*d*i+3*w*d*d*r+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Yi(...l[0]),y0:Yi(...l[1]),x1:Ki(...l[0]),y1:Ki(...l[1])}}function Vy(e){if(_A(e)||(e=hA(e)),mA(e))return e;for(var t=yA(wA(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,y;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Gy(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),f=["C",h,y,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...zy(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...zy(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...nl(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...nl(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...nl(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...nl(d.x,d.y,d.X,d.Y)];break}return f},o=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)r[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),l=t.length}},r=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(r[c]=a,c&&(s=r[c-1])),t[c]=i(t[c],n,s),r[c]!="A"&&a=="C"&&(r[c]="C"),o(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Dy(u[p-4])||n.x,n.by=Dy(u[p-3])||n.y}return t}function Pt(e){return fn(e)&&Zn(e,"waypoints")}function Je(e){return fn(e)&&Zn(e,"labelTarget")}function SA(e){return fn(e)&&Yr(e.parent)}function Wy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function fo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function il(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function RA(e){return fo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function CA(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=PA(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),o=i/2,r=0,a=n[r];a.endLength<o;)a=n[++r];var s=(o-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 je(e){return Pt(e)?CA(e):RA(e)}function kn(e,t,n){n=n||0,fn(n)||(n={x:n,y:n});var i=Be(e),o=Be(t),r=i.bottom+n.y<=o.top,a=i.left-n.x>=o.right,s=i.top-n.y>=o.bottom,c=i.right+n.x<=o.left,l=r?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function ys(e,t,n){var i=MA(e,t);return i.length===1||i.length===2&&ms(i[0],i[1])<1?fo(i[0]):i.length>1?(i=Hi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),fo(i[n?0:i.length-1])):null}function MA(e,t){return jy(e,t)}function AA(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],ms(n,o)===0||Sf(i,o,n)?e.splice(t,1):t++;return e}function PA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ol(e,t){return Math.round(e*t)/t}function Uy(e){return Fe(e)?e+"px":e}function TA(e){for(;e.parent;)e=e.parent;return e}function kA(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),zn(n,{position:"relative",overflow:"hidden",width:Uy(e.width),height:Uy(e.height)}),t.appendChild(n),n}function qy(e,t,n){const i=Oe("g");at(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const OA="base",Yy=0,DA=1,LA={shape:["x","y","width","height"],connection:["waypoints"]};function He(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||{})}He.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],He.prototype._init=function(e){const t=this._eventBus,n=this._container=kA(e),i=this._svg=Oe("svg");we(i,{width:"100%",height:"100%"}),En(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{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")}),ze(n,i);const o=this._viewport=qy(i,"viewport");e.deferUpdate&&(this._viewboxChanged=yp(this._viewboxChanged,300)),this._restoreFocus=yp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:o})}),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)},He.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},He.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},He.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Ty(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},He.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},He.prototype.restoreFocus=function(){this._restoreFocus()},He.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},He.prototype.isFocused=function(){return this._focused},He.prototype.getDefaultLayer=function(){return this.getLayer(OA,Yy)},He.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},He.prototype._getChildIndex=function(e){return Qn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},He.prototype._createLayer=function(e,t){typeof t>"u"&&(t=DA);const n=this._getChildIndex(t);return{group:qy(this._viewport,"layer-"+e,n),index:t,visible:!0}},He.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,o=t.index;if(t.visible)return i;const r=this._getChildIndex(o);return n.insertBefore(i,n.childNodes[r]||null),t.visible=!0,i},He.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&&(on(n),t.visible=!1),n},He.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],on(t.group))},He.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},He.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(TA(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},He.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},He.prototype._findPlaneForRoot=function(e){return Ot(this._planes,function(t){return t.rootElement===e})},He.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},He.prototype._resolveElements=function(e){return $e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},He.prototype.getContainer=function(){return this._container},He.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&&(z([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),at(o).add(t)):(e.markers.delete(t),at(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},He.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},He.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},He.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},He.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},He.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},He.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,Yy);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},He.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},He.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},He.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)},He.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})},He.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})},He.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=LA[e];if(!Ao(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},He.prototype._setParent=function(e,t,n){tn(t.children,e,n),e.parent=t},He.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const o=this._eventBus,r=this._graphicsFactory;this._ensureValid(e,t),o.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=r.create(e,t,i);return this._elementRegistry.add(t,a),r.update(e,t,a),o.fire(e+".added",{element:t,gfx:a}),t},He.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},He.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},He.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e),!!e)return o.fire(t+".remove",{element:e}),i.remove(e),Zt(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},He.prototype.removeShape=function(e){return this._removeElement(e,"shape")},He.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},He.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},He.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},He.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},He.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,o,r,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);fs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=fs(t),o=a?a.matrix:FM(),s=ol(o.a,1e3),c=ol(-o.e||0,1e3),l=ol(-o.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/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},He.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Ky(t,n)}),{x:n.e,y:n.f}},He.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const o=this.findRoot(i);if(!o)return;o!==this.getRootElement()&&this.setRootElement(o);const r=i.filter(g=>g!=o);if(!r.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=rn(r),s=Be(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Be(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),y=Math.max(0,s.bottom-f.bottom),_=Math.min(0,s.top-f.top);u=g||h,p=y||_}this.scroll({dx:-u*l,dy:-p*l})},He.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)}),ol(i.a,1e3)};function Ky(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}He.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let o,r;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?r={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(o=Math.min(1,n.width/i.width,n.height/i.height),r={x:i.x+(e?i.width/2-n.width/o/2:0),y:i.y+(e?i.height/2-n.height/o/2:0),width:n.width/o,height:n.height/o}),this.viewbox(r),this.viewbox(!1).scale},He.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=V(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),Ky(this._viewport,u),u},He.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},He.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,o=n.y*t.scale-t.y*t.scale,r=n.width*t.scale,a=n.height*t.scale;return{x:i,y:o,width:r,height:a}},He.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var da="data-element-id";function gi(e){this._elements={},this._eventBus=e}gi.$inject=["eventBus"],gi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),we(t,da,i),n&&we(n,da,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},gi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(we(i.gfx,da,""),i.secondaryGfx&&we(i.secondaryGfx,da,""),delete t[n])},gi.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)},gi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&we(t,da,i),t},gi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&we(e,da);var n=this._elements[t];return n&&n.element},gi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},gi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},gi.prototype.getAll=function(){return this.filter(function(e){return e})},gi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},gi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},gi.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 IA(e,t,n,i){var o=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var a=this.indexOf(r);return a!==-1&&(this.splice(a,1),t.unset(r,o,i)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,a){var s=this.indexOf(r);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,r),s===-1&&t.set(r,o,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function BA(e){return e.__refs_collection===!0}function NA(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Xy(e,t,n){var i=IA(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(o){e.set(o,t.inverse,n)})}function $A(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(r){if(r!==o){var a=o;o=null,a&&e.unset(a,i,n),o=r,e.set(o,i,n)}}})}function xi(e,t){if(!(this instanceof xi))return new xi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}xi.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?Xy(this,t,e):$A(this,t,e)},xi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return BA(n)||Xy(this,t,e),n},xi.prototype.ensureBound=function(e,t){NA(e,t)||this.bind(e,t)},xi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},xi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Af=new xi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Zy=new xi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Qy=new xi({name:"attachers",collection:!0},{name:"host"}),Jy=new xi({name:"outgoing",collection:!0},{name:"source"}),ev=new xi({name:"incoming",collection:!0},{name:"target"});function ha(){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)}}),Af.bind(this,"parent"),Zy.bind(this,"labels"),Jy.bind(this,"outgoing"),ev.bind(this,"incoming")}function vs(){ha.call(this),Af.bind(this,"children"),Qy.bind(this,"host"),Qy.bind(this,"attachers")}Ce(vs,ha);function tv(){ha.call(this),Af.bind(this,"children")}Ce(tv,vs);function nv(){vs.call(this),Zy.bind(this,"labelTarget")}Ce(nv,vs);function iv(){ha.call(this),Jy.bind(this,"source"),ev.bind(this,"target")}Ce(iv,ha);var FA={connection:iv,shape:vs,label:nv,root:tv};function jA(e,t){var n=FA[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function HA(e){return e instanceof ha}function ho(){this._uid=12}ho.prototype.createRoot=function(e){return this.create("root",e)},ho.prototype.createLabel=function(e){return this.create("label",e)},ho.prototype.createShape=function(e){return this.create("shape",e)},ho.prototype.createConnection=function(e){return this.create("connection",e)},ho.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),jA(e,t)};var rl="__fn",ov=1e3,zA=Array.prototype.slice;function ei(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ei.prototype.on=function(e,t,n,i){if(e=$e(e)?e:[e],yn(t)&&(i=n,n=t,t=ov),!Fe(t))throw new Error("priority must be a number");var o=n;i&&(o=qn(n,i),o[rl]=n[rl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ei.prototype.once=function(e,t,n,i){var o=this;if(yn(t)&&(i=n,n=t,t=ov),!Fe(t))throw new Error("priority must be a number");function r(){r.__isTomb=!0;var a=n.apply(i,arguments);return o.off(e,r),a}r[rl]=n,this.on(e,t,r)},ei.prototype.off=function(e,t){e=$e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ei.prototype.createEvent=function(e){var t=new bs;return t.init(e),t},ei.prototype.fire=function(e,t){var n,i,o,r;if(r=zA.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 bs?n=t:n=this.createEvent(t),r[0]=n;var a=n.type;e!==a&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==a&&(n.type=a)}return o===void 0&&n.defaultPrevented&&(o=!1),o}},ei.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ei.prototype._destroy=function(){this._listeners={}},ei.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ei.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=GA(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(o){if(!this.handleError(o))throw console.error("unhandled error in event listener",o),o}return i},ei.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},ei.prototype._getListeners=function(e){return this._listeners[e]},ei.prototype._setListeners=function(e,t){this._listeners[e]=t},ei.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,o,r;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,r=n.callback,(r===t||r[rl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function bs(){}bs.prototype.stopPropagation=function(){this.cancelBubble=!0},bs.prototype.preventDefault=function(){this.defaultPrevented=!0},bs.prototype.init=function(e){V(this,e||{})};function GA(e,t){return e.apply(null,t)}function Ho(e){return e.childNodes[0]}function VA(e){return e.parentNode.childNodes[1]}function al(e,t,n,i,o){var r=ps();r.setTranslate(t,n);var a=ps();a.setRotate(i||0,0,0);var s=ps();s.setScale(1,1),fs(e,[r,a,s])}function On(e,t,n){var i=ps();i.setTranslate(t,n),fs(e,i)}function rv(e,t){var n=ps();n.setRotate(t,0,0),fs(e,n)}function mi(e,t){this._eventBus=e,this._elementRegistry=t}mi.$inject=["eventBus","elementRegistry"],mi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=VA(t),n||(n=Oe("g"),at(n).add("djs-children"),ze(t.parentNode,n))):n=t,n},mi.prototype._clear=function(e){var t=Ho(e);return Xc(t),t},mi.prototype._createContainer=function(e,t,n,i){var o=Oe("g");at(o).add("djs-group"),typeof n<"u"?WA(o,t,t.childNodes[n]):ze(t,o);var r=Oe("g");at(r).add("djs-element"),at(r).add("djs-"+e),i&&at(r).add("djs-frame"),ze(o,r);var a=Oe("g");return at(a).add("djs-visual"),ze(r,a),r},mi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,ky(t))},mi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Qn(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),z(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;z(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},mi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},mi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},mi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},mi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},mi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),On(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?we(n,"display","none"):we(n,"display","block")}},mi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);on(t.parentNode)};function WA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const UA={__depends__:[rA],__init__:["canvas"],canvas:["type",He],elementRegistry:["type",gi],elementFactory:["type",ho],eventBus:["type",ei],graphicsFactory:["type",mi]};function qA(e){var t=new Py(e);return t.init(),t}function YA(e){e=e||{};var t={config:["value",e]},n=[t,UA].concat(e.modules||[]);return qA(n)}function zo(e,t){this._injector=t||YA(e),this.get("eventBus").fire("diagram.init")}zo.prototype.get=function(e,t){return this._injector.get(e,t)},zo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},zo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},zo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Fn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Yn(e,t){return e.$instanceOf(t)}function KA(e){return Ot(e.rootElements,function(t){return Yn(t,"bpmn:Process")||Yn(t,"bpmn:Collaboration")})}function XA(e){var t={},n=[],i={};function o(W,Y){return function(ae){W(ae,Y)}}function r(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var ae=W.gfx;if(ae)throw new Error(`already rendered ${Fn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function l(W,Y){try{var ae=i[W.id]&&s(W,Y);return r(W),ae}catch(ge){u(ge.message,{element:W,error:ge}),console.error(`failed to import ${Fn(W)}`,ge)}}function u(W,Y){e.error(W,Y)}var p=this.registerDi=function(Y){var ae=Y.bpmnElement;ae?i[ae.id]?u(`multiple DI elements defined for ${Fn(ae)}`,{element:ae}):i[ae.id]=Y:u(`no bpmnElement referenced in ${Fn(Y)}`,{element:Y})};function f(W){d(W.plane)}function d(W){p(W),z(W.planeElement,g)}function g(W){p(W)}this.handleDefinitions=function(Y,ae){var ge=Y.diagrams;if(ae&&ge.indexOf(ae)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ae&&ge&&ge.length&&(ae=ge[0]),!ae)throw new Error("no diagram to display");i={},f(ae);var Te=ae.plane;if(!Te)throw new Error(`no plane for ${Fn(ae)}`);var B=Te.bpmnElement;if(!B)if(B=KA(Y),B)u(`correcting missing bpmnElement on ${Fn(Te)} to ${Fn(B)}`),Te.bpmnElement=B,p(Te);else throw new Error("no process or collaboration to display");var C=c(B,Te);if(Yn(B,"bpmn:Process")||Yn(B,"bpmn:SubProcess"))y(B,C);else if(Yn(B,"bpmn:Collaboration"))Z(B,C),_(Y.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Fn(Te)}: ${Fn(B)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function y(W,Y){qe(W,Y),D(W.ioSpecification,Y),T(W.artifacts,Y),r(W)}function _(W,Y){var ae=it(W,function(ge){return!a(ge)&&Yn(ge,"bpmn:Process")&&ge.laneSets});ae.forEach(o(y,Y))}function x(W,Y){l(W,Y)}function m(W,Y){z(W,o(x,Y))}function v(W,Y){l(W,Y)}function w(W,Y){l(W,Y)}function S(W,Y){l(W,Y)}function P(W,Y){l(W,Y)}function T(W,Y){z(W,function(ae){Yn(ae,"bpmn:Association")?n.push(function(){P(ae,Y)}):P(ae,Y)})}function D(W,Y){W&&(z(W.dataInputs,o(w,Y)),z(W.dataOutputs,o(S,Y)))}var $=this.handleSubProcess=function(Y,ae){qe(Y,ae),T(Y.artifacts,ae)};function N(W,Y){var ae=l(W,Y);Yn(W,"bpmn:SubProcess")&&$(W,ae||Y),Yn(W,"bpmn:Activity")&&D(W.ioSpecification,Y),n.push(function(){z(W.dataInputAssociations,o(v,Y)),z(W.dataOutputAssociations,o(v,Y))})}function H(W,Y){l(W,Y)}function X(W,Y){l(W,Y)}function Q(W,Y){n.push(function(){var ae=l(W,Y);W.childLaneSet&&ee(W.childLaneSet,ae||Y),oe(W)})}function ee(W,Y){z(W.lanes,o(Q,Y))}function Ve(W,Y){z(W,o(ee,Y))}function qe(W,Y){Ge(W.flowElements,Y),W.laneSets&&Ve(W.laneSets,Y)}function Ge(W,Y){z(W,function(ae){Yn(ae,"bpmn:SequenceFlow")?n.push(function(){H(ae,Y)}):Yn(ae,"bpmn:BoundaryEvent")?n.unshift(function(){N(ae,Y)}):Yn(ae,"bpmn:FlowNode")?N(ae,Y):Yn(ae,"bpmn:DataObject")||(Yn(ae,"bpmn:DataStoreReference")||Yn(ae,"bpmn:DataObjectReference")?X(ae,Y):u(`unrecognized flowElement ${Fn(ae)} in context ${Fn(Y&&Y.businessObject)}`,{element:ae,context:Y}))})}function Re(W,Y){var ae=l(W,Y),ge=W.processRef;ge&&y(ge,ae||Y)}function Z(W,Y){z(W.participants,o(Re,Y)),n.push(function(){m(W.messageFlows,Y)}),T(W.artifacts,Y)}function oe(W){z(W.flowNodeRef,function(Y){var ae=Y.get("lanes");ae&&ae.push(W)})}}function ZA(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,_){return i.add(h,y,_)},error:function(h,y){s.push({message:h,context:y})}},f=new XA(p);u=u||l.diagrams&&l.diagrams[0];var d=QA(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(g+"_plane")||r.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),o=e.get("eventBus"),r=e.get("canvas"),o.fire("import.render.start",{definitions:t}),c(t,n),o.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function QA(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=JA(n));var o;M(i,"bpmn:Collaboration")?o=i:o=Ot(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Ot(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Bn(o.participants,function(l){return l.processRef}),r.push(o));var a=av(r),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function av(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(av(n.flowElements)))}),t}function JA(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var eP='<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>',sv=eP,cv={verticalAlign:"middle"},lv={color:"#404040"},tP={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},nP={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},iP={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"},oP='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+sv+'</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>',Xi;function rP(){Xi=Nt(oP),zn(Xi,tP),zn(wt("svg",Xi),cv),zn(wt(".backdrop",Xi),nP),zn(wt(".notice",Xi),iP),zn(wt(".link",Xi),lv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function aP(){Xi||(rP(),Jn.bind(Xi,".backdrop","click",function(e){document.body.removeChild(Xi)})),document.body.appendChild(Xi)}const sl=5,uv="djs-outline-hidden";function Gt(e){e=V({},cP,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),uP(this._container)}Ce(Gt,zo),Gt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),cl(s,r),s=sP(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw cl(r,[]),r}if(typeof t=="string"&&(i=lP(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw cl(r,[]),r}try{this.clear()}catch(r){throw cl(r,[]),r}const{warnings:o}=await ZA(this,n,i);return{warnings:o}},Gt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=wt(":scope > defs",i._svg),a=Ay(o),s=r?"<defs>"+Ay(r)+"</defs>":"",c=i.getContainer();Rt(c).add(uv);let l;try{l=o.getBBox()}finally{Rt(c).remove(uv)}const u=l.x-sl,p=l.y-sl,f=l.width+sl*2,d=l.height+sl*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
8
  <!-- created with bpmn-js / http://bpmn.io -->
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Gt.prototype._setDefinitions=function(e){this._definitions=e},Gt.prototype.getModules=function(){return this._modules},Gt.prototype.clear=function(){this.getDefinitions()&&jr.prototype.clear.call(this)},Gt.prototype.destroy=function(){jr.prototype.destroy.call(this),qi(this._container)},Gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gt.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=_t(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gt.prototype.getDefinitions=function(){return this._definitions},Gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gt.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=V(zi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});jr.call(this,s),n&&n.container&&this.attachTo(n.container)},Gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gt.prototype._createContainer=function(e){const t=Nt('<div class="bjs-container"></div>');return zn(t,{width:iv(e.width),height:iv(e.height),position:e.position}),t},Gt.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new jm(t)},Gt.prototype._modules=[];function ol(e,t){return e.warnings=t,e}function VA(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 WA={width:"100%",height:"100%",position:"relative"};function iv(e){return e+(Fe(e)?"px":"")}function UA(e,t){return t&&kt(e.diagrams,function(n){return n.id===t})||null}function qA(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Jy+"</a>",i=Nt(n);zn(_t("svg",i),ev),zn(i,tv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Le.bind(i,"click",function(r){GA(),r.preventDefault()})}function da(e){Gt.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)}Ce(da,Gt),da.prototype._createModdle=function(e){var t=Gt.prototype._createModdle.call(this,e);return t.ids=new Ui([32,36,1]),t},da.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 st(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||ut(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!de(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=ut(e).isHorizontal;return t===void 0?!0:t}}function YA(e){return e&&de(e).isInterrupting!==!1}function jn(e){return e&&!!de(e).triggeredByEvent}function ha(e,t){var n=de(e).eventDefinitions;return Ar(n,function(i){return M(i,t)})}function KA(e){return ha(e,"bpmn:ErrorEventDefinition")}function XA(e){return ha(e,"bpmn:EscalationEventDefinition")}function ZA(e){return ha(e,"bpmn:CompensateEventDefinition")}var wo={width:90,height:20},rv=15;function Hr(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function al(e){return Je(e.label)}function QA(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=JA(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-=rv:a+=rv,{x:a,y:s}}function JA(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 Ef(e){return e.waypoints?QA(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+wo.height/2}:{x:e.x+e.width/2,y:e.y+e.height+wo.height/2}}function eP(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(wo.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Ef(t),i=wo),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function ov(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function tP(e){var t=e.categoryValueRef;return t&&t.value||""}function yi(e){var t=e.businessObject,n=ov(t);if(n)return n==="categoryValueRef"?tP(t):t[n]||""}function nP(e,t){var n=e.businessObject,i=ov(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function iP(e){return Je(e)&&Hr(e.labelTarget)}var ma=7;function av(e){let t=[];return H(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),H(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function gs(e){const t=new Map;return H(gf(e),n=>{H(av(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 Sf="hsl(225, 10%, 15%)",rP="white";function Zi(e,t){return Ar(e.eventDefinitions,function(n){return n.$type===t})}function oP(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function aP(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ot(e,t,n){var i=ut(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||rP}function Se(e,t,n){var i=ut(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Sf}function ys(e,t,n,i){var r=ut(e),o=r.get("label");return i||o&&o.get("color:color")||t||Se(e,n)}function sv(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 xo(r)}function Rf(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 xo(a)}function sP(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 xo(s)}function cP(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 xo(o)}function vs(e,t={}){return{width:_i(e,t),height:ti(e,t)}}function _i(e,t={}){return Zn(t,"width")?t.width:e.width}function ti(e,t={}){return Zn(t,"height")?t.height:e.height}var lP=new Ui,uP=10,sl=3,pP=1.5,cl=10,fP=4,ga=.95,dP=1,hP=.25;function Eo(e,t,n,i,r,o,a){ur.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(B){return n.computeStyle(B,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Sf,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Sf,strokeWidth:2})}function f(B,C){var{ref:w={x:0,y:0},scale:G=1,element:q,parentGfx:ne=r._svg}=C,Me=Oe("marker",{id:B,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});ze(Me,q);var Xe=_t(":scope > defs",ne);Xe||(Xe=Oe("defs"),ze(ne,Xe)),ze(Xe,Me)}function d(B,C,w,G){var q=lP.nextPrefixed("marker-");return g(B,q,C,w,G),"url(#"+q+")"}function g(B,C,w,G,q){if(w==="sequenceflow-end"){var ne=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:q,stroke:q,strokeWidth:1})});f(C,{element:ne,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(w==="messageflow-start"){var Me=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Me,ref:{x:6,y:6},parentGfx:B})}if(w==="messageflow-end"){var Xe=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Xe,ref:{x:8.5,y:5},parentGfx:B})}if(w==="association-start"){var mt=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(w==="association-end"){var qt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:qt,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(w==="conditional-flow-marker"){var Rt=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:q})});f(C,{element:Rt,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(w==="conditional-default-flow-marker"){var gn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:q,fill:"none"})});f(C,{element:gn,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function h(B,C,w,G,q={}){fn(G)&&(q=G,G=0),G=G||0,q=u(q);var ne=C/2,Me=w/2,Xe=Oe("circle",{cx:ne,cy:Me,r:Math.round((C+w)/4-G),...q});return ze(B,Xe),Xe}function y(B,C,w,G,q,ne){fn(q)&&(ne=q,q=0),q=q||0,ne=u(ne);var Me=Oe("rect",{x:q,y:q,width:C-q*2,height:w-q*2,rx:G,ry:G,...ne});return ze(B,Me),Me}function _(B,C,w,G){var q=C/2,ne=w/2,Me=[{x:q,y:0},{x:C,y:ne},{x:q,y:w},{x:0,y:ne}],Xe=Me.map(function(qt){return qt.x+","+qt.y}).join(" ");G=u(G);var mt=Oe("polygon",{...G,points:Xe});return ze(B,mt),mt}function x(B,C,w,G){w=p(w);var q=ls(C,w,G);return ze(B,q),q}function m(B,C,w){return x(B,C,w,5)}function v(B,C,w){w=p(w);var G=Oe("path",{...w,d:C});return ze(B,G),G}function E(B,C,w,G){return v(C,w,V({"data-marker":B},G))}function S(B){return Te[B]}function P(B){return function(C,w,G){return S(B)(C,w,G)}}var k={"bpmn:MessageEventDefinition":function(B,C,w={},G){var q=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||C.width,containerHeight:w.height||C.height,position:{mx:.235,my:.315}}),ne=G?Se(C,c,w.stroke):ot(C,s,w.fill),Me=G?ot(C,s,w.fill):Se(C,c,w.stroke),Xe=v(B,q,{fill:ne,stroke:Me,strokeWidth:1});return Xe},"bpmn:TimerEventDefinition":function(B,C,w={}){var G=w.width||C.width,q=w.height||C.height,ne=w.width?1:2,Me=h(B,G,q,.2*q,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:ne}),Xe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}});v(B,Xe,{stroke:Se(C,c,w.stroke),strokeWidth:ne});for(var mt=0;mt<12;mt++){var qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}}),Rt=G/2,gn=q/2;v(B,qt,{strokeWidth:1,stroke:Se(C,c,w.stroke),transform:"rotate("+mt*30+","+gn+","+Rt+")"})}return Me},"bpmn:EscalationEventDefinition":function(B,C,w={},G){var q=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||C.width,containerHeight:w.height||C.height,position:{mx:.5,my:.2}}),ne=G?Se(C,c,w.stroke):ot(C,s,w.fill);return v(B,q,{fill:ne,stroke:Se(C,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,C,w={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||C.width,containerHeight:w.height||C.height,position:{mx:.5,my:.222}});return v(B,G,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,C,w={},G){var q=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ne=G?Se(C,c,w.stroke):ot(C,s,w.fill);return v(B,q,{fill:ne,stroke:Se(C,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,C,w={},G){var q=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||C.width,containerHeight:w.height||C.height,position:{mx:.2,my:.722}}),ne=G?Se(C,c,w.stroke):ot(C,s,w.fill);return v(B,q,{fill:ne,stroke:Se(C,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,C,w={},G){var q=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ne=G?Se(C,c,w.stroke):"none",Me=v(B,q,{fill:ne,stroke:Se(C,c,w.stroke),strokeWidth:1});return Zy(Me,45),Me},"bpmn:CompensateEventDefinition":function(B,C,w={},G){var q=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||C.width,containerHeight:w.height||C.height,position:{mx:.22,my:.5}}),ne=G?Se(C,c,w.stroke):ot(C,s,w.fill);return v(B,q,{fill:ne,stroke:Se(C,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,C,w={},G){var q=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||C.width,containerHeight:w.height||C.height,position:{mx:.5,my:.2}}),ne=G?Se(C,c,w.stroke):ot(C,s,w.fill);return v(B,q,{strokeWidth:1,fill:ne,stroke:Se(C,c,w.stroke)})},"bpmn:MultipleEventDefinition":function(B,C,w={},G){var q=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||C.width,containerHeight:w.height||C.height,position:{mx:.211,my:.36}}),ne=G?Se(C,c,w.stroke):ot(C,s,w.fill);return v(B,q,{fill:ne,stroke:Se(C,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,C,w={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||C.width,containerHeight:w.height||C.height,position:{mx:.458,my:.194}});return v(B,G,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,C,w={}){var G=h(B,C.width,C.height,8,{fill:Se(C,c,w.stroke),stroke:Se(C,c,w.stroke),strokeWidth:4});return G}};function $(B,C,w={},G){var q=de(B),ne=oP(q),Me=G||B;return q.get("eventDefinitions")&&q.get("eventDefinitions").length>1?q.get("parallelMultiple")?k["bpmn:ParallelMultipleEventDefinition"](C,Me,w,ne):k["bpmn:MultipleEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:MessageEventDefinition")?k["bpmn:MessageEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:TimerEventDefinition")?k["bpmn:TimerEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:ConditionalEventDefinition")?k["bpmn:ConditionalEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:SignalEventDefinition")?k["bpmn:SignalEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:EscalationEventDefinition")?k["bpmn:EscalationEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:LinkEventDefinition")?k["bpmn:LinkEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:ErrorEventDefinition")?k["bpmn:ErrorEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:CancelEventDefinition")?k["bpmn:CancelEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:CompensateEventDefinition")?k["bpmn:CompensateEventDefinition"](C,Me,w,ne):Zi(q,"bpmn:TerminateEventDefinition")?k["bpmn:TerminateEventDefinition"](C,Me,w,ne):null}var N={ParticipantMultiplicityMarker:function(B,C,w={}){var G=_i(C,w),q=ti(C,w),ne=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2-6)/G,my:(q-15)/q}});E("participant-multiplicity",B,ne,{strokeWidth:2,fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke)})},SubProcessMarker:function(B,C,w={}){var G=y(B,14,14,0,{strokeWidth:1,fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke)});On(G,C.width/2-7.5,C.height-20);var q=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2-7.5)/C.width,my:(C.height-20)/C.height}});E("sub-process",B,q,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke)})},ParallelMarker:function(B,C,w){var G=_i(C,w),q=ti(C,w),ne=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+w.parallel)/G,my:(q-20)/q}});E("parallel",B,ne,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke)})},SequentialMarker:function(B,C,w){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+w.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",B,G,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke)})},CompensationMarker:function(B,C,w){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+w.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",B,G,{strokeWidth:1,fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke)})},LoopMarker:function(B,C,w){var G=_i(C,w),q=ti(C,w),ne=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+w.loop)/G,my:(q-7)/q}});E("loop",B,ne,{strokeWidth:1.5,fill:"none",stroke:Se(C,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,C,w){var G=_i(C,w),q=ti(C,w),ne=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+w.adhoc)/G,my:(q-15)/q}});E("adhoc",B,ne,{strokeWidth:1,fill:Se(C,c,w.stroke),stroke:Se(C,c,w.stroke)})}};function L(B,C,w,G){N[B](C,w,G)}function z(B,C,w=[],G={}){G={fill:G.fill,stroke:G.stroke,width:_i(C,G),height:ti(C,G)};var q=de(C),ne=w.includes("SubProcessMarker");ne?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},q.get("isForCompensation")&&w.push("CompensationMarker"),M(q,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),ne||V(G,{compensation:G.compensation-18}));var Me=q.get("loopCharacteristics"),Xe=Me&&Me.get("isSequential");Me&&(V(G,{compensation:G.compensation-18}),w.includes("AdhocMarker")&&V(G,{seq:-23,loop:-18,parallel:-24}),Xe===void 0&&w.push("LoopMarker"),Xe===!1&&w.push("ParallelMarker"),Xe===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&V(G,{compensation:-8}),H(w,function(mt){L(mt,B,C,G)})}function X(B,C,w={}){w=V({size:{width:100}},w);var G=o.createText(C||"",w);return at(G).add("djs-label"),ze(B,G),G}function oe(B,C,w,G={}){var q=de(C),ne=vs({x:C.x,y:C.y,width:C.width,height:C.height},G);return X(B,q.name,{align:w,box:ne,padding:7,style:{fill:ys(C,l,c,G.stroke)}})}function te(B,C,w={}){var G={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return X(B,yi(C),{box:G,style:V({},o.getExternalStyle(),{fill:ys(C,l,c,w.stroke)})})}function Ge(B,C,w,G={}){var q=xn(w),ne=X(B,C,{box:{height:30,width:q?ti(w,G):_i(w,G)},align:"center-middle",style:{fill:ys(w,l,c,G.stroke)}});if(q){var Me=-1*ti(w,G);il(ne,0,-Me,270)}}function qe(B,C,w={}){var{width:G,height:q}=vs(C,w);return y(B,G,q,cl,{...w,fill:ot(C,s,w.fill),fillOpacity:ga,stroke:Se(C,c,w.stroke)})}function Ve(B,C,w={}){var G=de(C),q=ot(C,s,w.fill),ne=Se(C,c,w.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(w.markerEnd=d(B,"association-end",q,ne)),G.get("associationDirection")==="Both"&&(w.markerStart=d(B,"association-start",q,ne)),w=ft(w,["markerStart","markerEnd"]),m(B,C.waypoints,{...w,stroke:ne,strokeDasharray:"0, 5"})}function Re(B,C,w={}){var G=ot(C,s,w.fill),q=Se(C,c,w.stroke),ne=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Me=v(B,ne,{fill:G,fillOpacity:ga,stroke:q}),Xe=de(C);if(aP(Xe)){var mt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});v(B,mt,{strokeWidth:2,fill:G,stroke:q})}return Me}function Z(B,C,w={}){return h(B,C.width,C.height,{fillOpacity:ga,...w,fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke)})}function ie(B,C,w={}){return _(B,C.width,C.height,{fill:ot(C,s,w.fill),fillOpacity:ga,stroke:Se(C,c,w.stroke)})}function W(B,C,w={}){var G=y(B,_i(C,w),ti(C,w),0,{fill:ot(C,s,w.fill),fillOpacity:w.fillOpacity||ga,stroke:Se(C,c,w.stroke),strokeWidth:1.5}),q=de(C);if(M(q,"bpmn:Lane")){var ne=q.get("name");Ge(B,ne,C,w)}return G}function Y(B,C,w={}){var G=qe(B,C,w),q=st(C);if(jn(C)&&(we(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!q)){var ne=de(C).flowElements||[],Me=ne.filter(Xe=>M(Xe,"bpmn:StartEvent"));Me.length===1&&ae(Me[0],B,w,C)}return oe(B,C,q?"center-top":"center-middle",w),q?z(B,C,void 0,w):z(B,C,["SubProcessMarker"],w),G}function ae(B,C,w,G){var q=22,ne={fill:ot(G,s,w.fill),stroke:Se(G,c,w.stroke),width:q,height:q},Me=de(B).isInterrupting,Xe=Me?0:3,mt=Me?1:1.2,qt=20,Rt=(q-qt)/2,gn="translate("+Rt+","+Rt+")";h(C,qt,qt,{fill:ne.fill,stroke:ne.stroke,strokeWidth:mt,strokeDasharray:Xe,transform:gn}),$(B,C,ne,G)}function me(B,C,w={}){var G=qe(B,C,w);return oe(B,C,"center-middle",w),z(B,C,void 0,w),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function(B,C,w={}){return st(C)?w=ft(w,["fill","stroke","width","height"]):w=ft(w,["fill","stroke"]),Y(B,C,w)},"bpmn:Association":function(B,C,w={}){return w=ft(w,["fill","stroke"]),Ve(B,C,w)},"bpmn:BoundaryEvent":function(B,C,w={}){var{renderIcon:G=!0}=w;w=ft(w,["fill","stroke"]);var q=de(C),ne=q.get("cancelActivity");w={strokeWidth:1.5,fill:ot(C,s,w.fill),fillOpacity:dP,stroke:Se(C,c,w.stroke)},ne||(w.strokeDasharray="6");var Me=Z(B,C,w);return h(B,C.width,C.height,sl,{...w,fill:"none"}),G&&$(C,B,w),Me},"bpmn:BusinessRuleTask":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=me(B,C,w),q=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ne=v(B,q);we(ne,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1});var Me=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Xe=v(B,Me);return we(Xe,{fill:Se(C,c,w.stroke),stroke:Se(C,c,w.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,C,w={}){return w=ft(w,["fill","stroke"]),Y(B,C,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=ie(B,C,w),q=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return v(B,q,{fill:Se(C,c,w.stroke),stroke:Se(C,c,w.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=Re(B,C,w);return v(B,G,{fill:"none",stroke:Se(C,c,w.stroke),strokeWidth:1}),q},"bpmn:DataInputAssociation":function(B,C,w={}){return w=ft(w,["fill","stroke"]),Ve(B,C,{...w,markerEnd:d(B,"association-end",ot(C,s,w.fill),Se(C,c,w.stroke))})},"bpmn:DataObject":function(B,C,w={}){return w=ft(w,["fill","stroke"]),Re(B,C,w)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=Re(B,C,w);return v(B,G,{strokeWidth:1,fill:Se(C,c,w.stroke),stroke:Se(C,c,w.stroke)}),q},"bpmn:DataOutputAssociation":function(B,C,w={}){return w=ft(w,["fill","stroke"]),Ve(B,C,{...w,markerEnd:d(B,"association-end",ot(C,s,w.fill),Se(C,c,w.stroke))})},"bpmn:DataStoreReference":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return v(B,G,{fill:ot(C,s,w.fill),fillOpacity:ga,stroke:Se(C,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,C,w={}){var{renderIcon:G=!0}=w;w=ft(w,["fill","stroke"]);var q=Z(B,C,{...w,strokeWidth:4});return G&&$(C,B,w),q},"bpmn:EventBasedGateway":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=de(C),q=ie(B,C,w);h(B,C.width,C.height,C.height*.2,{fill:ot(C,"none",w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1});var ne=G.get("eventGatewayType"),Me=!!G.get("instantiate");function Xe(){var qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});v(B,qt,{fill:"none",stroke:Se(C,c,w.stroke),strokeWidth:2})}if(ne==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});v(B,mt,{fill:"none",stroke:Se(C,c,w.stroke),strokeWidth:1})}else ne==="Exclusive"&&(Me||h(B,C.width,C.height,C.height*.26,{fill:"none",stroke:Se(C,c,w.stroke),strokeWidth:1}),Xe());return q},"bpmn:ExclusiveGateway":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=ie(B,C,w),q=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ne=ut(C);return ne.get("isMarkerVisible")&&v(B,q,{fill:Se(C,c,w.stroke),stroke:Se(C,c,w.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,C,w={}){return w=ft(w,["fill","stroke"]),ie(B,C,w)},"bpmn:Group":function(B,C,w={}){return w=ft(w,["fill","stroke","width","height"]),y(B,C.width,C.height,cl,{stroke:Se(C,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(C,w),height:ti(C,w)})},"bpmn:InclusiveGateway":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=ie(B,C,w);return h(B,C.width,C.height,C.height*.24,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,C,w={}){var{renderIcon:G=!0}=w;w=ft(w,["fill","stroke"]);var q=Z(B,C,{...w,strokeWidth:1.5});return h(B,C.width,C.height,sl,{fill:"none",stroke:Se(C,c,w.stroke),strokeWidth:1.5}),G&&$(C,B,w),q},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,C,w={}){return w=ft(w,["fill","stroke","width","height"]),W(B,C,{...w,fillOpacity:hP})},"bpmn:ManualTask":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=me(B,C,w),q=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(B,q,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=de(C),q=ut(C),ne=ot(C,s,w.fill),Me=Se(C,c,w.stroke),Xe=m(B,C.waypoints,{markerEnd:d(B,"messageflow-end",ne,Me),markerStart:d(B,"messageflow-start",ne,Me),stroke:Me,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=Xe.getPointAtLength(Xe.getTotalLength()/2),qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),Rt={strokeWidth:1};q.get("messageVisibleKind")==="initiating"?(Rt.fill=ne,Rt.stroke=Me):(Rt.fill=Me,Rt.stroke=ne);var gn=v(B,qt,Rt),Rn=G.get("messageRef"),Vn=Rn.get("name"),Mt=X(B,Vn,{align:"center-top",fitBox:!0,style:{fill:Me}}),Qt=gn.getBBox(),_n=Mt.getBBox(),za=mt.x-_n.width/2,Wn=mt.y+Qt.height/2+uP;il(Mt,za,Wn,0)}return Xe},"bpmn:ParallelGateway":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=ie(B,C,w),q=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return v(B,q,{fill:Se(C,c,w.stroke),stroke:Se(C,c,w.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,C,w={}){w=ft(w,["fill","stroke","width","height"]);var G=W(B,C,w),q=st(C),ne=xn(C),Me=de(C),Xe=Me.get("name");if(q){var mt=ne?[{x:30,y:0},{x:30,y:ti(C,w)}]:[{x:0,y:30},{x:_i(C,w),y:30}];x(B,mt,{stroke:Se(C,c,w.stroke),strokeWidth:pP}),Ge(B,Xe,C,w)}else{var qt=vs(C,w);ne||(qt.height=_i(C,w),qt.width=ti(C,w));var Rt=X(B,Xe,{box:qt,align:"center-middle",style:{fill:ys(C,l,c,w.stroke)}});if(!ne){var gn=-1*ti(C,w);il(Rt,0,-gn,270)}}return Me.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",B,C,w),G},"bpmn:ReceiveTask":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=de(C),q=me(B,C,w),ne;return G.get("instantiate")?(h(B,28,28,20*.22,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1}),ne=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ne=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v(B,ne,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1}),q},"bpmn:ScriptTask":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=me(B,C,w),q=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(B,q,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=me(B,C,w),q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(B,q,{fill:Se(C,c,w.stroke),stroke:ot(C,s,w.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=ot(C,s,w.fill),q=Se(C,c,w.stroke),ne=m(B,C.waypoints,{markerEnd:d(B,"sequenceflow-end",G,q),stroke:q}),Me=de(C),{source:Xe}=C;if(Xe){var mt=de(Xe);Me.get("conditionExpression")&&M(mt,"bpmn:Activity")&&we(ne,{markerStart:d(B,"conditional-flow-marker",G,q)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Me&&we(ne,{markerStart:d(B,"conditional-default-flow-marker",G,q)})}return ne},"bpmn:ServiceTask":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=me(B,C,w);h(B,10,10,{fill:ot(C,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(B,q,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1}),h(B,10,10,{fill:ot(C,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var ne=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(B,ne,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,C,w={}){var{renderIcon:G=!0}=w;w=ft(w,["fill","stroke"]);var q=de(C);q.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var ne=Z(B,C,w);return G&&$(C,B,w),ne},"bpmn:SubProcess":function(B,C,w={}){return st(C)?w=ft(w,["fill","stroke","width","height"]):w=ft(w,["fill","stroke"]),Y(B,C,w)},"bpmn:Task":function(B,C,w={}){return w=ft(w,["fill","stroke"]),me(B,C,w)},"bpmn:TextAnnotation":function(B,C,w={}){w=ft(w,["fill","stroke"]);var{width:G,height:q}=vs(C,w),ne=y(B,G,q,0,0,{fill:"none",stroke:"none"}),Me=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:0,my:0}});v(B,Me,{stroke:Se(C,c,w.stroke)});var Xe=de(C),mt=Xe.get("text")||"";return X(B,mt,{align:"left-top",box:vs(C,w),padding:ma,style:{fill:ys(C,l,c,w.stroke)}}),ne},"bpmn:Transaction":function(B,C,w={}){st(C)?w=ft(w,["fill","stroke","width","height"]):w=ft(w,["fill","stroke"]);var G=Y(B,C,{strokeWidth:1.5,...w}),q=n.style(["no-fill","no-events"],{stroke:Se(C,c,w.stroke),strokeWidth:1.5}),ne=st(C);return ne||(w={}),y(B,_i(C,w),ti(C,w),cl-sl,sl,q),G},"bpmn:UserTask":function(B,C,w={}){w=ft(w,["fill","stroke"]);var G=me(B,C,w),q=15,ne=12,Me=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:q,y:ne}});v(B,Me,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:q,y:ne}});v(B,Xe,{fill:ot(C,s,w.fill),stroke:Se(C,c,w.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:q,y:ne}});return v(B,mt,{fill:Se(C,c,w.stroke),stroke:Se(C,c,w.stroke),strokeWidth:.5}),G},label:function(B,C,w={}){return te(B,C,w)}};this._drawPath=v,this._renderer=S}Ce(Eo,ur),Eo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Eo.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},Eo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Eo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Eo.prototype.getShapePath=function(e){return Je(e)?Rf(e,fP):M(e,"bpmn:Event")?sv(e):M(e,"bpmn:Activity")?Rf(e,cl):M(e,"bpmn:Gateway")?sP(e):cP(e)};function ft(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var mP=0,gP={width:150,height:50};function yP(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function vP(e){return fn(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Cf=null;function bP(){return Cf||(Cf=document.createElement("canvas").getContext("2d")),Cf}function xP(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(cv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function cv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function _P(e,t){var n=bP();if(!n)return{width:0,height:0};n.font=xP(t),"letterSpacing"in n&&(n.letterSpacing=cv(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 wP(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=_P(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return EP(e,r,i,o);r=RP(r,o.width,t)}}function EP(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 lv="­";function SP(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===lv)&&r.pop();break}var a=r[r.length-1];return a&&a===lv&&(r[r.length-1]="-"),r.join("")}function RP(e,t,n){var i=Math.max(e.length*(n/t),1),r=SP(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function ll(e){this._config=V({},{size:gP,padding:mP,style:{},align:"center-top"},e||{})}ll.prototype.createText=function(e,t){return this.layoutText(e,t).element},ll.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},ll.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=yP(t.align||this._config.align),o=vP(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=CP(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(wP(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Qn(l,function(y,_,x){return y+(s||_.height)},0)+o.top+o.bottom,f=Qn(l,function(y,_,x){return _.width>y?_.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");we(g,i),H(l,function(y){var _;switch(d+=s||y.height,r.horizontal){case"left":_=o.left;break;case"right":_=(a?f:u)-o.right-y.width;break;default:_=Math.max(((a?f:u)-y.width)/2+o.left,0)}var x=Oe("tspan");we(x,{x:_,y:d}),x.textContent=y.text,ze(g,x)});var h={width:f,height:p};return{dimensions:h,element:g}};function CP(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var MP=12,AP=1.2,PP=40;function uv(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:MP,fontWeight:"normal",lineHeight:AP},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new ll({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,wo.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:ma});return{x:a.x,y:a.y,width:a.width,height:Math.max(PP,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}uv.$inject=["config.textRenderer"];function TP(){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,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=LP(i.d,{mx:r,my:o,e:a});return p}}var kP=/\{([^{}]+)\}/g,OP=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function DP(e,t,n){var i=n;return t.replace(OP,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 LP(e,t){return String(e).replace(kP,function(n,i){return DP(n,i,t)})}const IP={__init__:["bpmnRenderer"],bpmnRenderer:["type",Eo],textRenderer:["type",uv],pathMap:["type",TP]};function BP(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const bs={translate:["value",BP]};function ul(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function NP(e,t,n){var i=e.waypoint;return!i||i.length<2?[je(t),je(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function pv(e,t,n){return new Error(`element ${Fn(t)} referenced by ${Fn(e)}#${n} not yet drawn`)}function hr(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}hr.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],hr.prototype.add=function(e,t,n){var i,r,o;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ul(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!st(e,t),c=FP(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(ul(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(o=0),M(e,"bpmn:DataStoreReference")&&($P(n,je(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ul(e,t,{hidden:r,source:u,target:p,waypoints:NP(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Fn(t)} for element ${Fn(e)}`);return Hr(e)&&yi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},hr.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Fn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw pv(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},hr.prototype.addLabel=function(e,t,n){var i,r,o;return i=eP(t,n),r=yi(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ul(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!yi(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)},hr.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?pv(e,i,t+"Ref"):new Error(`${Fn(e)}#${t} Ref not specified`)},hr.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},hr.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},hr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function $P(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 FP(e){return M(e,"bpmn:Group")}const fv={__depends__:[IP,{__depends__:[bs],bpmnImporter:["type",hr]}]};function xs(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Bi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Mf(e){return Math.log(e)/Math.log(10)}var jP=1e3;function pe(e){this._eventBus=e}pe.$inject=["eventBus"];function HP(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}pe.prototype.on=function(e,t,n,i,r,o){if((yn(t)||Fe(t))&&(o=r,r=i,i=n,n=t,t=null),yn(n)&&(o=r,r=i,i=n,n=jP),fn(r)&&(o=r,r=!1),!yn(i))throw new Error("handlerFn must be a function");$e(e)||(e=[e]);var a=this._eventBus;H(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?HP(i,o):i,o)})},pe.prototype.canExecute=mr("canExecute"),pe.prototype.preExecute=mr("preExecute"),pe.prototype.preExecuted=mr("preExecuted"),pe.prototype.execute=mr("execute"),pe.prototype.executed=mr("executed"),pe.prototype.postExecute=mr("postExecute"),pe.prototype.postExecuted=mr("postExecuted"),pe.prototype.revert=mr("revert"),pe.prototype.reverted=mr("reverted");function mr(e){return function(n,i,r,o,a){(yn(n)||Fe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Af=["top","bottom","left","right"],pl=10;function Pf(e,t){pe.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,l=o.hints||{};l.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(al(r)&&!At(r)){var o=VP(r);o&&i(r,o)}}function i(r,o){var a=je(r),s=r.label,c=je(s);if(s.parent){var l=Be(r),u;switch(o){case"top":u={x:a.x,y:l.top-pl-s.height/2};break;case"left":u={x:l.left-pl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+pl+s.height/2};break;case"right":u={x:l.right+pl+s.width/2,y:a.y};break}var p=Bi(u,c);t.moveShape(s,p)}}}Ce(Pf,pe),Pf.$inject=["eventBus","modeling"];function zP(e){var t=e.host,n=je(e),i=kn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Af.filter(function(a){return r.indexOf(a)===-1});return o}function GP(e){var t=je(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 dv(t,i)});return n}function VP(e){var t=je(e.label),n=je(e),i=dv(n,t);if(WP(i)){var r=GP(e);if(e.host){var o=zP(e);r=r.concat(o)}var a=Af.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?kn(e.label,e)!=="intersect"?void 0:i:a[0]}}function dv(e,t){return kn(t,e,5)}function WP(e){return Af.indexOf(e)!==-1}function Tf(e){pe.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(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)}Ce(Tf,pe),Tf.$inject=["eventBus"];var UP=1500;function kf(e,t,n){e.invoke(pe,this),this.preExecute("elements.delete",UP,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=it(r,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return H(o,l=>{const u=new Set(qo(ua(Array.from(s),on(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ce(kf,pe),kf.$inject=["injector","eventBus","canvas"];function Of(e,t){e.invoke(pe,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=it(r.incoming.concat(r.outgoing),function(a){return M(a,"bpmn:Association")});H(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ce(Of,pe),Of.$inject=["injector","modeling"];function ya(e,t){for(Xn(t)&&(t=[t]);e=e.parent;)if(tt(e,t))return e;return null}function hv(e,t){var n=ya(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ya(e,i),n)return xn(n);if(tt(e,i))return xn(e);var r;for(r=de(e);r&&!M(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=de(a);return s&&s.get("processRef")===r});return o?xn(o):!0}var mv=500;function fl(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",mv,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return gv(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",mv,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];gv(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}fl.$inject=["bpmnReplace","injector"],Ce(fl,pe),fl.prototype._replaceShape=function(e,t){var n=qP(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function qP(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function gv(e,t){return!Je(e)&&tt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Df(e,t){pe.call(this,e);function n(i){return it(i.attachers,function(r){return M(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);M(r,"bpmn:EventBasedGateway")&&M(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;M(r,"bpmn:Gateway")&&M(o,"bpmn:EventBasedGateway")&&H(o.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Df.$inject=["eventBus","modeling"],Ce(Df,pe);function yv(e){return e.create("bpmn:Category")}function YP(e){return e.create("bpmn:CategoryValue")}function vv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=YP(e)),n.$parent||(n.$parent=yv(e)),n}function KP(e,t,n){return tn(t.get("categoryValue"),e),e.$parent=t,tn(n.get("rootElements"),t),t.$parent=n,e}function XP(e){var t=e.$parent;return t&&(Zt(t.get("categoryValue"),e),e.$parent=null),e}function ZP(e){var t=e.$parent;return t&&(Zt(t.get("rootElements"),e),e.$parent=null),e}var QP=500;function Lf(e,t,n){n.invoke(pe,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(de).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&KP(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&ZP(l),c&&!r(c,u)&&XP(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.executed(["shape.move","shape.resize"],QP,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,de(l))},!0),this.executed("group.updateRefs",function(c){bv(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){bv(c).forEach(function(l){s(l.categoryValue,l.category,de(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Lf.$inject=["bpmnjs","elementRegistry","injector"],Ce(Lf,pe);function bv(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function If(e,t,n){pe.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const _=y.source,x=y.target;va(_)&&_s(x)&&u(x)}function r(y){const _=y.connection,x=y.source,m=y.target;va(x)&&dl(m)&&(l(m),f(x,[_]))}function o(y){const _=y.newTarget,x=y.oldSource,m=y.oldTarget;if(m!==_){const v=x;_s(m)&&u(m),va(v)&&dl(_)&&l(_)}}function a(y){const{element:_}=y;_s(_)?(p(_),d(_)):dl(_)&&g(_)}function s(y){const{newData:_,oldShape:x}=y;if(va(y.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>_s(v));m&&m.target&&(y._connectionTarget=m.target)}else if(!va(y.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>dl(v));m&&m.target&&(y._connectionTarget=m.target),h(x)}}function c(y){const{_connectionTarget:_,newShape:x}=y;_&&t.connect(x,_)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const _ of y.incoming)n.canConnect(_.source,y)||t.removeConnection(_);for(const _ of y.outgoing)n.canConnect(y,_.target)||t.removeConnection(_)}function f(y,_){y.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>_s(v.target)&&!_.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const _=y.attachers.slice();_.length&&t.removeElements(_)}function g(y){const _=y.incoming.filter(x=>va(x.source));t.removeElements(_)}function h(y){const _=y.outgoing.filter(x=>M(x,"bpmn:SequenceFlow"));t.removeElements(_)}}Ce(If,pe),If.$inject=["eventBus","modeling","bpmnRules"];function _s(e){const t=de(e);return t&&t.get("isForCompensation")}function va(e){return e&&M(e,"bpmn:BoundaryEvent")&&ha(e,"bpmn:CompensateEventDefinition")}function dl(e){return e&&M(e,"bpmn:Activity")&&!jn(e)}function Bf(e){e.invoke(pe,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;M(i,"bpmn:Lane")&&!M(r,"bpmn:Lane")&&(n.parent=ya(i,"bpmn:Participant"))})}Bf.$inject=["injector"],Ce(Bf,pe);function Nf(e,t){pe.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(M(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}})}Nf.$inject=["eventBus","bpmnFactory"],Ce(Nf,pe);var $f=20,Ff=20,xv=30,hl=2e3;function jf(e,t,n){pe.call(this,t),t.on(["create.start","shape.move.start"],hl,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!Je(p)&&!At(p)});if(c.length){var l=on(c),u=JP(a,l);V(a,u),o.createConstraints=eT(a,l)}}}),t.on("create.start",hl,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",hl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return M(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",hl,function(r){var o=r.elements,a=r.parent,s=tT(o),c;s&&M(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=de(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;M(a,"bpmn:Participant")&&M(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=de(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)&&de(s).set("processRef",de(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,l=o.participant;a&&(!l||c===l)&&de(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 l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}jf.$inject=["canvas","eventBus","modeling"],Ce(jf,pe);function JP(e,t){t={width:t.width+$f*2+xv,height:t.height+Ff*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 eT(e,t){return t=Be(t),{bottom:t.top+e.height/2-Ff,left:t.right-e.width/2+$f,top:t.bottom-e.height/2+Ff,right:t.left+e.width/2-$f-xv}}function tT(e){return kt(e,function(t){return M(t,"bpmn:Participant")})}var _v="__targetRef_placeholder";function Hf(e,t){pe.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],wv(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],wv(o));function n(a,s,c){var l=a.get("dataInputAssociations");return kt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=kt(c,function(u){return u.name===_v});return!l&&s&&(l=t.create("bpmn:Property",{name:_v}),tn(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Zt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,_;h&&h!==p&&r(h,l),d&&d!==p&&r(d,l),p?(_=i(p,!0),y.targetRef=_):y.targetRef=null}}Hf.$inject=["eventBus","bpmnFactory"],Ce(Hf,pe);function wv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function ml(e){this._bpmnUpdater=e}ml.$inject=["bpmnUpdater"],ml.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),[]},ml.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 zf(e,t,n,i){pe.call(this,i),t.registerHandler("dataStore.updateContainment",ml);function r(){return n.filter(function(s){return M(s,"bpmn:Participant")&&de(s).processRef})[0]}function o(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ut(s),newSemanticParent:u.processRef||u,newDiParent:ut(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:iT(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();tt(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&o(u).filter(function(p){return nT(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=o(l);p.forEach(function(f){M(u,"bpmn:Process")&&a(f,u)})})}zf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ce(zf,pe);function nT(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 iT(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var gl=Math.max,yl=Math.min,rT=20;function Ev(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function oT(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 aT(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 vl(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Fe(r)&&(i=(/top|left/.test(e)?yl:gl)(i,r)),Fe(o)&&(i=(/top|left/.test(e)?gl:yl)(i,o)),i}function sT(e,t){if(!t)return e;var n=Be(e);return el({top:vl("top",n,t),right:vl("right",n,t),bottom:vl("bottom",n,t),left:vl("left",n,t)})}function cT(e,t,n,i){var r=Be(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Be(i):o,s={top:yl(o.top,a.top),left:yl(o.left,a.left),bottom:gl(o.bottom,a.bottom),right:gl(o.right,a.right)};return el(s)}function ws(e,t){return typeof e<"u"?e:rT}function lT(e,t){var n,i,r,o;return typeof t=="object"?(n=ws(t.left),i=ws(t.right),r=ws(t.top),o=ws(t.bottom)):n=i=r=o=ws(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function uT(e){return!(e.waypoints||e.type==="label")}function Sv(e,t){var n;if(e.length===void 0?n=it(e.children,uT):n=e,n.length)return lT(on(n),t)}var zr=Math.abs;function pT(e,t){return Ev(Be(t),Be(e))}var fT=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function bl(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(bl(n,t),t.push(n))}),t}function Gr(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ei(e){return ya(e,fT)||e}function dT(e,t){var n=Ei(e),i=M(n,"bpmn:Process")?[]:[n],r=bl(n,i),o=Be(e),a=Be(t),s=pT(e,t),c=[],l=xn(e);return r.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Be(u);s.top&&(zr(h.bottom-o.top)<10&&(d=a.top-h.bottom),zr(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(zr(h.right-o.left)<10&&(f=a.left-h.right),zr(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(zr(h.top-o.bottom)<10&&(p=a.bottom-h.top),zr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(zr(h.left-o.right)<10&&(g=a.right-h.left),zr(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:aT(u,{top:p,right:f,bottom:d,left:g})})}}),c}var hT=500;function Gf(e,t){pe.call(this,e);function n(i,r){var o=xn(i),a=Gr(r),s=[],c=[],l=[],u=[];if(_o(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",hT,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;M(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Gf.$inject=["eventBus","spaceTool"],Ce(Gf,pe);var Rv=500;function xl(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Rv,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Cv(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Rv,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Cv(a,gT(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}xl.$inject=["bpmnReplace","injector"],Ce(xl,pe),xl.prototype._replaceShape=function(e){var t=mT(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function mT(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function Cv(e,t){return!Je(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function gT(e,t){return e.indexOf(t)!==-1}var _l=Math.round,yT=Math.max;function vT(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 bT(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Mv=10;function xT(e,t){var n,i;for(n=0;i=e[n];n++)if(fs(i,t)<=Mv)return{point:e[n],bendpoint:!0,index:n};return null}function _T(e,t){var n=Oy(vT(t,Mv),bT(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=yT(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:_l(i.x+r.x)/2,y:_l(i.y+r.y)/2},index:i.segment2}:{point:{x:_l(i.x),y:_l(i.y)},index:i.segment2}:null}function Vf(e,t){return xT(e,t)||_T(e,t)}function Wf(e,t,n){pe.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,g,h=r.outgoing.slice(),y=r.incoming.slice(),_;Fe(a.width)?_=je(a):_=a;var x=Vf(s,_);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:_,(c.length===1||!Av(r,c[c.length-1]))&&c.push(Pv(u)),(l.length===1||!Av(r,l[0]))&&l.unshift(Pv(u))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||_),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||_),g=o));var m=[].concat(d&&it(y,function(v){return v.source===d.source})||[],g&&it(h,function(v){return v.target===g.target})||[]);m.length&&n.removeElements(m)}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 l=je(c),u={x:l.x+s.x,y:l.y+s.y},p=kt(o.children,function(f){var d=t.canInsert(a,f);return d&&Vf(f.waypoints,u)});p&&(r.targetFlow=p,r.position=u)}},!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)}Ce(Wf,pe),Wf.$inject=["eventBus","bpmnRules","modeling"];function Av(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 Pv(e){return V({},e)}function Uf(e,t){pe.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)&&ba(r)){var c=[];M(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&ba(l)):c=a.incoming.filter(l=>l!==r&&ba(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(M(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ba).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ba).forEach(function(s){const c=a.incoming.filter(ba).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Uf.$inject=["eventBus","modeling"],Ce(Uf,pe);function ba(e){return M(e,"bpmn:SequenceFlow")}var wl=1500,Tv=2e3;function kv(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"],wl,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!tt(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||tt(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"],wl,function(i){var r=i.hover;M(r,"bpmn:Lane")&&(i.hover=Ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],wl,function(i){var r=i.context,o=i.hover,a=r.type;M(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],wl,function(i){var r=i.context,o=r.start;M(o,"bpmn:Lane")&&(r.start=Ei(o)||o)}),t.on("shape.move.start",Tv,function(i){var r=i.shape;M(r,"bpmn:Lane")&&(i.shape=Ei(r)||r)}),t.on("spaceTool.move",Tv,function(i){var r=i.hover;r&&M(r,"bpmn:Lane")&&(i.hover=Ei(r))})}kv.$inject=["elementRegistry","eventBus","canvas"];var Ov=770;function qf(e,t,n,i){n.invoke(pe,this);function r(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef;u||(u=vv(e,l));var p=c.category||u.$parent||yv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function o(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=de(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=de(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||de(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Ov,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=de(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Ov,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,p=c.category;u&&(u=l.categoryValueRef=a(u)),p&&(u.$parent=a(p)),delete c.category,delete c.categoryValue})}qf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ce(qf,pe);function Yf(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 Dv(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Yf(i,r,o,a),l=Yf(i,r,o,s),u;c&&l?Lv(c,o)>Lv(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],je(i.source)),t(r[r.length-1],r[r.length-2],je(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Dv.$inject=["eventBus"];function Lv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Kf(e){pe.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=de(i),o=ut(i);if(tt(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Kf.$inject=["eventBus"],Ce(Kf,pe);function Iv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Bv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function wT(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 ET(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 Xf(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=ET([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 Nv(e,t){var n=Xf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Iv(i)}function Es(e,t){return Iv({x:e.x-t.x,y:e.y-t.y})}var $v=Math.sqrt,Fv=Math.min,ST=Math.max,jv=Math.abs;function Hv(e){return Math.pow(e,2)}function Ss(e,t){return $v(Hv(e.x-t.x)+Hv(e.y-t.y))}function RT(e,t){var n=0,i,r,o,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Gv(i,r)?l=[i]:(o=Ss(e,i),a=Ss(e,r),c=Fv(o,a),l=CT(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Gv(i,l[0])?n:n+1}),l.length===2&&(s=AT(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ss(i,s)/Ss(i,r)}),p=Ss(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function CT(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,l=r*a+o*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=$v(d),h=-p+g,y=-p-g,_={x:e.x-r*h,y:e.y-o*h};if(d===0)return[_];var x={x:e.x-r*y,y:e.y-o*y};return[_,x].filter(function(m){return MT(m,e,t)})}function MT(e,t,n){return zv(e.x,t.x,n.x)&&zv(e.y,t.y,n.y)}function zv(e,t,n){return e>=Fv(t,n)-El&&e<=ST(t,n)+El}function AT(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var El=.1;function Gv(e,t){return jv(e.x-t.x)<=El&&jv(e.y-t.y)<=El}function PT(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,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var p=Wv(t,l);p<n.relativeLocation&&u++}return u}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 Vv(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=RT(e,n),c=s.segmentIndex,l=PT(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Uv(n,c),p=Uv(t,l),f=s.position,d=kT(u,f),g=TT(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,_=n[y];if(t.indexOf(_)!==-1)return a;if(h===0){var x=t[y];return r=x.x-s.position.x,o=x.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=Wv(n,y))}var m={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=wT({x:e.x-f.x,y:e.y-f.y},g);return r=m.x+v.x-e.x,o=m.y+v.y-e.y,{point:fr(m),delta:fr({x:r,y:o})}}function Wv(e,t){var n=Es(e[t-1],e[t]),i=Es(e[t],e[t+1]),r=n/(n+i);return r}function TT(e,t){var n=Bv(e),i=Bv(t);return i-n}function Uv(e,t){return[e[t],e[t+1]]}function kT(e,t){var n=Es(e[0],e[1]),i=Es(e[0],t);return n===0?0:i/n}function OT(e,t,n,i){var r=je(e);return Vv(r,t,n,i).delta}function Rs(e,t,n){var i=xs(t),r=xs(n),o=Bi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return fr({x:r.x+a.x,y:r.y+a.y})}function qv(e,t,n){var i=xs(e),r=xs(t),o=xs(n),a=Bi(e,i),s=Bi(i,r),c=DT(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return fr({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function DT(e,t,n){var i=Be(t),r=Be(n);if(LT(i,r))return null;var o=kn(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=kn(n,s),c!==o?null:a}function LT(e,t){return IT(e,t)||BT(e,t)}function IT(e,t){return e.right!==t.right&&e.left!==t.left}function BT(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Yv="name",Kv="text";function Zf(e,t,n,i){pe.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{de(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Yv in l&&t.updateLabel(c,l[Yv]),Kv in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Kv]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Je(l)||!Hr(l)||yi(l)&&t.updateLabel(l,yi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=V({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),OT(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=o(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=de(c);u&&Hr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Je(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(yi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(al(c)){var p=c.label,f=je(p),d=FT(u),g=$T(f,d),h=NT(g,u,l);t.moveShape(p,h)}})}Ce(Zf,pe),Zf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function NT(e,t,n){var i=Rs(e,t,n);return fr(Bi(i,e))}function $T(e,t){if(t.length){var n=jT(e,t);return Xf(e,n)}}function FT(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 jT(e,t){var n=t.map(function(r){return{line:r,distance:Nv(e,r)}}),i=Hi(n,"distance");return i[0].line}function HT(e,t,n,i){return Vv(e,t,n,i).point}function Qf(e,t){pe.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=V({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),HT(r,c,l,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 l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ce(Qf,pe),Qf.$inject=["eventBus","modeling"];function Sl(e,t,n){var i=Cl(e),r=Zv(i,t),o=i[0];return r.length?r[r.length-1]:Rs(o.original||o,n,t)}function Rl(e,t,n){var i=Cl(e),r=Zv(i,t),o=i[i.length-1];return r.length?r[0]:Rs(o.original||o,n,t)}function Jf(e,t,n){var i=Cl(e),r=Xv(t,n),o=i[0];return Rs(o.original||o,r,t)}function ed(e,t,n){var i=Cl(e),r=Xv(t,n),o=i[i.length-1];return Rs(o.original||o,r,t)}function Xv(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Cl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Zv(e,t){var n=Bn(e,GT);return it(n,function(i){return zT(i,t)})}function zT(e,t){return kn(t,e,1)==="intersect"}function GT(e){return e.original||e}function td(e,t){pe.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(VT(i,r)){var o=WT(i);o.incoming.forEach(function(a){var s=Rl(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Sl(a,r,i);t.reconnectStart(a,r,s)})}},!0)}td.$inject=["eventBus","modeling"],Ce(td,pe);function VT(e,t){return M(e,"bpmn:Participant")&&st(e)&&M(t,"bpmn:Participant")&&!st(t)}function WT(e){var t=us([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){M(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){M(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const UT=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Qv(e){const t=de(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&jn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:UT.some(i=>M(n[0],i))}function Jv(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function nd(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Qv(r))return;const a=Jv(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=de(i).get(a),l=de(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}nd.$inject=["injector","modeling"],Ce(nd,pe);function id(e,t){pe.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ut(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ce(id,pe),id.$inject=["eventBus","modeling"];function rd(e,t,n){pe.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(!(!M(o,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=qT(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ce(rd,pe),rd.$inject=["eventBus","bpmnRules","modeling"];function xa(e){return e.original||e}function qT(e,t){var n=Yf(xa(e[e.length-2]),xa(e[e.length-1]),xa(t[1]),xa(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[xa(e[0]),xa(t[t.length-1])]}function od(e,t){pe.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;M(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)}od.$inject=["eventBus","modeling"],Ce(od,pe);function ad(e,t,n,i){pe.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,r&&s(u,g))}function s(c,l){var u=r.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;H(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=kt(p.outgoing,Ko({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Ce(ad,pe),ad.$inject=["eventBus","modeling","bpmnRules","injector"];function Ml(e,t,n,i,r,o){i.invoke(pe,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Qn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];H(s.closure.topLevel,function(f){jn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ce(Ml,pe),Ml.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;H(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)},Ml.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var YT=1500,KT={width:140,height:120},sd={width:300,height:60},cd={width:60,height:300},Al={width:300,height:150},Pl={width:150,height:300},eb={width:140,height:120},tb={width:100,height:40};function nb(e){e.on("resize.start",YT,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=ek(i,r,o)),M(i,"bpmn:SubProcess")&&st(i)&&(n.minDimensions=eb),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=tb)})}nb.$inject=["eventBus"];var Vr=Math.abs,XT=Math.min,ZT=Math.max;function ib(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function _a(e,t,n){return ib(e,t,n,XT)}function wa(e,t,n){return ib(e,t,n,ZT)}var QT={top:20,left:50,right:20,bottom:20},JT={top:50,left:20,right:20,bottom:20};function ek(e,t,n){var i=Ei(e),r=!0,o=!0,a=bl(i,[i]),s=Be(e),c={},l={},u=xn(e),p=u?sd:cd;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Be(g);u?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&Vr(s.top-h.bottom)<10&&wa(c,"top",h.top+p.height),Vr(s.top-h.top)<5&&_a(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Vr(s.right-h.left)<10&&_a(c,"right",h.right-p.width),Vr(s.right-h.right)<5&&wa(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Vr(s.bottom-h.top)<10&&_a(c,"bottom",h.bottom-p.height),Vr(s.bottom-h.bottom)<5&&wa(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Vr(s.left-h.right)<10&&wa(c,"left",h.left+p.width),Vr(s.left-h.left)<5&&_a(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?QT:JT;return f.forEach(function(g){var h=Be(g);/n/.test(t)&&(!u||r)&&_a(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&wa(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&wa(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&_a(l,"left",h.left-d.left)}),{min:l,max:c}}function rb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ea(e){return e.originalEvent||e.srcEvent}function ld(e){rb(e),rb(Ea(e))}function So(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 ob(){return/mac/i.test(navigator.platform)}function ab(e,t){return(Ea(e)||e).button===t}function Wr(e){return ab(e,0)}function tk(e){return ab(e,1)}function Cs(e){var t=Ea(e)||e;return Wr(e)?ob()?t.metaKey:t.ctrlKey:!1}function Tl(e){var t=Ea(e)||e;return Wr(e)&&t.shiftKey}var sb=1001;function cb(e,t){e.on("resize.start",sb+500,function(n){var i=n.context,r=i.shape;(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))&&(i.balanced=!Cs(n))}),e.on("resize.end",sb,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))return o&&(a=Ny(a),t.resizeLane(r,a,i.balanced)),!1})}cb.$inject=["eventBus","modeling"];var nk=500;function ud(e,t,n,i,r){n.invoke(pe,this);function o(u){return tt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||ik(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!kt(f,Ko({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(o(p)){var f=de(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),tn(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Zt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=de(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",nk,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(f,d),delete p.referencedRootElement)})}ud.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ce(ud,pe);function ik(e,t){return $e(t)||(t=[t]),Ar(t,function(n){return ha(e,n)})}var lb=Math.max;function ub(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return H(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(o[s]=ok(a,i,r)),M(a,"bpmn:Lane")&&(o[s]=xn(a)?sd:cd),M(a,"bpmn:SubProcess")&&st(a)&&(o[s]=eb),M(a,"bpmn:TextAnnotation")&&(o[s]=tb),M(a,"bpmn:Group")&&(o[s]=KT)}),o})}ub.$inject=["eventBus"];function rk(e){return e==="x"}function ok(e,t,n){var i=xn(e);if(!ck(e))return i?Al:Pl;var r=rk(t),o={};return r?i?o=Al:o={width:sk(e,n,r),height:Pl.height}:i?o={width:Al.width,height:ak(e,n,r)}:o=Pl,o}function ak(e,t,n){var i;return i=lk(e,t,n),lb(Al.height,i)}function sk(e,t,n){var i;return i=uk(e,t,n),lb(Pl.width,i)}function ck(e){return!!Gr(e).length}function lk(e,t,n){var i=Gr(e),r;return r=pd(i,t,n),e.height-r.height+sd.height}function uk(e,t,n){var i=Gr(e),r;return r=pd(i,t,n),e.width-r.width+cd.width}function pd(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=Gr(r),o.length?pd(o,t,n):r}var pb="_plane";function fb(e){var t=e.id;return pk(t)}function Qi(e){var t=e.id;return M(e,"bpmn:SubProcess")?db(t):t}function Ro(e){return db(e)}function kl(e){var t=ut(e);return M(t,"bpmndi:BPMNPlane")}function db(e){return e+pb}function pk(e){return e.replace(new RegExp(pb+"$"),"")}var hb=400,fk=600,mb={x:180,y:160};function gr(e,t,n,i,r,o,a){pe.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return M(p,"bpmn:SubProcess")&&!st(p)}function l(p){var f=p.shape,d=p.newRootElement,g=de(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=de(f);s._removeDiagram(d);var g=p.newRootElement=a.get(Qi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;H(f,function(d){if(c(d)){var g=a.get(Qi(d));if(!(!g||!d.children||!d.children.length)){var h=gb(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!st(f)||H(gs([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Qi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Qi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(Qi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(kl(f)){a.updateId(f,Ro(y)),a.updateId(h,y);return}var _=a.get(Ro(h));_&&a.updateId(Ro(h),Ro(y))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(kl(f)){a.updateId(f,Ro(h)),a.updateId(y,h);return}var _=a.get(Ro(y));_&&a.updateId(_,Ro(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(kl(f)){var d=f,g=a.get(fb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",hb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(st(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",hb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(st(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",fk,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(st(f))s._moveChildrenToShape(d.children.slice(),f),H(gs(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),H(h.associations,y=>{n.moveConnection(y,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=gb(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=Qi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,y=M(ut(h),"bpmndi:BPMNPlane");if(y){var _=fb(h),x=kt(g,function(m){return m.id===_});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ce(gr,pe),gr.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=on(i),o;if(!t.x)o={x:mb.x-r.x,y:mb.y-r.y};else{var a=je(t),s=je(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},gr.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(av(e).map(i=>i.annotation));n.size&&H(gs(e.children),i=>{n.has(i.annotation)&&H(i.associations,r=>{t.removeConnection(r)})})},gr.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},gr.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},gr.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:Qi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},gr.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=kt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},gr.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function dk(e){var t=[];return H(gs(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function gb(e){return e.children.slice().concat(dk(e.children)).concat(hk(e))}function hk(e){return gf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function fd(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!M(r,"bpmn:SubProcess")||M(r,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!st(r))){var o=mk(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}fd.$inject=["injector","modeling"],Ce(fd,pe);function mk(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function dd(e,t){pe.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(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&&M(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(!(!M(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,yi(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ce(dd,pe),dd.$inject=["eventBus","textRenderer"];function hd(e,t){pe.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(st(i))return;var r=us(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();H(s,function(l){o(l,!0)}),H(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,je(i)):t.reconnectStart(a,i,je(i)))}},!0)}Ce(hd,pe),hd.$inject=["eventBus","modeling"];var md=500;function gd(e,t,n){pe.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,l=s,u,p;return u=gk(c).concat([a]),p=Sv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}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"],md,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?ut(c).isExpanded=!1:(i(c.children),ut(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],md,function(a){var s=a.context,c=s.shape;c.collapsed?ut(c).isExpanded=!1:ut(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],md,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ce(gd,pe),gd.$inject=["eventBus","elementFactory","modeling"];function gk(e){return e.filter(function(t){return!t.hidden})}function yd(e,t,n,i){t.invoke(pe,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Je(a)||(M(a,"bpmn:Participant")&&st(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;M(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ce(yd,pe),yd.$inject=["canvas","injector","moddle","modeling"];function vd(e,t){pe.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;yk(r,o)&&t.updateProperties(o,{default:null})})}Ce(vd,pe),vd.$inject=["eventBus","modeling"];function yk(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=de(t),i=de(e);return n.get("default")===i}var vk=500,bk=5e3,yb=["shape.create","shape.delete","shape.move","shape.resize"],vb=[...yb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function bd(e,t){pe.call(this,e);var n;function i(){return n=n||new xk,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(vb,bk,function(){i()}),this.postExecuted(vb,vk,function(){o()}),this.preExecute(yb,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}bd.$inject=["eventBus","modeling"],Ce(bd,pe);function xk(){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 _k=500,wk=5e3,bb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],xb=[...bb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function xd(e,t){pe.call(this,e);var n;function i(){return n=n||new Ek,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(xb,wk,function(){i()}),this.postExecuted(xb,_k,function(){o()}),this.preExecute(bb,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&r().addGroup(s)})}xd.$inject=["eventBus","modeling"],Ce(xd,pe);function Ek(){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 _d(e,t){pe.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)Sk(o)&&!Ck(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ce(_d,pe),_d.$inject=["eventBus","modeling"];function Sk(e){const t=de(e);return t&&t.isForCompensation}function Rk(e){return e&&M(e,"bpmn:BoundaryEvent")&&ha(e,"bpmn:CompensateEventDefinition")}function Ck(e){return e.incoming.filter(n=>Rk(n.source)).length>0}const Mk={__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",Pf],appendBehavior:["type",Tf],associationBehavior:["type",Of],attachEventBehavior:["type",fl],artifactBehavior:["type",kf],boundaryEventBehavior:["type",Df],categoryRootElementReferenceBehavior:["type",Lf],compensateBoundaryEventBehaviour:["type",If],createBehavior:["type",Bf],createDataObjectBehavior:["type",Nf],createParticipantBehavior:["type",jf],dataInputAssociationBehavior:["type",Hf],dataStoreBehavior:["type",zf],deleteLaneBehavior:["type",Gf],detachEventBehavior:["type",xl],dropOnFlowBehavior:["type",Wf],eventBasedGatewayBehavior:["type",Uf],fixHoverBehavior:["type",kv],groupBehavior:["type",qf],importDockingFix:["type",Dv],isHorizontalFix:["type",Kf],labelBehavior:["type",Zf],layoutConnectionBehavior:["type",Qf],messageFlowBehavior:["type",td],nonInterruptingBehavior:["type",nd],removeElementBehavior:["type",rd],removeEmbeddedLabelBoundsBehavior:["type",id],removeParticipantBehavior:["type",od],replaceConnectionBehavior:["type",ad],replaceElementBehaviour:["type",Ml],resizeBehavior:["type",nb],resizeLaneBehavior:["type",cb],rootElementReferenceBehavior:["type",ud],spaceToolBehavior:["type",ub],subProcessPlaneBehavior:["type",gr],subProcessStartEventBehavior:["type",fd],textAnnotationBehavior:["type",dd],toggleCollapseConnectionBehaviour:["type",hd],toggleElementCollapseBehaviour:["type",gd],unclaimIdBehavior:["type",yd],unsetDefaultFlowBehavior:["type",vd],updateFlowNodeRefsBehavior:["type",bd],updateCategoryValueRefsBehavior:["type",xd],setCompensationActivityAfterPasteBehavior:["type",_d]};function wd(e){this._commandStack=e.get("commandStack",!1)}wd.$inject=["injector"],wd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Ji={__init__:["rules"],rules:["type",wd]};function Si(e){pe.call(this,e),this.init()}Si.$inject=["eventBus"],Ce(Si,pe),Si.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)})},Si.prototype.init=function(){};function _b(e,t){var n=kn(e,t,-15);return n!=="intersect"?n:null}function Dn(e){Si.call(this,e)}Ce(Dn,Si),Dn.$inject=["eventBus"],Dn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return Ak(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 Dl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Dl(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 Lb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return At(i)&&!Ll(t,i)?!1:Mr(t,function(r){return At(r)?Dl(r.source,r.target,r):r.host?Ms(r,r.host,null,n):Cd(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 Ab(a)&&!n.includes(a.host)})?!1:Ms(n,t,null,i)||Ob(n,t,i)||Db(n,t)||Ll(n,t)}),this.addRule("shape.create",function(e){return Cd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ms(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Fb(n,t)})},Dn.prototype.canConnectMessageFlow=Nb,Dn.prototype.canConnectSequenceFlow=$b,Dn.prototype.canConnectDataAssociation=Md,Dn.prototype.canConnectAssociation=Ib,Dn.prototype.canConnectCompensationAssociation=Bb,Dn.prototype.canMove=Db,Dn.prototype.canAttach=Ms,Dn.prototype.canReplace=Ob,Dn.prototype.canDrop=Sa,Dn.prototype.canInsert=Ll,Dn.prototype.canCreate=Cd,Dn.prototype.canConnect=Dl,Dn.prototype.canResize=Lb,Dn.prototype.canCopy=Fb;function Ak(e){return Ed(e)?null:tt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Ed(e){return!e||Je(e)}function wb(e){do{if(M(e,"bpmn:Process"))return de(e);if(M(e,"bpmn:Participant"))return de(e).processRef||de(e)}while(e=e.parent)}function Sd(e){return M(e,"bpmn:TextAnnotation")}function Rd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function Eb(e){return M(e,"bpmn:BoundaryEvent")&&er(e,"bpmn:CompensateEventDefinition")}function Ol(e){return de(e).isForCompensation}function Pk(e,t){var n=wb(e),i=wb(t);return n===i}function Tk(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&Cb(e,"bpmn:MessageEventDefinition"))}function kk(e){return M(e,"bpmn:InteractionNode")&&!Ol(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&Cb(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!er(e,"bpmn:MessageEventDefinition"))}function Sb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return de(t);if(M(t,"bpmn:Participant"))return de(t).processRef}return null}function Rb(e,t){var n=Sb(e),i=Sb(t);return n===i}function er(e,t){var n=de(e);return!!kt(n.eventDefinitions||[],function(i){return M(i,t)})}function Cb(e,t){var n=de(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function Ok(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&er(e,"bpmn:LinkEventDefinition"))&&!Eb(e)&&!Ol(e)}function Dk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&er(e,"bpmn:LinkEventDefinition"))&&!Ol(e)}function Lk(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(er(e,"bpmn:MessageEventDefinition")||er(e,"bpmn:TimerEventDefinition")||er(e,"bpmn:ConditionalEventDefinition")||er(e,"bpmn:SignalEventDefinition"))}function Ik(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Mb(e,t){var n=Ik(t);return n.indexOf(e)!==-1}function Dl(e,t,n){if(Ed(e)||Ed(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Nb(e,t))return{type:"bpmn:MessageFlow"};if($b(e,t))return{type:"bpmn:SequenceFlow"}}var i=Md(e,t);return i||(Bb(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Ib(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Sa(e,t){return Je(e)||Rd(e)?!0:M(t,"bpmn:Participant")&&!st(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):tt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!Bk(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?st(t):tt(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?Ar(de(t).get("participants"),function(n){return!!n.get("processRef")}):tt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?tt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function Bk(e){return de(e).cancelActivity&&(Pb(e)||Tb(e))}function Ab(e){return!Je(e)&&M(e,"bpmn:BoundaryEvent")}function Nk(e){return M(e,"bpmn:Lane")}function $k(e){return Ab(e)||M(e,"bpmn:IntermediateThrowEvent")&&Pb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&Tb(e)}function Pb(e){var t=de(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Tb(e){return kb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function kb(e,t){return t.some(function(n){return er(e,n)})}function Fk(e){return M(e,"bpmn:ReceiveTask")&&kt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function Ms(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Je(r)||!$k(r)||jn(t)||!M(t,"bpmn:Activity")||Ol(t)||i&&!_b(i,t)||Fk(t)?!1:"attach"}function Ob(e,t,n){if(!t)return!1;var i={replacements:[]};return H(e,function(r){jn(t)||M(r,"bpmn:StartEvent")&&r.type!=="label"&&Sa(r,t)&&(YA(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(KA(r)||XA(r)||ZA(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),kb(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||er(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(M(r,"bpmn:EndEvent")&&Sa(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),M(r,"bpmn:BoundaryEvent")&&Ms(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Db(e,t){return Ar(e,Nk)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Sa(n,t)})}function Cd(e,t,n,i){return t?Je(e)||Rd(e)?!0:Sa(e,t)||Ll(e,t):!1}function Lb(e,t,n){return M(e,"bpmn:SubProcess")?st(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:Sd(e)?n?n==="e"||n==="w":!0:Rd(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function jk(e,t){var n=Sd(e),i=Sd(t);return(n||i)&&n!==i}function Ib(e,t){return Mb(t,e)||Mb(e,t)?!1:jk(e,t)?!0:!!Md(e,t)}function Bb(e,t){return Rb(e,t)&&Eb(e)&&M(t,"bpmn:Activity")&&!zk(t,e)&&!jn(t)}function Nb(e,t){return Hb(e)&&!Hb(t)?!1:Tk(e)&&kk(t)&&!Pk(e,t)}function $b(e,t){return Ok(e)&&Dk(t)&&Rb(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!Lk(t))}function Md(e,t){return tt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Ll(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:tt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&Sa(e,t.parent)}function Ad(e,t){return e&&t&&e.indexOf(t)!==-1}function Fb(e,t){return Je(t)?!0:!(M(t,"bpmn:Lane")&&!Ad(e,t.parent)||M(t,"bpmn:MessageFlow")&&!Hk(e,t))}function Hk(e,t){var n=jb(t.source),i=jb(t.target);return Ad(e,n)&&Ad(e,i)}function jb(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function Hb(e){return ya(e,"bpmn:Process")||ya(e,"bpmn:Collaboration")}function zk(e,t){return e.attachers.includes(t)}const Gk={__depends__:[Ji],__init__:["bpmnRules"],bpmnRules:["type",Dn]};var Vk=2e3;function zb(e,t){e.on("saveXML.start",Vk,n);function n(){var i=t.getRootElements();H(i,function(r){var o=ut(r),a,s;a=us([r]),a=it(a,function(c){return c!==r&&!c.labelTarget}),s=Bn(a,ut),o.set("planeElement",s)})}}zb.$inject=["eventBus","canvas"];const Wk={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",zb]};function Il(e){pe.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)})}Il.prototype.getOrdering=function(e,t){return null},Ce(Il,pe);function Pd(e,t){Il.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=kt(n,function(c){return tt(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 l=s;l&&!tt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(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 l=s.children.indexOf(a),u=vm(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Pd.$inject=["eventBus","canvas"],Ce(Pd,Il);const Uk={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Pd]};function As(){}As.prototype.get=function(){return this._data},As.prototype.set=function(e){this._data=e},As.prototype.clear=function(){var e=this._data;return delete this._data,e},As.prototype.isEmpty=function(){return!this._data};const qk={clipboard:["type",As]};var Gb=1500;function Vb(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),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Gb,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Gb,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=So(a),c=document.elementFromPoint(s.x,s.y),Yk(c)}}Vb.$inject=["elementRegistry","eventBus","injector"];function Yk(e){return bo(e,"svg, .djs-element",!0)}const Kk={__init__:["hoverFix"],hoverFix:["type",Vb]};function Xk(e){return!0}function Bl(e){return Wr(e)||tk(e)}var Wb=500;function Ub(e,t,n){var i=this;function r(k,$,N){if(!s(k,$)){var L,z,X;N?z=t.getGraphics(N):(L=$.delegateTarget||$.target,L&&(z=L,N=t.get(z))),!(!z||!N)&&(X=e.fire(k,{element:N,gfx:z,originalEvent:$}),X===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(k){return o[k]}function s(k,$){var N=l[k]||Wr;return!N($)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":Xk,"element.mousedown":Bl,"element.mouseup":Bl,"element.click":Bl,"element.dblclick":Bl};function u(k,$,N){var L=c[k];if(!L)throw new Error("unmapped DOM event name <"+k+">");return r(L,$,N)}var p="svg, .djs-element";function f(k,$,N,L){var z=o[N]=function(X){r(N,X)};L&&(l[N]=L),z.$delegate=Jn.bind(k,p,$,z)}function d(k,$,N){var L=a(N);L&&Jn.unbind(k,$,L.$delegate)}function g(k){H(c,function($,N){f(k,N,$)})}function h(k){H(c,function($,N){d(k,N,$)})}e.on("canvas.destroy",function(k){h(k.svg)}),e.on("canvas.init",function(k){g(k.svg)}),e.on(["shape.added","connection.added"],function(k){var $=k.element,N=k.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:N})}),e.on(["shape.changed","connection.changed"],Wb,function(k){var $=k.element,N=k.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:N})}),e.on("interactionEvents.createHit",Wb,function(k){var $=k.element,N=k.gfx;i.createDefaultHit($,N)}),e.on("interactionEvents.updateHit",function(k){var $=k.element,N=k.gfx;i.updateDefaultHit($,N)});var y=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),x=E("djs-hit djs-hit-all"),m=E("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":_,stroke:y,"no-move":m};function E(k,$){return $=V({stroke:"white",strokeWidth:15},$||{}),n.cls(k,["no-fill","no-border"],$)}function S(k,$){var N=v[$];if(!N)throw new Error("invalid hit type <"+$+">");return we(k,N),k}function P(k,$){ze(k,$)}this.removeHits=function(k){var $=os(".djs-hit",k);H($,rn)},this.createDefaultHit=function(k,$){var N=k.waypoints,L=k.isFrame,z;return N?this.createWaypointsHit($,N):(z=L?"stroke":"all",this.createBoxHit($,z,{width:k.width,height:k.height}))},this.createWaypointsHit=function(k,$){var N=ls($);return S(N,"stroke"),P(k,N),N},this.createBoxHit=function(k,$,N){N=V({x:0,y:0},N);var L=Oe("rect");return S(L,$),we(L,N),P(k,L),L},this.updateDefaultHit=function(k,$){var N=_t(".djs-hit",$);if(N)return k.waypoints?mf(N,k.waypoints):we(N,{width:k.width,height:k.height}),N},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Ub.$inject=["eventBus","elementRegistry","styles"];const Nl={__init__:["interactionEvents"],interactionEvents:["type",Ub]};function Ra(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)})}Ra.$inject=["eventBus","canvas"],Ra.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()})}},Ra.prototype.get=function(){return Array.from(this._selectedElements)},Ra.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ra.prototype.select=function(e,t){var n=this.get();$e(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?H(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var qb="hover",Yb="selected";function Kb(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,qb)}),t.on("element.out",function(r){i(r.element,qb)}),t.on("selection.changed",function(r){function o(l){i(l,Yb)}function a(l){n(l,Yb)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Kb.$inject=["canvas","eventBus"];function Xb(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;$e(l)?t.select(l):t.select(s.filter(Zk))}}),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=kt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Wr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Tl(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Xb.$inject=["eventBus","selection","canvas","elementRegistry"];function Zk(e){return!e.hidden}const Ri={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Nl],selection:["type",Ra],selectionVisuals:["type",Kb],selectionBehavior:["type",Xb]};var Qk=/^djs-cursor-.*$/;function $l(e){var t=St(document.body);t.removeMatching(Qk),e&&t.add("djs-cursor-"+e)}function Zb(){$l(null)}var Jk=5e3;function Qb(e,t){t=t||"element.click";function n(){return!1}return e.once(t,Jk,n),function(){e.off(t,n)}}var e2=["c","C"],t2=["v","V"],n2=["d","D"],i2=["x","X"],r2=["y","Y"],Jb=["z","Z"];function o2(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ni(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function hn(e,t){return e=$e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Td(e){return e.shiftKey}function a2(e){return ni(e)&&hn(e2,e)}function s2(e){return ni(e)&&hn(t2,e)}function c2(e){return ni(e)&&hn(n2,e)}function l2(e){return ni(e)&&hn(i2,e)}function u2(e){return ni(e)&&!Td(e)&&hn(Jb,e)}function p2(e){return ni(e)&&(hn(r2,e)||hn(Jb,e)&&Td(e))}var Ca=Math.round,ex="djs-drag-active";function Co(e){e.preventDefault()}function f2(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function d2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function tx(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(m){var v=t.viewbox(),E=t._container.getBoundingClientRect();return{x:v.x+(m.x-E.left)/v.scale,y:v.y+(m.y-E.top)/v.scale}}function s(m,v){v=v||o;var E=e.createEvent(V({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+m,E)===!1?!1:e.fire(v.prefix+"."+m,E)}function c(m){var v=m.filter(function(E){return i.get(E.id)});v.length&&n.select(v)}function l(m,v){var E=o.payload,S=o.displacement,P=o.globalStart,k=So(m),$=Bi(k,P),N=o.localStart,L=a(k),z=Bi(L,N);if(!o.active&&(v||d2($)>o.threshold)){if(V(E,{x:Ca(N.x+S.x),y:Ca(N.y+S.y),dx:0,dy:0},{originalEvent:m}),s("start")===!1)return y();o.active=!0,o.keepSelection||(E.previousSelection=n.get(),n.select(null)),o.cursor&&$l(o.cursor),t.addMarker(t.getRootElement(),ex)}ld(m),o.active&&(V(E,{x:Ca(L.x+S.x),y:Ca(L.y+S.y),dx:Ca(z.x),dy:Ca(z.y)},{originalEvent:m}),s("move"))}function u(m){var v,E=!0;o.active&&(m&&(o.payload.originalEvent=m,ld(m)),E=s("end")),E===!1&&s("rejected"),v=_(E!==!0),s("ended",v)}function p(m){hn("Escape",m)&&(Co(m),y())}function f(m){var v;o.active&&(v=Qb(e),setTimeout(v,400),Co(m)),u(m)}function d(m){l(m)}function g(m){var v=o.payload;v.hoverGfx=m.gfx,v.hover=m.element,s("hover")}function h(m){s("out");var v=o.payload;v.hoverGfx=null,v.hover=null}function y(m){var v;if(o){var E=o.active;E&&s("cancel"),v=_(m),E&&s("canceled",v)}}function _(m){var v,E;s("cleanup"),Zb(),o.trapClick?E=f:E=u,Le.unbind(document,"mousemove",l),Le.unbind(document,"dragstart",Co),Le.unbind(document,"selectstart",Co),Le.unbind(document,"mousedown",E,!0),Le.unbind(document,"mouseup",E,!0),Le.unbind(document,"keyup",p),Le.unbind(document,"touchstart",d,!0),Le.unbind(document,"touchcancel",y,!0),Le.unbind(document,"touchmove",l,!0),Le.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),ex);var S=o.payload.previousSelection;return m!==!1&&S&&!n.get().length&&c(S),v=o,o=null,v}function x(m,v,E,S){o&&y(!1),typeof v=="string"&&(S=E,E=v,v=null),S=V({},r,S||{});var P=S.data||{},k,$,N,L,z;if(S.trapClick?L=f:L=u,m?(k=Ea(m)||m,$=So(m),ld(m),k.type==="dragstart"&&Co(k)):(k=null,$={x:0,y:0}),N=a($),v||(v=N),z=f2(k),o=V({prefix:E,data:P,payload:{},globalStart:$,displacement:Bi(v,N),localStart:N,isTouch:z},S),S.manual||(z?(Le.bind(document,"touchstart",d,!0),Le.bind(document,"touchcancel",y,!0),Le.bind(document,"touchmove",l,!0),Le.bind(document,"touchend",u,!0)):(Le.bind(document,"mousemove",l),Le.bind(document,"dragstart",Co),Le.bind(document,"selectstart",Co),Le.bind(document,"mousedown",L,!0),Le.bind(document,"mouseup",L,!0)),Le.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;S.autoActivate&&l(m,!0)}e.on("diagram.destroy",y),this.init=x,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(m){V(r,m)}}tx.$inject=["eventBus","canvas","selection","elementRegistry"];const yr={__depends__:[Kk,Ri],dragging:["type",tx]};function Mo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Mo.prototype.next=function(){return this._prefix+ ++this._counter};const h2=new Mo("ps");var m2=["marker-start","marker-mid","marker-end"],g2=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Ur(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Ur.$inject=["elementRegistry","eventBus","canvas","styles"],Ur.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},Ur.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Ur.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=sf(n);return this._cloneMarkers(Fr(r),i),we(r,this._styles.cls(i,[])),ze(t,r),we(r,"data-preview-support-element-id",e.id),r},Ur.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ze(t,n),we(n,"data-preview-support-element-id",e.id),n},Ur.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),x2(e)&&m2.forEach(function(r){if(we(e,r)){var o=y2(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Ur.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,h2.next()].join("-"),a=_t("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||sf(n);s.id=o,at(s).add(r);var c=_t(":scope > defs",e);c||(c=Oe("defs"),ze(e,c)),ze(c,s);var l=b2(s.id);we(t,i,l)};function y2(e,t,n){var i=v2(we(e,t));return _t("marker#"+i,n||document)}function v2(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function b2(e){return"url(#"+e+")"}function x2(e){return g2.indexOf(e.nodeName)!==-1}const Ma={__init__:["previewSupport"],previewSupport:["type",Ur]};var _2="drop-ok",nx="drop-not-ok",ix="attach-ok",rx="new-parent",ox="create",w2=2e3;function ax(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=it(c,function(x){var m=x.labelTarget;return!x.parent&&!(Je(x)&&c.indexOf(m)!==-1)});var d=kt(c,function(x){return!At(x)}),g=!1,h=!1,y=!1;cx(c)&&(g=r.allowed("shape.attach",{position:u,shape:d,target:l})),g||(cx(c)?y=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var _=f.connectionTarget;return y||g?(d&&p&&(h=r.allowed("connection.create",{source:_===p?d:p,target:_===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[ix,_2,nx,rx].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}sx(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&o(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,ix):a(p,h?rx:nx))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,_=l.hints||{};if(g===!1||!d)return!1;sx(c);var x={x:c.x,y:c.y};y?p=i.appendShape(u,p,x,d,{attach:h,connection:y===!0?{}:y,connectionTarget:_.connectionTarget}):(f=i.createElements(f,x,d,V({},_,{attach:h})),p=kt(f,function(m){return!At(m)})),V(l,{elements:f,shape:p}),V(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===ox&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],w2,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){$e(l)||(l=[l]);var p=kt(l,function(g){return!At(g)});if(p){u=V({elements:l,hints:{},shape:p},u||{}),H(l,function(g){Fe(g.x)||(g.x=0),Fe(g.y)||(g.y=0)});var f=it(l,function(g){return!g.hidden}),d=on(f);H(l,function(g){At(g)&&(g.waypoints=Bn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,ox,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}ax.$inject=["canvas","dragging","eventBus","modeling","rules"];function sx(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 cx(e){return e&&e.length===1&&!At(e[0])}var E2=750;function lx(e,t,n,i,r){function o(a){var s=Oe("g");we(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Fr(u),l)):(u=n._createContainer("shape",c),n.drawShape(Fr(u),l),On(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",E2,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),ze(p,u)),On(u,a.x,a.y)):rn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&rn(c)})}lx.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Fl={__depends__:[yr,Ma,Ji,Ri],__init__:["create","createPreview"],create:["type",ax],createPreview:["type",lx]};function kd(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)})}kd.$inject=["eventBus"],kd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||S2(0,0)};function S2(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 Ps={__init__:["mouse"],mouse:["type",kd]};var ux=2e3;function ii(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 l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),R2(u)&&(l.priority=2,l.host=u.host.id),At(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=C2(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),H(["x","y","width","height"],function(f){Fe(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",ux,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",ux,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;V(l,{createElementsBehavior:!1})})}ii.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ii.prototype.copy=function(e,t={}){var n,i;return $e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree($e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ii.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})}}},ii.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ii.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},ii.prototype._getElementIdsFromTree=function(e){var t={};return H(e,function(n){H(n,function(i){i.id&&(t[i.id]=!0)})}),t},ii.prototype._paste=function(e,t,n,i){H(e,function(o){Fe(o.x)||(o.x=0),Fe(o.y)||(o.y=0)});var r=on(e);return H(e,function(o){At(o)&&(o.waypoints=Bn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),V(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,V({},i))},ii.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return H(e,function(o,a){o=Hi(o,"priority"),H(o,function(s){var c=V({},zi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(At(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Je(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},ii.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(zi(e,["id"]));return t},ii.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(zi(e,["id"]));return t},ii.prototype.createShape=function(e){var t=this._elementFactory.createShape(zi(e,["id"]));return t},ii.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(At(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},ii.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Zc(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var g={element:p,depth:f};r.push(g),o.set(p,g);return}if(d.depth<f){r=l(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}_o(a,function(p,f,d){if(Je(p))return;H(p.labels,function(y){c(y,d)});function g(y){y&&y.length&&H(y,function(_){H(_.labels,function(x){c(x,d)}),c(_,d)})}H([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Bn(r,function(p){return p.element});var u=new Set(e);return r=Bn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),r=Hi(r,function(p){return p.descriptor.priority}),e=Bn(r,function(p){return p.element}),H(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){fx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){fx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function R2(e){return!!e.host}function C2(e){return Bn(e.waypoints,function(t){return t=px(t),t.original&&(t.original=px(t.original)),t})}function px(e){return V({},e)}function fx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const M2={__depends__:[qk,Fl,Ps,Ji],__init__:["copyPaste"],copyPaste:["type",ii]};function Od(e,t,n){$e(n)||(n=[n]),H(n,function(i){fo(e[i])||(t[i]=e[i])})}var Dd=750;function dx(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Dd,function(c){var l=c.descriptor,u=c.element,p=de(u);if(Je(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(ut(u),!0);d.bpmnElement=f,Od(f,l,"name"),Od(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var p=de(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(de(c).attachedToRef=de(l[c.host])),zi(u,Qn(u,function(f,d,g){var h=d.element,y=d.property;return g===c.id&&(h.set(y,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(Je(u)){u.businessObject=de(l[u.labelTarget]),u.di=ut(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,Od(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Dd,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=de(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&H(gs(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Dd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}dx.$inject=["bpmnFactory","eventBus","moddleCopy"];const A2=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],P2=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ts(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 Hi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=fn(r)&&r.$descriptor;if(a&&P2.includes(a))return o;if(a&&A2.includes(a)||a&&s&&!kt(s.properties,Ko({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(M(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Ts.$inject=["eventBus","bpmnFactory","moddle"],Ts.prototype.copyElement=function(e,t,n,i=!1){n&&!$e(n)&&(n=[n]),n=n||Ld(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||($e(r)&&(n=r),H(n,o=>{let a;Zn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!pn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ts.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 fn(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):$e(e)?Qn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):fn(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},Ts.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 Ld(e,t){return Qn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const hx={__depends__:[M2],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",dx],moddleCopy:["type",Ts]};var mx=Math.round;function Id(e,t){this._modeling=e,this._eventBus=t}Id.$inject=["modeling","eventBus"],Id.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,l=mx(s+o/2),u=mx(c+a/2),p=i.replaceShape(e,V({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function gx(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}gx.$inject=["selection","eventBus"];const T2={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",gx],replace:["type",Id]};function k2(e,t,n){$e(n)||(n=[n]),H(n,function(i){fo(e[i])||(t[i]=e[i])})}var O2=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function D2(e,t){var n=e&&Zn(e,"collapsed")?e.collapsed:!st(e),i;return t&&(Zn(t,"collapsed")||Zn(t,"isExpanded"))?i=Zn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function yx(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(jl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&D2(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),k2(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Ld(p.$descriptor),h=Ld(f.$descriptor,!0),y=L2(g,h);V(f,Li(c,O2));var _=it(y,function(v){return v==="eventDefinitions"?vx(s,c.eventDefinitionType):v==="loopCharacteristics"?!jn(f):Zn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!jn(f):!0});if(f=n.copyElement(p,f,_),c.eventDefinitionType&&(vx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(jl(p))d.isExpanded=st(s);else if(c&&Zn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}st(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(jl(p)&&!jl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var m=xn(s);ut(s).isHorizontal||(ut(d).isHorizontal=m),d.width=m?s.width:t.getDefaultSize(d).width,d.height=m?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,tt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&tt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}yx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function jl(e){return M(e,"bpmn:SubProcess")}function vx(e,t){var n=de(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function L2(e,t){return e.filter(function(n){return t.includes(n)})}const bx={__depends__:[hx,T2,Ri],bpmnReplace:["type",yx]};var I2=250;function Ao(e){this._eventBus=e,this._tools=[],this._active=null}Ao.$inject=["eventBus"],Ao.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)},Ao.prototype.isActive=function(e){return e&&this._active===e},Ao.prototype.length=function(e){return this._tools.length},Ao.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Ao.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),H(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,I2,function(r){this._active&&(B2(r)||this.setActive(null))},this)};function B2(e){var t=e.originalEvent&&e.originalEvent.target;return t&&bo(t,'.group[data-group="tools"]')}const Hl={__depends__:[yr],__init__:["toolManager"],toolManager:["type",Ao]};function N2(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 $2(e,t){var n=[],i=new Set(e);H(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;H(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function F2(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 Bd=Math.abs,j2=Math.round,vr={x:"width",y:"height"},xx="crosshair",qr={n:"top",w:"left",s:"bottom",e:"right"},H2=1500,zl={n:"s",w:"e",s:"n",e:"w"},Gl=20;function Ci(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",H2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&wx(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){wx(c);var h={x:0,y:0};h[u]=j2(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Ci.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ci.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:xx,data:{context:{reactivate:n}},trapClick:!1})},Ci.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:xx,data:{context:{}}})},Ci.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Ci.prototype.init=function(e,t){var n=Bd(e.dx)>Bd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Bd(i)<5)return!1;i<0&&(i*=-1),Cs(e)&&(i*=-1);var o=N2(n,i),a=this._canvas.getRootElement();!Tl(e)&&e.hover&&(a=e.hover);var s=[...us(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=z2(c,n,o,r,l);return V(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),$l("resize-"+(n==="x"?"ew":"ns")),!0},Ci.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return H(e,function(d){if(!(!d.parent||Je(d))){if(At(d)){u.push(d);return}var g=d[t],h=g+d[vr[t]];if(G2(d)&&(n>0&&je(d)[t]>i||n<0&&je(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),H(o,function(d){var g=d.attachers;g&&H(g,function(h){p(h)})}),H(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),H(u,function(d){var g=d.source,h=d.target,y=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:o,resizingShapes:a}},Ci.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ci.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function _x(e){return{top:e.top-Gl,right:e.right+Gl,bottom:e.bottom+Gl,left:e.left-Gl}}function wx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Fe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function z2(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),p=new Set(a);return H(a,function(f){var d=f.attachers,g=f.children,h=Be(f),y=it(g,function(z){return!At(z)&&!Je(z)&&!u.has(z)&&!p.has(z)}),_=it(g,function(z){return!At(z)&&!Je(z)&&u.has(z)}),x,m,v,E=[],S=[],P,k,$,N;y.length&&(m=_x(Be(on(y))),x=i-h[qr[n]]+m[qr[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,x):x:n==="w"?s.right=l=Fe(l)?Math.min(l,x):x:n==="s"?s.top=c=Fe(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Fe(c)?Math.max(c,x):x)),_.length&&(v=_x(Be(on(_))),x=i-v[qr[zl[n]]]+h[qr[zl[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,x):x:n==="w"?s.right=l=Fe(l)?Math.min(l,x):x:n==="s"?s.top=c=Fe(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Fe(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(z){u.has(z)?E.push(z):S.push(z)}),E.length&&(P=Be(on(E.map(je))),k=h[qr[zl[n]]]-(P[qr[zl[n]]]-i)),S.length&&($=Be(on(S.map(je))),N=$[qr[n]]-(h[qr[n]]-i)),n==="n"?(x=Math.min(k||1/0,N||1/0),s.bottom=l=Fe(l)?Math.min(l,x):x):n==="w"?(x=Math.min(k||1/0,N||1/0),s.right=l=Fe(l)?Math.min(l,x):x):n==="s"?(x=Math.max(k||-1/0,N||-1/0),s.top=c=Fe(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(k||-1/0,N||-1/0),s.left=c=Fe(c)?Math.max(c,x):x));var L=r&&r[f.id];L&&(n==="n"?(x=i+f[vr[t]]-L[vr[t]],s.bottom=l=Fe(l)?Math.min(l,x):x):n==="w"?(x=i+f[vr[t]]-L[vr[t]],s.right=l=Fe(l)?Math.min(l,x):x):n==="s"?(x=i-f[vr[t]]+L[vr[t]],s.top=c=Fe(c)?Math.max(c,x):x):n==="e"&&(x=i-f[vr[t]]+L[vr[t]],s.left=c=Fe(c)?Math.max(c,x):x))}),s}}function G2(e){return!!e.host}var Nd="djs-dragging",Ex="djs-resizing",V2=250,Vl=Math.max;function Sx(e,t,n,i,r){function o(a,s){H(a,function(c){r.addDragger(c,s),n.addMarker(c,Nd)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");we(u,i.cls("djs-crosshair-group",["no-events"])),ze(s,u);var p=Oe("path");we(p,"d",l.x),at(p).add("djs-crosshair"),ze(u,p);var f=Oe("path");we(f,"d",l.y),at(f).add("djs-crosshair"),ze(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;On(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&rn(c)}),e.on("spaceTool.move",V2,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),we(c,"d","M0,0 L0,0"),at(c).add("djs-crosshair"),ze(f,c),s.line=c;var d=Oe("g");we(d,i.cls("djs-drag-group",["no-events"])),ze(n.getActiveLayer(),d),o(u,d);var g=new Set(u);H(p,function(S){g.add(S)});var h=new Set,y=s.movingConnections=[];g.forEach(function(S){H(S.outgoing,function(P){h.has(P)||!At(P)||!g.has(P.target)||(h.add(P),y.push(P))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var _=Oe("g");we(_,i.cls("djs-frame-group",["no-events"])),ze(n.getActiveLayer(),_);var x=[];H(p,function(S){var P=r.addFrame(S,_),k=P.getBBox();x.push({element:P,initialBounds:k}),n.addMarker(S,Ex)}),s.frameGroup=_,s.frames=x}var m={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};we(c,{d:m[l]});var v={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[v[s.axis]]=0,On(s.dragGroup,E.x,E.y),H(s.frames,function(S){var P=S.element,k=S.initialBounds,$,N;s.direction==="e"?we(P,{width:Vl(k.width+E.x,5)}):($=Vl(k.width-E.x,5),we(P,{width:$,x:k.x+k.width-$})),s.direction==="s"?we(P,{height:Vl(k.height+E.y,5)}):(N=Vl(k.height-E.y,5),we(P,{height:N,y:k.y+k.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;H(c,function(g){n.removeMarker(g,Nd)}),H(l,function(g){n.removeMarker(g,Nd)}),f&&(rn(p),rn(f)),H(u,function(g){n.removeMarker(g,Ex)}),d&&rn(d)})}Sx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const W2={__init__:["spaceToolPreview"],__depends__:[yr,Ji,Hl,Ma,Ps],spaceTool:["type",Ci],spaceToolPreview:["type",Sx]};function Wl(e,t){e.invoke(Ci,this),this._canvas=t}Wl.$inject=["injector","canvas"],Ce(Wl,Ci),Wl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=qo(ua(r.children.filter(l=>M(l,"bpmn:Artifact")),on(o))));const s=[...e,...a];var c=Ci.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||U2(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function U2(e){return M(e,"bpmn:Participant")&&!de(e).processRef}const Rx={__depends__:[W2],spaceTool:["type",Wl]};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:bm("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=$e(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 q2={commandStack:["type",Vt]};function Yr(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 Y2=250,Cx=1400;function $d(e,t,n){pe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Cx,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Mx(a),o.validatedShapes=Mx(s)}),i&&t.on("shape.move.start",Y2,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",Cx,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];H(s,function(l){H(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;Yr(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=yf(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&&(tn(s.labels,a,c),a.labelTarget=s)})}Ce($d,pe),$d.$inject=["injector","eventBus","modeling"];function Mx(e){var t=new Set(e);return it(e,function(n){return!t.has(n.labelTarget)})}const K2={__init__:["labelSupport"],labelSupport:["type",$d]};var X2=251,Ax=1401,Px="attach-ok";function Fd(e,t,n,i,r){pe.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Ax,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=Z2(c),s.validatedShapes=Q2(l)}),o&&t.on("shape.move.start",X2,function(a){var s=a.context,c=s.shapes,l=jd(c);H(l,function(u){o.makeDraggable(s,u,!0),H(u.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Px),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Px)}))}}),this.preExecuted("elements.move",Ax,function(a){var s=a.context,c=s.closure,l=s.shapes,u=jd(l);H(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=it(c,function(p){var f=p.host;return J2(p)&&!eO(c,f)}),H(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;H(s,function(c){H(c.attachers,function(l){H(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),H(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Yr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&H(l.attachers,function(u){var p=qv(u,c,l);r.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&H(p,function(d){var g=qv(d,l,u);r.moveShape(d,g,d.parent),H(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Yr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ce(Fd,pe),Fd.$inject=["injector","eventBus","canvas","rules","modeling"];function jd(e){return fp(Bn(e,function(t){return t.attachers||[]}))}function Z2(e){var t=jd(e);return T1("id",e,t)}function Q2(e){var t=Yo(e,"id");return it(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function J2(e){return!!e.host}function eO(e,t){return e.indexOf(t)!==-1}const tO={__depends__:[Ji],__init__:["attachSupport"],attachSupport:["type",Fd]};function Tx(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(wy(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)})}Tx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Hd={__init__:["changeSupport"],changeSupport:["type",Tx]};function Mi(e){this._model=e}Mi.$inject=["moddle"],Mi.prototype._needsId=function(e){return tt(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"])},Mi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":tt(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))},Mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},Mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Mi.prototype.createDiWaypoints=function(e){var t=this;return Bn(e,function(n){return t.createDiWaypoint(n)})},Mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Li(e,["x","y"]))},Mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function ri(e,t,n){pe.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},y;!g.cropped&&h.createElementsBehavior!==!1&&(y=g.connection,y.waypoints=n.getCroppedWaypoints(y),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,y=g.parent||g.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],oi(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],oi(a));function s(d){var g=d.context,h=g.oldRoot,y=h.children;H(y,function(_){M(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],oi(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],oi(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 l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],oi(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],oi(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],oi(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],oi(u)),this.executed("connection.reconnect",oi(function(d){var g=d.context,h=g.connection,y=g.oldSource,_=g.newSource,x=de(h),m=de(y),v=de(_);x.conditionExpression&&!tt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),y!==_&&m.default===x&&(g.oldDefault=m.default,delete m.default)})),this.reverted("connection.reconnect",oi(function(d){var g=d.context,h=g.connection,y=g.oldSource,_=g.newSource,x=de(h),m=de(y),v=de(_);g.oldConditionExpression&&(x.conditionExpression=g.oldConditionExpression),g.oldDefault&&(m.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],oi(p)),this.reverted(["element.updateAttachment"],oi(p)),this.executed("element.updateLabel",oi(f)),this.reverted("element.updateLabel",oi(f));function f(d){const{element:g}=d.context,h=yi(g),y=ut(g),_=y&&y.get("label");Hr(g)||kl(g)||(h&&!_?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&y.set("label",void 0))}}Ce(ri,pe),ri.$inject=["eventBus","bpmnFactory","connectionDocking"],ri.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ri.prototype.updateParent=function(e,t){if(!Je(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ut(e),o=n&&n.businessObject,a=ut(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),M(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},ri.prototype.updateBounds=function(e){var t=ut(e),n=iO(e);if(n){var i=Bi(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=Je(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},ri.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Zt(i,e)),M(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),tn(r,e))}},ri.prototype.updateDiConnection=function(e,t,n){var i=ut(e),r=ut(t),o=ut(n);i.sourceElement&&i.sourceElement.bpmnElement!==de(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==de(n)&&(i.targetElement=n&&o)},ri.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Zt(n,e),e.$parent=null)}};function nO(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ri.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(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)},ri.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=nO(e.$parent||t),e.$parent&&(Zt(o.get("rootElements"),r),r.$parent=null),t&&(tn(o.get("rootElements"),r),r.$parent=o))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(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),Zt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Zt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ri.prototype.updateConnectionWaypoints=function(e){var t=ut(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ri.prototype.updateConnection=function(e){var t=e.connection,n=de(t),i=t.source,r=de(i),o=t.target,a=de(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Zt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Zt(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)},ri.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function oi(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function iO(e){if(M(e,"bpmn:Activity")){var t=ut(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Kr(e,t){dr.call(this),this._bpmnFactory=e,this._moddle=t}Ce(Kr,dr),Kr.$inject=["bpmnFactory","moddle"],Kr.prototype._baseCreate=dr.prototype.create,Kr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},wo,t))}return this.createElement(e,t)},Kr.prototype.createElement=function(e,t){t=V({},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(!oO(r)){var o=V({},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)}M(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=rO(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=zd(r,t,"isExpanded")),tt(i,["bpmn:Lane","bpmn:Participant"])&&(t=zd(r,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!st(i,r)),M(i,"bpmn:ExclusiveGateway")&&(Zn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),pn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),pn(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=V({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Kr.prototype.getDefaultSize=function(e,t){var n=de(e);if(t=t||ut(e),M(n,"bpmn:SubProcess"))return st(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return st(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Kr.prototype.createParticipantShape=function(e){return fn(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function rO(e,t,n){return H(n,function(i){t=zd(e,t,i)}),t}function zd(e,t,n){return t[n]===void 0?t:(e[n]=t[n],zi(t,[n]))}function oO(e){return tt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Ul(e,t){this._modeling=e,this._canvas=t}Ul.$inject=["modeling","canvas"],Ul.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;H(n,function(r){var o={x:0,y:0};pn(i.left)?o.x=i.left-r.x:pn(i.right)?o.x=i.right-r.width-r.x:pn(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:pn(i.top)?o.y=i.top-r.y:pn(i.bottom)?o.y=i.bottom-r.height-r.y:pn(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Ul.prototype.postExecute=function(e){};function ql(e){this._modeling=e}ql.$inject=["modeling"],ql.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},ql.prototype.postExecute=function(e){var t=e.hints||{};aO(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 aO(e,t){return Ar(e.outgoing,function(n){return n.target===t})}function Yl(e,t){this._canvas=e,this._layouter=t}Yl.$inject=["canvas","layouter"],Yl.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},Yl.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Kl=Math.round;function Gd(e){this._modeling=e}Gd.$inject=["modeling"],Gd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;H(t,function(p){Fe(p.x)||(p.x=0),Fe(p.y)||(p.y=0)});var s=it(t,function(p){return!p.hidden}),c=on(s);H(t,function(p){At(p)&&(p.waypoints=Bn(p.waypoints,function(f){return{x:Kl(f.x-c.x-c.width/2+r.x),y:Kl(f.y-c.y-c.height/2+r.y)}})),V(p,{x:Kl(p.x-c.x-c.width/2+r.x),y:Kl(p.y-c.y-c.height/2+r.y)})});var l=new Set(Zc(t)),u={};H(t,function(p){if(At(p)){u[p.id]=Fe(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,o):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,o);return}var f=V({},o);l.has(p)||(f.autoResize=!1),Je(p)&&(f=zi(f,["attach"])),u[p.id]=Fe(i)?a.createShape(p,Li(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Li(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=qo(u)};var kx=Math.round;function Xr(e){this._canvas=e}Xr.$inject=["canvas"],Xr.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?V(t,n):V(t,{x:n.x-kx(t.width/2),y:n.y-kx(t.height/2)}),this._canvas.addShape(t,i,r),t},Xr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ks(e){Xr.call(this,e)}Ce(ks,Xr),ks.$inject=["canvas"];var sO=Xr.prototype.execute;ks.prototype.execute=function(e){var t=e.shape;return lO(t),t.labelTarget=e.labelTarget,sO.call(this,e)};var cO=Xr.prototype.revert;ks.prototype.revert=function(e){return e.shape.labelTarget=null,cO.call(this,e)};function lO(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Os(e,t){this._canvas=e,this._modeling=t}Os.$inject=["canvas","modeling"],Os.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Yr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Yr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Os.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=yf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Os.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t};function Vd(e,t){this._modeling=e,this._elementRegistry=t}Vd.$inject=["modeling","elementRegistry"],Vd.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;H(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Ds(e,t){this._canvas=e,this._modeling=t}Ds.$inject=["canvas","modeling"],Ds.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Yr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Yr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Yr(n.children,function(i){At(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Ds.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=yf(i.children,n),t.removeShape(n),n},Ds.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return tn(i.children,n,r),t.addShape(n,i),n};function Xl(e){this._modeling=e}Xl.$inject=["modeling"];var Ox={x:"y",y:"x"};Xl.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,_){y.range.min=Math.min(_[i],y.range.min),y.range.max=Math.max(_[i]+_[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,_){var x={y:0};x[i]=y-a(_),x[i]&&(x[Ox[i]]=0,t.moveElements([_],x,_.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;H(n,function(y,_){var x,m,v;if(y.elements.length<2){_&&_!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}x=Hi(y.elements,i),m=x[0],_===p&&(m=x[s(x)]),v=a(m),y.range=null,H(x,function(E){if(l(v,E),y.range===null){y.range={min:E[i],max:E[i]+E[r]};return}o(y,E)}),_&&_!==n.length-1&&(h+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&H(n,function(y,_){var x={},m;y===u||y===f||(m=n[_-1],y.range.max=0,H(y.elements,function(v,E){x[Ox[i]]=0,x[i]=m.range.max-v[i]+d,y.range.min!==v[i]&&(x[i]+=v[i]-y.range.min),x[i]&&t.moveElements([v],x,v.parent),y.range.max=Math.max(v[i]+v[r],E?y.range.max:0)}))})},Xl.prototype.postExecute=function(e){};function Zl(e,t){this._layouter=e,this._canvas=t}Zl.$inject=["layouter","canvas"],Zl.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Zl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Wd(){}Wd.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=Zt(o.children,t),tn(i.children,t,r),t.parent=i,H(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},Wd.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Zt(n.children,t),tn(i.children,t,r),t.parent=i,H(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 Ud(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ud.prototype.add=function(e,t){return this.addAll([e],t)},Ud.prototype.addAll=function(e,t){var n=FM(e,!!t,this);return V(this,n),this};function Ls(e){this._modeling=e}Ls.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ls.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),H(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),H(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,l[p.id]&&!u&&n):o.layoutConnection(p,{connectionStart:f&&Jf(p,p.source,t),connectionEnd:d&&ed(p,p.target,t)})})},Ls.prototype.getClosure=function(e){return new Ud().addAll(e,!0)};function Ql(e){this._helper=new Ls(e)}Ql.$inject=["modeling"],Ql.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ql.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 Po(e){this._modeling=e,this._helper=new Ls(e)}Po.$inject=["modeling"],Po.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=Li(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Zt(o.children,t),tn(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Po.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(H(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:ed(o,t,n)})}),H(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Jf(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Po.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return tn(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Po.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Po.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Is(e){this._modeling=e}Is.$inject=["modeling"],Is.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 $e(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},Is.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||Dx($e(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Dx($e(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Is.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 Dx(e){return e.original||e}function br(e,t){this._modeling=e,this._rules=t}br.$inject=["modeling","rules"],br.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,y){return i.allowed("connection.reconnect",{connection:y,source:g,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();H(f,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,Rl(g,s,u),a)}),H(d,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,Sl(g,s,u),a)})},br.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},br.prototype.execute=function(e){},br.prototype.revert=function(e){},br.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},br.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},br.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Bs(e){this._modeling=e}Bs.$inject=["modeling"],Bs.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},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Bs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(H(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Rl(o,n,i)})}),H(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Sl(o,n,i)})}))},Bs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Zr(e){this._modeling=e}Zr.$inject=["modeling"],Zr.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),H(r,function(s){a[s.id]=pO(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints($2(i,r),t,n,o,i,r,a)},Zr.prototype.execute=function(){},Zr.prototype.revert=function(){},Zr.prototype.moveShapes=function(e,t){var n=this;H(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Zr.prototype.resizeShapes=function(e,t,n){var i=this;H(e,function(r){var o=F2(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Zr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);H(e,function(u){var p=u.source,f=u.target,d=uO(u),g=Ix(n),h={},y=c.has(p)||l.has(p),_=c.has(f)||l.has(f);y&&_?(d=Bn(d,function(x){return Bx(x,i,n)&&(x[g]=x[g]+t[g]),x.original&&Bx(x.original,i,n)&&(x.original[g]=x.original[g]+t[g]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||_)&&(c.has(p)?h.connectionStart=Jf(u,p,t):c.has(f)?h.connectionEnd=ed(u,f,t):l.has(p)?h.connectionStart=Sl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Rl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function Lx(e){return V({},e)}function uO(e){return Bn(e.waypoints,function(t){return t=Lx(t),t.original&&(t.original=Lx(t.original)),t})}function Ix(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Bx(e,t,n){var i=Ix(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function pO(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Jl(e){this._modeling=e}Jl.$inject=["modeling"],Jl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Nx(n),t.collapsed=!t.collapsed;var i=$x(n,t.collapsed);return[t].concat(i)},Jl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Fx(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Nx(e){var t={};return H(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,Nx(n.children)))}),t}function $x(e,t){var n=[];return H(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat($x(i.children,i.collapsed||t)))}),n}function Fx(e,t){var n=[];return H(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Fx(i.children,t)))}),n}function eu(e){this._modeling=e}eu.$inject=["modeling"],eu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=jx(i,t),Hx(n,t),t.host=n,t},eu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,jx(n,t),Hx(i,t,r),t};function jx(e,t){return Zt(e&&e.attachers,t)}function Hx(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),tn(i,t,n)}}function qd(){}qd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},qd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Pt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Pt.$inject=["eventBus","elementFactory","commandStack"],Pt.prototype.getHandlers=function(){return{"shape.append":ql,"shape.create":Xr,"shape.delete":Ds,"shape.move":Po,"shape.resize":Bs,"shape.replace":br,"shape.toggleCollapse":Jl,spaceTool:Zr,"label.create":ks,"connection.create":Yl,"connection.delete":Os,"connection.move":Wd,"connection.layout":Zl,"connection.updateWaypoints":qd,"connection.reconnect":Is,"elements.create":Gd,"elements.move":Ql,"elements.delete":Vd,"elements.distribute":Xl,"elements.align":Ul,"element.updateAttachment":eu}},Pt.prototype.registerHandlers=function(e){H(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Pt.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)},Pt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Pt.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)},Pt.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)},Pt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Pt.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},Pt.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},Pt.prototype.createElements=function(e,t,n,i,r){$e(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},Pt.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},Pt.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},Pt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Pt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Pt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Pt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Pt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Pt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Pt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Pt.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)},Pt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Pt.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)},Pt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},Pt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},Pt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Pt.prototype._create=function(e,t){return SA(t)?t:this._elementFactory.create(e,t)},Pt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ns(e){this._elementRegistry=e}Ns.$inject=["elementRegistry"],Ns.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||fO(n,vc(i));return zx(n,i),e.oldProperties=o,e.changed=r,r},Ns.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return zx(n,t),i},Ns.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?dO(e,t):[]};function fO(e,t){return Qn(t,function(n,i){return n[i]=e.get(i),n},{})}function zx(e,t){H(t,function(n,i){e.set(i,n)})}function dO(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&de(n).dataObjectRef===e})}var $s="default",xr="id",Gx="di",hO={width:0,height:0};function Fs(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Fs.$inject=["elementRegistry","moddle","modeling","textRenderer"],Fs.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=bO(e.properties),s=e.oldProperties||mO(t,a);return Vx(a,o)&&(r.unclaim(o[xr]),i.updateId(t,a[xr]),r.claim(a[xr],o)),$s in a&&(a[$s]&&n.push(i.get(a[$s].id)),o[$s]&&n.push(i.get(o[$s].id))),Wx(t,a),e.oldProperties=s,e.changed=n,n},Fs.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&de(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,hO)}},Fs.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 Wx(t,i),Vx(n,r)&&(a.unclaim(n[xr]),o.updateId(t,i[xr]),a.claim(i[xr],r)),e.changed};function Vx(e,t){return xr in e&&e[xr]!==t[xr]}function mO(e,t){var n=vc(t),i=e.businessObject,r=ut(e);return Qn(n,function(o,a){return a!==Gx?o[a]=i.get(a):o[a]=gO(r,vc(t.di)),o},{})}function gO(e,t){return Qn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Wx(e,t){var n=e.businessObject,i=ut(e);H(t,function(r,o){o!==Gx?n.set(o,r):i&&yO(i,r)})}function yO(e,t){H(t,function(n,i){e.set(i,n)})}var vO=["default"];function bO(e){var t=V({},e);return vO.forEach(function(n){n in e&&(t[n]=de(t[n]))}),t}function tu(e,t){this._canvas=e,this._modeling=t}tu.$inject=["canvas","modeling"],tu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ut(r);return t.setRootElement(n),t.removeRootElement(r),tn(a.rootElements,i),i.$parent=a,Zt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},tu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ut(n);return t.setRootElement(r),t.removeRootElement(n),Zt(a.rootElements,i),i.$parent=null,tn(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Yd(e,t){this._modeling=e,this._spaceTool=t}Yd.$inject=["modeling","spaceTool"],Yd.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Ei(i),a=o===i,s=a?i:i.parent,c=Gr(s),l=xn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];_o(o,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:it(v.children,function(E){return E!==i})});var f,d,g,h,y;r==="top"?(f=-120,d=i.y,g=d+10,h="n",y="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",y="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",y="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",y="x");var _=t.calculateAdjustments(p,y,f,g),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,x,h,g);var m=l?{x:i.x+(a?wi:0),y:d-(r==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},m,s)};function Kd(e){this._modeling=e}Kd.$inject=["modeling"],Kd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Gr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function js(e,t){this._modeling=e,this._spaceTool=t}js.$inject=["modeling","spaceTool"],js.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},js.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=dT(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},js.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Be(e),r=Be(t),o=Ev(r,i),a=Ei(e),s=[],c=[];_o(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Hs="flowNodeRef",Xd="lanes";function nu(){}nu.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Be(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var p=Ei(u);return r[p.id]||(r[p.id]=bl(p)),r[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ei(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(Xd),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Hs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},nu.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(Xd);n.remove.forEach(function(o){Zt(r,o),Zt(o.get(Hs),i)}),n.add.forEach(function(o){tn(r,o),tn(o.get(Hs),i)})}),[]},nu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Xd);n.add.forEach(function(o){Zt(r,o),Zt(o.get(Hs),i)}),n.remove.forEach(function(o){tn(r,o),tn(o.get(Hs),i)})}),[]};var Zd="categoryValueRef";function zs(e,t){this._bpmnFactory=e,this._elementRegistry=t}zs.$inject=["bpmnFactory","elementRegistry"],zs.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(x,m,v){if(m){var E=a.get(x);E||(E={},a.set(x,E)),!(v&&E.present)&&(!v&&E.past||(v?E.present={categoryValue:m,root:Qd(x)}:E.past={categoryValue:m}))}}function c(x){r.set(x,de(x))}function l(){n.filter(function(x){return M(x,"bpmn:FlowElement")&&!Je(x)&&x.parent}).forEach(c)}function u(x){var m=de(x),v=m.get("categoryValueRef");return v||(v=vv(i,m),o.push(xO(x,v))),v}function p(x){return x.reduce(function(m,v){var E=Qd(v),S=m.get(E);return S||(S=[],m.set(E,S)),S.push(v),m},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return M(x,"bpmn:Group")&&!Je(x)&&x.parent}).forEach(function(x){var m=de(x).get("categoryValueRef");if(!m){var v=Qd(x),E=f.get(v)||[],S=ua(E,x),P=Object.keys(S).length>0;P&&(m=u(x))}s(x,m,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(x,m){return m.present&&x.add(m.present.categoryValue),m.past&&x.add(m.past.categoryValue),x},new Set),h=new Map,y=p(d);a.forEach(function(x,m){var v=x.present;if(v){var E=y.get(v.root)||[],S=ua(E,m);E.forEach(function(P){if(S[P.id]){var k=h.get(P);k||(k=new Set,h.set(P,k)),k.add(v.categoryValue)}})}});var _=d.reduce(function(x,m){var v=r.get(m),E=v.get(Zd),S=new Set(E),P=h.get(m)||new Set,k=Array.from(P).filter(function(N){return!S.has(N)}),$=E.filter(function(N){return g.has(N)&&!P.has(N)});return(k.length||$.length)&&x.push({businessObject:v,categoryValuesToAdd:k,categoryValuesToRemove:$}),x},[]);return{flowElements:_,groups:o}},zs.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),_O(t.groups),EO(t.flowElements),[]},zs.prototype.revert=function(e){var t=e.updates;return SO(t.flowElements),wO(t.groups),[]};function xO(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function _O(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function wO(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=null})}function EO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Zd);t.categoryValuesToRemove.forEach(function(r){Zt(i,r)}),t.categoryValuesToAdd.forEach(function(r){tn(i,r,!0)})})}function SO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Zd);t.categoryValuesToAdd.forEach(function(r){Zt(i,r)}),t.categoryValuesToRemove.forEach(function(r){tn(i,r,!0)})})}function Qd(e){for(;e.parent;)e=e.parent;return e}function iu(e){this._moddle=e}iu.$inject=["moddle"],iu.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),[]},iu.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 RO={fill:void 0,stroke:void 0};function Jd(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Xn(t)){var n=CO(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Jd.$inject=["commandStack"],Jd.prototype.postExecute=function(e){var t=e.elements,n=e.colors||RO,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),H(t,function(o){var a=At(o)?Li(r,["border-color"]):r,s=ut(o);if(MO(a),Je(o)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!tt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function CO(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 MO(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var AO={width:0,height:0};function Ux(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return nP(u,l),[u,p]}function r(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!Je(l)&&Hr(l)&&!al(l)&&!qx(p)){var f=7,d=Ef(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=yi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Je(u)&&!M(u,"bpmn:TextAnnotation"))){if(Je(u)&&qx(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=yi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,AO)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Ux.$inject=["modeling","textRenderer","bpmnFactory"];function qx(e){return!e||!e.trim()}function Ln(e,t,n,i){Pt.call(this,e,t,n),this._bpmnRules=i}Ce(Ln,Pt),Ln.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Ln.prototype.getHandlers=function(){var e=Pt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ns,e["element.updateProperties"]=Fs,e["canvas.updateRoot"]=tu,e["lane.add"]=Yd,e["lane.resize"]=js,e["lane.split"]=Kd,e["lane.updateRefs"]=nu,e["group.updateRefs"]=zs,e["id.updateClaim"]=iu,e["element.setColor"]=Jd,e["element.updateLabel"]=Ux,e},Ln.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Ln.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)},Ln.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Ln.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ln.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ln.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ln.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ln.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ln.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Ln.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ln.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ln.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Yx(){}Yx.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||je(t.source||e.source),t.connectionEnd||je(t.target||e.target)]};var ru=20,PO=5,ou=Math.round,Kx=20,TO={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function kO(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function OO(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Xx(e,t,n){var i=kn(t,e,PO),r=n.split(":")[0],o=ou((t.x-e.x)/2+e.x),a=ou((t.y-e.y)/2+e.y),s,c,l=OO(r,i),u=/h|r|l/.test(r),p=!1,f=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=kO(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+ru*(/l/.test(r)?-1:1),y:f?a+ru:a}):(f=o===e.x,s={x:f?o+ru:o,y:e.y+ru*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:eh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function DO(e,t,n){return Xx(e,t,n)}function LO(e,t,n){var i=Xx(t,e,Zx(n));return{waypoints:i.waypoints.slice().reverse(),directions:Zx(i.directions),turnNextDirections:i.turnNextDirections}}function IO(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=eh(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Zx(e){return e.split(":").reverse().join(":")}function BO(e,t,n){var i=ou((t.x-e.x)/2+e.x),r=ou((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 eh(e,t,n){if(n=n||"h:h",!WO(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Jx(n)){var i=DO(e,t,n),r=LO(e,t,n),o=IO(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return BO(e,t,n)}function NO(e,t,n){var i=eh(e,t,n);return i.unshift(e),i.push(t),t_(i)}function $O(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=A1(o,"straight")[0]||"h:h",s=TO[a]||0,c=kn(e,t,s),l=VO(c,a);n=n||je(e),i=i||je(t);var u=l.split(":"),p=e_(n,e,u[0],UO(c)),f=e_(i,t,u[1],c);return NO(p,f,l)}function FO(e,t,n,i,r,o){$e(n)&&(r=n,o=i,n=je(e),i=je(t)),o=V({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&HO(e,t,n,i,o),c||(c=o.connectionEnd&&GO(t,e,i,r),c)||(c=o.connectionStart&&zO(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:$O(e,t,n,i,o)}function jO(e,t,n){return e>=t&&e<=n}function Qx(e,t,n){var i={x:"width",y:"height"};return jO(t[e],n[e],n[e]+n[i[e]])}function HO(e,t,n,i,r){var o={},a,s;return s=kn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Qx(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:Qx(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 zO(e,t,n,i){return th(e,t,n,i)}function GO(e,t,n,i){var r=i.slice().reverse();return r=th(e,t,n,r),r?r.reverse():null}function th(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!kt(u,function(p,f){var d=u[f-1];return d&&fs(p,d)<3})}function o(u,p,f){var d=pr(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(Sy(u[d],p,Kx)||Sy(u[d],f,Kx))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=th(e,t,n,l)),c&&pr(c)?null:c}function VO(e,t){if(Jx(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 WO(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Jx(e){return e&&/t|r|b|l/.test(e)}function UO(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 e_(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 t_(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return vf(r,o,n,0)||t.push(n),t},[])}var qO=-10,YO=40,KO={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},XO={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},nh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Gs={top:"t",right:"r",bottom:"b",left:"l"};function au(e){this._elementRegistry=e}Ce(au,Yx),au.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,l;if(o||(o=n_(r&&r[0],n)),a||(a=n_(r&&r[r.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&r&&!i_(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=hv(n,s)?KO:XO;return M(e,"bpmn:MessageFlow")?c=QO(n,i,u):(M(e,"bpmn:SequenceFlow")||i_(n,i))&&(n===i?c={preferredLayouts:rD(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:oD(n,i,a,u)}:Vs(n)||Vs(i)?c={preferredLayouts:u.subProcess,preserveDocking:eD(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=V(c,t),l=t_(FO(n,i,o,a,r,c))),l||[o,a]};function ZO(e){var t=e.host;return kn(je(e),t,qO)}function QO(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:JO(e,t)}}function JO(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Vs(t)?"source":Vs(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function eD(e){return Vs(e)?"target":"source"}function n_(e,t){return e?e.original||e:je(t)}function i_(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Vs(e){return M(e,"bpmn:SubProcess")&&st(e)}function To(e,t){return e===t}function tD(e,t){return t.indexOf(e)!==-1}function Aa(e){var t=/right|left/.exec(e);return t&&t[0]}function Pa(e){var t=/top|bottom/.exec(e);return t&&t[0]}function r_(e,t){return nh[e]===t}function nD(e,t){var n=Aa(e),i=nh[n];return t.indexOf(i)!==-1}function iD(e,t){var n=Pa(e),i=nh[n];return t.indexOf(i)!==-1}function o_(e){return e==="right"||e==="left"}function rD(e,t,n){var i=t.waypoints,r=i&&i.length&&kn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function oD(e,t,n,i){var r=je(e),o=je(t),a=ZO(e),s,c,l=To(e.host,t),u=tD(a,["top","right","bottom","left"]),p=kn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?aD(a,u,e,t,n,i):(s=sD(a,p,u,i.isHorizontal),c=cD(a,p,u,i.isHorizontal),[s+":"+c])}function aD(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Pa(e):Aa(e),s=Gs[a],c;return t?o_(e)?c=a_("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=a_("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function a_(e,t,n,i){var r=YO;return!(ih(e,i,n,r)||ih(e,i,{x:n.x+n.width,y:n.y+n.height},r)||ih(e,i,je(t),r))}function ih(e,t,n,i){return Math.abs(t[e]-n[e])<i}function sD(e,t,n,i){if(n)return Gs[e];var r=Pa(e),o=Aa(e),a=Pa(t),s=Aa(t);if(i){if(To(r,a)||r_(o,s))return Gs[r]}else if(To(o,s)||r_(r,a))return Gs[o];return Gs[i?o:r]}function cD(e,t,n,i){if(n)return o_(e)?nD(e,t)||To(e,t)?"h":"v":iD(e,t)||To(e,t)?"v":"h";var r=Pa(e),o=Aa(e),a=Pa(t),s=Aa(t);return a&&!s?"v":s&&!a?"h":i?To(r,a)?"h":"v":To(o,s)?"v":"h"}au.$inject=["elementRegistry"];function s_(e){return V({original:e.point.original||e.point},e.actual)}function Qr(e,t){this._elementRegistry=e,this._graphicsFactory=t}Qr.$inject=["elementRegistry","graphicsFactory"],Qr.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(s_(i)),o.push(s_(r)),o},Qr.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}},Qr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return ds(i,r,n)},Qr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Qr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Qr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const rh={__init__:["modeling","bpmnUpdater"],__depends__:[Mk,Gk,Wk,Uk,bx,q2,K2,tO,Ri,Hd,Rx],bpmnFactory:["type",Mi],bpmnUpdater:["type",ri],elementFactory:["type",Kr],modeling:["type",Ln],layouter:["type",au],connectionDocking:["type",Qr]};var lD=10,c_=50,uD=250;function oh(e,t,n,i){for(var r;r=pD(e,n,t);)n=i(t,n,r);return n}function ah(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,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function pD(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=dD(e);return kt(r,function(o){if(o===n)return!1;var a=kn(o,i,lD);return a==="intersect"})}function fD(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||c_,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||uD,c=t.reference||"start";o||(o=gD);function l(g,h){return r==="n"?c==="start"?Be(g).top-Be(h).bottom:c==="center"?Be(g).top-je(h).y:Be(g).top-Be(h).top:r==="w"?c==="start"?Be(g).left-Be(h).right:c==="center"?Be(g).left-je(h).x:Be(g).left-Be(h).left:r==="s"?c==="start"?Be(h).top-Be(g).bottom:c==="center"?je(h).y-Be(g).bottom:Be(h).bottom-Be(g).bottom:c==="start"?Be(h).left-Be(g).right:c==="center"?je(h).x-Be(g).right:Be(h).right-Be(g).right}var u=e.incoming.filter(o).map(function(g){var h=a(g),y=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:y,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),y=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:y,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Qn(f,function(g,h){var y=h.distance,_=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*_,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return d.distance||i}function dD(e){var t=sh(e);return e.host&&(t=t.concat(sh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(sh(i))},[]))),t}function sh(e){return mD(e).concat(hD(e))}function hD(e){return e.incoming.map(function(t){return t.source})}function mD(e){return e.outgoing.map(function(t){return t.target})}function gD(){return!0}var yD=100;function l_(e,t,n){e.on("autoPlace",yD,function(i){var r=i.shape,o=i.source;return vD(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}}l_.$inject=["eventBus","modeling","canvas"];function vD(e,t,n){n||(n={});var i=n.defaultDistance||c_,r=je(e),o=Be(e);return{x:o.right+i+t.width/2,y:r.y}}function u_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}u_.$inject=["eventBus","selection"];const bD={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",l_],autoPlaceSelectionBehavior:["type",u_]};function p_(e,t,n){var i=hv(e,n);if(M(t,"bpmn:TextAnnotation"))return _D(e,t,i);if(tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return wD(e,t,i);if(M(t,"bpmn:FlowNode"))return xD(e,t,i)}function xD(e,t,n){var i=Be(e),r=je(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=fD(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=kn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+f_(l,c,o)}:{x:r.x+f_(l,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return oh(e,t,u,ah(f))}function f_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function _D(e,t,n){var i=Be(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};At(e)&&(r=je(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 oh(e,t,r,ah(a))}function wD(e,t,n){var i=Be(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return oh(e,t,r,ah(a))}function d_(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return p_(r,i,t)})}d_.$inject=["eventBus","elementRegistry"];const su={__depends__:[bD],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",d_]},h_=[fv,bs,rh,su,wp];function ED(e={}){Gm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new da({container:t,moddleExtensions:e.moddleExtensions??Cc,additionalModules:[...h_,...e.additionalModules??[]]})}const m_={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","label-over-shape":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},SD={이:["이","가"],을:["을","를"],와:["과","와"]};function RD(e,t){const[n,i]=SD[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const CD={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},MD="요소";function ch(e){return(e&&CD[e.type])??MD}const g_=20;function AD(e){const t=e.replace(/\s+/g," ").trim();return t.length>g_?`${t.slice(0,g_)}…`:t}function cu(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:AD(r.name),a=o===void 0?i+ch(r):o,s=o===void 0?a:`「${o}」`;return n?s+RD(a,n).slice(a.length):s}function PD(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&ch(o)===ch(a);return[cu(e,t,i),cu(e,n,r,s?"다른 ":"")]}function TD(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function kD(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const lu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function OD(e,t){const n=(r,o)=>cu(t,r,o),i=(r,o,a,s)=>PD(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${lu[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${lu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${lu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${lu[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function DD(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${cu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const y_="기타",lh={error:0,warning:1,info:2};function v_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${pt(i)}`,source:"geometry",code:i.kind,severity:TD(i),targetRefs:kD(i),category:m_[i.kind]??y_,message:OD(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:m_[i.ruleId]??y_,message:DD(i,t)});return n}function b_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ta(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function uh(e,t){if(t===void 0||e.length===0)return!1;const n=Ta(e[0],t);return e.some(i=>Ta(i,t)!==n)}function x_(e,t){const n=uh(e,t);return e.slice().sort((i,r)=>(n?Number(Ta(r,t))-Number(Ta(i,t)):0)||lh[i.severity]-lh[r.severity])}const __="i18n-untranslated",w_="i18n-review-requested",ph="i18nDisplay.redrawn",E_=[["untranslated",__],["reviewRequested",w_]];class fh{constructor(t,n,i,r,o,a,s,c){ui(this,"config");ui(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=r.drawShape.bind(r);r.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=o.activate.bind(o);o.activate=f=>this.withDisplayText(f,()=>u(f));const p=o.update.bind(o);o.update=(f,d,g,h)=>{const y=this.resolve(f);if(!y||y.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(xc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(xc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,r,o;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((r=n==null?void 0:n.get)==null?void 0:r.call(n,"xml:lang"))??((o=n==null?void 0:n.$attrs)==null?void 0:o["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=ho(n);if(!i)return;const r=this.displayLocale,o=i.target[i.key]??"",a=Zo(n).filter(f=>Nn(f)),s=f=>f.body??"",c=a.find(f=>Nn(f)===r&&s(f)),l=Pr(n).some(f=>f.locale===r)?"reviewRequested":"ok";if(!o)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===o).map(Nn);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(r)?{text:o,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:o,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var o;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let r=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((o=this.resolve(a))==null?void 0:o.status)===n&&r++}finally{this.displayLocale=i}return r}withDisplayText(t,n,i){var f;if(!this.config)return n();const r=this.resolve(t),o=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(o)for(const[d,g]of E_)o.toggle(g,(r==null?void 0:r.status)===d);if(!r||r.native)return n();const{target:a,key:s}=ho((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===r.text)return n();a[s]=r.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,r.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:r}=t,o=this.textRenderer.getExternalLabelBounds(t,n);return t.width=o.width,t.height=o.height,{dx:(i-o.width)/2,restore:()=>(t.width=i,t.height=r)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,r]of E_)i.classList.remove(r);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(ph)}}ui(fh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const S_={__depends__:[wp],__init__:["i18nDisplay"],i18nDisplay:["type",fh]};var LD=new Mo("ov"),ID=500;function Sn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=LD,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=BD(n.getContainer()),this._init()}Sn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Sn.prototype.get=function(e){if(Xn(e)&&(e={id:e}),Xn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?it(t.overlays,Ko({type:e.type})):t.overlays.slice():[]}else return e.type?it(this._overlays,Ko({type:e.type})):e.id?this._overlays[e.id]:null},Sn.prototype.add=function(e,t,n){if(fn(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=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Sn.prototype.remove=function(e){var t=this.get(e)||[];$e(t)||(t=[t]);var n=this;H(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(qi(i.html),qi(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)}})},Sn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Sn.prototype.show=function(){uu(this._overlayRoot)},Sn.prototype.hide=function(){uu(this._overlayRoot,!1)},Sn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],qc(this._overlayRoot)},Sn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=on(t);i=o.x,r=o.y}R_(n,i,r),En(e.html,"data-container-id",t.id)},Sn.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=on(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=on(i).height:s=i.height,o=t.bottom*-1+s}R_(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._createOverlayContainer=function(e){var t=Nt('<div class="djs-overlays" />');zn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Sn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";C_(this._overlayRoot,n)},Sn.prototype._getOverlayContainer=function(e,t){var n=kt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Sn.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)),Xn(i)&&(i=Nt(i)),o=this._getOverlayContainer(n),r=Nt('<div class="djs-overlay" data-overlay-id="'+t+'">'),zn(r,{position:"absolute"}),r.appendChild(i),e.type&&St(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();uu(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())},Sn.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&&(pn(r)&&r>t.scale||pn(o)&&o<t.scale))&&(c=!1),uu(a,c),this._updateOverlayScale(e,t)},Sn.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),pn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),pn(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),pn(a)&&(s="scale("+a+","+a+")"),C_(o,s)},Sn.prototype._updateOverlaysVisibilty=function(e){var t=this;H(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Sn.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});H(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){qi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",ID,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(H(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&&St(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 BD(e){var t=Nt('<div class="djs-overlay-container" />');return zn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function R_(e,t,n){zn(e,{left:t+"px",top:n+"px"})}function uu(e,t){e.style.display=t===!1?"none":""}function C_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const pu={__init__:["overlays"],overlays:["type",Sn]};function dh(e,t){t.invoke(pe,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)})}Ce(dh,pe),dh.$inject=["canvas","injector"];const ND={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",dh]};function ko(e){return CSS.escape(e)}var $D={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function M_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return $D[t]})}var FD="bjs-breadcrumbs-shown";function A_(e,t,n){var i=Nt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=St(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=de(l),p=kt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=jD(c));var l=a.flatMap(function(p){var f=n.findRoot(Qi(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(y){var _=de(y);return _&&_.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=M_(p.name||p.id),h=Nt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;o.toggle(FD,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}A_.$inject=["eventBus","elementRegistry","canvas"];function jD(e){for(var t=de(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function P_(e,t){var n=null,i=new HD;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,!(!M(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}P_.$inject=["eventBus","canvas"];function HD(){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 T_={x:180,y:160};function Oo(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Oo.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)})}},Oo.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;M(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),GD(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},Oo.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=zD(e),i={x:n.x-T_.x,y:n.y-T_.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)})},Oo.prototype._moveToDiPlane=function(e,t){var n=k_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Oo.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},Oo.$inject=["eventBus","moddle"];function k_(e){return M(e,"bpmndi:BPMNDiagram")?e:k_(e.$parent)}function zD(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Be(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),el(t)}function GD(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||tt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var fu=250,VD='<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>',WD="bjs-drilldown-empty";function Jr(e,t,n,i,r){pe.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",fu,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",fu,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],fu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],fu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ce(Jr,pe),Jr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Jr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(Qi(e))},Jr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=de(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;St(i.html).toggle(WD,!r)}},Jr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=de(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Nt('<button type="button" class="bjs-drilldown">'+VD+"</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(Qi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Jr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Jr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const UD={__depends__:[pu,Hd,ND],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",A_],drilldownCentering:["type",P_],drilldownOverlayBehavior:["type",Jr],subprocessCompatibility:["type",Oo]};function eo(e){Gt.call(this,e)}Ce(eo,Gt),eo.prototype._modules=[fv,UD,pu,Ri,bs],eo.prototype._moddleExtensions={};var du="keyboard.keydown",qD="keyboard.keyup",YD=1e3,O_="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 Gn(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(O_));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Gn.$inject=["config.keyboard","eventBus"],Gn.prototype._keydownHandler=function(e){this._keyHandler(e,du)},Gn.prototype._keyupHandler=function(e){this._keyHandler(e,qD)},Gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||du,i),n&&e.preventDefault()}},Gn.prototype._isEventIgnored=function(e){return!1},Gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(O_)),this.unbind(),e=this._node=this._target,Le.bind(e,"keydown",this._keydownHandler),Le.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Gn.prototype.getBinding=function(){return this._node},Gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Le.unbind(e,"keydown",this._keydownHandler),Le.unbind(e,"keyup",this._keyupHandler)),this._node=null},Gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Gn.prototype.addListener=function(e,t,n){yn(e)&&(n=t,t=e,e=YD),this._eventBus.on(n||du,e,t)},Gn.prototype.removeListener=function(e,t){this._eventBus.off(t||du,e)},Gn.prototype.hasModifier=o2,Gn.prototype.isCmd=ni,Gn.prototype.isShift=Td,Gn.prototype.isKey=hn;var KD=500;function ka(e,t){var n=this;e.on("editorActions.init",KD,function(i){var r=i.editorActions;n.registerBindings(t,r)})}ka.$inject=["eventBus","keyboard"],ka.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(u2(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(p2(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(a2(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(s2(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(c2(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(l2(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(hn(["+","Add","="],r)&&ni(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(hn(["-","Subtract"],r)&&ni(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(hn("0",r)&&ni(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(hn(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const hh={__init__:["keyboard","keyboardBindings"],keyboard:["type",Gn],keyboardBindings:["type",ka]};var XD={moveSpeed:50,moveSpeedAccelerated:200};function D_(e,t,n){var i=this;this._config=V({},XD,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,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}D_.$inject=["config.keyboardMove","keyboard","canvas"];const L_={__depends__:[hh],__init__:["keyboardMove"],keyboardMove:["type",D_]};var ZD=15;function I_(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,l=n.button,u=So(s),p=Bi(u,c);if(!n.dragging&&QD(p)>ZD&&(n.dragging=!0,l===0&&Qb(e),$l("grab")),n.dragging){var f=n.last||n.start;p=Bi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function o(s){Le.unbind(document,"mousemove",r),Le.unbind(document,"mouseup",o),n=null,Zb()}function a(s){if(!bo(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:So(s)},Le.bind(document,"mousemove",r),Le.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}I_.$inject=["eventBus","canvas"];function QD(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const B_={__init__:["moveCanvas"],moveCanvas:["type",I_]};function N_(e,t){var n=Mf(e.min),i=Mf(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function JD(e,t){return Math.max(e.min,Math.min(e.max,t))}var eL=Math.sign||function(e){return e>=0?1:-1},mh={min:.2,max:4},$_=10,tL=.1,nL=.75;function tr(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=qn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||nL;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}tr.$inject=["config.zoomScroll","eventBus","canvas"],tr.prototype.scroll=function(t){this._canvas.scroll(t)},tr.prototype.reset=function(){this._canvas.zoom("fit-viewport")},tr.prototype.zoom=function(t,n){var i=N_(mh,$_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>tL&&(this._zoom(t,n,i),this._totalDelta=0)},tr.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||ob()&&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))*eL(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)}},tr.prototype.stepZoom=function(t,n){var i=N_(mh,$_);this._zoom(t,n,i)},tr.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Mf(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(JD(mh,s),t)},tr.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Le[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},tr.prototype._init=function(e){this.toggle(e)};const F_={__init__:["zoomScroll"],zoomScroll:["type",tr]};function Ws(e){eo.call(this,e)}Ce(Ws,eo),Ws.prototype._navigationModules=[L_,B_,F_],Ws.prototype._modules=[].concat(eo.prototype._modules,Ws.prototype._navigationModules);function gh(e){return e&&e[e.length-1]}function j_(e){return e.y}function H_(e){return e.x}var iL={left:H_,center:H_,right:function(e){return e.x+e.width},top:j_,middle:j_,bottom:function(e){return e.y+e.height}};function Oa(e,t){this._modeling=e,this._rules=t}Oa.$inject=["modeling","rules"],Oa.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}},Oa.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Oa.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=gh(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(H(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Hi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=gh(c).center,o;l=t[0],t=Hi(t,function(f){return f[i]+f[r]}),u=gh(t),o[e]=p(l,u)}return o},Oa.prototype.trigger=function(e,t){var n=this._modeling,i,r=it(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),$e(i)&&(r=i),!(r.length<2||!i)){var o=iL[t],a=Hi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const rL={__init__:["alignElements"],alignElements:["type",Oa]},oL=new Mo;function Da(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Da.$inject=["eventBus"],Da.prototype.schedule=function(e,t=oL.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Da.prototype._schedule=function(e,t){const n=aL();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}},Da.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Da.prototype._cancel=function(e){clearTimeout(e.executionId)};function aL(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const sL={scheduler:["type",Da]};var cL="djs-element-hidden",hu=".entry",lL=1e3,z_=8,uL=300;function sn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}sn.$inject=["canvas","elementRegistry","eventBus","scheduler"],sn.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=$e(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=$e(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},sn.prototype._createContainer=function(){var e=Nt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},sn.prototype.registerProvider=function(e,t){t||(t=e,e=lL),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},sn.prototype.getEntries=function(e){var t=this._getProviders(),n=$e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return H(t,function(r){if(yn(r[n])){var o=r[n](e);yn(o)?i=o(i):H(o,function(a,s){i[s]=a})}}),i},sn.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=En(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},uL);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},sn.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(yn(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},sn.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))}},sn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},sn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;H(t,function(r,o){var a=r.group||"default",s=Nt(r.html||'<div class="entry" draggable="true"></div>'),c;En(s,"data-action",o),c=_t("[data-group="+ko(a)+"]",n),c||(c=Nt('<div class="group"></div>'),En(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&pL(s,r.className),r.title&&En(s,"title",r.title),r.imageUrl&&(i=Nt("<img>"),En(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),St(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},sn.prototype._createHtml=function(e){var t=this,n=Nt('<div class="djs-context-pad"></div>');return Jn.bind(n,hu,"click",function(i){t.trigger("click",i)}),Jn.bind(n,hu,"dragstart",function(i){t.trigger("dragstart",i)}),Jn.bind(n,hu,"mouseover",function(i){t.trigger("mouseover",i)}),Jn.bind(n,hu,"mouseout",function(i){t.trigger("mouseout",i)}),Le.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},sn.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()&&dL(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},sn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},sn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return $e(e)!==$e(n)?!1:$e(e)?e.length===n.length&&Mr(e,function(i){return n.includes(i)}):n===e},sn.prototype.isShown=function(){return this.isOpen()&&St(this._current.html).has("open")},sn.prototype.show=function(){this.isOpen()&&(St(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},sn.prototype.hide=function(){this.isOpen()&&(St(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},sn.prototype._getPosition=function(e){if(!$e(e)&&At(e)){var t=this._canvas.viewbox(),n=fL(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+z_*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+z_*this._canvas.zoom(),top:s.top-a.top}},sn.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")},sn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=$e(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,cL)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},sn.prototype._getTargetBounds=function(e){var t=this,n=$e(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 pL(e,t){var n=St(e);t=$e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function fL(e){return e.waypoints[e.waypoints.length-1]}function dL(e,t){return e=$e(e)?e:[e],t=$e(t)?t:[t],e.length===t.length&&Mr(e,function(n){return t.includes(n)})}const G_={__depends__:[Nl,sL,pu],contextPad:["type",sn]};var mu,Wt,V_,to,W_,U_,q_,yh,gu,Us,Y_,vh,bh,xh,yu={},vu=[],hL=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,bu=Array.isArray;function _r(e,t){for(var n in t)e[n]=t[n];return e}function _h(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function K_(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?mu.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 xu(e,a,i,r,null)}function xu(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++V_,__i:-1,__u:0};return r==null&&Wt.vnode!=null&&Wt.vnode(o),o}function _u(e){return e.children}function wu(e,t){this.props=e,this.context=t}function Do(e,t){if(t==null)return e.__?Do(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"?Do(e):null}function mL(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=_r({},t);o.__v=t.__v+1,Wt.vnode&&Wt.vnode(o),wh(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Do(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,iw(i,o,r),t.__e=t.__=null,o.__e!=n&&X_(o)}}function X_(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}),X_(e)}function Z_(e){(!e.__d&&(e.__d=!0)&&to.push(e)&&!Eu.__r++||W_!=Wt.debounceRendering)&&((W_=Wt.debounceRendering)||U_)(Eu)}function Eu(){try{for(var e,t=1;to.length;)to.length>t&&to.sort(q_),e=to.shift(),t=to.length,mL(e)}finally{to.length=Eu.__r=0}}function Q_(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,g,h,y,_=i&&i.__k||vu,x=t.length;for(c=gL(n,t,_,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&_[d.__i]||yu,d.__i=p,y=wh(e,d,f,r,o,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Eh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=J_(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function gL(e,t,n,i,r){var o,a,s,c,l,u=n.length,p=u,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=xu(null,a,null,null,null):bu(a)?a=e.__k[o]=xu(_u,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=xu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=yL(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?f--:r<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Do(s)),ow(s,s));return i}function J_(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=J_(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Do(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function yL(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function ew(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||hL.test(t)?n:n+"px"}function Su(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||ew(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ew(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Y_,"$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[Us]=i[Us]:(n[Us]=vh,e.addEventListener(t,o?xh:bh,o)):e.removeEventListener(t,o?xh:bh,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 tw(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[gu]==null)t[gu]=vh++;else if(t[gu]<n[Us])return;return n(Wt.event?Wt.event(t):t)}}}function wh(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,g,h,y,_,x,m,v,E,S,P,k,$,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Wt.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(x=t.props,m=N.prototype&&N.prototype.render,v=(u=N.contextType)&&i[u.__c],E=u?v?v.props.value:u.__:i,n.__c?_=(f=t.__c=n.__c).__=f.__E:(m?t.__c=f=new N(x,E):(t.__c=f=new wu(x,E),f.constructor=N,f.render=bL),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),m&&f.__s==null&&(f.__s=f.state),m&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=_r({},f.__s)),_r(f.__s,N.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=t,d)m&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),m&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(m&&N.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,E)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),vu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Do(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,E),m&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,y)})}if(f.context=E,f.props=x,f.__P=e,f.__e=!1,S=Wt.__r,P=0,m)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),vu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(i=_r(_r({},i),f.getChildContext())),m&&!d&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(g,h)),k=u!=null&&u.type===_u&&u.key==null?rw(u.props.children):u,s=Q_(e,bu(k)?k:[k],t,n,i,r,o,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),_&&(f.__E=f.__=null)}catch(L){if(a.length=p,t.__v=null,c||o!=null){if(L.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for($=o.length;$--;)_h(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||nw(t),Wt.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=vL(n.__e,t,n,i,r,o,a,c,l);return(u=Wt.diffed)&&u(t),128&t.__u?void 0:s}function nw(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nw))}function iw(e,t,n){for(var i=0;i<n.length;i++)Eh(n[i],n[++i],n[++i]);Wt.__c&&Wt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Wt.__e(o,r.__v)}})}function rw(e){return typeof e!="object"||e==null||e.__b>0?e:bu(e)?e.map(rw):e.constructor!==void 0?null:_r({},e)}function vL(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,g,h,y=n.props||yu,_=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(_);e=document.createElementNS(r,x,_.is&&_),s&&(Wt.__m&&Wt.__m(t,o),s=!1),o=null}if(x==null)y===_||s&&e.data==_||(e.data=_);else{if(o=x=="textarea"&&_.defaultValue!=null?null:o&&mu.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||Su(e,l,null,d,r);for(l in _)d=_[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||Su(e,l,d,y[l],r);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),Q_(t.type=="template"?e.content:e,bu(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Do(n,0),s,c),o!=null)for(l=o.length;l--;)_h(o[l]);s&&x!="textarea"||(l="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||x=="progress"&&!g||x=="option"&&g!=y[l])&&Su(e,l,g,y[l],r),l="checked",h!=null&&h!=e[l]&&Su(e,l,h,y[l],r))}return e}function Eh(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Wt.__e(r,n)}}function ow(e,t,n){var i,r;if(Wt.unmount&&Wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Eh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Wt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&ow(i[r],t,n||typeof e.type!="function");n||_h(e.__e),e.__c=e.__=e.__e=void 0}function bL(e,t,n){return this.constructor(e,n)}function aw(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Wt.__&&Wt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],wh(t,e=t.__k=K_(_u,null,[e]),r||yu,yu,t.namespaceURI,r?null:t.firstChild?mu.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),iw(o,e,a),e.props.children=null}mu=vu.slice,Wt={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},V_=0,wu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=_r({},this.state),typeof e=="function"&&(e=e(_r({},n),this.props)),e&&_r(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Z_(this))},wu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Z_(this))},wu.prototype.render=_u,to=[],U_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,q_=function(e,t){return e.__v.__b-t.__v.__b},Eu.__r=0,yh=Math.random().toString(8),gu="__d"+yh,Us="__a"+yh,Y_=/(PointerCapture)$|Capture$/i,vh=0,bh=tw(!1),xh=tw(!0);var sw=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,sw(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},cw=new Map;function xL(e){var t=cw.get(this);return t||(t=new Map,cw.set(this,t)),(t=sw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],o===1?i==="<"?(l(),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===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][p+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Tt=xL.bind(K_),La,cn,Sh,lw,qs=0,uw=[],mn=Wt,pw=mn.__b,fw=mn.__r,dw=mn.diffed,hw=mn.__c,mw=mn.unmount,gw=mn.__;function Ru(e,t){mn.__h&&mn.__h(cn,e,qs||t),qs=0;var n=cn.__H||(cn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Rh(e){return qs=1,_L(vw,e)}function _L(e,t,n){var i=Ru(La++,2);if(i.t=e,!i.__c&&(i.__=[vw(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=cn,!cn.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,l);return u?f||p:f}return!u||p};cn.__f=!0;var o=cn.shouldComponentUpdate,a=cn.componentWillUpdate;cn.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},cn.shouldComponentUpdate=r}return i.__N||i.__}function Cu(e,t){var n=Ru(La++,3);!mn.__s&&Ah(n.__H,t)&&(n.__=e,n.u=t,cn.__H.__h.push(n))}function Ch(e,t){var n=Ru(La++,4);!mn.__s&&Ah(n.__H,t)&&(n.__=e,n.u=t,cn.__h.push(n))}function Mu(e){return qs=5,wr(function(){return{current:e}},[])}function wr(e,t){var n=Ru(La++,7);return Ah(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ys(e,t){return qs=8,wr(function(){return e},t)}function wL(){for(var e;e=uw.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Au),t.__h.some(Mh),t.__h=[]}catch(n){t.__h=[],mn.__e(n,e.__v)}}}mn.__b=function(e){cn=null,pw&&pw(e)},mn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gw&&gw(e,t)},mn.__r=function(e){fw&&fw(e),La=0;var t=(cn=e.__c).__H;t&&(Sh===cn?(t.__h=[],cn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Au),t.__h.some(Mh),t.__h=[],La=0)),Sh=cn},mn.diffed=function(e){dw&&dw(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(uw.push(t)!==1&&lw===mn.requestAnimationFrame||((lw=mn.requestAnimationFrame)||EL)(wL)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Sh=cn=null},mn.__c=function(e,t){t.some(function(n){try{n.__h.some(Au),n.__h=n.__h.filter(function(i){return!i.__||Mh(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],mn.__e(i,n.__v)}}),hw&&hw(e,t)},mn.unmount=function(e){mw&&mw(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Au(i)}catch(r){t=r}}),n.__H=void 0,t&&mn.__e(t,n.__v))};var yw=typeof requestAnimationFrame=="function";function EL(e){var t,n=function(){clearTimeout(i),yw&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);yw&&(t=requestAnimationFrame(n))}function Au(e){var t=cn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),cn=t}function Mh(e){var t=cn;e.__c=e.__(),cn=t}function Ah(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function vw(e,t){return typeof t=="function"?t(e):t}function SL(e){const{navigationStack:t,setNavigationStack:n}=e,i=wr(()=>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 Tt`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Gt.prototype._setDefinitions=function(e){this._definitions=e},Gt.prototype.getModules=function(){return this._modules},Gt.prototype.clear=function(){this.getDefinitions()&&zo.prototype.clear.call(this)},Gt.prototype.destroy=function(){zo.prototype.destroy.call(this),qi(this._container)},Gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gt.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=wt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gt.prototype.getDefinitions=function(){return this._definitions},Gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=V(zi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});zo.call(this,s),n&&n.container&&this.attachTo(n.container)},Gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gt.prototype._createContainer=function(e){const t=Nt('<div class="bjs-container"></div>');return zn(t,{width:pv(e.width),height:pv(e.height),position:e.position}),t},Gt.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new Ug(t)},Gt.prototype._modules=[];function cl(e,t){return e.warnings=t,e}function sP(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 cP={width:"100%",height:"100%",position:"relative"};function pv(e){return e+(Fe(e)?"px":"")}function lP(e,t){return t&&Ot(e.diagrams,function(n){return n.id===t})||null}function uP(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+sv+"</a>",i=Nt(n);zn(wt("svg",i),cv),zn(i,lv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Le.bind(i,"click",function(o){aP(),o.preventDefault()})}function ga(e){Gt.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)}Ce(ga,Gt),ga.prototype._createModdle=function(e){var t=Gt.prototype._createModdle.call(this,e);return t.ids=new Ui([32,36,1]),t},ga.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,o;i.clear();for(o in t)i.claim(o,t[o])};function st(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||ft(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!de(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=ft(e).isHorizontal;return t===void 0?!0:t}}function pP(e){return e&&de(e).isInterrupting!==!1}function jn(e){return e&&!!de(e).triggeredByEvent}function ma(e,t){var n=de(e).eventDefinitions;return Po(n,function(i){return M(i,t)})}function fP(e){return ma(e,"bpmn:ErrorEventDefinition")}function dP(e){return ma(e,"bpmn:EscalationEventDefinition")}function hP(e){return ma(e,"bpmn:CompensateEventDefinition")}var Sr={width:90,height:20},fv=15;function Go(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function ll(e){return Je(e.label)}function gP(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=mP(e),r=Math.atan((i.y-n.y)/(i.x-n.x)),a=o.x,s=o.y;return Math.abs(r)<Math.PI/2?s-=fv:a+=fv,{x:a,y:s}}function mP(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 Pf(e){return e.waypoints?gP(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Sr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Sr.height/2}}function yP(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Sr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Pf(t),i=Sr),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function dv(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function vP(e){var t=e.categoryValueRef;return t&&t.value||""}function yi(e){var t=e.businessObject,n=dv(t);if(n)return n==="categoryValueRef"?vP(t):t[n]||""}function bP(e,t){var n=e.businessObject,i=dv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function xP(e){return Je(e)&&Go(e.labelTarget)}var ya=7;function hv(e){let t=[];return z(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function xs(e){const t=new Map;return z(wf(e),n=>{z(hv(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 Tf="hsl(225, 10%, 15%)",_P="white";function Zi(e,t){return Po(e.eventDefinitions,function(n){return n.$type===t})}function wP(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function EP(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function rt(e,t,n){var i=ft(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||_P}function Se(e,t,n){var i=ft(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Tf}function _s(e,t,n,i){var o=ft(e),r=o.get("label");return i||r&&r.get("color:color")||t||Se(e,n)}function gv(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,o=[["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 wr(o)}function kf(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=[["M",n+t,i],["l",o-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-o,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return wr(a)}function SP(e){var t=e.width,n=e.height,i=e.x,o=e.y,r=t/2,a=n/2,s=[["M",i+r,o],["l",r,a],["l",-r,a],["l",-r,-a],["z"]];return wr(s)}function RP(e){var t=e.x,n=e.y,i=e.width,o=e.height,r=[["M",t,n],["l",i,0],["l",0,o],["l",-i,0],["z"]];return wr(r)}function ws(e,t={}){return{width:_i(e,t),height:ti(e,t)}}function _i(e,t={}){return Zn(t,"width")?t.width:e.width}function ti(e,t={}){return Zn(t,"height")?t.height:e.height}var CP=new Ui,MP=10,ul=3,AP=1.5,pl=10,PP=4,va=.95,TP=1,kP=.25;function Rr(e,t,n,i,o,r,a){uo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(B){return n.computeStyle(B,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Tf,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Tf,strokeWidth:2})}function f(B,C){var{ref:E={x:0,y:0},scale:G=1,element:q,parentGfx:ie=o._svg}=C,Me=Oe("marker",{id:B,viewBox:"0 0 20 20",refX:E.x,refY:E.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});ze(Me,q);var Xe=wt(":scope > defs",ie);Xe||(Xe=Oe("defs"),ze(ie,Xe)),ze(Xe,Me)}function d(B,C,E,G){var q=CP.nextPrefixed("marker-");return g(B,q,C,E,G),"url(#"+q+")"}function g(B,C,E,G,q){if(E==="sequenceflow-end"){var ie=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:q,stroke:q,strokeWidth:1})});f(C,{element:ie,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(E==="messageflow-start"){var Me=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Me,ref:{x:6,y:6},parentGfx:B})}if(E==="messageflow-end"){var Xe=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Xe,ref:{x:8.5,y:5},parentGfx:B})}if(E==="association-start"){var gt=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:gt,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(E==="association-end"){var qt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:qt,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(E==="conditional-flow-marker"){var Ct=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:q})});f(C,{element:Ct,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(E==="conditional-default-flow-marker"){var mn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:q,fill:"none"})});f(C,{element:mn,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function h(B,C,E,G,q={}){fn(G)&&(q=G,G=0),G=G||0,q=u(q);var ie=C/2,Me=E/2,Xe=Oe("circle",{cx:ie,cy:Me,r:Math.round((C+E)/4-G),...q});return ze(B,Xe),Xe}function y(B,C,E,G,q,ie){fn(q)&&(ie=q,q=0),q=q||0,ie=u(ie);var Me=Oe("rect",{x:q,y:q,width:C-q*2,height:E-q*2,rx:G,ry:G,...ie});return ze(B,Me),Me}function _(B,C,E,G){var q=C/2,ie=E/2,Me=[{x:q,y:0},{x:C,y:ie},{x:q,y:E},{x:0,y:ie}],Xe=Me.map(function(qt){return qt.x+","+qt.y}).join(" ");G=u(G);var gt=Oe("polygon",{...G,points:Xe});return ze(B,gt),gt}function x(B,C,E,G){E=p(E);var q=ds(C,E,G);return ze(B,q),q}function m(B,C,E){return x(B,C,E,5)}function v(B,C,E){E=p(E);var G=Oe("path",{...E,d:C});return ze(B,G),G}function w(B,C,E,G){return v(C,E,V({"data-marker":B},G))}function S(B){return Te[B]}function P(B){return function(C,E,G){return S(B)(C,E,G)}}var T={"bpmn:MessageEventDefinition":function(B,C,E={},G){var q=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||C.width,containerHeight:E.height||C.height,position:{mx:.235,my:.315}}),ie=G?Se(C,c,E.stroke):rt(C,s,E.fill),Me=G?rt(C,s,E.fill):Se(C,c,E.stroke),Xe=v(B,q,{fill:ie,stroke:Me,strokeWidth:1});return Xe},"bpmn:TimerEventDefinition":function(B,C,E={}){var G=E.width||C.width,q=E.height||C.height,ie=E.width?1:2,Me=h(B,G,q,.2*q,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:ie}),Xe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}});v(B,Xe,{stroke:Se(C,c,E.stroke),strokeWidth:ie});for(var gt=0;gt<12;gt++){var qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}}),Ct=G/2,mn=q/2;v(B,qt,{strokeWidth:1,stroke:Se(C,c,E.stroke),transform:"rotate("+gt*30+","+mn+","+Ct+")"})}return Me},"bpmn:EscalationEventDefinition":function(B,C,E={},G){var q=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||C.width,containerHeight:E.height||C.height,position:{mx:.5,my:.2}}),ie=G?Se(C,c,E.stroke):rt(C,s,E.fill);return v(B,q,{fill:ie,stroke:Se(C,c,E.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,C,E={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||C.width,containerHeight:E.height||C.height,position:{mx:.5,my:.222}});return v(B,G,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,C,E={},G){var q=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ie=G?Se(C,c,E.stroke):rt(C,s,E.fill);return v(B,q,{fill:ie,stroke:Se(C,c,E.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,C,E={},G){var q=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||C.width,containerHeight:E.height||C.height,position:{mx:.2,my:.722}}),ie=G?Se(C,c,E.stroke):rt(C,s,E.fill);return v(B,q,{fill:ie,stroke:Se(C,c,E.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,C,E={},G){var q=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ie=G?Se(C,c,E.stroke):"none",Me=v(B,q,{fill:ie,stroke:Se(C,c,E.stroke),strokeWidth:1});return rv(Me,45),Me},"bpmn:CompensateEventDefinition":function(B,C,E={},G){var q=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||C.width,containerHeight:E.height||C.height,position:{mx:.22,my:.5}}),ie=G?Se(C,c,E.stroke):rt(C,s,E.fill);return v(B,q,{fill:ie,stroke:Se(C,c,E.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,C,E={},G){var q=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||C.width,containerHeight:E.height||C.height,position:{mx:.5,my:.2}}),ie=G?Se(C,c,E.stroke):rt(C,s,E.fill);return v(B,q,{strokeWidth:1,fill:ie,stroke:Se(C,c,E.stroke)})},"bpmn:MultipleEventDefinition":function(B,C,E={},G){var q=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||C.width,containerHeight:E.height||C.height,position:{mx:.211,my:.36}}),ie=G?Se(C,c,E.stroke):rt(C,s,E.fill);return v(B,q,{fill:ie,stroke:Se(C,c,E.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,C,E={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:E.width||C.width,containerHeight:E.height||C.height,position:{mx:.458,my:.194}});return v(B,G,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,C,E={}){var G=h(B,C.width,C.height,8,{fill:Se(C,c,E.stroke),stroke:Se(C,c,E.stroke),strokeWidth:4});return G}};function D(B,C,E={},G){var q=de(B),ie=wP(q),Me=G||B;return q.get("eventDefinitions")&&q.get("eventDefinitions").length>1?q.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](C,Me,E,ie):T["bpmn:MultipleEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](C,Me,E,ie):Zi(q,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](C,Me,E,ie):null}var $={ParticipantMultiplicityMarker:function(B,C,E={}){var G=_i(C,E),q=ti(C,E),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2-6)/G,my:(q-15)/q}});w("participant-multiplicity",B,ie,{strokeWidth:2,fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke)})},SubProcessMarker:function(B,C,E={}){var G=y(B,14,14,0,{strokeWidth:1,fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke)});On(G,C.width/2-7.5,C.height-20);var q=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2-7.5)/C.width,my:(C.height-20)/C.height}});w("sub-process",B,q,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke)})},ParallelMarker:function(B,C,E){var G=_i(C,E),q=ti(C,E),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+E.parallel)/G,my:(q-20)/q}});w("parallel",B,ie,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke)})},SequentialMarker:function(B,C,E){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+E.seq)/C.width,my:(C.height-19)/C.height}});w("sequential",B,G,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke)})},CompensationMarker:function(B,C,E){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+E.compensation)/C.width,my:(C.height-13)/C.height}});w("compensation",B,G,{strokeWidth:1,fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke)})},LoopMarker:function(B,C,E){var G=_i(C,E),q=ti(C,E),ie=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+E.loop)/G,my:(q-7)/q}});w("loop",B,ie,{strokeWidth:1.5,fill:"none",stroke:Se(C,c,E.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,C,E){var G=_i(C,E),q=ti(C,E),ie=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+E.adhoc)/G,my:(q-15)/q}});w("adhoc",B,ie,{strokeWidth:1,fill:Se(C,c,E.stroke),stroke:Se(C,c,E.stroke)})}};function N(B,C,E,G){$[B](C,E,G)}function H(B,C,E=[],G={}){G={fill:G.fill,stroke:G.stroke,width:_i(C,G),height:ti(C,G)};var q=de(C),ie=E.includes("SubProcessMarker");ie?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},q.get("isForCompensation")&&E.push("CompensationMarker"),M(q,"bpmn:AdHocSubProcess")&&(E.push("AdhocMarker"),ie||V(G,{compensation:G.compensation-18}));var Me=q.get("loopCharacteristics"),Xe=Me&&Me.get("isSequential");Me&&(V(G,{compensation:G.compensation-18}),E.includes("AdhocMarker")&&V(G,{seq:-23,loop:-18,parallel:-24}),Xe===void 0&&E.push("LoopMarker"),Xe===!1&&E.push("ParallelMarker"),Xe===!0&&E.push("SequentialMarker")),E.includes("CompensationMarker")&&E.length===1&&V(G,{compensation:-8}),z(E,function(gt){N(gt,B,C,G)})}function X(B,C,E={}){E=V({size:{width:100}},E);var G=r.createText(C||"",E);return at(G).add("djs-label"),ze(B,G),G}function Q(B,C,E,G={}){var q=de(C),ie=ws({x:C.x,y:C.y,width:C.width,height:C.height},G);return X(B,q.name,{align:E,box:ie,padding:7,style:{fill:_s(C,l,c,G.stroke)}})}function ee(B,C,E={}){var G={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return X(B,yi(C),{box:G,style:V({},r.getExternalStyle(),{fill:_s(C,l,c,E.stroke)})})}function Ve(B,C,E,G={}){var q=xn(E),ie=X(B,C,{box:{height:30,width:q?ti(E,G):_i(E,G)},align:"center-middle",style:{fill:_s(E,l,c,G.stroke)}});if(q){var Me=-1*ti(E,G);al(ie,0,-Me,270)}}function qe(B,C,E={}){var{width:G,height:q}=ws(C,E);return y(B,G,q,pl,{...E,fill:rt(C,s,E.fill),fillOpacity:va,stroke:Se(C,c,E.stroke)})}function Ge(B,C,E={}){var G=de(C),q=rt(C,s,E.fill),ie=Se(C,c,E.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(E.markerEnd=d(B,"association-end",q,ie)),G.get("associationDirection")==="Both"&&(E.markerStart=d(B,"association-start",q,ie)),E=dt(E,["markerStart","markerEnd"]),m(B,C.waypoints,{...E,stroke:ie,strokeDasharray:"0, 5"})}function Re(B,C,E={}){var G=rt(C,s,E.fill),q=Se(C,c,E.stroke),ie=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Me=v(B,ie,{fill:G,fillOpacity:va,stroke:q}),Xe=de(C);if(EP(Xe)){var gt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});v(B,gt,{strokeWidth:2,fill:G,stroke:q})}return Me}function Z(B,C,E={}){return h(B,C.width,C.height,{fillOpacity:va,...E,fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke)})}function oe(B,C,E={}){return _(B,C.width,C.height,{fill:rt(C,s,E.fill),fillOpacity:va,stroke:Se(C,c,E.stroke)})}function W(B,C,E={}){var G=y(B,_i(C,E),ti(C,E),0,{fill:rt(C,s,E.fill),fillOpacity:E.fillOpacity||va,stroke:Se(C,c,E.stroke),strokeWidth:1.5}),q=de(C);if(M(q,"bpmn:Lane")){var ie=q.get("name");Ve(B,ie,C,E)}return G}function Y(B,C,E={}){var G=qe(B,C,E),q=st(C);if(jn(C)&&(we(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!q)){var ie=de(C).flowElements||[],Me=ie.filter(Xe=>M(Xe,"bpmn:StartEvent"));Me.length===1&&ae(Me[0],B,E,C)}return Q(B,C,q?"center-top":"center-middle",E),q?H(B,C,void 0,E):H(B,C,["SubProcessMarker"],E),G}function ae(B,C,E,G){var q=22,ie={fill:rt(G,s,E.fill),stroke:Se(G,c,E.stroke),width:q,height:q},Me=de(B).isInterrupting,Xe=Me?0:3,gt=Me?1:1.2,qt=20,Ct=(q-qt)/2,mn="translate("+Ct+","+Ct+")";h(C,qt,qt,{fill:ie.fill,stroke:ie.stroke,strokeWidth:gt,strokeDasharray:Xe,transform:mn}),D(B,C,ie,G)}function ge(B,C,E={}){var G=qe(B,C,E);return Q(B,C,"center-middle",E),H(B,C,void 0,E),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function(B,C,E={}){return st(C)?E=dt(E,["fill","stroke","width","height"]):E=dt(E,["fill","stroke"]),Y(B,C,E)},"bpmn:Association":function(B,C,E={}){return E=dt(E,["fill","stroke"]),Ge(B,C,E)},"bpmn:BoundaryEvent":function(B,C,E={}){var{renderIcon:G=!0}=E;E=dt(E,["fill","stroke"]);var q=de(C),ie=q.get("cancelActivity");E={strokeWidth:1.5,fill:rt(C,s,E.fill),fillOpacity:TP,stroke:Se(C,c,E.stroke)},ie||(E.strokeDasharray="6");var Me=Z(B,C,E);return h(B,C.width,C.height,ul,{...E,fill:"none"}),G&&D(C,B,E),Me},"bpmn:BusinessRuleTask":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=ge(B,C,E),q=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ie=v(B,q);we(ie,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1});var Me=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Xe=v(B,Me);return we(Xe,{fill:Se(C,c,E.stroke),stroke:Se(C,c,E.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,C,E={}){return E=dt(E,["fill","stroke"]),Y(B,C,{strokeWidth:5,...E})},"bpmn:ComplexGateway":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=oe(B,C,E),q=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return v(B,q,{fill:Se(C,c,E.stroke),stroke:Se(C,c,E.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=Re(B,C,E);return v(B,G,{fill:"none",stroke:Se(C,c,E.stroke),strokeWidth:1}),q},"bpmn:DataInputAssociation":function(B,C,E={}){return E=dt(E,["fill","stroke"]),Ge(B,C,{...E,markerEnd:d(B,"association-end",rt(C,s,E.fill),Se(C,c,E.stroke))})},"bpmn:DataObject":function(B,C,E={}){return E=dt(E,["fill","stroke"]),Re(B,C,E)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=Re(B,C,E);return v(B,G,{strokeWidth:1,fill:Se(C,c,E.stroke),stroke:Se(C,c,E.stroke)}),q},"bpmn:DataOutputAssociation":function(B,C,E={}){return E=dt(E,["fill","stroke"]),Ge(B,C,{...E,markerEnd:d(B,"association-end",rt(C,s,E.fill),Se(C,c,E.stroke))})},"bpmn:DataStoreReference":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return v(B,G,{fill:rt(C,s,E.fill),fillOpacity:va,stroke:Se(C,c,E.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,C,E={}){var{renderIcon:G=!0}=E;E=dt(E,["fill","stroke"]);var q=Z(B,C,{...E,strokeWidth:4});return G&&D(C,B,E),q},"bpmn:EventBasedGateway":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=de(C),q=oe(B,C,E);h(B,C.width,C.height,C.height*.2,{fill:rt(C,"none",E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1});var ie=G.get("eventGatewayType"),Me=!!G.get("instantiate");function Xe(){var qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});v(B,qt,{fill:"none",stroke:Se(C,c,E.stroke),strokeWidth:2})}if(ie==="Parallel"){var gt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});v(B,gt,{fill:"none",stroke:Se(C,c,E.stroke),strokeWidth:1})}else ie==="Exclusive"&&(Me||h(B,C.width,C.height,C.height*.26,{fill:"none",stroke:Se(C,c,E.stroke),strokeWidth:1}),Xe());return q},"bpmn:ExclusiveGateway":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=oe(B,C,E),q=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ie=ft(C);return ie.get("isMarkerVisible")&&v(B,q,{fill:Se(C,c,E.stroke),stroke:Se(C,c,E.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,C,E={}){return E=dt(E,["fill","stroke"]),oe(B,C,E)},"bpmn:Group":function(B,C,E={}){return E=dt(E,["fill","stroke","width","height"]),y(B,C.width,C.height,pl,{stroke:Se(C,c,E.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(C,E),height:ti(C,E)})},"bpmn:InclusiveGateway":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=oe(B,C,E);return h(B,C.width,C.height,C.height*.24,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,C,E={}){var{renderIcon:G=!0}=E;E=dt(E,["fill","stroke"]);var q=Z(B,C,{...E,strokeWidth:1.5});return h(B,C.width,C.height,ul,{fill:"none",stroke:Se(C,c,E.stroke),strokeWidth:1.5}),G&&D(C,B,E),q},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,C,E={}){return E=dt(E,["fill","stroke","width","height"]),W(B,C,{...E,fillOpacity:kP})},"bpmn:ManualTask":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=ge(B,C,E),q=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(B,q,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=de(C),q=ft(C),ie=rt(C,s,E.fill),Me=Se(C,c,E.stroke),Xe=m(B,C.waypoints,{markerEnd:d(B,"messageflow-end",ie,Me),markerStart:d(B,"messageflow-start",ie,Me),stroke:Me,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var gt=Xe.getPointAtLength(Xe.getTotalLength()/2),qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:gt.x,y:gt.y}}),Ct={strokeWidth:1};q.get("messageVisibleKind")==="initiating"?(Ct.fill=ie,Ct.stroke=Me):(Ct.fill=Me,Ct.stroke=ie);var mn=v(B,qt,Ct),Rn=G.get("messageRef"),Vn=Rn.get("name"),At=X(B,Vn,{align:"center-top",fitBox:!0,style:{fill:Me}}),Qt=mn.getBBox(),_n=At.getBBox(),Va=gt.x-_n.width/2,Wn=gt.y+Qt.height/2+MP;al(At,Va,Wn,0)}return Xe},"bpmn:ParallelGateway":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=oe(B,C,E),q=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return v(B,q,{fill:Se(C,c,E.stroke),stroke:Se(C,c,E.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,C,E={}){E=dt(E,["fill","stroke","width","height"]);var G=W(B,C,E),q=st(C),ie=xn(C),Me=de(C),Xe=Me.get("name");if(q){var gt=ie?[{x:30,y:0},{x:30,y:ti(C,E)}]:[{x:0,y:30},{x:_i(C,E),y:30}];x(B,gt,{stroke:Se(C,c,E.stroke),strokeWidth:AP}),Ve(B,Xe,C,E)}else{var qt=ws(C,E);ie||(qt.height=_i(C,E),qt.width=ti(C,E));var Ct=X(B,Xe,{box:qt,align:"center-middle",style:{fill:_s(C,l,c,E.stroke)}});if(!ie){var mn=-1*ti(C,E);al(Ct,0,-mn,270)}}return Me.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",B,C,E),G},"bpmn:ReceiveTask":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=de(C),q=ge(B,C,E),ie;return G.get("instantiate")?(h(B,28,28,20*.22,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1}),ie=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ie=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v(B,ie,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1}),q},"bpmn:ScriptTask":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=ge(B,C,E),q=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(B,q,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=ge(B,C,E),q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(B,q,{fill:Se(C,c,E.stroke),stroke:rt(C,s,E.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=rt(C,s,E.fill),q=Se(C,c,E.stroke),ie=m(B,C.waypoints,{markerEnd:d(B,"sequenceflow-end",G,q),stroke:q}),Me=de(C),{source:Xe}=C;if(Xe){var gt=de(Xe);Me.get("conditionExpression")&&M(gt,"bpmn:Activity")&&we(ie,{markerStart:d(B,"conditional-flow-marker",G,q)}),gt.get("default")&&(M(gt,"bpmn:Gateway")||M(gt,"bpmn:Activity"))&&gt.get("default")===Me&&we(ie,{markerStart:d(B,"conditional-default-flow-marker",G,q)})}return ie},"bpmn:ServiceTask":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=ge(B,C,E);h(B,10,10,{fill:rt(C,s,E.fill),stroke:"none",transform:"translate(6, 6)"});var q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(B,q,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1}),h(B,10,10,{fill:rt(C,s,E.fill),stroke:"none",transform:"translate(11, 10)"});var ie=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(B,ie,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,C,E={}){var{renderIcon:G=!0}=E;E=dt(E,["fill","stroke"]);var q=de(C);q.get("isInterrupting")||(E={...E,strokeDasharray:"6"});var ie=Z(B,C,E);return G&&D(C,B,E),ie},"bpmn:SubProcess":function(B,C,E={}){return st(C)?E=dt(E,["fill","stroke","width","height"]):E=dt(E,["fill","stroke"]),Y(B,C,E)},"bpmn:Task":function(B,C,E={}){return E=dt(E,["fill","stroke"]),ge(B,C,E)},"bpmn:TextAnnotation":function(B,C,E={}){E=dt(E,["fill","stroke"]);var{width:G,height:q}=ws(C,E),ie=y(B,G,q,0,0,{fill:"none",stroke:"none"}),Me=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:0,my:0}});v(B,Me,{stroke:Se(C,c,E.stroke)});var Xe=de(C),gt=Xe.get("text")||"";return X(B,gt,{align:"left-top",box:ws(C,E),padding:ya,style:{fill:_s(C,l,c,E.stroke)}}),ie},"bpmn:Transaction":function(B,C,E={}){st(C)?E=dt(E,["fill","stroke","width","height"]):E=dt(E,["fill","stroke"]);var G=Y(B,C,{strokeWidth:1.5,...E}),q=n.style(["no-fill","no-events"],{stroke:Se(C,c,E.stroke),strokeWidth:1.5}),ie=st(C);return ie||(E={}),y(B,_i(C,E),ti(C,E),pl-ul,ul,q),G},"bpmn:UserTask":function(B,C,E={}){E=dt(E,["fill","stroke"]);var G=ge(B,C,E),q=15,ie=12,Me=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:q,y:ie}});v(B,Me,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:q,y:ie}});v(B,Xe,{fill:rt(C,s,E.fill),stroke:Se(C,c,E.stroke),strokeWidth:.5});var gt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:q,y:ie}});return v(B,gt,{fill:Se(C,c,E.stroke),stroke:Se(C,c,E.stroke),strokeWidth:.5}),G},label:function(B,C,E={}){return ee(B,C,E)}};this._drawPath=v,this._renderer=S}Ce(Rr,uo),Rr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Rr.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},Rr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Rr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Rr.prototype.getShapePath=function(e){return Je(e)?kf(e,PP):M(e,"bpmn:Event")?gv(e):M(e,"bpmn:Activity")?kf(e,pl):M(e,"bpmn:Gateway")?SP(e):RP(e)};function dt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var OP=0,DP={width:150,height:50};function LP(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function IP(e){return fn(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Of=null;function BP(){return Of||(Of=document.createElement("canvas").getContext("2d")),Of}function NP(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(mv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function mv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function $P(e,t){var n=BP();if(!n)return{width:0,height:0};n.font=NP(t),"letterSpacing"in n&&(n.letterSpacing=mv(t.letterSpacing)||"0px");var i=e==="",o=i?"dummy":e.replace(/\s+$/,""),r=n.measureText(o);return{width:i?0:r.width,height:"fontBoundingBoxAscent"in r?r.fontBoundingBoxAscent+r.fontBoundingBoxDescent:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent}}function FP(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=$P(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return jP(e,o,i,r);o=zP(o,r.width,t)}}function jP(e,t,n,i){if(t.length<n.length){var o=n.slice(t.length).trim();e.unshift(o)}return{width:i.width,height:i.height,text:t}}var yv="­";function HP(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,o=[],r=0;if(n.length>1)for(;i=n.shift();)if(i.length+r<t)o.push(i),r+=i.length;else{(i==="-"||i===yv)&&o.pop();break}var a=o[o.length-1];return a&&a===yv&&(o[o.length-1]="-"),o.join("")}function zP(e,t,n){var i=Math.max(e.length*(n/t),1),o=HP(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function fl(e){this._config=V({},{size:DP,padding:OP,style:{},align:"center-top"},e||{})}fl.prototype.createText=function(e,t){return this.layoutText(e,t).element},fl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},fl.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),o=LP(t.align||this._config.align),r=IP(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=GP(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(FP(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=Qn(l,function(y,_,x){return y+(s||_.height)},0)+r.top+r.bottom,f=Qn(l,function(y,_,x){return _.width>y?_.width:y},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");we(g,i),z(l,function(y){var _;switch(d+=s||y.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?f:u)-r.right-y.width;break;default:_=Math.max(((a?f:u)-y.width)/2+r.left,0)}var x=Oe("tspan");we(x,{x:_,y:d}),x.textContent=y.text,ze(g,x)});var h={width:f,height:p};return{dimensions:h,element:g}};function GP(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var VP=12,WP=1.2,UP=40;function vv(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:VP,fontWeight:"normal",lineHeight:WP},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),o=new fl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Sr.width),height:30},l=r(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=r(s,a,{style:t,align:"left-top",padding:ya});return{x:a.x,y:a.y,width:a.width,height:Math.max(UP,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}vv.$inject=["config.textRenderer"];function qP(){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],o,r;n.abspos?(o=n.abspos.x,r=n.abspos.y):(o=n.containerWidth*n.position.mx,r=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,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=ZP(i.d,{mx:o,my:r,e:a});return p}}var YP=/\{([^{}]+)\}/g,KP=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function XP(e,t,n){var i=n;return t.replace(KP,function(o,r,a,s,c){r=r||s,i&&(r in i&&(i=i[r]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function ZP(e,t){return String(e).replace(YP,function(n,i){return XP(n,i,t)})}const QP={__init__:["bpmnRenderer"],bpmnRenderer:["type",Rr],textRenderer:["type",vv],pathMap:["type",qP]};function JP(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Es={translate:["value",JP]};function dl(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function eT(e,t,n){var i=e.waypoint;return!i||i.length<2?[je(t),je(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function bv(e,t,n){return new Error(`element ${Fn(t)} referenced by ${Fn(e)}#${n} not yet drawn`)}function go(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}go.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],go.prototype.add=function(e,t,n){var i,o,r;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(dl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!st(e,t),c=nT(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(dl(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(r=0),M(e,"bpmn:DataStoreReference")&&(tT(n,je(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(dl(e,t,{hidden:o,source:u,target:p,waypoints:eT(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Fn(t)} for element ${Fn(e)}`);return Go(e)&&yi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},go.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Fn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw bv(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},go.prototype.addLabel=function(e,t,n){var i,o,r;return i=yP(t,n),o=yi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(dl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!yi(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(r,n.parent)},go.prototype._getConnectedElement=function(e,t){var n,i,o=e.$type;if(i=e[t+"Ref"],t==="source"&&o==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&o==="bpmn:DataOutputAssociation"||t==="target"&&o==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?bv(e,i,t+"Ref"):new Error(`${Fn(e)}#${t} Ref not specified`)},go.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},go.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},go.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function tT(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 nT(e){return M(e,"bpmn:Group")}const xv={__depends__:[QP,{__depends__:[Es],bpmnImporter:["type",go]}]};function Ss(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Bi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Df(e){return Math.log(e)/Math.log(10)}var iT=1e3;function pe(e){this._eventBus=e}pe.$inject=["eventBus"];function oT(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}pe.prototype.on=function(e,t,n,i,o,r){if((yn(t)||Fe(t))&&(r=o,o=i,i=n,n=t,t=null),yn(n)&&(r=o,o=i,i=n,n=iT),fn(o)&&(r=o,o=!1),!yn(i))throw new Error("handlerFn must be a function");$e(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?oT(i,r):i,r)})},pe.prototype.canExecute=mo("canExecute"),pe.prototype.preExecute=mo("preExecute"),pe.prototype.preExecuted=mo("preExecuted"),pe.prototype.execute=mo("execute"),pe.prototype.executed=mo("executed"),pe.prototype.postExecute=mo("postExecute"),pe.prototype.postExecuted=mo("postExecuted"),pe.prototype.revert=mo("revert"),pe.prototype.reverted=mo("reverted");function mo(e){return function(n,i,o,r,a){(yn(n)||Fe(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Lf=["top","bottom","left","right"],hl=10;function If(e,t){pe.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(ll(o)&&!Pt(o)){var r=sT(o);r&&i(o,r)}}function i(o,r){var a=je(o),s=o.label,c=je(s);if(s.parent){var l=Be(o),u;switch(r){case"top":u={x:a.x,y:l.top-hl-s.height/2};break;case"left":u={x:l.left-hl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+hl+s.height/2};break;case"right":u={x:l.right+hl+s.width/2,y:a.y};break}var p=Bi(u,c);t.moveShape(s,p)}}}Ce(If,pe),If.$inject=["eventBus","modeling"];function rT(e){var t=e.host,n=je(e),i=kn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Lf.filter(function(a){return o.indexOf(a)===-1});return r}function aT(e){var t=je(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 _v(t,i)});return n}function sT(e){var t=je(e.label),n=je(e),i=_v(n,t);if(cT(i)){var o=aT(e);if(e.host){var r=rT(e);o=o.concat(r)}var a=Lf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?kn(e.label,e)!=="intersect"?void 0:i:a[0]}}function _v(e,t){return kn(t,e,5)}function cT(e){return Lf.indexOf(e)!==-1}function Bf(e){pe.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(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)}Ce(Bf,pe),Bf.$inject=["eventBus"];var lT=1500;function Nf(e,t,n){e.invoke(pe,this),this.preExecute("elements.delete",lT,function(o){var r=o.context,a=r.elements,s=i(a);s.length&&(r.elements=a.concat(s))}),t.on("shape.move.start",function(o){var r=o.context.shapes,a=i(r);a.length&&(o.context.shapes=r.concat(a))});function i(o){var r=it(o,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(r,l=>{const u=new Set(Kr(fa(Array.from(s),rn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ce(Nf,pe),Nf.$inject=["injector","eventBus","canvas"];function $f(e,t){e.invoke(pe,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=it(o.incoming.concat(o.outgoing),function(a){return M(a,"bpmn:Association")});z(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ce($f,pe),$f.$inject=["injector","modeling"];function ba(e,t){for(Xn(t)&&(t=[t]);e=e.parent;)if(tt(e,t))return e;return null}function wv(e,t){var n=ba(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ba(e,i),n)return xn(n);if(tt(e,i))return xn(e);var o;for(o=de(e);o&&!M(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=de(a);return s&&s.get("processRef")===o});return r?xn(r):!0}var Ev=500;function gl(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ev,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Sv(r,a)}),o.length===1&&o.map(function(r){return o.indexOf(r)}).forEach(function(r){var a=o[r];i.elements[r]=n._replaceShape(o[r],a)})},!0),this.preExecute("elements.move",Ev,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Sv(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}gl.$inject=["bpmnReplace","injector"],Ce(gl,pe),gl.prototype._replaceShape=function(e,t){var n=uT(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function uT(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function Sv(e,t){return!Je(e)&&tt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ff(e,t){pe.call(this,e);function n(i){return it(i.attachers,function(o){return M(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);M(o,"bpmn:EventBasedGateway")&&M(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;M(o,"bpmn:Gateway")&&M(r,"bpmn:EventBasedGateway")&&z(r.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Ff.$inject=["eventBus","modeling"],Ce(Ff,pe);function Rv(e){return e.create("bpmn:Category")}function pT(e){return e.create("bpmn:CategoryValue")}function Cv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=pT(e)),n.$parent||(n.$parent=Rv(e)),n}function fT(e,t,n){return tn(t.get("categoryValue"),e),e.$parent=t,tn(n.get("rootElements"),t),t.$parent=n,e}function dT(e){var t=e.$parent;return t&&(Zt(t.get("categoryValue"),e),e.$parent=null),e}function hT(e){var t=e.$parent;return t&&(Zt(t.get("rootElements"),e),e.$parent=null),e}var gT=500;function jf(e,t,n){n.invoke(pe,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(de).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&fT(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&hT(l),c&&!o(c,u)&&dT(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.executed(["shape.move","shape.resize"],gT,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,de(l))},!0),this.executed("group.updateRefs",function(c){Mv(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Mv(c).forEach(function(l){s(l.categoryValue,l.category,de(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}jf.$inject=["bpmnjs","elementRegistry","injector"],Ce(jf,pe);function Mv(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Hf(e,t,n){pe.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const _=y.source,x=y.target;xa(_)&&Rs(x)&&u(x)}function o(y){const _=y.connection,x=y.source,m=y.target;xa(x)&&ml(m)&&(l(m),f(x,[_]))}function r(y){const _=y.newTarget,x=y.oldSource,m=y.oldTarget;if(m!==_){const v=x;Rs(m)&&u(m),xa(v)&&ml(_)&&l(_)}}function a(y){const{element:_}=y;Rs(_)?(p(_),d(_)):ml(_)&&g(_)}function s(y){const{newData:_,oldShape:x}=y;if(xa(y.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>Rs(v));m&&m.target&&(y._connectionTarget=m.target)}else if(!xa(y.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>ml(v));m&&m.target&&(y._connectionTarget=m.target),h(x)}}function c(y){const{_connectionTarget:_,newShape:x}=y;_&&t.connect(x,_)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const _ of y.incoming)n.canConnect(_.source,y)||t.removeConnection(_);for(const _ of y.outgoing)n.canConnect(y,_.target)||t.removeConnection(_)}function f(y,_){y.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>Rs(v.target)&&!_.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const _=y.attachers.slice();_.length&&t.removeElements(_)}function g(y){const _=y.incoming.filter(x=>xa(x.source));t.removeElements(_)}function h(y){const _=y.outgoing.filter(x=>M(x,"bpmn:SequenceFlow"));t.removeElements(_)}}Ce(Hf,pe),Hf.$inject=["eventBus","modeling","bpmnRules"];function Rs(e){const t=de(e);return t&&t.get("isForCompensation")}function xa(e){return e&&M(e,"bpmn:BoundaryEvent")&&ma(e,"bpmn:CompensateEventDefinition")}function ml(e){return e&&M(e,"bpmn:Activity")&&!jn(e)}function zf(e){e.invoke(pe,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;M(i,"bpmn:Lane")&&!M(o,"bpmn:Lane")&&(n.parent=ba(i,"bpmn:Participant"))})}zf.$inject=["injector"],Ce(zf,pe);function Gf(e,t){pe.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(M(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}Gf.$inject=["eventBus","bpmnFactory"],Ce(Gf,pe);var Vf=20,Wf=20,Av=30,yl=2e3;function Uf(e,t,n){pe.call(this,t),t.on(["create.start","shape.move.start"],yl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!Je(p)&&!Pt(p)});if(c.length){var l=rn(c),u=mT(a,l);V(a,u),r.createConstraints=yT(a,l)}}}),t.on("create.start",yl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",yl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return M(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",yl,function(o){var r=o.elements,a=o.parent,s=vT(r),c;s&&M(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=de(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;M(a,"bpmn:Participant")&&M(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=de(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&de(s).set("processRef",de(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&de(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Uf.$inject=["canvas","eventBus","modeling"],Ce(Uf,pe);function mT(e,t){t={width:t.width+Vf*2+Av,height:t.height+Wf*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 yT(e,t){return t=Be(t),{bottom:t.top+e.height/2-Wf,left:t.right-e.width/2+Vf,top:t.bottom-e.height/2+Wf,right:t.left+e.width/2-Vf-Av}}function vT(e){return Ot(e,function(t){return M(t,"bpmn:Participant")})}var Pv="__targetRef_placeholder";function qf(e,t){pe.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Tv(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Tv(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Ot(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Ot(c,function(u){return u.name===Pv});return!l&&s&&(l=t.create("bpmn:Property",{name:Pv}),tn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||Zt(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,_;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(_=i(p,!0),y.targetRef=_):y.targetRef=null}}qf.$inject=["eventBus","bpmnFactory"],Ce(qf,pe);function Tv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function vl(e){this._bpmnUpdater=e}vl.$inject=["bpmnUpdater"],vl.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},vl.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,o=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]};function Yf(e,t,n,i){pe.call(this,i),t.registerHandler("dataStore.updateContainment",vl);function o(){return n.filter(function(s){return M(s,"bpmn:Participant")&&de(s).processRef})[0]}function r(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ft(s),newSemanticParent:u.processRef||u,newDiParent:ft(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:xT(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();tt(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&r(u).filter(function(p){return bT(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=r(l);p.forEach(function(f){M(u,"bpmn:Process")&&a(f,u)})})}Yf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ce(Yf,pe);function bT(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 xT(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var bl=Math.max,xl=Math.min,_T=20;function kv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function wT(e,t,n){var i=n.x,o=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+o,r.height=e.height-o):t.indexOf("s")!==-1&&(r.height=e.height+o),t.indexOf("e")!==-1?r.width=e.width+i:t.indexOf("w")!==-1&&(r.x=e.x+i,r.width=e.width-i),r}function ET(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 _l(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Fe(o)&&(i=(/top|left/.test(e)?xl:bl)(i,o)),Fe(r)&&(i=(/top|left/.test(e)?bl:xl)(i,r)),i}function ST(e,t){if(!t)return e;var n=Be(e);return il({top:_l("top",n,t),right:_l("right",n,t),bottom:_l("bottom",n,t),left:_l("left",n,t)})}function RT(e,t,n,i){var o=Be(t),r={top:/n/.test(e)?o.bottom-n.height:o.top,left:/w/.test(e)?o.right-n.width:o.left,bottom:/s/.test(e)?o.top+n.height:o.bottom,right:/e/.test(e)?o.left+n.width:o.right},a=i?Be(i):r,s={top:xl(r.top,a.top),left:xl(r.left,a.left),bottom:bl(r.bottom,a.bottom),right:bl(r.right,a.right)};return il(s)}function Cs(e,t){return typeof e<"u"?e:_T}function CT(e,t){var n,i,o,r;return typeof t=="object"?(n=Cs(t.left),i=Cs(t.right),o=Cs(t.top),r=Cs(t.bottom)):n=i=o=r=Cs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function MT(e){return!(e.waypoints||e.type==="label")}function Ov(e,t){var n;if(e.length===void 0?n=it(e.children,MT):n=e,n.length)return CT(rn(n),t)}var Vo=Math.abs;function AT(e,t){return kv(Be(t),Be(e))}var PT=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function wl(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(wl(n,t),t.push(n))}),t}function Wo(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ei(e){return ba(e,PT)||e}function TT(e,t){var n=Ei(e),i=M(n,"bpmn:Process")?[]:[n],o=wl(n,i),r=Be(e),a=Be(t),s=AT(e,t),c=[],l=xn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Be(u);s.top&&(Vo(h.bottom-r.top)<10&&(d=a.top-h.bottom),Vo(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Vo(h.right-r.left)<10&&(f=a.left-h.right),Vo(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Vo(h.top-r.bottom)<10&&(p=a.bottom-h.top),Vo(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Vo(h.left-r.right)<10&&(g=a.right-h.left),Vo(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:ET(u,{top:p,right:f,bottom:d,left:g})})}}),c}var kT=500;function Kf(e,t){pe.call(this,e);function n(i,o){var r=xn(i),a=Wo(o),s=[],c=[],l=[],u=[];if(Er(a,function(y){return r?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",kT,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;M(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Kf.$inject=["eventBus","spaceTool"],Ce(Kf,pe);var Dv=500;function El(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Dv,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Lv(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Dv,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Lv(a,DT(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}El.$inject=["bpmnReplace","injector"],Ce(El,pe),El.prototype._replaceShape=function(e){var t=OT(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function OT(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function Lv(e,t){return!Je(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function DT(e,t){return e.indexOf(t)!==-1}var Sl=Math.round,LT=Math.max;function IT(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 BT(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Iv=10;function NT(e,t){var n,i;for(n=0;i=e[n];n++)if(ms(i,t)<=Iv)return{point:e[n],bendpoint:!0,index:n};return null}function $T(e,t){var n=jy(IT(t,Iv),BT(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=LT(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Sl(i.x+o.x)/2,y:Sl(i.y+o.y)/2},index:i.segment2}:{point:{x:Sl(i.x),y:Sl(i.y)},index:i.segment2}:null}function Xf(e,t){return NT(e,t)||$T(e,t)}function Zf(e,t,n){pe.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,f,d,g,h=o.outgoing.slice(),y=o.incoming.slice(),_;Fe(a.width)?_=je(a):_=a;var x=Xf(s,_);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:_,(c.length===1||!Bv(o,c[c.length-1]))&&c.push(Nv(u)),(l.length===1||!Bv(o,l[0]))&&l.unshift(Nv(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),g=r));var m=[].concat(d&&it(y,function(v){return v.source===d.source})||[],g&&it(h,function(v){return v.target===g.target})||[]);m.length&&n.removeElements(m)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=je(c),u={x:l.x+s.x,y:l.y+s.y},p=Ot(r.children,function(f){var d=t.canInsert(a,f);return d&&Xf(f.waypoints,u)});p&&(o.targetFlow=p,o.position=u)}},!0),this.postExecuted("elements.move",function(o){var r=o.shapes,a=o.targetFlow,s=o.position;a&&i(r[0],a,s)},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;t.canInsert(a,r)&&(o.targetFlow=r,o.parent=r.parent)},!0),this.postExecuted("shape.create",function(o){var r=o.shape,a=o.targetFlow,s=o.position;a&&i(r,a,s)},!0)}Ce(Zf,pe),Zf.$inject=["eventBus","bpmnRules","modeling"];function Bv(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 Nv(e){return V({},e)}function Qf(e,t){pe.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&_a(o)){var c=[];M(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&_a(l)):c=a.incoming.filter(l=>l!==o&&_a(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(M(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(_a).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(_a).forEach(function(s){const c=a.incoming.filter(_a).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}Qf.$inject=["eventBus","modeling"],Ce(Qf,pe);function _a(e){return M(e,"bpmn:SequenceFlow")}var Rl=1500,$v=2e3;function Fv(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"],Rl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!tt(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||tt(r,["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"],Rl,function(i){var o=i.hover;M(o,"bpmn:Lane")&&(i.hover=Ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Rl,function(i){var o=i.context,r=i.hover,a=o.type;M(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Rl,function(i){var o=i.context,r=o.start;M(r,"bpmn:Lane")&&(o.start=Ei(r)||r)}),t.on("shape.move.start",$v,function(i){var o=i.shape;M(o,"bpmn:Lane")&&(i.shape=Ei(o)||o)}),t.on("spaceTool.move",$v,function(i){var o=i.hover;o&&M(o,"bpmn:Lane")&&(i.hover=Ei(o))})}Fv.$inject=["elementRegistry","eventBus","canvas"];var jv=770;function Jf(e,t,n,i){n.invoke(pe,this);function o(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef;u||(u=Cv(e,l));var p=c.category||u.$parent||Rv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=de(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=de(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||de(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",jv,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=de(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",jv,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,p=c.category;u&&(u=l.categoryValueRef=a(u)),p&&(u.$parent=a(p)),delete c.category,delete c.categoryValue})}Jf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ce(Jf,pe);function ed(e,t,n,i){var o,r,a,s,c;return o=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),o==0?null:(r=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*r-(i.y-n.y)*a,s=c/o,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Hv(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=ed(i,o,r,a),l=ed(i,o,r,s),u;c&&l?zv(c,r)>zv(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],je(i.source)),t(o[o.length-1],o[o.length-2],je(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Hv.$inject=["eventBus"];function zv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function td(e){pe.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=de(i),r=ft(i);if(tt(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}td.$inject=["eventBus"],Ce(td,pe);function Gv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Vv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function FT(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 jT(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],o=i[0].n*t[0]+i[1].n*t[1],r=i[0].lambda*t[0]+i[1].lambda*t[1];return-o/r}function nd(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=jT([n.x,n.y],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function Wv(e,t){var n=nd(e,t),i={x:n.x-e.x,y:n.y-e.y};return Gv(i)}function Ms(e,t){return Gv({x:e.x-t.x,y:e.y-t.y})}var Uv=Math.sqrt,qv=Math.min,HT=Math.max,Yv=Math.abs;function Kv(e){return Math.pow(e,2)}function As(e,t){return Uv(Kv(e.x-t.x)+Kv(e.y-t.y))}function zT(e,t){var n=0,i,o,r,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],Zv(i,o)?l=[i]:(r=As(e,i),a=As(e,o),c=qv(r,a),l=GT(i,o,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Zv(i,l[0])?n:n+1}),l.length===2&&(s=WT(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:As(i,s)/As(i,o)}),p=As(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function GT(e,t,n,i){var o=t.x-e.x,r=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=o*o+r*r,l=o*a+r*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=Uv(d),h=-p+g,y=-p-g,_={x:e.x-o*h,y:e.y-r*h};if(d===0)return[_];var x={x:e.x-o*y,y:e.y-r*y};return[_,x].filter(function(m){return VT(m,e,t)})}function VT(e,t,n){return Xv(e.x,t.x,n.x)&&Xv(e.y,t.y,n.y)}function Xv(e,t,n){return e>=qv(t,n)-Cl&&e<=HT(t,n)+Cl}function WT(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Cl=.1;function Zv(e,t){return Yv(e.x-t.x)<=Cl&&Yv(e.y-t.y)<=Cl}function UT(e,t,n,i){var o=n.segmentIndex,r=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return o===a?s:o>=s?o+r<s?s:o+r:o}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(r===0)return o;if(o>=l&&(u=c?o+1:o-1),o<l&&(u=o,c&&n.type!=="bendpoint"&&l-1===o)){var p=Jv(t,l);p<n.relativeLocation&&u++}return u}return r===0?o:i.connectionStart&&o===0?0:i.connectionEnd&&o===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Qv(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=zT(e,n),c=s.segmentIndex,l=UT(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=eb(n,c),p=eb(t,l),f=s.position,d=YT(u,f),g=qT(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,_=n[y];if(t.indexOf(_)!==-1)return a;if(h===0){var x=t[y];return o=x.x-s.position.x,r=x.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&y!==0&&y<n.length-1&&(d=Jv(n,y))}var m={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=FT({x:e.x-f.x,y:e.y-f.y},g);return o=m.x+v.x-e.x,r=m.y+v.y-e.y,{point:fo(m),delta:fo({x:o,y:r})}}function Jv(e,t){var n=Ms(e[t-1],e[t]),i=Ms(e[t],e[t+1]),o=n/(n+i);return o}function qT(e,t){var n=Vv(e),i=Vv(t);return i-n}function eb(e,t){return[e[t],e[t+1]]}function YT(e,t){var n=Ms(e[0],e[1]),i=Ms(e[0],t);return n===0?0:i/n}function KT(e,t,n,i){var o=je(e);return Qv(o,t,n,i).delta}function Ps(e,t,n){var i=Ss(t),o=Ss(n),r=Bi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return fo({x:o.x+a.x,y:o.y+a.y})}function tb(e,t,n){var i=Ss(e),o=Ss(t),r=Ss(n),a=Bi(e,i),s=Bi(i,o),c=XT(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:r.x+l.x,y:r.y+l.y};return fo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function XT(e,t,n){var i=Be(t),o=Be(n);if(ZT(i,o))return null;var r=kn(t,e),a,s,c;if(r==="top")a={x:0,y:o.bottom-i.bottom};else if(r==="bottom")a={x:0,y:o.top-i.top};else if(r==="right")a={x:o.left-i.left,y:0};else if(r==="left")a={x:o.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=kn(n,s),c!==r?null:a}function ZT(e,t){return QT(e,t)||JT(e,t)}function QT(e,t){return e.right!==t.right&&e.left!==t.left}function JT(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var nb="name",ib="text";function id(e,t,n,i){pe.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{de(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(nb in l&&t.updateLabel(c,l[nb]),ib in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[ib]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Je(l)||!Go(l)||yi(l)&&t.updateLabel(l,yi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function r(a){var s=a.context,c=s.connection,l=c.label,u=V({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),KT(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=de(c);u&&Go(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Je(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(yi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(ll(c)){var p=c.label,f=je(p),d=nk(u),g=tk(f,d),h=ek(g,u,l);t.moveShape(p,h)}})}Ce(id,pe),id.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function ek(e,t,n){var i=Ps(e,t,n);return fo(Bi(i,e))}function tk(e,t){if(t.length){var n=ik(e,t);return nd(e,n)}}function nk(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 ik(e,t){var n=t.map(function(o){return{line:o,distance:Wv(e,o)}}),i=Hi(n,"distance");return i[0].line}function ok(e,t,n,i){return Qv(e,t,n,i).point}function od(e,t){pe.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=V({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),ok(o,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming,c=o.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ce(od,pe),od.$inject=["eventBus","modeling"];function Ml(e,t,n){var i=Pl(e),o=rb(i,t),r=i[0];return o.length?o[o.length-1]:Ps(r.original||r,n,t)}function Al(e,t,n){var i=Pl(e),o=rb(i,t),r=i[i.length-1];return o.length?o[0]:Ps(r.original||r,n,t)}function rd(e,t,n){var i=Pl(e),o=ob(t,n),r=i[0];return Ps(r.original||r,o,t)}function ad(e,t,n){var i=Pl(e),o=ob(t,n),r=i[i.length-1];return Ps(r.original||r,o,t)}function ob(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Pl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function rb(e,t){var n=Bn(e,ak);return it(n,function(i){return rk(i,t)})}function rk(e,t){return kn(t,e,1)==="intersect"}function ak(e){return e.original||e}function sd(e,t){pe.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(sk(i,o)){var r=ck(i);r.incoming.forEach(function(a){var s=Al(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Ml(a,o,i);t.reconnectStart(a,o,s)})}},!0)}sd.$inject=["eventBus","modeling"],Ce(sd,pe);function sk(e,t){return M(e,"bpmn:Participant")&&st(e)&&M(t,"bpmn:Participant")&&!st(t)}function ck(e){var t=hs([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){M(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){M(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const lk=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ab(e){const t=de(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&jn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:lk.some(i=>M(n[0],i))}function sb(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function cd(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!ab(o))return;const a=sb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=de(i).get(a),l=de(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}cd.$inject=["injector","modeling"],Ce(cd,pe);function ld(e,t){pe.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=ft(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ce(ld,pe),ld.$inject=["eventBus","modeling"];function ud(e,t,n){pe.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!M(r,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=uk(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ce(ud,pe),ud.$inject=["eventBus","bpmnRules","modeling"];function wa(e){return e.original||e}function uk(e,t){var n=ed(wa(e[e.length-2]),wa(e[e.length-1]),wa(t[1]),wa(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[wa(e[0]),wa(t[t.length-1])]}function pd(e,t){pe.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;M(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}pd.$inject=["eventBus","modeling"],Ce(pd,pe);function fd(e,t,n,i){pe.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,o&&s(u,g))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Ot(p.outgoing,Zr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Ce(fd,pe),fd.$inject=["eventBus","modeling","bpmnRules","injector"];function Tl(e,t,n,i,o,r){i.invoke(pe,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Qn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){jn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Ce(Tl,pe),Tl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;z(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},Tl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var pk=1500,fk={width:140,height:120},dd={width:300,height:60},hd={width:60,height:300},kl={width:300,height:150},Ol={width:150,height:300},cb={width:140,height:120},lb={width:100,height:40};function ub(e){e.on("resize.start",pk,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=yk(i,o,r)),M(i,"bpmn:SubProcess")&&st(i)&&(n.minDimensions=cb),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=lb)})}ub.$inject=["eventBus"];var Uo=Math.abs,dk=Math.min,hk=Math.max;function pb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ea(e,t,n){return pb(e,t,n,dk)}function Sa(e,t,n){return pb(e,t,n,hk)}var gk={top:20,left:50,right:20,bottom:20},mk={top:50,left:20,right:20,bottom:20};function yk(e,t,n){var i=Ei(e),o=!0,r=!0,a=wl(i,[i]),s=Be(e),c={},l={},u=xn(e),p=u?dd:hd;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Be(g);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&Uo(s.top-h.bottom)<10&&Sa(c,"top",h.top+p.height),Uo(s.top-h.top)<5&&Ea(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Uo(s.right-h.left)<10&&Ea(c,"right",h.right-p.width),Uo(s.right-h.right)<5&&Sa(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Uo(s.bottom-h.top)<10&&Ea(c,"bottom",h.bottom-p.height),Uo(s.bottom-h.bottom)<5&&Sa(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Uo(s.left-h.right)<10&&Sa(c,"left",h.left+p.width),Uo(s.left-h.left)<5&&Ea(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?gk:mk;return f.forEach(function(g){var h=Be(g);/n/.test(t)&&(!u||o)&&Ea(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Sa(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Sa(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Ea(l,"left",h.left-d.left)}),{min:l,max:c}}function fb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ra(e){return e.originalEvent||e.srcEvent}function gd(e){fb(e),fb(Ra(e))}function Cr(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 db(){return/mac/i.test(navigator.platform)}function hb(e,t){return(Ra(e)||e).button===t}function qo(e){return hb(e,0)}function vk(e){return hb(e,1)}function Ts(e){var t=Ra(e)||e;return qo(e)?db()?t.metaKey:t.ctrlKey:!1}function Dl(e){var t=Ra(e)||e;return qo(e)&&t.shiftKey}var gb=1001;function mb(e,t){e.on("resize.start",gb+500,function(n){var i=n.context,o=i.shape;(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))&&(i.balanced=!Ts(n))}),e.on("resize.end",gb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))return r&&(a=Wy(a),t.resizeLane(o,a,i.balanced)),!1})}mb.$inject=["eventBus","modeling"];var bk=500;function md(e,t,n,i,o){n.invoke(pe,this);function r(u){return tt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||xk(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Ot(f,Zr({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var f=de(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),tn(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Zt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=de(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",bk,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,o.create(d.$type))),l(f,d),delete p.referencedRootElement)})}md.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ce(md,pe);function xk(e,t){return $e(t)||(t=[t]),Po(t,function(n){return ma(e,n)})}var yb=Math.max;function vb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(r[s]=wk(a,i,o)),M(a,"bpmn:Lane")&&(r[s]=xn(a)?dd:hd),M(a,"bpmn:SubProcess")&&st(a)&&(r[s]=cb),M(a,"bpmn:TextAnnotation")&&(r[s]=lb),M(a,"bpmn:Group")&&(r[s]=fk)}),r})}vb.$inject=["eventBus"];function _k(e){return e==="x"}function wk(e,t,n){var i=xn(e);if(!Rk(e))return i?kl:Ol;var o=_k(t),r={};return o?i?r=kl:r={width:Sk(e,n,o),height:Ol.height}:i?r={width:kl.width,height:Ek(e,n,o)}:r=Ol,r}function Ek(e,t,n){var i;return i=Ck(e,t,n),yb(kl.height,i)}function Sk(e,t,n){var i;return i=Mk(e,t,n),yb(Ol.width,i)}function Rk(e){return!!Wo(e).length}function Ck(e,t,n){var i=Wo(e),o;return o=yd(i,t,n),e.height-o.height+dd.height}function Mk(e,t,n){var i=Wo(e),o;return o=yd(i,t,n),e.width-o.width+hd.width}function yd(e,t,n){var i,o,r;for(i=0;i<e.length;i++)if(o=e[i],!n&&t>=o.y&&t<=o.y+o.height||n&&t>=o.x&&t<=o.x+o.width)return r=Wo(o),r.length?yd(r,t,n):o}var bb="_plane";function xb(e){var t=e.id;return Ak(t)}function Qi(e){var t=e.id;return M(e,"bpmn:SubProcess")?_b(t):t}function Mr(e){return _b(e)}function Ll(e){var t=ft(e);return M(t,"bpmndi:BPMNPlane")}function _b(e){return e+bb}function Ak(e){return e.replace(new RegExp(bb+"$"),"")}var wb=400,Pk=600,Eb={x:180,y:160};function yo(e,t,n,i,o,r,a){pe.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return M(p,"bpmn:SubProcess")&&!st(p)}function l(p){var f=p.shape,d=p.newRootElement,g=de(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=de(f);s._removeDiagram(d);var g=p.newRootElement=a.get(Qi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;z(f,function(d){if(c(d)){var g=a.get(Qi(d));if(!(!g||!d.children||!d.children.length)){var h=Sb(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!st(f)||z(xs([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Qi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Qi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(Qi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(Ll(f)){a.updateId(f,Mr(y)),a.updateId(h,y);return}var _=a.get(Mr(h));_&&a.updateId(Mr(h),Mr(y))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(Ll(f)){a.updateId(f,Mr(h)),a.updateId(y,h);return}var _=a.get(Mr(y));_&&a.updateId(_,Mr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Ll(f)){var d=f,g=a.get(xb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",wb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(st(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",wb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(st(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",Pk,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(st(f))s._moveChildrenToShape(d.children.slice(),f),z(xs(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),z(h.associations,y=>{n.moveConnection(y,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Sb(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=Qi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,y=M(ft(h),"bpmndi:BPMNPlane");if(y){var _=xb(h),x=Ot(g,function(m){return m.id===_});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ce(yo,pe),yo.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 o=rn(i),r;if(!t.x)r={x:Eb.x-o.x,y:Eb.y-o.y};else{var a=je(t),s=je(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},yo.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(hv(e).map(i=>i.annotation));n.size&&z(xs(e.children),i=>{n.has(i.annotation)&&z(i.associations,o=>{t.removeConnection(o)})})},yo.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(o){o.hidden=!!t,i=i.concat(o),o.children&&(i=i.concat(n._showRecursively(o.children,o.collapsed||t)))}),i},yo.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},yo.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:Qi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},yo.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ot(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},yo.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function Tk(e){var t=[];return z(xs(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Sb(e){return e.children.slice().concat(Tk(e.children)).concat(kk(e))}function kk(e){return wf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function vd(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!M(o,"bpmn:SubProcess")||M(o,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!st(o))){var r=Ok(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}vd.$inject=["injector","modeling"],Ce(vd,pe);function Ok(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function bd(e,t){pe.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(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&&M(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!M(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,yi(o)||""),c=a.y!==o.y&&Math.abs(a.y+a.height-(o.y+o.height))<=1,l=o.y+o.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ce(bd,pe),bd.$inject=["eventBus","textRenderer"];function xd(e,t){pe.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(st(i))return;var o=hs(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){r(l,!0)}),z(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,je(i)):t.reconnectStart(a,i,je(i)))}},!0)}Ce(xd,pe),xd.$inject=["eventBus","modeling"];var _d=500;function wd(e,t,n){pe.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=Dk(c).concat([a]),p=Ov(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function r(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"],_d,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?ft(c).isExpanded=!1:(i(c.children),ft(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],_d,function(a){var s=a.context,c=s.shape;c.collapsed?ft(c).isExpanded=!1:ft(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],_d,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=r(s,c):l=o(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ce(wd,pe),wd.$inject=["eventBus","elementFactory","modeling"];function Dk(e){return e.filter(function(t){return!t.hidden})}function Ed(e,t,n,i){t.invoke(pe,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;Je(a)||(M(a,"bpmn:Participant")&&st(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;M(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ce(Ed,pe),Ed.$inject=["canvas","injector","moddle","modeling"];function Sd(e,t){pe.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;Lk(o,r)&&t.updateProperties(r,{default:null})})}Ce(Sd,pe),Sd.$inject=["eventBus","modeling"];function Lk(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=de(t),i=de(e);return n.get("default")===i}var Ik=500,Bk=5e3,Rb=["shape.create","shape.delete","shape.move","shape.resize"],Cb=[...Rb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Rd(e,t){pe.call(this,e);var n;function i(){return n=n||new Nk,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){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(Cb,Bk,function(){i()}),this.postExecuted(Cb,Ik,function(){r()}),this.preExecute(Rb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Rd.$inject=["eventBus","modeling"],Ce(Rd,pe);function Nk(){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 $k=500,Fk=5e3,Mb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Ab=[...Mb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Cd(e,t){pe.call(this,e);var n;function i(){return n=n||new jk,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){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(Ab,Fk,function(){i()}),this.postExecuted(Ab,$k,function(){r()}),this.preExecute(Mb,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&o().addGroup(s)})}Cd.$inject=["eventBus","modeling"],Ce(Cd,pe);function jk(){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 Md(e,t){pe.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)Hk(r)&&!Gk(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ce(Md,pe),Md.$inject=["eventBus","modeling"];function Hk(e){const t=de(e);return t&&t.isForCompensation}function zk(e){return e&&M(e,"bpmn:BoundaryEvent")&&ma(e,"bpmn:CompensateEventDefinition")}function Gk(e){return e.incoming.filter(n=>zk(n.source)).length>0}const Vk={__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",If],appendBehavior:["type",Bf],associationBehavior:["type",$f],attachEventBehavior:["type",gl],artifactBehavior:["type",Nf],boundaryEventBehavior:["type",Ff],categoryRootElementReferenceBehavior:["type",jf],compensateBoundaryEventBehaviour:["type",Hf],createBehavior:["type",zf],createDataObjectBehavior:["type",Gf],createParticipantBehavior:["type",Uf],dataInputAssociationBehavior:["type",qf],dataStoreBehavior:["type",Yf],deleteLaneBehavior:["type",Kf],detachEventBehavior:["type",El],dropOnFlowBehavior:["type",Zf],eventBasedGatewayBehavior:["type",Qf],fixHoverBehavior:["type",Fv],groupBehavior:["type",Jf],importDockingFix:["type",Hv],isHorizontalFix:["type",td],labelBehavior:["type",id],layoutConnectionBehavior:["type",od],messageFlowBehavior:["type",sd],nonInterruptingBehavior:["type",cd],removeElementBehavior:["type",ud],removeEmbeddedLabelBoundsBehavior:["type",ld],removeParticipantBehavior:["type",pd],replaceConnectionBehavior:["type",fd],replaceElementBehaviour:["type",Tl],resizeBehavior:["type",ub],resizeLaneBehavior:["type",mb],rootElementReferenceBehavior:["type",md],spaceToolBehavior:["type",vb],subProcessPlaneBehavior:["type",yo],subProcessStartEventBehavior:["type",vd],textAnnotationBehavior:["type",bd],toggleCollapseConnectionBehaviour:["type",xd],toggleElementCollapseBehaviour:["type",wd],unclaimIdBehavior:["type",Ed],unsetDefaultFlowBehavior:["type",Sd],updateFlowNodeRefsBehavior:["type",Rd],updateCategoryValueRefsBehavior:["type",Cd],setCompensationActivityAfterPasteBehavior:["type",Md]};function Ad(e){this._commandStack=e.get("commandStack",!1)}Ad.$inject=["injector"],Ad.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Ji={__init__:["rules"],rules:["type",Ad]};function Si(e){pe.call(this,e),this.init()}Si.$inject=["eventBus"],Ce(Si,pe),Si.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(o){i.canExecute(o,t,function(r,a,s){return n(r)},!0)})},Si.prototype.init=function(){};function Pb(e,t){var n=kn(e,t,-15);return n!=="intersect"?n:null}function Dn(e){Si.call(this,e)}Ce(Dn,Si),Dn.$inject=["eventBus"],Dn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return Wk(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},o=i.targetParent,r=i.targetAttach;if(r)return!1;o&&(n.parent=o);try{return Bl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Bl(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 zb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Pt(i)&&!Nl(t,i)?!1:Ao(t,function(o){return Pt(o)?Bl(o.source,o.target,o):o.host?ks(o,o.host,null,n):Od(o,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,o=e.hints;return o!=null&&o.keyboardMove&&n.some(function(a){return Bb(a)&&!n.includes(a.host)})?!1:ks(n,t,null,i)||jb(n,t,i)||Hb(n,t)||Nl(n,t)}),this.addRule("shape.create",function(e){return Od(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ks(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return qb(n,t)})},Dn.prototype.canConnectMessageFlow=Wb,Dn.prototype.canConnectSequenceFlow=Ub,Dn.prototype.canConnectDataAssociation=Dd,Dn.prototype.canConnectAssociation=Gb,Dn.prototype.canConnectCompensationAssociation=Vb,Dn.prototype.canMove=Hb,Dn.prototype.canAttach=ks,Dn.prototype.canReplace=jb,Dn.prototype.canDrop=Ca,Dn.prototype.canInsert=Nl,Dn.prototype.canCreate=Od,Dn.prototype.canConnect=Bl,Dn.prototype.canResize=zb,Dn.prototype.canCopy=qb;function Wk(e){return Pd(e)?null:tt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Pd(e){return!e||Je(e)}function Tb(e){do{if(M(e,"bpmn:Process"))return de(e);if(M(e,"bpmn:Participant"))return de(e).processRef||de(e)}while(e=e.parent)}function Td(e){return M(e,"bpmn:TextAnnotation")}function kd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function kb(e){return M(e,"bpmn:BoundaryEvent")&&eo(e,"bpmn:CompensateEventDefinition")}function Il(e){return de(e).isForCompensation}function Uk(e,t){var n=Tb(e),i=Tb(t);return n===i}function qk(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&Lb(e,"bpmn:MessageEventDefinition"))}function Yk(e){return M(e,"bpmn:InteractionNode")&&!Il(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&Lb(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!eo(e,"bpmn:MessageEventDefinition"))}function Ob(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return de(t);if(M(t,"bpmn:Participant"))return de(t).processRef}return null}function Db(e,t){var n=Ob(e),i=Ob(t);return n===i}function eo(e,t){var n=de(e);return!!Ot(n.eventDefinitions||[],function(i){return M(i,t)})}function Lb(e,t){var n=de(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function Kk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&eo(e,"bpmn:LinkEventDefinition"))&&!kb(e)&&!Il(e)}function Xk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&eo(e,"bpmn:LinkEventDefinition"))&&!Il(e)}function Zk(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(eo(e,"bpmn:MessageEventDefinition")||eo(e,"bpmn:TimerEventDefinition")||eo(e,"bpmn:ConditionalEventDefinition")||eo(e,"bpmn:SignalEventDefinition"))}function Qk(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ib(e,t){var n=Qk(t);return n.indexOf(e)!==-1}function Bl(e,t,n){if(Pd(e)||Pd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Wb(e,t))return{type:"bpmn:MessageFlow"};if(Ub(e,t))return{type:"bpmn:SequenceFlow"}}var i=Dd(e,t);return i||(Vb(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Gb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ca(e,t){return Je(e)||kd(e)?!0:M(t,"bpmn:Participant")&&!st(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):tt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!Jk(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?st(t):tt(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?Po(de(t).get("participants"),function(n){return!!n.get("processRef")}):tt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?tt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function Jk(e){return de(e).cancelActivity&&(Nb(e)||$b(e))}function Bb(e){return!Je(e)&&M(e,"bpmn:BoundaryEvent")}function e2(e){return M(e,"bpmn:Lane")}function t2(e){return Bb(e)||M(e,"bpmn:IntermediateThrowEvent")&&Nb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&$b(e)}function Nb(e){var t=de(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function $b(e){return Fb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Fb(e,t){return t.some(function(n){return eo(e,n)})}function n2(e){return M(e,"bpmn:ReceiveTask")&&Ot(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function ks(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return Je(o)||!t2(o)||jn(t)||!M(t,"bpmn:Activity")||Il(t)||i&&!Pb(i,t)||n2(t)?!1:"attach"}function jb(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(o){jn(t)||M(o,"bpmn:StartEvent")&&o.type!=="label"&&Ca(o,t)&&(pP(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(fP(o)||dP(o)||hP(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),Fb(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||eo(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(M(o,"bpmn:EndEvent")&&Ca(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),M(o,"bpmn:BoundaryEvent")&&ks(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Hb(e,t){return Po(e,e2)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ca(n,t)})}function Od(e,t,n,i){return t?Je(e)||kd(e)?!0:Ca(e,t)||Nl(e,t):!1}function zb(e,t,n){return M(e,"bpmn:SubProcess")?st(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:Td(e)?n?n==="e"||n==="w":!0:kd(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function i2(e,t){var n=Td(e),i=Td(t);return(n||i)&&n!==i}function Gb(e,t){return Ib(t,e)||Ib(e,t)?!1:i2(e,t)?!0:!!Dd(e,t)}function Vb(e,t){return Db(e,t)&&kb(e)&&M(t,"bpmn:Activity")&&!r2(t,e)&&!jn(t)}function Wb(e,t){return Kb(e)&&!Kb(t)?!1:qk(e)&&Yk(t)&&!Uk(e,t)}function Ub(e,t){return Kk(e)&&Xk(t)&&Db(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!Zk(t))}function Dd(e,t){return tt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Nl(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:tt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&Ca(e,t.parent)}function Ld(e,t){return e&&t&&e.indexOf(t)!==-1}function qb(e,t){return Je(t)?!0:!(M(t,"bpmn:Lane")&&!Ld(e,t.parent)||M(t,"bpmn:MessageFlow")&&!o2(e,t))}function o2(e,t){var n=Yb(t.source),i=Yb(t.target);return Ld(e,n)&&Ld(e,i)}function Yb(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function Kb(e){return ba(e,"bpmn:Process")||ba(e,"bpmn:Collaboration")}function r2(e,t){return e.attachers.includes(t)}const a2={__depends__:[Ji],__init__:["bpmnRules"],bpmnRules:["type",Dn]};var s2=2e3;function Xb(e,t){e.on("saveXML.start",s2,n);function n(){var i=t.getRootElements();z(i,function(o){var r=ft(o),a,s;a=hs([o]),a=it(a,function(c){return c!==o&&!c.labelTarget}),s=Bn(a,ft),r.set("planeElement",s)})}}Xb.$inject=["eventBus","canvas"];const c2={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Xb]};function $l(e){pe.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);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,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}$l.prototype.getOrdering=function(e,t){return null},Ce($l,pe);function Id(e,t){$l.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=Ot(n,function(c){return tt(a,[c.type])});return s&&s.order||{level:1}}function o(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function r(a,s,c){for(var l=s;l&&!tt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=Sg(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<o(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Id.$inject=["eventBus","canvas"],Ce(Id,$l);const l2={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Id]};function Os(){}Os.prototype.get=function(){return this._data},Os.prototype.set=function(e){this._data=e},Os.prototype.clear=function(){var e=this._data;return delete this._data,e},Os.prototype.isEmpty=function(){return!this._data};const u2={clipboard:["type",Os]};var Zb=1500;function Qb(e,t,n){var i=this,o=n.get("dragging",!1);function r(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),o.hover({element:l,gfx:c}),o.move(s))}}o&&t.on("drag.start",function(a){t.once("drag.move",Zb,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Zb,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=Cr(a),c=document.elementFromPoint(s.x,s.y),p2(c)}}Qb.$inject=["elementRegistry","eventBus","injector"];function p2(e){return _r(e,"svg, .djs-element",!0)}const f2={__init__:["hoverFix"],hoverFix:["type",Qb]};function d2(e){return!0}function Fl(e){return qo(e)||vk(e)}var Jb=500;function ex(e,t,n){var i=this;function o(T,D,$){if(!s(T,D)){var N,H,X;$?H=t.getGraphics($):(N=D.delegateTarget||D.target,N&&(H=N,$=t.get(H))),!(!H||!$)&&(X=e.fire(T,{element:$,gfx:H,originalEvent:D}),X===!1&&(D.stopPropagation(),D.preventDefault()))}}var r={};function a(T){return r[T]}function s(T,D){var $=l[T]||qo;return!$(D)}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"},l={"element.contextmenu":d2,"element.mousedown":Fl,"element.mouseup":Fl,"element.click":Fl,"element.dblclick":Fl};function u(T,D,$){var N=c[T];if(!N)throw new Error("unmapped DOM event name <"+T+">");return o(N,D,$)}var p="svg, .djs-element";function f(T,D,$,N){var H=r[$]=function(X){o($,X)};N&&(l[$]=N),H.$delegate=Jn.bind(T,p,D,H)}function d(T,D,$){var N=a($);N&&Jn.unbind(T,D,N.$delegate)}function g(T){z(c,function(D,$){f(T,$,D)})}function h(T){z(c,function(D,$){d(T,$,D)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var D=T.element,$=T.gfx;e.fire("interactionEvents.createHit",{element:D,gfx:$})}),e.on(["shape.changed","connection.changed"],Jb,function(T){var D=T.element,$=T.gfx;e.fire("interactionEvents.updateHit",{element:D,gfx:$})}),e.on("interactionEvents.createHit",Jb,function(T){var D=T.element,$=T.gfx;i.createDefaultHit(D,$)}),e.on("interactionEvents.updateHit",function(T){var D=T.element,$=T.gfx;i.updateDefaultHit(D,$)});var y=w("djs-hit djs-hit-stroke"),_=w("djs-hit djs-hit-click-stroke"),x=w("djs-hit djs-hit-all"),m=w("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":_,stroke:y,"no-move":m};function w(T,D){return D=V({stroke:"white",strokeWidth:15},D||{}),n.cls(T,["no-fill","no-border"],D)}function S(T,D){var $=v[D];if(!$)throw new Error("invalid hit type <"+D+">");return we(T,$),T}function P(T,D){ze(T,D)}this.removeHits=function(T){var D=ls(".djs-hit",T);z(D,on)},this.createDefaultHit=function(T,D){var $=T.waypoints,N=T.isFrame,H;return $?this.createWaypointsHit(D,$):(H=N?"stroke":"all",this.createBoxHit(D,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,D){var $=ds(D);return S($,"stroke"),P(T,$),$},this.createBoxHit=function(T,D,$){$=V({x:0,y:0},$);var N=Oe("rect");return S(N,D),we(N,$),P(T,N),N},this.updateDefaultHit=function(T,D){var $=wt(".djs-hit",D);if($)return T.waypoints?_f($,T.waypoints):we($,{width:T.width,height:T.height}),$},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}ex.$inject=["eventBus","elementRegistry","styles"];const jl={__init__:["interactionEvents"],interactionEvents:["type",ex]};function Ma(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var o=i.element;n.deselect(o)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ma.$inject=["eventBus","canvas"],Ma.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()})}},Ma.prototype.get=function(){return Array.from(this._selectedElements)},Ma.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ma.prototype.select=function(e,t){var n=this.get();$e(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?z(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var tx="hover",nx="selected";function ix(e,t){this._canvas=e;function n(o,r){e.addMarker(o,r)}function i(o,r){e.removeMarker(o,r)}t.on("element.hover",function(o){n(o.element,tx)}),t.on("element.out",function(o){i(o.element,tx)}),t.on("selection.changed",function(o){function r(l){i(l,nx)}function a(l){n(l,nx)}var s=new Set(o.oldSelection),c=new Set(o.newSelection);for(let l of s)c.has(l)||r(l);for(let l of c)s.has(l)||a(l)})}ix.$inject=["canvas","eventBus"];function ox(e,t,n,i){e.on("create.end",500,function(o){var r=o.context,a=r.canExecute,s=r.elements,c=r.hints||{},l=c.autoSelect;if(a){if(l===!1)return;$e(l)?t.select(l):t.select(s.filter(h2))}}),e.on("connect.end",500,function(o){var r=o.context,a=r.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(o){var r=o.previousSelection||[],a=i.get(o.context.shape.id),s=Ot(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(qo(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Dl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}ox.$inject=["eventBus","selection","canvas","elementRegistry"];function h2(e){return!e.hidden}const Ri={__init__:["selectionVisuals","selectionBehavior"],__depends__:[jl],selection:["type",Ma],selectionVisuals:["type",ix],selectionBehavior:["type",ox]};var g2=/^djs-cursor-.*$/;function Hl(e){var t=Rt(document.body);t.removeMatching(g2),e&&t.add("djs-cursor-"+e)}function rx(){Hl(null)}var m2=5e3;function ax(e,t){t=t||"element.click";function n(){return!1}return e.once(t,m2,n),function(){e.off(t,n)}}var y2=["c","C"],v2=["v","V"],b2=["d","D"],x2=["x","X"],_2=["y","Y"],sx=["z","Z"];function w2(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ni(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function hn(e,t){return e=$e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Bd(e){return e.shiftKey}function E2(e){return ni(e)&&hn(y2,e)}function S2(e){return ni(e)&&hn(v2,e)}function R2(e){return ni(e)&&hn(b2,e)}function C2(e){return ni(e)&&hn(x2,e)}function M2(e){return ni(e)&&!Bd(e)&&hn(sx,e)}function A2(e){return ni(e)&&(hn(_2,e)||hn(sx,e)&&Bd(e))}var Aa=Math.round,cx="djs-drag-active";function Ar(e){e.preventDefault()}function P2(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function T2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function lx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(m){var v=t.viewbox(),w=t._container.getBoundingClientRect();return{x:v.x+(m.x-w.left)/v.scale,y:v.y+(m.y-w.top)/v.scale}}function s(m,v){v=v||r;var w=e.createEvent(V({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+m,w)===!1?!1:e.fire(v.prefix+"."+m,w)}function c(m){var v=m.filter(function(w){return i.get(w.id)});v.length&&n.select(v)}function l(m,v){var w=r.payload,S=r.displacement,P=r.globalStart,T=Cr(m),D=Bi(T,P),$=r.localStart,N=a(T),H=Bi(N,$);if(!r.active&&(v||T2(D)>r.threshold)){if(V(w,{x:Aa($.x+S.x),y:Aa($.y+S.y),dx:0,dy:0},{originalEvent:m}),s("start")===!1)return y();r.active=!0,r.keepSelection||(w.previousSelection=n.get(),n.select(null)),r.cursor&&Hl(r.cursor),t.addMarker(t.getRootElement(),cx)}gd(m),r.active&&(V(w,{x:Aa(N.x+S.x),y:Aa(N.y+S.y),dx:Aa(H.x),dy:Aa(H.y)},{originalEvent:m}),s("move"))}function u(m){var v,w=!0;r.active&&(m&&(r.payload.originalEvent=m,gd(m)),w=s("end")),w===!1&&s("rejected"),v=_(w!==!0),s("ended",v)}function p(m){hn("Escape",m)&&(Ar(m),y())}function f(m){var v;r.active&&(v=ax(e),setTimeout(v,400),Ar(m)),u(m)}function d(m){l(m)}function g(m){var v=r.payload;v.hoverGfx=m.gfx,v.hover=m.element,s("hover")}function h(m){s("out");var v=r.payload;v.hoverGfx=null,v.hover=null}function y(m){var v;if(r){var w=r.active;w&&s("cancel"),v=_(m),w&&s("canceled",v)}}function _(m){var v,w;s("cleanup"),rx(),r.trapClick?w=f:w=u,Le.unbind(document,"mousemove",l),Le.unbind(document,"dragstart",Ar),Le.unbind(document,"selectstart",Ar),Le.unbind(document,"mousedown",w,!0),Le.unbind(document,"mouseup",w,!0),Le.unbind(document,"keyup",p),Le.unbind(document,"touchstart",d,!0),Le.unbind(document,"touchcancel",y,!0),Le.unbind(document,"touchmove",l,!0),Le.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),cx);var S=r.payload.previousSelection;return m!==!1&&S&&!n.get().length&&c(S),v=r,r=null,v}function x(m,v,w,S){r&&y(!1),typeof v=="string"&&(S=w,w=v,v=null),S=V({},o,S||{});var P=S.data||{},T,D,$,N,H;if(S.trapClick?N=f:N=u,m?(T=Ra(m)||m,D=Cr(m),gd(m),T.type==="dragstart"&&Ar(T)):(T=null,D={x:0,y:0}),$=a(D),v||(v=$),H=P2(T),r=V({prefix:w,data:P,payload:{},globalStart:D,displacement:Bi(v,$),localStart:$,isTouch:H},S),S.manual||(H?(Le.bind(document,"touchstart",d,!0),Le.bind(document,"touchcancel",y,!0),Le.bind(document,"touchmove",l,!0),Le.bind(document,"touchend",u,!0)):(Le.bind(document,"mousemove",l),Le.bind(document,"dragstart",Ar),Le.bind(document,"selectstart",Ar),Le.bind(document,"mousedown",N,!0),Le.bind(document,"mouseup",N,!0)),Le.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;S.autoActivate&&l(m,!0)}e.on("diagram.destroy",y),this.init=x,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(m){V(o,m)}}lx.$inject=["eventBus","canvas","selection","elementRegistry"];const vo={__depends__:[f2,Ri],dragging:["type",lx]};function Pr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Pr.prototype.next=function(){return this._prefix+ ++this._counter};const k2=new Pr("ps");var O2=["marker-start","marker-mid","marker-end"],D2=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Yo(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Yo.$inject=["elementRegistry","eventBus","canvas","styles"],Yo.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")},Yo.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Yo.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=df(n);return this._cloneMarkers(Ho(o),i),we(o,this._styles.cls(i,[])),ze(t,o),we(o,"data-preview-support-element-id",e.id),o},Yo.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ze(t,n),we(n,"data-preview-support-element-id",e.id),n},Yo.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),N2(e)&&O2.forEach(function(o){if(we(e,o)){var r=L2(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},Yo.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,k2.next()].join("-"),a=wt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||df(n);s.id=r,at(s).add(o);var c=wt(":scope > defs",e);c||(c=Oe("defs"),ze(e,c)),ze(c,s);var l=B2(s.id);we(t,i,l)};function L2(e,t,n){var i=I2(we(e,t));return wt("marker#"+i,n||document)}function I2(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function B2(e){return"url(#"+e+")"}function N2(e){return D2.indexOf(e.nodeName)!==-1}const Pa={__init__:["previewSupport"],previewSupport:["type",Yo]};var $2="drop-ok",ux="drop-not-ok",px="attach-ok",fx="new-parent",dx="create",F2=2e3;function hx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=it(c,function(x){var m=x.labelTarget;return!x.parent&&!(Je(x)&&c.indexOf(m)!==-1)});var d=Ot(c,function(x){return!Pt(x)}),g=!1,h=!1,y=!1;mx(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(mx(c)?y=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):y=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=f.connectionTarget;return y||g?(d&&p&&(h=o.allowed("connection.create",{source:_===p?d:p,target:_===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[px,$2,ux,fx].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}gx(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,px):a(p,h?fx:ux))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,_=l.hints||{};if(g===!1||!d)return!1;gx(c);var x={x:c.x,y:c.y};y?p=i.appendShape(u,p,x,d,{attach:h,connection:y===!0?{}:y,connectionTarget:_.connectionTarget}):(f=i.createElements(f,x,d,V({},_,{attach:h})),p=Ot(f,function(m){return!Pt(m)})),V(l,{elements:f,shape:p}),V(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===dx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],F2,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){$e(l)||(l=[l]);var p=Ot(l,function(g){return!Pt(g)});if(p){u=V({elements:l,hints:{},shape:p},u||{}),z(l,function(g){Fe(g.x)||(g.x=0),Fe(g.y)||(g.y=0)});var f=it(l,function(g){return!g.hidden}),d=rn(f);z(l,function(g){Pt(g)&&(g.waypoints=Bn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,dx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}hx.$inject=["canvas","dragging","eventBus","modeling","rules"];function gx(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 mx(e){return e&&e.length===1&&!Pt(e[0])}var j2=750;function yx(e,t,n,i,o){function r(a){var s=Oe("g");we(s,o.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Ho(u),l)):(u=n._createContainer("shape",c),n.drawShape(Ho(u),l),On(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",j2,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),ze(p,u)),On(u,a.x,a.y)):on(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&on(c)})}yx.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const zl={__depends__:[vo,Pa,Ji,Ri],__init__:["create","createPreview"],create:["type",hx],createPreview:["type",yx]};function Nd(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var o=t._svg=i.svg;o.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Nd.$inject=["eventBus"],Nd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||H2(0,0)};function H2(e,t){var n=document.createEvent("MouseEvent"),i=e,o=t,r=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,o,r,a,!1,!1,!1,!1,0,null),n}const Ds={__init__:["mouse"],mouse:["type",Nd]};var vx=2e3;function ii(e,t,n,i,o,r,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=o,this._modeling=r,this._mouse=a,this._rules=s,o.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),z2(u)&&(l.priority=2,l.host=u.host.id),Pt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=G2(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){Fe(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",vx,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",vx,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;V(l,{createElementsBehavior:!1})})}ii.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ii.prototype.copy=function(e,t={}){var n,i;return $e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree($e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ii.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 o=t.hints,r=this._createElements(i);if(t.element&&t.point)return this._paste(r,t.element,t.point,o);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:o})}}},ii.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ii.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(o){return n[o.id]});return i.length>0&&this._modeling.removeElements(i),t},ii.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},ii.prototype._paste=function(e,t,n,i){z(e,function(r){Fe(r.x)||(r.x=0),Fe(r.y)||(r.y=0)});var o=rn(e);return z(e,function(r){Pt(r)&&(r.waypoints=Bn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),V(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,V({},i))},ii.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return z(e,function(r,a){r=Hi(r,"priority"),z(r,function(s){var c=V({},zi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Pt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(Je(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),o.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),o.push(l)})}),o},ii.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(zi(e,["id"]));return t},ii.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(zi(e,["id"]));return t},ii.prototype.createShape=function(e){var t=this._elementFactory.createShape(zi(e,["id"]));return t},ii.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Pt(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},ii.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=el(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=r.get(p);if(!d){var g={element:p,depth:f};o.push(g),r.set(p,g);return}if(d.depth<f){o=l(d,o);var h={element:d.element,depth:f};o.push(h),r.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Er(a,function(p,f,d){if(Je(p))return;z(p.labels,function(y){c(y,d)});function g(y){y&&y.length&&z(y,function(_){z(_.labels,function(x){c(x,d)}),c(_,d)})}z([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Bn(o,function(p){return p.element});var u=new Set(e);return o=Bn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Hi(o,function(p){return p.descriptor.priority}),e=Bn(o,function(p){return p.element}),z(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){xx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){xx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function z2(e){return!!e.host}function G2(e){return Bn(e.waypoints,function(t){return t=bx(t),t.original&&(t.original=bx(t.original)),t})}function bx(e){return V({},e)}function xx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const V2={__depends__:[u2,zl,Ds,Ji],__init__:["copyPaste"],copyPaste:["type",ii]};function $d(e,t,n){$e(n)||(n=[n]),z(n,function(i){hr(e[i])||(t[i]=e[i])})}var Fd=750;function _x(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Fd,function(c){var l=c.descriptor,u=c.element,p=de(u);if(Je(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(ft(u),!0);d.bpmnElement=f,$d(f,l,"name"),$d(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=de(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(de(c).attachedToRef=de(l[c.host])),zi(u,Qn(u,function(f,d,g){var h=d.element,y=d.property;return g===c.id&&(h.set(y,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(Je(u)){u.businessObject=de(l[u.labelTarget]),u.di=ft(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,$d(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Fd,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=de(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&z(xs(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Fd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}_x.$inject=["bpmnFactory","eventBus","moddleCopy"];const W2=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],U2=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ls(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return Hi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=fn(o)&&o.$descriptor;if(a&&U2.includes(a))return r;if(a&&W2.includes(a)||a&&s&&!Ot(s.properties,Zr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(M(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Ls.$inject=["eventBus","bpmnFactory","moddle"],Ls.prototype.copyElement=function(e,t,n,i=!1){n&&!$e(n)&&(n=[n]),n=n||jd(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||($e(o)&&(n=o),z(n,r=>{let a;Zn(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!pn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Ls.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return fn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):$e(e)?Qn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):fn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},Ls.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 jd(e,t){return Qn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const wx={__depends__:[V2],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",_x],moddleCopy:["type",Ls]};var Ex=Math.round;function Hd(e,t){this._modeling=e,this._eventBus=t}Hd.$inject=["modeling","eventBus"],Hd.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,o=this._eventBus;o.fire("replace.start",{element:e,attrs:t,hints:n});var r=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Ex(s+r/2),u=Ex(c+a/2),p=i.replaceShape(e,V({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Sx(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Sx.$inject=["selection","eventBus"];const q2={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Sx],replace:["type",Hd]};function Y2(e,t,n){$e(n)||(n=[n]),z(n,function(i){hr(e[i])||(t[i]=e[i])})}var K2=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function X2(e,t){var n=e&&Zn(e,"collapsed")?e.collapsed:!st(e),i;return t&&(Zn(t,"collapsed")||Zn(t,"isExpanded"))?i=Zn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Rx(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Gl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&X2(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),Y2(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=jd(p.$descriptor),h=jd(f.$descriptor,!0),y=Z2(g,h);V(f,Li(c,K2));var _=it(y,function(v){return v==="eventDefinitions"?Cx(s,c.eventDefinitionType):v==="loopCharacteristics"?!jn(f):Zn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!jn(f):!0});if(f=n.copyElement(p,f,_),c.eventDefinitionType&&(Cx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(Gl(p))d.isExpanded=st(s);else if(c&&Zn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}st(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Gl(p)&&!Gl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var m=xn(s);ft(s).isHorizontal||(ft(d).isHorizontal=m),d.width=m?s.width:t.getDefaultSize(d).width,d.height=m?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,tt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&tt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),o.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}Rx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Gl(e){return M(e,"bpmn:SubProcess")}function Cx(e,t){var n=de(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function Z2(e,t){return e.filter(function(n){return t.includes(n)})}const Mx={__depends__:[wx,q2,Ri],bpmnReplace:["type",Rx]};var Q2=250;function Tr(e){this._eventBus=e,this._tools=[],this._active=null}Tr.$inject=["eventBus"],Tr.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)},Tr.prototype.isActive=function(e){return e&&this._active===e},Tr.prototype.length=function(e){return this._tools.length},Tr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Tr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),z(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,Q2,function(o){this._active&&(J2(o)||this.setActive(null))},this)};function J2(e){var t=e.originalEvent&&e.originalEvent.target;return t&&_r(t,'.group[data-group="tools"]')}const Vl={__depends__:[vo],__init__:["toolManager"],toolManager:["type",Tr]};function eO(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 tO(e,t){var n=[],i=new Set(e);z(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;z(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function nO(e,t,n){var i=e.x,o=e.y,r=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:o+c,width:r,height:a-c};case"s":return{x:i,y:o,width:r,height:a+c};case"w":return{x:i+s,y:o,width:r-s,height:a};case"e":return{x:i,y:o,width:r+s,height:a};default:throw new Error("unknown direction: "+t)}}var zd=Math.abs,iO=Math.round,bo={x:"width",y:"height"},Ax="crosshair",Ko={n:"top",w:"left",s:"bottom",e:"right"},oO=1500,Wl={n:"s",w:"e",s:"n",e:"w"},Ul=20;function Ci(e,t,n,i,o,r,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=o,this._toolManager=r,this._mouse=a;var s=this;r.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",oO,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Tx(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){Tx(c);var h={x:0,y:0};h[u]=iO(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Ci.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ci.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ax,data:{context:{reactivate:n}},trapClick:!1})},Ci.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ax,data:{context:{}}})},Ci.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ci.prototype.init=function(e,t){var n=zd(e.dx)>zd(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(zd(i)<5)return!1;i<0&&(i*=-1),Ts(e)&&(i*=-1);var r=eO(n,i),a=this._canvas.getRootElement();!Dl(e)&&e.hover&&(a=e.hover);var s=[...hs(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,o),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:r,shapes:c.resizingShapes,start:o}),u=rO(c,n,r,o,l);return V(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),Hl("resize-"+(n==="x"?"ew":"ns")),!0},Ci.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),r.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||Je(d))){if(Pt(d)){u.push(d);return}var g=d[t],h=g+d[bo[t]];if(aO(d)&&(n>0&&je(d)[t]>i||n<0&&je(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&o.allowed("shape.resize",{shape:d})){f(d);return}}}),z(r,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,y=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:r,resizingShapes:a}},Ci.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ci.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Px(e){return{top:e.top-Ul,right:e.right+Ul,bottom:e.bottom+Ul,left:e.left-Ul}}function Tx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Fe(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function rO(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return z(a,function(f){var d=f.attachers,g=f.children,h=Be(f),y=it(g,function(H){return!Pt(H)&&!Je(H)&&!u.has(H)&&!p.has(H)}),_=it(g,function(H){return!Pt(H)&&!Je(H)&&u.has(H)}),x,m,v,w=[],S=[],P,T,D,$;y.length&&(m=Px(Be(rn(y))),x=i-h[Ko[n]]+m[Ko[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,x):x:n==="w"?s.right=l=Fe(l)?Math.min(l,x):x:n==="s"?s.top=c=Fe(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Fe(c)?Math.max(c,x):x)),_.length&&(v=Px(Be(rn(_))),x=i-v[Ko[Wl[n]]]+h[Ko[Wl[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,x):x:n==="w"?s.right=l=Fe(l)?Math.min(l,x):x:n==="s"?s.top=c=Fe(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Fe(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(H){u.has(H)?w.push(H):S.push(H)}),w.length&&(P=Be(rn(w.map(je))),T=h[Ko[Wl[n]]]-(P[Ko[Wl[n]]]-i)),S.length&&(D=Be(rn(S.map(je))),$=D[Ko[n]]-(h[Ko[n]]-i)),n==="n"?(x=Math.min(T||1/0,$||1/0),s.bottom=l=Fe(l)?Math.min(l,x):x):n==="w"?(x=Math.min(T||1/0,$||1/0),s.right=l=Fe(l)?Math.min(l,x):x):n==="s"?(x=Math.max(T||-1/0,$||-1/0),s.top=c=Fe(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(T||-1/0,$||-1/0),s.left=c=Fe(c)?Math.max(c,x):x));var N=o&&o[f.id];N&&(n==="n"?(x=i+f[bo[t]]-N[bo[t]],s.bottom=l=Fe(l)?Math.min(l,x):x):n==="w"?(x=i+f[bo[t]]-N[bo[t]],s.right=l=Fe(l)?Math.min(l,x):x):n==="s"?(x=i-f[bo[t]]+N[bo[t]],s.top=c=Fe(c)?Math.max(c,x):x):n==="e"&&(x=i-f[bo[t]]+N[bo[t]],s.left=c=Fe(c)?Math.max(c,x):x))}),s}}function aO(e){return!!e.host}var Gd="djs-dragging",kx="djs-resizing",sO=250,ql=Math.max;function Ox(e,t,n,i,o){function r(a,s){z(a,function(c){o.addDragger(c,s),n.addMarker(c,Gd)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");we(u,i.cls("djs-crosshair-group",["no-events"])),ze(s,u);var p=Oe("path");we(p,"d",l.x),at(p).add("djs-crosshair"),ze(u,p);var f=Oe("path");we(f,"d",l.y),at(f).add("djs-crosshair"),ze(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;On(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&on(c)}),e.on("spaceTool.move",sO,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),we(c,"d","M0,0 L0,0"),at(c).add("djs-crosshair"),ze(f,c),s.line=c;var d=Oe("g");we(d,i.cls("djs-drag-group",["no-events"])),ze(n.getActiveLayer(),d),r(u,d);var g=new Set(u);z(p,function(S){g.add(S)});var h=new Set,y=s.movingConnections=[];g.forEach(function(S){z(S.outgoing,function(P){h.has(P)||!Pt(P)||!g.has(P.target)||(h.add(P),y.push(P))})}),r(y,d),s.dragGroup=d}if(!s.frameGroup){var _=Oe("g");we(_,i.cls("djs-frame-group",["no-events"])),ze(n.getActiveLayer(),_);var x=[];z(p,function(S){var P=o.addFrame(S,_),T=P.getBBox();x.push({element:P,initialBounds:T}),n.addMarker(S,kx)}),s.frameGroup=_,s.frames=x}var m={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};we(c,{d:m[l]});var v={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[v[s.axis]]=0,On(s.dragGroup,w.x,w.y),z(s.frames,function(S){var P=S.element,T=S.initialBounds,D,$;s.direction==="e"?we(P,{width:ql(T.width+w.x,5)}):(D=ql(T.width-w.x,5),we(P,{width:D,x:T.x+T.width-D})),s.direction==="s"?we(P,{height:ql(T.height+w.y,5)}):($=ql(T.height-w.y,5),we(P,{height:$,y:T.y+T.height-$}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,Gd)}),z(l,function(g){n.removeMarker(g,Gd)}),f&&(on(p),on(f)),z(u,function(g){n.removeMarker(g,kx)}),d&&on(d)})}Ox.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const cO={__init__:["spaceToolPreview"],__depends__:[vo,Ji,Vl,Pa,Ds],spaceTool:["type",Ci],spaceToolPreview:["type",Ox]};function Yl(e,t){e.invoke(Ci,this),this._canvas=t}Yl.$inject=["injector","canvas"],Ce(Yl,Ci),Yl.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=Kr(fa(o.children.filter(l=>M(l,"bpmn:Artifact")),rn(r))));const s=[...e,...a];var c=Ci.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||lO(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function lO(e){return M(e,"bpmn:Participant")&&!de(e).processRef}const Dx={__depends__:[cO],spaceTool:["type",Yl]};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 o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},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 o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},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,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.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:Rg("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=$e(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 uO={commandStack:["type",Vt]};function Xo(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 pO=250,Lx=1400;function Vd(e,t,n){pe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Lx,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=Ix(a),r.validatedShapes=Ix(s)}),i&&t.on("shape.move.start",pO,function(o){var r=o.context,a=new Set(r.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(r,c,!0)}),this.preExecuted("elements.move",Lx,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;Xo(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.labelTarget;s&&(r.labelTargetIndex=Ef(s.labels,a),r.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(o){var r=o.context,a=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(tn(s.labels,a,c),a.labelTarget=s)})}Ce(Vd,pe),Vd.$inject=["injector","eventBus","modeling"];function Ix(e){var t=new Set(e);return it(e,function(n){return!t.has(n.labelTarget)})}const fO={__init__:["labelSupport"],labelSupport:["type",Vd]};var dO=251,Bx=1401,Nx="attach-ok";function Wd(e,t,n,i,o){pe.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",Bx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=hO(c),s.validatedShapes=gO(l)}),r&&t.on("shape.move.start",dO,function(a){var s=a.context,c=s.shapes,l=Ud(c);z(l,function(u){r.makeDraggable(s,u,!0),z(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Nx),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Nx)}))}}),this.preExecuted("elements.move",Bx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Ud(l);z(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=it(c,function(p){var f=p.host;return mO(p)&&!yO(c,f)}),z(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),z(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Xo(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&z(l.attachers,function(u){var p=tb(u,c,l);o.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=tb(d,l,u);o.moveShape(d,g,d.parent),z(d.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Xo(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ce(Wd,pe),Wd.$inject=["injector","eventBus","canvas","rules","modeling"];function Ud(e){return gp(Bn(e,function(t){return t.attachers||[]}))}function hO(e){var t=Ud(e);return $1("id",e,t)}function gO(e){var t=Xr(e,"id");return it(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function mO(e){return!!e.host}function yO(e,t){return e.indexOf(t)!==-1}const vO={__depends__:[Ji],__init__:["attachSupport"],attachSupport:["type",Wd]};function $x(e,t,n,i){e.on("element.changed",function(o){var r=o.element;(r.parent||r===t.getRootElement())&&(o.gfx=n.getGraphics(r)),o.gfx&&e.fire(Ty(r)+".changed",o)}),e.on("elements.changed",function(o){var r=o.elements;r.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(r)}),e.on("shape.changed",function(o){i.update("shape",o.element,o.gfx)}),e.on("connection.changed",function(o){i.update("connection",o.element,o.gfx)})}$x.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const qd={__init__:["changeSupport"],changeSupport:["type",$x]};function Mi(e){this._model=e}Mi.$inject=["moddle"],Mi.prototype._needsId=function(e){return tt(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"])},Mi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":tt(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))},Mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},Mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Mi.prototype.createDiWaypoints=function(e){var t=this;return Bn(e,function(n){return t.createDiWaypoint(n)})},Mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Li(e,["x","y"]))},Mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function oi(e,t,n){pe.call(this,e),this._bpmnFactory=t;var i=this;function o(d){var g=d.context,h=g.hints||{},y;!g.cropped&&h.createElementsBehavior!==!1&&(y=g.connection,y.waypoints=n.getCroppedWaypoints(y),g.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function r(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,y=g.parent||g.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ri(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ri(a));function s(d){var g=d.context,h=g.oldRoot,y=h.children;z(y,function(_){M(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],ri(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],ri(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 l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],ri(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ri(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ri(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ri(u)),this.executed("connection.reconnect",ri(function(d){var g=d.context,h=g.connection,y=g.oldSource,_=g.newSource,x=de(h),m=de(y),v=de(_);x.conditionExpression&&!tt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),y!==_&&m.default===x&&(g.oldDefault=m.default,delete m.default)})),this.reverted("connection.reconnect",ri(function(d){var g=d.context,h=g.connection,y=g.oldSource,_=g.newSource,x=de(h),m=de(y),v=de(_);g.oldConditionExpression&&(x.conditionExpression=g.oldConditionExpression),g.oldDefault&&(m.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],ri(p)),this.reverted(["element.updateAttachment"],ri(p)),this.executed("element.updateLabel",ri(f)),this.reverted("element.updateLabel",ri(f));function f(d){const{element:g}=d.context,h=yi(g),y=ft(g),_=y&&y.get("label");Go(g)||Ll(g)||(h&&!_?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&y.set("label",void 0))}}Ce(oi,pe),oi.$inject=["eventBus","bpmnFactory","connectionDocking"],oi.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},oi.prototype.updateParent=function(e,t){if(!Je(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=ft(e),r=n&&n.businessObject,a=ft(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),M(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},oi.prototype.updateBounds=function(e){var t=ft(e),n=xO(e);if(n){var i=Bi(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var o=Je(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),V(r,{x:e.x,y:e.y,width:e.width,height:e.height})},oi.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Zt(i,e)),M(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),tn(o,e))}},oi.prototype.updateDiConnection=function(e,t,n){var i=ft(e),o=ft(t),r=ft(n);i.sourceElement&&i.sourceElement.bpmnElement!==de(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==de(n)&&(i.targetElement=n&&r)},oi.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Zt(n,e),e.$parent=null)}};function bO(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}oi.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(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)},oi.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=bO(e.$parent||t),e.$parent&&(Zt(r.get("rootElements"),o),o.$parent=null),t&&(tn(r.get("rootElements"),o),o.$parent=r))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(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),Zt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Zt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},oi.prototype.updateConnectionWaypoints=function(e){var t=ft(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},oi.prototype.updateConnection=function(e){var t=e.connection,n=de(t),i=t.source,o=de(i),r=t.target,a=de(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(Zt(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(Zt(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,r)},oi.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function ri(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function xO(e){if(M(e,"bpmn:Activity")){var t=ft(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Zo(e,t){ho.call(this),this._bpmnFactory=e,this._moddle=t}Ce(Zo,ho),Zo.$inject=["bpmnFactory","moddle"],Zo.prototype._baseCreate=ho.prototype.create,Zo.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Sr,t))}return this.createElement(e,t)},Zo.prototype.createElement=function(e,t){t=V({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!wO(o)){var r=V({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}M(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=_O(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Yd(o,t,"isExpanded")),tt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Yd(o,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!st(i,o)),M(i,"bpmn:ExclusiveGateway")&&(Zn(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),pn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),pn(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,o),t=V({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},Zo.prototype.getDefaultSize=function(e,t){var n=de(e);if(t=t||ft(e),M(n,"bpmn:SubProcess"))return st(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return st(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Zo.prototype.createParticipantShape=function(e){return fn(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function _O(e,t,n){return z(n,function(i){t=Yd(e,t,i)}),t}function Yd(e,t,n){return t[n]===void 0?t:(e[n]=t[n],zi(t,[n]))}function wO(e){return tt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Kl(e,t){this._modeling=e,this._canvas=t}Kl.$inject=["modeling","canvas"],Kl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(o){var r={x:0,y:0};pn(i.left)?r.x=i.left-o.x:pn(i.right)?r.x=i.right-o.width-o.x:pn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:pn(i.top)?r.y=i.top-o.y:pn(i.bottom)?r.y=i.bottom-o.height-o.y:pn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},Kl.prototype.postExecute=function(e){};function Xl(e){this._modeling=e}Xl.$inject=["modeling"],Xl.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,o=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:o.attach}),e.shape=i},Xl.prototype.postExecute=function(e){var t=e.hints||{};EO(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 EO(e,t){return Po(e.outgoing,function(n){return n.target===t})}function Zl(e,t){this._canvas=e,this._layouter=t}Zl.$inject=["canvas","layouter"],Zl.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,o=e.parent,r=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!o)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,o,r),t},Zl.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ql=Math.round;function Kd(e){this._modeling=e}Kd.$inject=["modeling"],Kd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;z(t,function(p){Fe(p.x)||(p.x=0),Fe(p.y)||(p.y=0)});var s=it(t,function(p){return!p.hidden}),c=rn(s);z(t,function(p){Pt(p)&&(p.waypoints=Bn(p.waypoints,function(f){return{x:Ql(f.x-c.x-c.width/2+o.x),y:Ql(f.y-c.y-c.height/2+o.y)}})),V(p,{x:Ql(p.x-c.x-c.width/2+o.x),y:Ql(p.y-c.y-c.height/2+o.y)})});var l=new Set(el(t)),u={};z(t,function(p){if(Pt(p)){u[p.id]=Fe(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var f=V({},r);l.has(p)||(f.autoResize=!1),Je(p)&&(f=zi(f,["attach"])),u[p.id]=Fe(i)?a.createShape(p,Li(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Li(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Kr(u)};var Fx=Math.round;function Qo(e){this._canvas=e}Qo.$inject=["canvas"],Qo.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?V(t,n):V(t,{x:n.x-Fx(t.width/2),y:n.y-Fx(t.height/2)}),this._canvas.addShape(t,i,o),t},Qo.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Is(e){Qo.call(this,e)}Ce(Is,Qo),Is.$inject=["canvas"];var SO=Qo.prototype.execute;Is.prototype.execute=function(e){var t=e.shape;return CO(t),t.labelTarget=e.labelTarget,SO.call(this,e)};var RO=Qo.prototype.revert;Is.prototype.revert=function(e){return e.shape.labelTarget=null,RO.call(this,e)};function CO(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Bs(e,t){this._canvas=e,this._modeling=t}Bs.$inject=["canvas","modeling"],Bs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Xo(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Xo(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Bs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Ef(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Bs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t};function Xd(e,t){this._modeling=e,this._elementRegistry=t}Xd.$inject=["modeling","elementRegistry"],Xd.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function Ns(e,t){this._canvas=e,this._modeling=t}Ns.$inject=["canvas","modeling"],Ns.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Xo(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Xo(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Xo(n.children,function(i){Pt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Ns.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Ef(i.children,n),t.removeShape(n),n},Ns.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return tn(i.children,n,o),t.addShape(n,i),n};function Jl(e){this._modeling=e}Jl.$inject=["modeling"];var jx={x:"y",y:"x"};Jl.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(y,_){y.range.min=Math.min(_[i],y.range.min),y.range.max=Math.max(_[i]+_[o],y.range.max)}function a(y){return y[i]+y[o]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,_){var x={y:0};x[i]=y-a(_),x[i]&&(x[jx[i]]=0,t.moveElements([_],x,_.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(y,_){var x,m,v;if(y.elements.length<2){_&&_!==n.length-1&&(r(y,y.elements[0]),h+=c(y.range));return}x=Hi(y.elements,i),m=x[0],_===p&&(m=x[s(x)]),v=a(m),y.range=null,z(x,function(w){if(l(v,w),y.range===null){y.range={min:w[i],max:w[i]+w[o]};return}r(y,w)}),_&&_!==n.length-1&&(h+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(y,_){var x={},m;y===u||y===f||(m=n[_-1],y.range.max=0,z(y.elements,function(v,w){x[jx[i]]=0,x[i]=m.range.max-v[i]+d,y.range.min!==v[i]&&(x[i]+=v[i]-y.range.min),x[i]&&t.moveElements([v],x,v.parent),y.range.max=Math.max(v[i]+v[o],w?y.range.max:0)}))})},Jl.prototype.postExecute=function(e){};function eu(e,t){this._layouter=e,this._canvas=t}eu.$inject=["layouter","canvas"],eu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},eu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Zd(){}Zd.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Zt(r.children,t),tn(i.children,t,o),t.parent=i,z(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},Zd.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return Zt(n.children,t),tn(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function Qd(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Qd.prototype.add=function(e,t){return this.addAll([e],t)},Qd.prototype.addAll=function(e,t){var n=nA(e,!!t,this);return V(this,n),this};function $s(e){this._modeling=e}$s.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},$s.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),z(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&rd(p,p.source,t),connectionEnd:d&&ad(p,p.target,t)})})},$s.prototype.getClosure=function(e){return new Qd().addAll(e,!0)};function tu(e){this._helper=new $s(e)}tu.$inject=["modeling"],tu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},tu.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 kr(e){this._modeling=e,this._helper=new $s(e)}kr.$inject=["modeling"],kr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=Li(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Zt(r.children,t),tn(i.children,t,o),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},kr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(z(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:ad(r,t,n)})}),z(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:rd(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},kr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return tn(n.children,t,i),V(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},kr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},kr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Fs(e){this._modeling=e}Fs.$inject=["modeling"],Fs.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,o=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return $e(o)&&(e.oldWaypoints=i.waypoints,i.waypoints=o),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Fs.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,o=e.dockingOrPoints,r=e.hints||{},a={};r.connectionStart&&(a.connectionStart=r.connectionStart),r.connectionEnd&&(a.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!i||r.docking==="source")&&(a.connectionStart=a.connectionStart||Hx($e(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||Hx($e(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Fs.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,o=e.connection;return t&&(o.source=t),n&&(o.target=n),i&&(o.waypoints=i),o};function Hx(e){return e.original||e}function xo(e,t){this._modeling=e,this._rules=t}xo.$inject=["modeling","rules"],xo.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=e.newData,a=e.hints||{},s;function c(g,h,y){return i.allowed("connection.reconnect",{connection:y,source:g,target:h})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=o.incoming.slice(),d=o.outgoing.slice();z(f,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,Al(g,s,u),a)}),z(d,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,Ml(g,s,u),a)})},xo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},xo.prototype.execute=function(e){},xo.prototype.revert=function(e){},xo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},xo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},xo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function js(e){this._modeling=e}js.$inject=["modeling"],js.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},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},js.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(z(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Al(r,n,i)})}),z(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ml(r,n,i)})}))},js.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Jo(e){this._modeling=e}Jo.$inject=["modeling"],Jo.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),z(o,function(s){a[s.id]=AO(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(tO(i,o),t,n,r,i,o,a)},Jo.prototype.execute=function(){},Jo.prototype.revert=function(){},Jo.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Jo.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(o){var r=nO(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Jo.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);z(e,function(u){var p=u.source,f=u.target,d=MO(u),g=Gx(n),h={},y=c.has(p)||l.has(p),_=c.has(f)||l.has(f);y&&_?(d=Bn(d,function(x){return Vx(x,i,n)&&(x[g]=x[g]+t[g]),x.original&&Vx(x.original,i,n)&&(x.original[g]=x.original[g]+t[g]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||_)&&(c.has(p)?h.connectionStart=rd(u,p,t):c.has(f)?h.connectionEnd=ad(u,f,t):l.has(p)?h.connectionStart=Ml(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Al(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function zx(e){return V({},e)}function MO(e){return Bn(e.waypoints,function(t){return t=zx(t),t.original&&(t.original=zx(t.original)),t})}function Gx(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Vx(e,t,n){var i=Gx(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function AO(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function nu(e){this._modeling=e}nu.$inject=["modeling"],nu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Wx(n),t.collapsed=!t.collapsed;var i=Ux(n,t.collapsed);return[t].concat(i)},nu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=qx(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function Wx(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,Wx(n.children)))}),t}function Ux(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Ux(i.children,i.collapsed||t)))}),n}function qx(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(qx(i.children,t)))}),n}function iu(e){this._modeling=e}iu.$inject=["modeling"],iu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Yx(i,t),Kx(n,t),t.host=n,t},iu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,Yx(n,t),Kx(i,t,o),t};function Yx(e,t){return Zt(e&&e.attachers,t)}function Kx(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),tn(i,t,n)}}function Jd(){}Jd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Jd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Tt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Tt.$inject=["eventBus","elementFactory","commandStack"],Tt.prototype.getHandlers=function(){return{"shape.append":Xl,"shape.create":Qo,"shape.delete":Ns,"shape.move":kr,"shape.resize":js,"shape.replace":xo,"shape.toggleCollapse":nu,spaceTool:Jo,"label.create":Is,"connection.create":Zl,"connection.delete":Bs,"connection.move":Zd,"connection.layout":eu,"connection.updateWaypoints":Jd,"connection.reconnect":Fs,"elements.create":Kd,"elements.move":tu,"elements.delete":Xd,"elements.distribute":Jl,"elements.align":Kl,"element.updateAttachment":iu}},Tt.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Tt.prototype.moveShape=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},Tt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Tt.prototype.moveElements=function(e,t,n,i){i=i||{};var o=i.attach,r=n,a;o===!0?(a=n,r=n.parent):o===!1&&(a=null);var s={shapes:e,delta:t,newParent:r,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Tt.prototype.moveConnection=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},Tt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Tt.prototype.createConnection=function(e,t,n,i,o,r){typeof n=="object"&&(r=o,o=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:o,parentIndex:n,connection:i,hints:r};return this._commandStack.execute("connection.create",a),a.connection},Tt.prototype.createShape=function(e,t,n,i,o){typeof i!="number"&&(o=i,i=void 0),o=o||{};var r=o.attach,a,s;e=this._create("shape",e),r?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",c),c.shape},Tt.prototype.createElements=function(e,t,n,i,o){$e(e)||(e=[e]),typeof i!="number"&&(o=i,i=void 0),o=o||{};var r={position:t,elements:e,parent:n,parentIndex:i,hints:o};return this._commandStack.execute("elements.create",r),r.elements},Tt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},Tt.prototype.appendShape=function(e,t,n,i,o){o=o||{},t=this._create("shape",t);var r={source:e,position:n,target:i,shape:t,connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},Tt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Tt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Tt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Tt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Tt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Tt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Tt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Tt.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},Tt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Tt.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},Tt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},Tt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},Tt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Tt.prototype._create=function(e,t){return HA(t)?t:this._elementFactory.create(e,t)},Tt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Hs(e){this._elementRegistry=e}Hs.$inject=["elementRegistry"],Hs.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var o=e.changed||this._getVisualReferences(n).concat(t),r=e.oldProperties||PO(n,wc(i));return Xx(n,i),e.oldProperties=r,e.changed=o,o},Hs.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Xx(n,t),i},Hs.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?TO(e,t):[]};function PO(e,t){return Qn(t,function(n,i){return n[i]=e.get(i),n},{})}function Xx(e,t){z(t,function(n,i){e.set(i,n)})}function TO(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&de(n).dataObjectRef===e})}var zs="default",_o="id",Zx="di",kO={width:0,height:0};function Gs(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Gs.$inject=["elementRegistry","moddle","modeling","textRenderer"],Gs.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,o=this._moddle.ids,r=t.businessObject,a=BO(e.properties),s=e.oldProperties||OO(t,a);return Qx(a,r)&&(o.unclaim(r[_o]),i.updateId(t,a[_o]),o.claim(a[_o],r)),zs in a&&(a[zs]&&n.push(i.get(a[zs].id)),r[zs]&&n.push(i.get(r[zs].id))),Jx(t,a),e.oldProperties=s,e.changed=n,n},Gs.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&de(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,kO)}},Gs.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return Jx(t,i),Qx(n,o)&&(a.unclaim(n[_o]),r.updateId(t,i[_o]),a.claim(i[_o],o)),e.changed};function Qx(e,t){return _o in e&&e[_o]!==t[_o]}function OO(e,t){var n=wc(t),i=e.businessObject,o=ft(e);return Qn(n,function(r,a){return a!==Zx?r[a]=i.get(a):r[a]=DO(o,wc(t.di)),r},{})}function DO(e,t){return Qn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Jx(e,t){var n=e.businessObject,i=ft(e);z(t,function(o,r){r!==Zx?n.set(r,o):i&&LO(i,o)})}function LO(e,t){z(t,function(n,i){e.set(i,n)})}var IO=["default"];function BO(e){var t=V({},e);return IO.forEach(function(n){n in e&&(t[n]=de(t[n]))}),t}function ou(e,t){this._canvas=e,this._modeling=t}ou.$inject=["canvas","modeling"],ou.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=ft(o);return t.setRootElement(n),t.removeRootElement(o),tn(a.rootElements,i),i.$parent=a,Zt(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},ou.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=ft(n);return t.setRootElement(o),t.removeRootElement(n),Zt(a.rootElements,i),i.$parent=null,tn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function eh(e,t){this._modeling=e,this._spaceTool=t}eh.$inject=["modeling","spaceTool"],eh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ei(i),a=r===i,s=a?i:i.parent,c=Wo(s),l=xn(i);if(l?o==="left"?o="top":o==="right"&&(o="bottom"):o==="top"?o="left":o==="bottom"&&(o="right"),!c.length){var u=l?{x:i.x+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Er(r,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:it(v.children,function(w){return w!==i})});var f,d,g,h,y;o==="top"?(f=-120,d=i.y,g=d+10,h="n",y="y"):o==="left"?(f=-120,d=i.x,g=d+10,h="w",y="x"):o==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",y="y"):o==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",y="x");var _=t.calculateAdjustments(p,y,f,g),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,x,h,g);var m=l?{x:i.x+(a?wi:0),y:d-(o==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},m,s)};function th(e){this._modeling=e}th.$inject=["modeling"],th.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=Wo(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Vs(e,t){this._modeling=e,this._spaceTool=t}Vs.$inject=["modeling","spaceTool"],Vs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Vs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=TT(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Vs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Be(e),o=Be(t),r=kv(o,i),a=Ei(e),s=[],c=[];Er(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",f=r.top>0||r.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",f=r.left>0||r.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Ws="flowNodeRef",nh="lanes";function ru(){}ru.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=Be(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ei(u);return o[p.id]||(o[p.id]=wl(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ei(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,f=p.get(nh),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Ws).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},ru.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,o=i.get(nh);n.remove.forEach(function(r){Zt(o,r),Zt(r.get(Ws),i)}),n.add.forEach(function(r){tn(o,r),tn(r.get(Ws),i)})}),[]},ru.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(nh);n.add.forEach(function(r){Zt(o,r),Zt(r.get(Ws),i)}),n.remove.forEach(function(r){tn(o,r),tn(r.get(Ws),i)})}),[]};var ih="categoryValueRef";function Us(e,t){this._bpmnFactory=e,this._elementRegistry=t}Us.$inject=["bpmnFactory","elementRegistry"],Us.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(x,m,v){if(m){var w=a.get(x);w||(w={},a.set(x,w)),!(v&&w.present)&&(!v&&w.past||(v?w.present={categoryValue:m,root:oh(x)}:w.past={categoryValue:m}))}}function c(x){o.set(x,de(x))}function l(){n.filter(function(x){return M(x,"bpmn:FlowElement")&&!Je(x)&&x.parent}).forEach(c)}function u(x){var m=de(x),v=m.get("categoryValueRef");return v||(v=Cv(i,m),r.push(NO(x,v))),v}function p(x){return x.reduce(function(m,v){var w=oh(v),S=m.get(w);return S||(S=[],m.set(w,S)),S.push(v),m},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return M(x,"bpmn:Group")&&!Je(x)&&x.parent}).forEach(function(x){var m=de(x).get("categoryValueRef");if(!m){var v=oh(x),w=f.get(v)||[],S=fa(w,x),P=Object.keys(S).length>0;P&&(m=u(x))}s(x,m,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(x,m){return m.present&&x.add(m.present.categoryValue),m.past&&x.add(m.past.categoryValue),x},new Set),h=new Map,y=p(d);a.forEach(function(x,m){var v=x.present;if(v){var w=y.get(v.root)||[],S=fa(w,m);w.forEach(function(P){if(S[P.id]){var T=h.get(P);T||(T=new Set,h.set(P,T)),T.add(v.categoryValue)}})}});var _=d.reduce(function(x,m){var v=o.get(m),w=v.get(ih),S=new Set(w),P=h.get(m)||new Set,T=Array.from(P).filter(function($){return!S.has($)}),D=w.filter(function($){return g.has($)&&!P.has($)});return(T.length||D.length)&&x.push({businessObject:v,categoryValuesToAdd:T,categoryValuesToRemove:D}),x},[]);return{flowElements:_,groups:r}},Us.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),$O(t.groups),jO(t.flowElements),[]},Us.prototype.revert=function(e){var t=e.updates;return HO(t.flowElements),FO(t.groups),[]};function NO(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function $O(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function FO(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=null})}function jO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(ih);t.categoryValuesToRemove.forEach(function(o){Zt(i,o)}),t.categoryValuesToAdd.forEach(function(o){tn(i,o,!0)})})}function HO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(ih);t.categoryValuesToAdd.forEach(function(o){Zt(i,o)}),t.categoryValuesToRemove.forEach(function(o){tn(i,o,!0)})})}function oh(e){for(;e.parent;)e=e.parent;return e}function au(e){this._moddle=e}au.$inject=["moddle"],au.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},au.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.unclaim(n):t.claim(n,i),[]};var zO={fill:void 0,stroke:void 0};function rh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Xn(t)){var n=GO(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}rh.$inject=["commandStack"],rh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||zO,i=this,o={};"fill"in n&&V(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(o,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(r){var a=Pt(r)?Li(o,["border-color"]):o,s=ft(r);if(VO(a),Je(r)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!tt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function GO(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 VO(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var WO={width:0,height:0};function e_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return bP(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!Je(l)&&Go(l)&&!ll(l)&&!t_(p)){var f=7,d=Pf(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=yi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Je(u)&&!M(u,"bpmn:TextAnnotation"))){if(Je(u)&&t_(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=yi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,WO)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}e_.$inject=["modeling","textRenderer","bpmnFactory"];function t_(e){return!e||!e.trim()}function Ln(e,t,n,i){Tt.call(this,e,t,n),this._bpmnRules=i}Ce(Ln,Tt),Ln.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Ln.prototype.getHandlers=function(){var e=Tt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Hs,e["element.updateProperties"]=Gs,e["canvas.updateRoot"]=ou,e["lane.add"]=eh,e["lane.resize"]=Vs,e["lane.split"]=th,e["lane.updateRefs"]=ru,e["group.updateRefs"]=Us,e["id.updateClaim"]=au,e["element.setColor"]=rh,e["element.updateLabel"]=e_,e},Ln.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Ln.prototype.connect=function(e,t,n,i){var o=this._bpmnRules;if(n||(n=o.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Ln.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Ln.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ln.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ln.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ln.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ln.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ln.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Ln.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ln.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ln.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function n_(){}n_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||je(t.source||e.source),t.connectionEnd||je(t.target||e.target)]};var su=20,UO=5,cu=Math.round,i_=20,qO={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function YO(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function KO(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function o_(e,t,n){var i=kn(t,e,UO),o=n.split(":")[0],r=cu((t.x-e.x)/2+e.x),a=cu((t.y-e.y)/2+e.y),s,c,l=KO(o,i),u=/h|r|l/.test(o),p=!1,f=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=YO(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+su*(/l/.test(o)?-1:1),y:f?a+su:a}):(f=r===e.x,s={x:f?r+su:r,y:e.y+su*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:ah(e,s,c).concat(s),directions:c,turnNextDirections:f}}function XO(e,t,n){return o_(e,t,n)}function ZO(e,t,n){var i=o_(t,e,r_(n));return{waypoints:i.waypoints.slice().reverse(),directions:r_(i.directions),turnNextDirections:i.turnNextDirections}}function QO(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 o=n+":"+i,r=ah(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function r_(e){return e.split(":").reverse().join(":")}function JO(e,t,n){var i=cu((t.x-e.x)/2+e.x),o=cu((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:o},{x:t.x,y:o}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function ah(e,t,n){if(n=n||"h:h",!cD(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(s_(n)){var i=XO(e,t,n),o=ZO(e,t,n),r=QO(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return JO(e,t,n)}function eD(e,t,n){var i=ah(e,t,n);return i.unshift(e),i.push(t),l_(i)}function tD(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=B1(r,"straight")[0]||"h:h",s=qO[a]||0,c=kn(e,t,s),l=sD(c,a);n=n||je(e),i=i||je(t);var u=l.split(":"),p=c_(n,e,u[0],lD(c)),f=c_(i,t,u[1],c);return eD(p,f,l)}function nD(e,t,n,i,o,r){$e(n)&&(o=n,r=i,n=je(e),i=je(t)),r=V({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&oD(e,t,n,i,r),c||(c=r.connectionEnd&&aD(t,e,i,o),c)||(c=r.connectionStart&&rD(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:tD(e,t,n,i,r)}function iD(e,t,n){return e>=t&&e<=n}function a_(e,t,n){var i={x:"width",y:"height"};return iD(t[e],n[e],n[e]+n[i[e]])}function oD(e,t,n,i,o){var r={},a,s;return s=kn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?a_(a,i,e)?(r[a]=i[a],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:i.x,y:i.y}]):null:a_(a,n,t)?(r[a]=n[a],[{x:n.x,y:n.y},{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y,original:{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y}}]):null):null}function rD(e,t,n,i){return sh(e,t,n,i)}function aD(e,t,n,i){var o=i.slice().reverse();return o=sh(e,t,n,o),o?o.reverse():null}function sh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Ot(u,function(p,f){var d=u[f-1];return d&&ms(p,d)<3})}function r(u,p,f){var d=po(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(Oy(u[d],p,i_)||Oy(u[d],f,i_))return u.slice(d);return u}if(o(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=r(c[1],s,n),l=a(c,e,t),l!==c&&(c=sh(e,t,n,l)),c&&po(c)?null:c}function sD(e,t){if(s_(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 cD(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function s_(e){return e&&/t|r|b|l/.test(e)}function lD(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 c_(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 l_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return Sf(o,r,n,0)||t.push(n),t},[])}var uD=-10,pD=40,fD={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},dD={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},ch={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},qs={top:"t",right:"r",bottom:"b",left:"l"};function lu(e){this._elementRegistry=e}Ce(lu,n_),lu.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,o=t.waypoints||e.waypoints,r=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(r||(r=u_(o&&o[0],n)),a||(a=u_(o&&o[o.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&o&&!p_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=wv(n,s)?fD:dD;return M(e,"bpmn:MessageFlow")?c=gD(n,i,u):(M(e,"bpmn:SequenceFlow")||p_(n,i))&&(n===i?c={preferredLayouts:_D(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:wD(n,i,a,u)}:Ys(n)||Ys(i)?c={preferredLayouts:u.subProcess,preserveDocking:yD(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=V(c,t),l=l_(nD(n,i,r,a,o,c))),l||[r,a]};function hD(e){var t=e.host;return kn(je(e),t,uD)}function gD(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:mD(e,t)}}function mD(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Ys(t)?"source":Ys(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function yD(e){return Ys(e)?"target":"source"}function u_(e,t){return e?e.original||e:je(t)}function p_(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ys(e){return M(e,"bpmn:SubProcess")&&st(e)}function Or(e,t){return e===t}function vD(e,t){return t.indexOf(e)!==-1}function Ta(e){var t=/right|left/.exec(e);return t&&t[0]}function ka(e){var t=/top|bottom/.exec(e);return t&&t[0]}function f_(e,t){return ch[e]===t}function bD(e,t){var n=Ta(e),i=ch[n];return t.indexOf(i)!==-1}function xD(e,t){var n=ka(e),i=ch[n];return t.indexOf(i)!==-1}function d_(e){return e==="right"||e==="left"}function _D(e,t,n){var i=t.waypoints,o=i&&i.length&&kn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function wD(e,t,n,i){var o=je(e),r=je(t),a=hD(e),s,c,l=Or(e.host,t),u=vD(a,["top","right","bottom","left"]),p=kn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?ED(a,u,e,t,n,i):(s=SD(a,p,u,i.isHorizontal),c=RD(a,p,u,i.isHorizontal),[s+":"+c])}function ED(e,t,n,i,o,r){var a=t?e:r.isHorizontal?ka(e):Ta(e),s=qs[a],c;return t?d_(e)?c=h_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=h_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function h_(e,t,n,i){var o=pD;return!(lh(e,i,n,o)||lh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||lh(e,i,je(t),o))}function lh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function SD(e,t,n,i){if(n)return qs[e];var o=ka(e),r=Ta(e),a=ka(t),s=Ta(t);if(i){if(Or(o,a)||f_(r,s))return qs[o]}else if(Or(r,s)||f_(o,a))return qs[r];return qs[i?r:o]}function RD(e,t,n,i){if(n)return d_(e)?bD(e,t)||Or(e,t)?"h":"v":xD(e,t)||Or(e,t)?"v":"h";var o=ka(e),r=Ta(e),a=ka(t),s=Ta(t);return a&&!s?"v":s&&!a?"h":i?Or(o,a)?"h":"v":Or(r,s)?"v":"h"}lu.$inject=["elementRegistry"];function g_(e){return V({original:e.point.original||e.point},e.actual)}function er(e,t){this._elementRegistry=e,this._graphicsFactory=t}er.$inject=["elementRegistry","graphicsFactory"],er.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(g_(i)),r.push(g_(o)),r},er.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},er.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return ys(i,o,n)},er.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},er.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},er.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const uh={__init__:["modeling","bpmnUpdater"],__depends__:[Vk,a2,c2,l2,Mx,uO,fO,vO,Ri,qd,Dx],bpmnFactory:["type",Mi],bpmnUpdater:["type",oi],elementFactory:["type",Zo],modeling:["type",Ln],layouter:["type",lu],connectionDocking:["type",er]};var CD=10,m_=50,MD=250;function ph(e,t,n,i){for(var o;o=AD(e,n,t);)n=i(t,n,o);return n}function fh(e){return function(t,n,i){var o={x:n.x,y:n.y};return["x","y"].forEach(function(r){var a=e[r];if(a){var s=r==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?o[r]=Math.min(i[r]+c-t[s]/2,n[r]-l+c):o[r]=Math.max(i[r]+i[s]+c+t[s]/2,n[r]+l+c)}}),o}}function AD(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=TD(e);return Ot(o,function(r){if(r===n)return!1;var a=kn(r,i,CD);return a==="intersect"})}function PD(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||m_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||MD,c=t.reference||"start";r||(r=DD);function l(g,h){return o==="n"?c==="start"?Be(g).top-Be(h).bottom:c==="center"?Be(g).top-je(h).y:Be(g).top-Be(h).top:o==="w"?c==="start"?Be(g).left-Be(h).right:c==="center"?Be(g).left-je(h).x:Be(g).left-Be(h).left:o==="s"?c==="start"?Be(h).top-Be(g).bottom:c==="center"?je(h).y-Be(g).bottom:Be(h).bottom-Be(g).bottom:c==="start"?Be(h).left-Be(g).right:c==="center"?je(h).x-Be(g).right:Be(h).right-Be(g).right}var u=e.incoming.filter(r).map(function(g){var h=a(g),y=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:y,weight:h}}),p=e.outgoing.filter(r).map(function(g){var h=a(g),y=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:y,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Qn(f,function(g,h){var y=h.distance,_=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*_,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return d.distance||i}function TD(e){var t=dh(e);return e.host&&(t=t.concat(dh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(dh(i))},[]))),t}function dh(e){return OD(e).concat(kD(e))}function kD(e){return e.incoming.map(function(t){return t.source})}function OD(e){return e.outgoing.map(function(t){return t.target})}function DD(){return!0}var LD=100;function y_(e,t,n){e.on("autoPlace",LD,function(i){var o=i.shape,r=i.source;return ID(r,o)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,o,r){e.fire("autoPlace.start",{source:i,shape:o});var a=e.fire("autoPlace",{source:i,shape:o}),s=t.appendShape(i,o,a,i.parent,r);return e.fire("autoPlace.end",{source:i,shape:s}),s}}y_.$inject=["eventBus","modeling","canvas"];function ID(e,t,n){n||(n={});var i=n.defaultDistance||m_,o=je(e),r=Be(e);return{x:r.right+i+t.width/2,y:o.y}}function v_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}v_.$inject=["eventBus","selection"];const BD={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",y_],autoPlaceSelectionBehavior:["type",v_]};function b_(e,t,n){var i=wv(e,n);if(M(t,"bpmn:TextAnnotation"))return $D(e,t,i);if(tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return FD(e,t,i);if(M(t,"bpmn:FlowNode"))return ND(e,t,i)}function ND(e,t,n){var i=Be(e),o=je(e),r=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=PD(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=kn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+x_(l,c,r)}:{x:o.x+x_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return ph(e,t,u,fh(f))}function x_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function $D(e,t,n){var i=Be(e),o=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};Pt(e)&&(o=je(e),n?(o.x+=100,o.y-=50):(o.x+=100,o.y+=50));var r={margin:n?-30:30,minDistance:20},a=n?{y:r}:{x:r};return ph(e,t,o,fh(a))}function FD(e,t,n){var i=Be(e),o=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},r={margin:30,minDistance:30},a=n?{x:r}:{y:r};return ph(e,t,o,fh(a))}function __(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return b_(o,i,t)})}__.$inject=["eventBus","elementRegistry"];const uu={__depends__:[BD],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",__]},w_=[xv,Es,uh,uu,Rp];function jD(e={}){Kg(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ga({container:t,moddleExtensions:e.moddleExtensions??Tc,additionalModules:[...w_,...e.additionalModules??[]]})}const E_={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","label-over-shape":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},HD={이:["이","가"],을:["을","를"],와:["과","와"]};function zD(e,t){const[n,i]=HD[t],o=e.at(-1)??"",r=o.charCodeAt(0);return r>=44032&&r<=55203?e+((r-44032)%28===0?i:n):o>="0"&&o<="9"?e+("013678".includes(o)?n:i):e+`${n}(${i})`}const GD={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},VD="요소";function hh(e){return(e&&GD[e.type])??VD}const S_=20;function WD(e){const t=e.replace(/\s+/g," ").trim();return t.length>S_?`${t.slice(0,S_)}…`:t}function pu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:WD(o.name),a=r===void 0?i+hh(o):r,s=r===void 0?a:`「${r}」`;return n?s+zD(a,n).slice(a.length):s}function UD(e,t,n,i,o){const[r,a]=[e(t),e(n)],s=(r==null?void 0:r.name)===void 0&&(a==null?void 0:a.name)===void 0&&hh(r)===hh(a);return[pu(e,t,i),pu(e,n,o,s?"다른 ":"")]}function qD(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function YD(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const fu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function KD(e,t){const n=(o,r)=>pu(t,o,r),i=(o,r,a,s)=>UD(t,o,r,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[o,r]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${o} ${r} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${o} ${r} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[o,r]=i(e.edge,e.other,void 0,"와");return`${o}의 라벨이 ${r} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[o,r]=i(e.groups[0],e.groups[1],"와","이");return`${o} ${r} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${fu[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${fu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${fu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${fu[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[o,r]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${o} ${r} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${o} ${r} 겹칩니다.`}}}function XD(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${pu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const R_="기타",gh={error:0,warning:1,info:2};function C_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:qD(i),targetRefs:YD(i),category:E_[i.kind]??R_,message:KD(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:E_[i.ruleId]??R_,message:XD(i,t)});return n}function M_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Oa(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function mh(e,t){if(t===void 0||e.length===0)return!1;const n=Oa(e[0],t);return e.some(i=>Oa(i,t)!==n)}function A_(e,t){const n=mh(e,t);return e.slice().sort((i,o)=>(n?Number(Oa(o,t))-Number(Oa(i,t)):0)||gh[i.severity]-gh[o.severity])}const P_="i18n-untranslated",T_="i18n-review-requested",yh="i18nDisplay.redrawn",k_=[["untranslated",P_],["reviewRequested",T_]];class vh{constructor(t,n,i,o,r,a,s,c){ui(this,"config");ui(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=o.drawShape.bind(o);o.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=r.activate.bind(r);r.activate=f=>this.withDisplayText(f,()=>u(f));const p=r.update.bind(r);r.update=(f,d,g,h)=>{const y=this.resolve(f);if(!y||y.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(Sc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(Sc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=gr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Jr(n).filter(f=>Nn(f)),s=f=>f.body??"",c=a.find(f=>Nn(f)===o&&s(f)),l=To(n).some(f=>f.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===r).map(Nn);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var r;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let o=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((r=this.resolve(a))==null?void 0:r.status)===n&&o++}finally{this.displayLocale=i}return o}withDisplayText(t,n,i){var f;if(!this.config)return n();const o=this.resolve(t),r=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(r)for(const[d,g]of k_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=gr((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===o.text)return n();a[s]=o.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,o.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,o]of k_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(yh)}}ui(vh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const O_={__depends__:[Rp],__init__:["i18nDisplay"],i18nDisplay:["type",vh]};var ZD=new Pr("ov"),QD=500;function Sn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=ZD,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=JD(n.getContainer()),this._init()}Sn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Sn.prototype.get=function(e){if(Xn(e)&&(e={id:e}),Xn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?it(t.overlays,Zr({type:e.type})):t.overlays.slice():[]}else return e.type?it(this._overlays,Zr({type:e.type})):e.id?this._overlays[e.id]:null},Sn.prototype.add=function(e,t,n){if(fn(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=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Sn.prototype.remove=function(e){var t=this.get(e)||[];$e(t)||(t=[t]);var n=this;z(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(qi(i.html),qi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Sn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Sn.prototype.show=function(){du(this._overlayRoot)},Sn.prototype.hide=function(){du(this._overlayRoot,!1)},Sn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Xc(this._overlayRoot)},Sn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=rn(t);i=r.x,o=r.y}D_(n,i,o),En(e.html,"data-container-id",t.id)},Sn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=rn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=rn(i).height:s=i.height,r=t.bottom*-1+s}D_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._createOverlayContainer=function(e){var t=Nt('<div class="djs-overlays" />');zn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Sn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";L_(this._overlayRoot,n)},Sn.prototype._getOverlayContainer=function(e,t){var n=Ot(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Sn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Xn(i)&&(i=Nt(i)),r=this._getOverlayContainer(n),o=Nt('<div class="djs-overlay" data-overlay-id="'+t+'">'),zn(o,{position:"absolute"}),o.appendChild(i),e.type&&Rt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();du(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(pn(o)&&o>t.scale||pn(r)&&r<t.scale))&&(c=!1),du(a,c),this._updateOverlayScale(e,t)},Sn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),pn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),pn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),pn(a)&&(s="scale("+a+","+a+")"),L_(r,s)},Sn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Sn.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 o=i.element,r=t.get({element:o});z(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){qi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",QD,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(z(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&Rt(o.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 JD(e){var t=Nt('<div class="djs-overlay-container" />');return zn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function D_(e,t,n){zn(e,{left:t+"px",top:n+"px"})}function du(e,t){e.style.display=t===!1?"none":""}function L_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const hu={__init__:["overlays"],overlays:["type",Sn]};function bh(e,t){t.invoke(pe,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)})}Ce(bh,pe),bh.$inject=["canvas","injector"];const eL={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",bh]};function Dr(e){return CSS.escape(e)}var tL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function I_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return tL[t]})}var nL="bjs-breadcrumbs-shown";function B_(e,t,n){var i=Nt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Rt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=de(l),p=Ot(a,function(f){return f===u});p&&s()});function s(c){c&&(a=iL(c));var l=a.flatMap(function(p){var f=n.findRoot(Qi(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(y){var _=de(y);return _&&_.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=I_(p.name||p.id),h=Nt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;r.toggle(nL,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}B_.$inject=["eventBus","elementRegistry","canvas"];function iL(e){for(var t=de(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function N_(e,t){var n=null,i=new oL;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!M(r,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}N_.$inject=["eventBus","canvas"];function oL(){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 $_={x:180,y:160};function Lr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}Lr.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)})}},Lr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;M(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),aL(a,e)&&i.push({diElement:r,parent:s})}});var o=[];return n.forEach(function(r){if(!t._processToDiagramMap[r.id]){var a=t._createDiagram(r);t._processToDiagramMap[r.id]=a,o.push(a)}}),i.forEach(function(r){for(var a=r.diElement,s=r.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),o},Lr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=rL(e),i={x:n.x-$_.x,y:n.y-$_.y};t.forEach(function(o){o.waypoint?o.waypoint.forEach(function(r){r.x=r.x-i.x,r.y=r.y-i.y}):o.bounds&&(o.bounds.x=o.bounds.x-i.x,o.bounds.y=o.bounds.y-i.y)})},Lr.prototype._moveToDiPlane=function(e,t){var n=F_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Lr.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},Lr.$inject=["eventBus","moddle"];function F_(e){return M(e,"bpmndi:BPMNDiagram")?e:F_(e.$parent)}function rL(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Be(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),il(t)}function aL(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||tt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var gu=250,sL='<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>',cL="bjs-drilldown-empty";function tr(e,t,n,i,o){pe.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",gu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",gu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],gu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],gu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return r._canDrillDown(a)}).map(function(a){r._addOverlay(a)})})}Ce(tr,pe),tr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},tr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(Qi(e))},tr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=de(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Rt(i.html).toggle(cL,!o)}},tr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=de(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Nt('<button type="button" class="bjs-drilldown">'+sL+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});r.setAttribute("title",s),r.addEventListener("click",function(){t.setRootElement(t.findRoot(Qi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},tr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},tr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const lL={__depends__:[hu,qd,eL],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",B_],drilldownCentering:["type",N_],drilldownOverlayBehavior:["type",tr],subprocessCompatibility:["type",Lr]};function nr(e){Gt.call(this,e)}Ce(nr,Gt),nr.prototype._modules=[xv,lL,hu,Ri,Es],nr.prototype._moddleExtensions={};var mu="keyboard.keydown",uL="keyboard.keyup",pL=1e3,j_="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 Gn(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(j_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Gn.$inject=["config.keyboard","eventBus"],Gn.prototype._keydownHandler=function(e){this._keyHandler(e,mu)},Gn.prototype._keyupHandler=function(e){this._keyHandler(e,uL)},Gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||mu,i),n&&e.preventDefault()}},Gn.prototype._isEventIgnored=function(e){return!1},Gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(j_)),this.unbind(),e=this._node=this._target,Le.bind(e,"keydown",this._keydownHandler),Le.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Gn.prototype.getBinding=function(){return this._node},Gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Le.unbind(e,"keydown",this._keydownHandler),Le.unbind(e,"keyup",this._keyupHandler)),this._node=null},Gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Gn.prototype.addListener=function(e,t,n){yn(e)&&(n=t,t=e,e=pL),this._eventBus.on(n||mu,e,t)},Gn.prototype.removeListener=function(e,t){this._eventBus.off(t||mu,e)},Gn.prototype.hasModifier=w2,Gn.prototype.isCmd=ni,Gn.prototype.isShift=Bd,Gn.prototype.isKey=hn;var fL=500;function Da(e,t){var n=this;e.on("editorActions.init",fL,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Da.$inject=["eventBus","keyboard"],Da.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(M2(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(A2(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(E2(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(S2(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(R2(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(C2(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(hn(["+","Add","="],o)&&ni(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(hn(["-","Subtract"],o)&&ni(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(hn("0",o)&&ni(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(hn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const xh={__init__:["keyboard","keyboardBindings"],keyboard:["type",Gn],keyboardBindings:["type",Da]};var dL={moveSpeed:50,moveSpeedAccelerated:200};function H_(e,t,n){var i=this;this._config=V({},dL,e||{}),t.addListener(o);function o(r){var a=r.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,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(r){var a=0,s=0,c=r.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(r.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}H_.$inject=["config.keyboardMove","keyboard","canvas"];const z_={__depends__:[xh],__init__:["keyboardMove"],keyboardMove:["type",H_]};var hL=15;function G_(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 o(s){var c=n.start,l=n.button,u=Cr(s),p=Bi(u,c);if(!n.dragging&&gL(p)>hL&&(n.dragging=!0,l===0&&ax(e),Hl("grab")),n.dragging){var f=n.last||n.start;p=Bi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Le.unbind(document,"mousemove",o),Le.unbind(document,"mouseup",r),n=null,rx()}function a(s){if(!_r(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Cr(s)},Le.bind(document,"mousemove",o),Le.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}G_.$inject=["eventBus","canvas"];function gL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const V_={__init__:["moveCanvas"],moveCanvas:["type",G_]};function W_(e,t){var n=Df(e.min),i=Df(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function mL(e,t){return Math.max(e.min,Math.min(e.max,t))}var yL=Math.sign||function(e){return e>=0?1:-1},_h={min:.2,max:4},U_=10,vL=.1,bL=.75;function to(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=qn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||bL;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}to.$inject=["config.zoomScroll","eventBus","canvas"],to.prototype.scroll=function(t){this._canvas.scroll(t)},to.prototype.reset=function(){this._canvas.zoom("fit-viewport")},to.prototype.zoom=function(t,n){var i=W_(_h,U_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>vL&&(this._zoom(t,n,i),this._totalDelta=0)},to.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||db()&&t.metaKey,o=t.shiftKey,r=-1*this._scale,a;if(i?r*=t.deltaMode===0?.02:.32:r*=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))*yL(t.deltaY)*r,this.zoom(a,c)}else o?a={dx:r*t.deltaY,dy:0}:a={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(a)}},to.prototype.stepZoom=function(t,n){var i=W_(_h,U_);this._zoom(t,n,i)},to.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Df(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(mL(_h,s),t)},to.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Le[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},to.prototype._init=function(e){this.toggle(e)};const q_={__init__:["zoomScroll"],zoomScroll:["type",to]};function Ks(e){nr.call(this,e)}Ce(Ks,nr),Ks.prototype._navigationModules=[z_,V_,q_],Ks.prototype._modules=[].concat(nr.prototype._modules,Ks.prototype._navigationModules);function wh(e){return e&&e[e.length-1]}function Y_(e){return e.y}function K_(e){return e.x}var xL={left:K_,center:K_,right:function(e){return e.x+e.width},top:Y_,middle:Y_,bottom:function(e){return e.y+e.height}};function La(e,t){this._modeling=e,this._rules=t}La.$inject=["modeling","rules"],La.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}},La.prototype._isType=function(e,t){return t.indexOf(e)!==-1},La.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(f,d){return Math.round((f[i]+d[i]+d[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=wh(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(z(t,function(f){var d=f[i]+Math.round(f[o]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Hi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=wh(c).center,r;l=t[0],t=Hi(t,function(f){return f[i]+f[o]}),u=wh(t),r[e]=p(l,u)}return r},La.prototype.trigger=function(e,t){var n=this._modeling,i,o=it(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),$e(i)&&(o=i),!(o.length<2||!i)){var r=xL[t],a=Hi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const _L={__init__:["alignElements"],alignElements:["type",La]},wL=new Pr;function Ia(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ia.$inject=["eventBus"],Ia.prototype.schedule=function(e,t=wL.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ia.prototype._schedule=function(e,t){const n=EL();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(o){n.reject(o)}}catch(o){console.error("Scheduler#_schedule execution failed",o)}}),promise:n.promise}},Ia.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ia.prototype._cancel=function(e){clearTimeout(e.executionId)};function EL(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const SL={scheduler:["type",Ia]};var RL="djs-element-hidden",yu=".entry",CL=1e3,X_=8,ML=300;function sn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}sn.$inject=["canvas","elementRegistry","eventBus","scheduler"],sn.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 o=i.target,r=$e(o)?o:[o],a=r.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=r.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,o=$e(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},sn.prototype._createContainer=function(){var e=Nt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},sn.prototype.registerProvider=function(e,t){t||(t=e,e=CL),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},sn.prototype.getEntries=function(e){var t=this._getProviders(),n=$e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(o){if(yn(o[n])){var r=o[n](e);yn(r)?i=r(i):z(r,function(a,s){i[s]=a})}}),i},sn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=En(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},ML);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},sn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(yn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},sn.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))}},sn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},sn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(o,r){var a=o.group||"default",s=Nt(o.html||'<div class="entry" draggable="true"></div>'),c;En(s,"data-action",r),c=wt("[data-group="+Dr(a)+"]",n),c||(c=Nt('<div class="group"></div>'),En(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&AL(s,o.className),o.title&&En(s,"title",o.title),o.imageUrl&&(i=Nt("<img>"),En(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Rt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},sn.prototype._createHtml=function(e){var t=this,n=Nt('<div class="djs-context-pad"></div>');return Jn.bind(n,yu,"click",function(i){t.trigger("click",i)}),Jn.bind(n,yu,"dragstart",function(i){t.trigger("dragstart",i)}),Jn.bind(n,yu,"mouseover",function(i){t.trigger("mouseover",i)}),Jn.bind(n,yu,"mouseout",function(i){t.trigger("mouseout",i)}),Le.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},sn.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()&&TL(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},sn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},sn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return $e(e)!==$e(n)?!1:$e(e)?e.length===n.length&&Ao(e,function(i){return n.includes(i)}):n===e},sn.prototype.isShown=function(){return this.isOpen()&&Rt(this._current.html).has("open")},sn.prototype.show=function(){this.isOpen()&&(Rt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},sn.prototype.hide=function(){this.isOpen()&&(Rt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},sn.prototype._getPosition=function(e){if(!$e(e)&&Pt(e)){var t=this._canvas.viewbox(),n=PL(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+X_*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+X_*this._canvas.zoom(),top:s.top-a.top}},sn.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")},sn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=$e(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,RL)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},sn.prototype._getTargetBounds=function(e){var t=this,n=$e(e)?e:[e],i=n.map(function(o){return t._canvas.getGraphics(o)});return i.reduce(function(o,r){const a=r.getBoundingClientRect();return o.top=Math.min(o.top,a.top),o.right=Math.max(o.right,a.right),o.bottom=Math.max(o.bottom,a.bottom),o.left=Math.min(o.left,a.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function AL(e,t){var n=Rt(e);t=$e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function PL(e){return e.waypoints[e.waypoints.length-1]}function TL(e,t){return e=$e(e)?e:[e],t=$e(t)?t:[t],e.length===t.length&&Ao(e,function(n){return t.includes(n)})}const Z_={__depends__:[jl,SL,hu],contextPad:["type",sn]};var vu,Wt,Q_,ir,J_,ew,tw,Eh,bu,Xs,nw,Sh,Rh,Ch,xu={},_u=[],kL=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,wu=Array.isArray;function wo(e,t){for(var n in t)e[n]=t[n];return e}function Mh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function iw(e,t,n){var i,o,r,a={};for(r in t)r=="key"?i=t[r]:r=="ref"?o=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?vu.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)a[r]===void 0&&(a[r]=e.defaultProps[r]);return Eu(e,a,i,o,null)}function Eu(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Q_,__i:-1,__u:0};return o==null&&Wt.vnode!=null&&Wt.vnode(r),r}function Su(e){return e.children}function Ru(e,t){this.props=e,this.context=t}function Ir(e,t){if(t==null)return e.__?Ir(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"?Ir(e):null}function OL(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=wo({},t);r.__v=t.__v+1,Wt.vnode&&Wt.vnode(r),Ah(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Ir(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,pw(i,r,o),t.__e=t.__=null,r.__e!=n&&ow(r)}}function ow(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}),ow(e)}function rw(e){(!e.__d&&(e.__d=!0)&&ir.push(e)&&!Cu.__r++||J_!=Wt.debounceRendering)&&((J_=Wt.debounceRendering)||ew)(Cu)}function Cu(){try{for(var e,t=1;ir.length;)ir.length>t&&ir.sort(tw),e=ir.shift(),t=ir.length,OL(e)}finally{ir.length=Cu.__r=0}}function aw(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,y,_=i&&i.__k||_u,x=t.length;for(c=DL(n,t,_,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&_[d.__i]||xu,d.__i=p,y=Ah(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Ph(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=sw(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function DL(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,f=0;for(e.__k=new Array(o),r=0;r<o;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=Eu(null,a,null,null,null):wu(a)?a=e.__k[r]=Eu(Su,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Eu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+f,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=LL(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?f--:o<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Ir(s)),dw(s,s));return i}function sw(e,t,n){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=sw(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Ir(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function LL(e,t,n,i){var o,r,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(o=n-1,r=n+1;o>=0||r<t.length;)if((l=t[a=o>=0?o--:r++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function cw(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||kL.test(t)?n:n+"px"}function Mu(e,t,n,i,o){var r,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||cw(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||cw(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(nw,"$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+r]=n,n?i?n[Xs]=i[Xs]:(n[Xs]=Sh,e.addEventListener(t,r?Ch:Rh,r)):e.removeEventListener(t,r?Ch:Rh,r);else{if(o=="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 lw(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[bu]==null)t[bu]=Sh++;else if(t[bu]<n[Xs])return;return n(Wt.event?Wt.event(t):t)}}}function Ah(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,y,_,x,m,v,w,S,P,T,D,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Wt.__b)&&u(t);e:if(typeof $=="function"){p=a.length;try{if(x=t.props,m=$.prototype&&$.prototype.render,v=(u=$.contextType)&&i[u.__c],w=u?v?v.props.value:u.__:i,n.__c?_=(f=t.__c=n.__c).__=f.__E:(m?t.__c=f=new $(x,w):(t.__c=f=new Ru(x,w),f.constructor=$,f.render=BL),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),m&&f.__s==null&&(f.__s=f.state),m&&$.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=wo({},f.__s)),wo(f.__s,$.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=t,d)m&&$.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),m&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(m&&$.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,w)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),_u.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Ir(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,w),m&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,y)})}if(f.context=w,f.props=x,f.__P=e,f.__e=!1,S=Wt.__r,P=0,m)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),_u.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(i=wo(wo({},i),f.getChildContext())),m&&!d&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(g,h)),T=u!=null&&u.type===Su&&u.key==null?fw(u.props.children):u,s=aw(e,wu(T)?T:[T],t,n,i,o,r,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),_&&(f.__E=f.__=null)}catch(N){if(a.length=p,t.__v=null,c||r!=null){if(N.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r!=null&&(r[r.indexOf(s)]=null),t.__e=s}else if(r!=null)for(D=r.length;D--;)Mh(r[D])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||uw(t),Wt.__e(N,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=IL(n.__e,t,n,i,o,r,a,c,l);return(u=Wt.diffed)&&u(t),128&t.__u?void 0:s}function uw(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(uw))}function pw(e,t,n){for(var i=0;i<n.length;i++)Ph(n[i],n[++i],n[++i]);Wt.__c&&Wt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Wt.__e(r,o.__v)}})}function fw(e){return typeof e!="object"||e==null||e.__b>0?e:wu(e)?e.map(fw):e.constructor!==void 0?null:wo({},e)}function IL(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,y=n.props||xu,_=t.props,x=t.type;if(x=="svg"?o="http://www.w3.org/2000/svg":x=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((d=r[l])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(_);e=document.createElementNS(o,x,_.is&&_),s&&(Wt.__m&&Wt.__m(t,r),s=!1),r=null}if(x==null)y===_||s&&e.data==_||(e.data=_);else{if(r=x=="textarea"&&_.defaultValue!=null?null:r&&vu.call(e.childNodes),!s&&r!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||Mu(e,l,null,d,o);for(l in _)d=_[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||Mu(e,l,d,y[l],o);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),aw(t.type=="template"?e.content:e,wu(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Ir(n,0),s,c),r!=null)for(l=r.length;l--;)Mh(r[l]);s&&x!="textarea"||(l="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||x=="progress"&&!g||x=="option"&&g!=y[l])&&Mu(e,l,g,y[l],o),l="checked",h!=null&&h!=e[l]&&Mu(e,l,h,y[l],o))}return e}function Ph(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(o){Wt.__e(o,n)}}function dw(e,t,n){var i,o;if(Wt.unmount&&Wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ph(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Wt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&dw(i[o],t,n||typeof e.type!="function");n||Mh(e.__e),e.__c=e.__=e.__e=void 0}function BL(e,t,n){return this.constructor(e,n)}function hw(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Wt.__&&Wt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Ah(t,e=t.__k=iw(Su,null,[e]),o||xu,xu,t.namespaceURI,o?null:t.firstChild?vu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),pw(r,e,a),e.props.children=null}vu=_u.slice,Wt={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},Q_=0,Ru.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=wo({},this.state),typeof e=="function"&&(e=e(wo({},n),this.props)),e&&wo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),rw(this))},Ru.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),rw(this))},Ru.prototype.render=Su,ir=[],ew=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,tw=function(e,t){return e.__v.__b-t.__v.__b},Cu.__r=0,Eh=Math.random().toString(8),bu="__d"+Eh,Xs="__a"+Eh,nw=/(PointerCapture)$|Capture$/i,Sh=0,Rh=lw(!1),Ch=lw(!0);var gw=function(e,t,n,i){var o;t[0]=0;for(var r=1;r<t.length;r++){var a=t[r++],s=t[r]?(t[0]|=a?1:2,n[t[r++]]):t[++r];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++r]]=s:a===6?i[1][t[++r]]+=s+"":a?(o=e.apply(s,gw(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},mw=new Map;function NL(e){var t=mw.get(this);return t||(t=new Map,mw.set(this,t)),(t=gw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(f){r===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):r===3&&(f||a)?(c.push(3,f,a),r=2):r===2&&a==="..."&&f?c.push(4,f,0):r===2&&a&&!f?c.push(5,0,!0,a):r>=5&&((a||!f&&r===5)&&(c.push(r,0,a,o),r=6),f&&(c.push(r,f,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var kt=NL.bind(iw),Ba,cn,Th,yw,Zs=0,vw=[],gn=Wt,bw=gn.__b,xw=gn.__r,_w=gn.diffed,ww=gn.__c,Ew=gn.unmount,Sw=gn.__;function Au(e,t){gn.__h&&gn.__h(cn,e,Zs||t),Zs=0;var n=cn.__H||(cn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function kh(e){return Zs=1,$L(Cw,e)}function $L(e,t,n){var i=Au(Ba++,2);if(i.t=e,!i.__c&&(i.__=[Cw(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=cn,!cn.__f)){var o=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),r){var f=r.call(this,s,c,l);return u?f||p:f}return!u||p};cn.__f=!0;var r=cn.shouldComponentUpdate,a=cn.componentWillUpdate;cn.componentWillUpdate=function(s,c,l){if(this.__e){var u=r;r=void 0,o(s,c,l),r=u}a&&a.call(this,s,c,l)},cn.shouldComponentUpdate=o}return i.__N||i.__}function Pu(e,t){var n=Au(Ba++,3);!gn.__s&&Lh(n.__H,t)&&(n.__=e,n.u=t,cn.__H.__h.push(n))}function Oh(e,t){var n=Au(Ba++,4);!gn.__s&&Lh(n.__H,t)&&(n.__=e,n.u=t,cn.__h.push(n))}function Tu(e){return Zs=5,Eo(function(){return{current:e}},[])}function Eo(e,t){var n=Au(Ba++,7);return Lh(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Qs(e,t){return Zs=8,Eo(function(){return e},t)}function FL(){for(var e;e=vw.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ku),t.__h.some(Dh),t.__h=[]}catch(n){t.__h=[],gn.__e(n,e.__v)}}}gn.__b=function(e){cn=null,bw&&bw(e)},gn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Sw&&Sw(e,t)},gn.__r=function(e){xw&&xw(e),Ba=0;var t=(cn=e.__c).__H;t&&(Th===cn?(t.__h=[],cn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ku),t.__h.some(Dh),t.__h=[],Ba=0)),Th=cn},gn.diffed=function(e){_w&&_w(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vw.push(t)!==1&&yw===gn.requestAnimationFrame||((yw=gn.requestAnimationFrame)||jL)(FL)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Th=cn=null},gn.__c=function(e,t){t.some(function(n){try{n.__h.some(ku),n.__h=n.__h.filter(function(i){return!i.__||Dh(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],gn.__e(i,n.__v)}}),ww&&ww(e,t)},gn.unmount=function(e){Ew&&Ew(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{ku(i)}catch(o){t=o}}),n.__H=void 0,t&&gn.__e(t,n.__v))};var Rw=typeof requestAnimationFrame=="function";function jL(e){var t,n=function(){clearTimeout(i),Rw&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Rw&&(t=requestAnimationFrame(n))}function ku(e){var t=cn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),cn=t}function Dh(e){var t=cn;e.__c=e.__(),cn=t}function Lh(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Cw(e,t){return typeof t=="function"?t(e):t}function HL(e){const{navigationStack:t,setNavigationStack:n}=e,i=Eo(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),o=t.length>0?()=>n([]):null,r=t.length>0?t[t.length-1].label:null;return kt`
12
12
  <div class="djs-popup-breadcrumbs">
13
- ${r&&Tt`
13
+ ${o&&kt`
14
14
  <button
15
15
  type="button"
16
16
  class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
17
17
  title="Back"
18
18
  aria-label="Back"
19
- onClick=${r}
19
+ onClick=${o}
20
20
  >
21
21
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
22
22
  <path fill-rule="evenodd" clip-rule="evenodd" d="M8.03033 1.46967C8.32322 1.76256 8.32322 2.23744 8.03033 2.53033L4.56066 6L8.03033 9.46967C8.32322 9.76256 8.32322 10.2374 8.03033 10.5303C7.73744 10.8232 7.26256 10.8232 6.96967 10.5303L2.96967 6.53033C2.67678 6.23744 2.67678 5.76256 2.96967 5.46967L6.96967 1.46967C7.26256 1.17678 7.73744 1.17678 8.03033 1.46967Z" fill="currentColor"/>
23
23
  </svg>
24
24
  </button>
25
25
  `}
26
- ${i.map((a,s)=>Tt`
26
+ ${i.map((a,s)=>kt`
27
27
  <button
28
28
  key=${s}
29
29
  type="button"
@@ -35,33 +35,33 @@
35
35
  </button>
36
36
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
37
37
  `)}
38
- ${o&&Tt`
39
- <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
40
- ${o}
38
+ ${r&&kt`
39
+ <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${r}>
40
+ ${r}
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function bw(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=bw(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Pu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=bw(e))&&(i&&(i+=" "),i+=t);return i}function RL(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=wr(()=>CL(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Tt`
44
+ `}function Mw(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Mw(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Ou(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Mw(e))&&(i&&(i+=" "),i+=t);return i}function zL(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Eo(()=>GL(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return kt`
45
45
  <div class="djs-popup-header">
46
- <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
- ${a.map(l=>Tt`
46
+ <h3 class="djs-popup-title" title=${r}>${r}</h3>
47
+ ${a.map(l=>kt`
48
48
  <ul key=${l.id} class="djs-popup-header-group" data-header-group=${l.id}>
49
49
 
50
- ${l.entries.map(u=>Tt`
50
+ ${l.entries.map(u=>kt`
51
51
  <li key=${u.id}>
52
52
  <${s(u)?"button":"span"}
53
- class=${ML(u,u===i)}
53
+ class=${VL(u,u===i)}
54
54
  onClick=${p=>c(p,u)}
55
55
  title=${u.title||u.label}
56
56
  data-id=${u.id}
57
57
  aria-disabled=${u.disabled||void 0}
58
- onMouseEnter=${()=>s(u)&&r(u)}
59
- onMouseLeave=${()=>s(u)&&r(null)}
60
- onFocus=${()=>s(u)&&r(u)}
61
- onBlur=${()=>s(u)&&r(null)}
58
+ onMouseEnter=${()=>s(u)&&o(u)}
59
+ onMouseLeave=${()=>s(u)&&o(null)}
60
+ onFocus=${()=>s(u)&&o(u)}
61
+ onBlur=${()=>s(u)&&o(null)}
62
62
  >
63
- ${u.imageUrl&&Tt`<img class="djs-popup-entry-icon" src=${u.imageUrl} alt="" />`||u.imageHtml&&Tt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:u.imageHtml}} />`}
64
- ${u.label?Tt`
63
+ ${u.imageUrl&&kt`<img class="djs-popup-entry-icon" src=${u.imageUrl} alt="" />`||u.imageHtml&&kt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:u.imageHtml}} />`}
64
+ ${u.label?kt`
65
65
  <span class="djs-popup-label">${u.label}</span>
66
66
  `:null}
67
67
  </${u.action?"button":"span"}>
@@ -70,35 +70,35 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function CL(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 ML(e,t){return Pu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function xw(e,t){return`${e}-entry-${t.id}`}function AL(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return Tt`
73
+ `}function GL(e){return e.reduce((t,n)=>{const i=n.group||"default",o=t.find(r=>r.id===i);return o?o.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function VL(e,t){return Ou("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Aw(e,t){return`${e}-entry-${t.id}`}function WL(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:o,onMouseLeave:r,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return kt`
74
74
  <li
75
- class=${Pu("entry",{selected:i,disabled:n.disabled})}
75
+ class=${Ou("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${xw(t,n)}
77
+ id=${Aw(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
81
81
  title=${n.title}
82
82
  aria-disabled=${n.disabled||void 0}
83
83
  onClick=${s}
84
- onMouseEnter=${r}
85
- onMouseLeave=${o}
84
+ onMouseEnter=${o}
85
+ onMouseLeave=${r}
86
86
  onDragStart=${l=>c&&s(l,"dragstart")}
87
87
  draggable=${c}
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
91
- class=${Pu("djs-popup-entry-name",n.className)}
91
+ class=${Ou("djs-popup-entry-name",n.className)}
92
92
  >
93
- ${n.imageUrl&&Tt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Tt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
+ ${n.imageUrl&&kt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&kt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
95
- ${n.label?Tt`
95
+ ${n.label?kt`
96
96
  <span class="djs-popup-label">
97
97
  ${n.label}
98
98
  </span>
99
99
  `:null}
100
100
 
101
- ${n.documentationRef&&Tt`
101
+ ${n.documentationRef&&kt`
102
102
  <a
103
103
  class="djs-popup-entry-docs"
104
104
  href=${n.documentationRef}
@@ -115,7 +115,7 @@
115
115
  </a>
116
116
  `}
117
117
  </span>
118
- ${n.description&&Tt`
118
+ ${n.description&&kt`
119
119
  <span
120
120
  class="djs-popup-entry-description"
121
121
  >
@@ -123,7 +123,7 @@
123
123
  </span>
124
124
  `}
125
125
  </div>
126
- ${n.entries&&Tt`
126
+ ${n.entries&&kt`
127
127
  <div class="djs-popup-entry-chevron" aria-hidden="true">
128
128
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
129
129
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function PL(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Mu();Ch(()=>{if(!r||!r.current)return;const h=p.current;if(!h)return;const y=h.querySelector(".selected");y&&TL(y)},[t]);const f=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return Tt`
134
+ `}function UL(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Tu();Oh(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const y=h.querySelector(".selected");y&&qL(y)},[t]);const f=()=>{o.current=!1},d=h=>{o.current||n(h)},g=()=>{o.current||n(null)};return kt`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${p}
@@ -142,9 +142,9 @@
142
142
  aria-activedescendant=${l}
143
143
  onMouseMove=${f}
144
144
  >
145
- ${i.map(h=>Tt`
146
- ${h.name&&Tt`
147
- <div key=${h.id} id=${_w(o,h)} class="entry-header" title=${h.name}>
145
+ ${i.map(h=>kt`
146
+ ${h.name&&kt`
147
+ <div key=${h.id} id=${Pw(r,h)} class="entry-header" title=${h.name}>
148
148
  ${h.name}
149
149
  </div>
150
150
  `}
@@ -152,12 +152,12 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${h.name?_w(o,h):void 0}
155
+ aria-labelledby=${h.name?Pw(r,h):void 0}
156
156
  >
157
- ${h.entries.map(y=>Tt`
158
- <${AL}
157
+ ${h.entries.map(y=>kt`
158
+ <${WL}
159
159
  key=${y.id}
160
- idPrefix=${o}
160
+ idPrefix=${r}
161
161
  entry=${y}
162
162
  selected=${y===t}
163
163
  onMouseEnter=${()=>d(y)}
@@ -168,36 +168,36 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function _w(e,t){return`${e}-group-${t.id}`}function TL(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const kL=new Mo("djs-popup");function OL(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,y]=Rh([]);Cu(()=>{y([])},[f]);const[_,x]=Rh(""),m=_.trim().length>0,v=wr(()=>IL(f),[f]),E=wr(()=>pn(l)?v.length>5:!1,[l,v]),S=wr(()=>{const W=h.length?h[h.length-1].entries:f;return E?m?p(v.filter(({searchable:Y})=>Y!==!1),_,{keys:["label","search","description"]}).map(({item:Y})=>Y):W.filter(({rank:Y=0})=>Y>=0):W},[E,m,v,_,p,h,f]),P=wr(()=>m?S.length?[{id:"default",entries:S}]:[]:BL(S),[S,m]),[k,$]=Rh(S[0]),N=Mu(null),L=Mu(!1),z=wr(()=>kL.next(),[]),X=`${z}-results`,oe=k&&xw(z,k);Cu(()=>{const W=N.current;W&&S.includes(W)?$(W):$(S[0]),N.current=null},[S]);const te=Ys(W=>{const Y=LL(P);let me=Y.indexOf(k)+W;me<0&&(me=Y.length-1),me>=Y.length&&(me=0),L.current=!0,$(Y[me])},[P,k]),Ge=Ys(W=>{W>0&&k&&k.entries&&(L.current=!0,y(Y=>[...Y,k])),W<0&&h.length>0&&(L.current=!0,N.current=h[h.length+W],y(Y=>Y.slice(0,W)))},[k,h]),qe=Ys((W,Y,ae)=>{if(!(!Y||Y.disabled))return Y.entries?(W.preventDefault(),Ge(1)):n(W,Y,ae)},[n,Ge]),Ve=Ys(W=>{if(W.key==="Enter"&&k){const Y=W.target;return!!bo(Y,"a, button",!0)||k.disabled?void 0:qe(W,k)}if(W.key==="Backspace"){const Y=W.target;if(!(of(Y,"input")&&Y.value!==""))return Ge(-1),W.preventDefault()}if(W.key==="ArrowUp")return te(-1),W.preventDefault();if(W.key==="ArrowDown")return te(1),W.preventDefault();if(W.key==="ArrowRight")return Ge(1),W.preventDefault();if(W.key==="ArrowLeft")return Ge(-1),W.preventDefault()},[k,te,Ge,qe]),Re=Ys(W=>{of(W.target,"input")&&x(()=>W.target.value)},[x]);Cu(()=>(d(),()=>{g()}),[]);const Z=!m&&h.length>0,ie=(a||r.length>0)&&!Z;return Tt`
172
- <${ww}
171
+ `}function Pw(e,t){return`${e}-group-${t.id}`}function qL(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const YL=new Pr("djs-popup");function KL(e){const{onClose:t,onSelect:n,className:i,headerEntries:o,position:r,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,y]=kh([]);Pu(()=>{y([])},[f]);const[_,x]=kh(""),m=_.trim().length>0,v=Eo(()=>QL(f),[f]),w=Eo(()=>pn(l)?v.length>5:!1,[l,v]),S=Eo(()=>{const W=h.length?h[h.length-1].entries:f;return w?m?p(v.filter(({searchable:Y})=>Y!==!1),_,{keys:["label","search","description"]}).map(({item:Y})=>Y):W.filter(({rank:Y=0})=>Y>=0):W},[w,m,v,_,p,h,f]),P=Eo(()=>m?S.length?[{id:"default",entries:S}]:[]:JL(S),[S,m]),[T,D]=kh(S[0]),$=Tu(null),N=Tu(!1),H=Eo(()=>YL.next(),[]),X=`${H}-results`,Q=T&&Aw(H,T);Pu(()=>{const W=$.current;W&&S.includes(W)?D(W):D(S[0]),$.current=null},[S]);const ee=Qs(W=>{const Y=ZL(P);let ge=Y.indexOf(T)+W;ge<0&&(ge=Y.length-1),ge>=Y.length&&(ge=0),N.current=!0,D(Y[ge])},[P,T]),Ve=Qs(W=>{W>0&&T&&T.entries&&(N.current=!0,y(Y=>[...Y,T])),W<0&&h.length>0&&(N.current=!0,$.current=h[h.length+W],y(Y=>Y.slice(0,W)))},[T,h]),qe=Qs((W,Y,ae)=>{if(!(!Y||Y.disabled))return Y.entries?(W.preventDefault(),Ve(1)):n(W,Y,ae)},[n,Ve]),Ge=Qs(W=>{if(W.key==="Enter"&&T){const Y=W.target;return!!_r(Y,"a, button",!0)||T.disabled?void 0:qe(W,T)}if(W.key==="Backspace"){const Y=W.target;if(!(pf(Y,"input")&&Y.value!==""))return Ve(-1),W.preventDefault()}if(W.key==="ArrowUp")return ee(-1),W.preventDefault();if(W.key==="ArrowDown")return ee(1),W.preventDefault();if(W.key==="ArrowRight")return Ve(1),W.preventDefault();if(W.key==="ArrowLeft")return Ve(-1),W.preventDefault()},[T,ee,Ve,qe]),Re=Qs(W=>{pf(W.target,"input")&&x(()=>W.target.value)},[x]);Pu(()=>(d(),()=>{g()}),[]);const Z=!m&&h.length>0,oe=(a||o.length>0)&&!Z;return kt`
172
+ <${Tw}
173
173
  onClose=${t}
174
174
  onKeyup=${Re}
175
- onKeydown=${Ve}
175
+ onKeydown=${Ge}
176
176
  className=${i}
177
- position=${o}
177
+ position=${r}
178
178
  width=${s}
179
179
  scale=${c}
180
180
  navigationStack=${h}
181
181
  >
182
- ${ie&&Tt`
183
- <${RL}
184
- headerEntries=${r}
182
+ ${oe&&kt`
183
+ <${zL}
184
+ headerEntries=${o}
185
185
  onSelect=${n}
186
- selectedEntry=${k}
187
- setSelectedEntry=${$}
186
+ selectedEntry=${T}
187
+ setSelectedEntry=${D}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${Z&&Tt`
192
- <${SL}
191
+ ${Z&&kt`
192
+ <${HL}
193
193
  navigationStack=${h}
194
194
  setNavigationStack=${y}
195
195
  />
196
196
  `}
197
- ${f.length>0&&Tt`
197
+ ${f.length>0&&kt`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${E&&Tt`
200
+ ${w&&kt`
201
201
  <div class="djs-popup-search">
202
202
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
203
203
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -209,38 +209,38 @@
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
211
  aria-controls=${X}
212
- aria-activedescendant=${oe||void 0}
212
+ aria-activedescendant=${Q||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
216
216
  `}
217
217
 
218
- ${m&&Tt`
218
+ ${m&&kt`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${S.length} ${S.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${PL}
224
+ <${UL}
225
225
  groupedEntries=${P}
226
- selectedEntry=${k}
227
- setSelectedEntry=${$}
228
- keyboardSelection=${L}
226
+ selectedEntry=${T}
227
+ setSelectedEntry=${D}
228
+ keyboardSelection=${N}
229
229
  onAction=${qe}
230
- idPrefix=${z}
230
+ idPrefix=${H}
231
231
  id=${X}
232
232
  ariaLabel=${a||"Results"}
233
- tabIndex=${E?-1:0}
234
- ariaActivedescendant=${E?void 0:oe||void 0}
233
+ tabIndex=${w?-1:0}
234
+ ariaActivedescendant=${w?void 0:Q||void 0}
235
235
  />
236
236
 
237
- ${k&&k.documentationRef&&Tt`
237
+ ${T&&T.documentationRef&&kt`
238
238
  <div class="djs-popup-footer">
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
- href=${k.documentationRef}
241
+ href=${T.documentationRef}
242
242
  onClick=${W=>W.stopPropagation()}
243
- aria-label=${k.label?`Open entry documentation for ${k.label}`:"Open entry documentation"}
243
+ aria-label=${T.label?`Open entry documentation for ${T.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
246
246
  >
@@ -254,37 +254,37 @@
254
254
  `}
255
255
  </div>
256
256
  `}
257
- ${u&&S.length===0&&Tt`
257
+ ${u&&S.length===0&&kt`
258
258
  <div class="djs-popup-no-results">${yn(u)?u(_):u}</div>
259
259
  `}
260
- </${ww}>
261
- `}function ww(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Mu();return Ch(()=>{if(typeof s!="function")return;const l=c.current,u=s(l);l.style.left=`${u.x}px`,l.style.top=`${u.y}px`},[c.current,s]),Ch(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Cu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!bo(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),Tt`
260
+ </${Tw}>
261
+ `}function Tw(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=Tu();return Oh(()=>{if(typeof s!="function")return;const l=c.current,u=s(l);l.style.left=`${u.x}px`,l.style.top=`${u.y}px`},[c.current,s]),Oh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Pu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!_r(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),kt`
262
262
  <div
263
- class=${Pu("djs-popup",r)}
264
- style=${DL(e)}
263
+ class=${Ou("djs-popup",o)}
264
+ style=${XL(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
268
268
  tabIndex="-1"
269
269
  >
270
- ${o}
270
+ ${r}
271
271
  </div>
272
- `}function DL(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:pn(t)?n:void 0,maxWidth:pn(t)?"unset":void 0,"transform-origin":"top left"}}function LL(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function IL(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function BL(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 NL="data-id",Ew=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],$L=1e3;function Ut(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=pn(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()})}Ut.$inject=["config.popupMenu","eventBus","canvas","search"],Ut.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Sw(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);aw(Tt`
273
- <${OL}
272
+ `}function XL(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:pn(t)?n:void 0,maxWidth:pn(t)?"unset":void 0,"transform-origin":"top left"}}function ZL(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function QL(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function JL(e){const t=[],n=r=>t.find(a=>r.id===a.id),i=r=>!!n(r),o=r=>typeof r=="string"?{id:r}:r;return e.forEach(r=>{const a=r.group?o(r.group):{id:"default"};i(a)?n(a).entries.push(r):t.push({...a,entries:[r]})}),t}var eI="data-id",kw=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],tI=1e3;function Ut(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=pn(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const a=this.isOpen()&&this._current.target;r.element===a&&this.refresh()})}Ut.$inject=["config.popupMenu","eventBus","canvas","search"],Ut.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=Ow(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);hw(kt`
273
+ <${KL}
274
274
  onClose=${f=>this.close(f)}
275
275
  onSelect=${(f,d,g)=>this.trigger(f,d,g)}
276
276
  position=${c}
277
277
  className=${t}
278
278
  entries=${a}
279
279
  headerEntries=${s}
280
- emptyPlaceholder=${r}
280
+ emptyPlaceholder=${o}
281
281
  scale=${l}
282
282
  onOpened=${this._onOpened.bind(this)}
283
283
  onClosed=${this._onClosed.bind(this)}
284
284
  searchFn=${this._search}
285
- ...${{...o}}
285
+ ...${{...r}}
286
286
  />
287
- `,this._current.container)},Ut.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()},Ut.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()},Ut.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)}},Ut.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Ut.prototype.reset=function(){const e=this._current.container;aw(null,e),qi(e)},Ut.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Ut.prototype._onOpened=function(){this._emit("opened")},Ut.prototype._onClosed=function(){this._emit("closed")},Ut.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Nt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Ut.prototype._bindAutoClose=function(){this._eventBus.once(Ew,this.close,this)},Ut.prototype._unbindAutoClose=function(){this._eventBus.off(Ew,this.close,this)},Ut.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),pn(n)&&e<n&&(r=n),pn(i)&&e>i&&(r=i)),r},Ut.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}},Ut.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},Ut.prototype.registerProvider=function(e,t,n){n||(n=t,t=$L),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Ut.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Ut.prototype._getEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuEntries){H(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=zi(o,["id"])});return}var r=i.getPopupMenuEntries(e);yn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},Ut.prototype._getHeaderEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;H(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=zi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);yn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},Ut.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>yn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Ut.prototype.isOpen=function(){return!!this._current},Ut.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=bo(e.delegateTarget||e.target,".entry",!0),o=En(r,NL);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(yn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Ut.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 Sw(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Sw(r.entries,[...t,...Rw(r.search)]):t.length&&(r.search=[...t,...Rw(r.search)]),r})}function Rw(e){return e?$e(e)?e:[e]:[]}function FL(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=jL(o,r,i);return a?{item:o,tokens:a}:[]}).sort(HL(i))}function jL(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=$e(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=Tw(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Tw(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function HL(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=zL(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Cw;continue}const s=GL(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Cw;continue}}return i}}function zL(e,t){return Mw(t)-Mw(e)}const Cw=.5,Ia={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Mw(e){const t=e.reduce((s,c)=>s+Aw(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 Aw(e){if($e(e))return Math.max(...e.map(Aw));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Ia.FULL:e.wordEnd?Ia.START_FULL_WORD:Ia.START_WORD_PART:e.wordStart?Ia.WORD_START:Ia.WORD_PART)*t:Ia.NO_MATCH*t}function Pw(e=""){return $e(e)?e.join(", "):e}function GL(e,t){return Pw(e).localeCompare(Pw(t))}function Tw(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(VL),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(p-1)),_=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:_,start:d,end:g,all:h});const x=h?t:[u];for(const m of x)i[m.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function VL(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const kw={search:["value",FL]},Ph={__depends__:[kw],__init__:["popupMenu"],popupMenu:["type",Ut]};var Ow={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},Ut.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 o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Ut.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},Ut.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),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},Ut.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Ut.prototype.reset=function(){const e=this._current.container;hw(null,e),qi(e)},Ut.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Ut.prototype._onOpened=function(){this._emit("opened")},Ut.prototype._onClosed=function(){this._emit("closed")},Ut.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Nt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Ut.prototype._bindAutoClose=function(){this._eventBus.once(kw,this.close,this)},Ut.prototype._unbindAutoClose=function(){this._eventBus.off(kw,this.close,this)},Ut.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,o=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),pn(n)&&e<n&&(o=n),pn(i)&&e>i&&(o=i)),o},Ut.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,a=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,a=t.y-i.height):o.x?(r=t.x-i.width,a=t.y):o.y&&t.y<i.height?(r=t.x,a=10):o.y&&(r=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:r,y:a}},Ut.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},Ut.prototype.registerProvider=function(e,t,n){n||(n=t,t=tI),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Ut.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Ut.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=zi(r,["id"])});return}var o=i.getPopupMenuEntries(e);yn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Ut.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=zi(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);yn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Ut.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>yn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Ut.prototype.isOpen=function(){return!!this._current},Ut.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=_r(e.delegateTarget||e.target,".entry",!0),r=En(o,eI);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(yn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Ut.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 Ow(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=Ow(o.entries,[...t,...Dw(o.search)]):t.length&&(o.search=[...t,...Dw(o.search)]),o})}function Dw(e){return e?$e(e)?e:[e]:[]}function nI(e,t,n){const{keys:i}=n;if(t=t.trim().toLowerCase(),!t)throw new Error("<pattern> must not be empty");const o=t.trim().toLowerCase().split(/\s+/);return e.flatMap(r=>{const a=iI(r,o,i);return a?{item:r,tokens:a}:[]}).sort(oI(i))}function iI(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=$e(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=$w(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):$w(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function oI(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=rI(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=Lw;continue}const s=aI(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=Lw;continue}}return i}}function rI(e,t){return Iw(t)-Iw(e)}const Lw=.5,Na={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Iw(e){const t=e.reduce((s,c)=>s+Bw(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),o=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),r=i?o/i:0;return t*(1+r)}function Bw(e){if($e(e))return Math.max(...e.map(Bw));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Na.FULL:e.wordEnd?Na.START_FULL_WORD:Na.START_WORD_PART:e.wordStart?Na.WORD_START:Na.WORD_PART)*t:Na.NO_MATCH*t}function Nw(e=""){return $e(e)?e.join(", "):e}function aI(e,t){return Nw(e).localeCompare(Nw(t))}function $w(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(sI),r=[`(?<all>${o.join("\\s+")})`,...o].join("|"),a=new RegExp(r,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(p-1)),_=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:_,start:d,end:g,all:h});const x=h?t:[u];for(const m of x)i[m.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function sI(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Fw={search:["value",nI]},Ih={__depends__:[Fw],__init__:["popupMenu"],popupMenu:["type",Ut]};var jw={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>`},WL=900;function Ba(e,t,n,i){e.registerProvider(WL,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ba.$inject=["contextPad","popupMenu","translate","canvas"],Ba.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ba.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ba.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Ow.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ba.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 UL=["left","center","right","top","middle","bottom"];function Ks(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ks.$inject=["popupMenu","alignElements","translate","rules"],Ks.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ks.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ks.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return H(UL,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Ow[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Tu(e){Si.call(this,e)}Tu.$inject=["eventBus"],Ce(Tu,Si),Tu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=it(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Zc(n),n.length<2?!1:n})};const qL={__depends__:[rL,G_,Ph],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ba],alignElementsMenuProvider:["type",Ks],bpmnAlignElements:["type",Tu]};function Er(e,t,n,i){pe.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,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=fp(qo(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Yo(s,function(p){return p.parent.id});H(u,function(p,f){$e(l)&&(p=p.filter(function(d){return kt(l,Ko({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}Er.$inject=["eventBus","elementRegistry","modeling","rules"],Ce(Er,pe),Er.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Be(on(e)),o=Be(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),el(V({},o,a))},Er.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(YL(i,t)){var r=KL(Li(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Er.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Er.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Er.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function YL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function KL(e,t){var n="";return e=Be(e),t=Be(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function ku(e){e.invoke(Er,this)}ku.$inject=["injector"],Ce(ku,Er),ku.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Xs(e){Si.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Xs.$inject=["eventBus"],Ce(Xs,Si),Xs.prototype.canResize=function(e,t){return!1};function Ou(e,t){Xs.call(this,e),this._modeling=t}Ce(Ou,Xs),Ou.$inject=["eventBus","modeling"],Ou.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return H(e,function(i){if(M(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const XL={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ku],bpmnAutoResizeProvider:["type",Ou]};function Na(e,t,n){this._canvas=n,this._opts=V({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()})}Na.$inject=["config.autoScroll","eventBus","canvas"],Na.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++)ZL(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 ZL(e,t,n){return t<e&&e<n}Na.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Na.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Na.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=So(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const QL={__depends__:[yr],__init__:["autoScroll"],autoScroll:["type",Na]};var Dw="djs-bendpoint",Lw="djs-segment-dragger";function JL(e,t){var n=So(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 Th(e,t,n){var i=JL(e,n),r=Vf(t,i);return r}function kh(e,t){var n=Oe("g");at(n).add(Dw),ze(e,n);var i=Oe("circle");we(i,{cx:0,cy:0,r:4}),at(i).add("djs-visual"),ze(n,i);var r=Oe("circle");return we(r,{cx:0,cy:0,r:10}),at(r).add("djs-hit"),ze(n,r),t&&at(n).add(t),n}function eI(e,t,n,i){var r=Oe("g");ze(e,r);var o=18,a=6,s=11,c=nI(t,n,i),l=a+s,u=Oe("rect");we(u,{x:-o/2,y:-a/2,width:o,height:a}),at(u).add("djs-visual"),ze(r,u);var p=Oe("rect");return we(p,{x:-c/2,y:-l/2,width:c,height:l}),at(p).add("djs-hit"),ze(r,p),Zy(r,i==="v"?90:0),r}function Iw(e,t,n){var i=Oe("g"),r=bf(t,n),o=pr(t,n);return ze(e,i),eI(i,t,n,o),at(i).add(Lw),at(i).add(o==="h"?"horizontal":"vertical"),On(i,r.x,r.y),i}function Oh(e){return Math.abs(Math.round(e*2/3))}function tI(e,t){var n=iI(e,t);return Xf(e,n)}function nI(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Oh(n==="h"?i:r)}function iI(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=Nv(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Bw(e,t,n,i,r){function o(m,v,E){var S=m.index,P=m.point,k,$,N,L,z,X;return S<=0||m.bendpoint?!1:(k=v[S-1],$=v[S],N=bf(k,$),L=pr(k,$),z=Math.abs(P.x-N.x),X=Math.abs(P.y-N.y),L&&z<=E&&X<=E)}function a(m,v){var E=m.waypoints,S,P,k,$;return v.index<=0||v.bendpoint||(S={start:E[v.index-1],end:E[v.index]},P=pr(S.start,S.end),!P)?null:(P==="h"?k=S.end.x-S.start.x:k=S.end.y-S.start.y,$=Oh(k)/2,$)}function s(m,v){var E=v.waypoints,S=Th(t,E,m),P;if(S){P=a(v,S);var k;if(o(S,E,P)?k=r.start(m,v,S.index):k=i.start(m,v,S.index,!S.bendpoint),k!==!1)return!0}}function c(m,v,E){Le.bind(m,v,function(S){n.triggerMouseEvent(v,S,E),S.stopPropagation()})}function l(m,v){var E=t.getLayer("overlays"),S=_t('.djs-bendpoints[data-element-id="'+ko(m.id)+'"]',E);return!S&&v&&(S=Oe("g"),we(S,{"data-element-id":m.id}),at(S).add("djs-bendpoints"),ze(E,S),c(S,"mousedown",m),c(S,"click",m),c(S,"dblclick",m)),S}function u(m,v){return _t('.djs-segment-dragger[data-segment-idx="'+m+'"]',v)}function p(m,v){v.waypoints.forEach(function(E,S){var P=kh(m);ze(m,P),On(P,E.x,E.y)}),kh(m,"floating")}function f(m,v){for(var E=v.waypoints,S,P,k,$=1;$<E.length;$++)S=E[$-1],P=E[$],pr(S,P)&&(k=Iw(m,S,P),we(k,{"data-segment-idx":$}),c(k,"mousemove",v))}function d(m){H(os("."+Dw,m),function(v){rn(v)})}function g(m){H(os("."+Lw,m),function(v){rn(v)})}function h(m){var v=l(m);return v||(v=l(m,!0),p(v,m),f(v,m)),v}function y(m){var v=l(m);v&&(g(v),d(v),f(v,m),p(v,m))}function _(m,v){var E=_t(".floating",m),S=v.point;E&&(On(E,S.x,S.y),at(E).add("positioned"))}function x(m,v,E){var S=u(v.index,m),P=E[v.index-1],k=E[v.index],$=v.point,N=bf(P,k),L=pr(P,k),z,X;S&&(z=rI(S),X={x:$.x-N.x,y:$.y-N.y},L==="v"&&(X={x:X.y,y:X.x}),On(z,X.x,X.y))}e.on("connection.changed",function(m){y(m.element)}),e.on("connection.remove",function(m){var v=l(m.element);v&&rn(v)}),e.on("element.marker.update",function(m){var v=m.element,E;v.waypoints&&(E=h(v),m.add?at(E).add(m.marker):at(E).remove(m.marker))}),e.on("element.mousemove",function(m){var v=m.element,E=v.waypoints,S,P;if(E){if(S=l(v,!0),P=Th(t,E,m.originalEvent),!P)return;_(S,P),P.bendpoint||x(S,P,E)}}),e.on("element.mousedown",function(m){if(Wr(m)){var v=m.originalEvent,E=m.element;if(E.waypoints)return s(v,E)}}),e.on("selection.changed",function(m){var v=m.newSelection,E=v[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(m){var v=m.element;v.waypoints&&h(v)}),e.on("element.out",function(m){var v=m.element;if(v.waypoints){var E=l(v);if(E){var S=_t(".floating",E);S&&at(S).remove("positioned")}}}),e.on("element.updateId",function(m){var v=m.element,E=m.newId;if(v.waypoints){var S=l(v);S&&we(S,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}Bw.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function rI(e){return _t(".djs-visual",e)}var Nw=Math.round,Lo="reconnectStart",Io="reconnectEnd",Zs="updateWaypoints";function Dh(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=Lo:!l&&c===d.length-1?g=Io:g=Zs;var h=g===Zs?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:p,target:f});if(y===!1&&(y=r.allowed(h,{connection:s,source:f,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===Zs?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===Lo?p:l,target:f===Io?p:u}),d){s.source=f===Lo?p:l,s.target=f===Io?p:u;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===Io?p:u,target:f===Lo?p:l})),d&&(s.source=f===Io?p:u,s.target=f===Lo?p:l)}}),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!==Zs&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,y=s.hints||{},_={x:Nw(a.x),y:Nw(a.y)};if(!c)return!1;h===Zs?(p?f.splice(l,0,_):f[l]=_,y.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,pA(f),y)):(h===Lo?(y.docking="source",Du(s)&&(y.docking="target",y.newWaypoints=f.reverse())):h===Io&&(y.docking="target",Du(s)&&(y.docking="source",y.newWaypoints=f.reverse())),o.reconnect(u,d,g,_,y))},this)}Dh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Dh.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 Du(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Lo)return t&&i&&t===i&&n!==i;if(r===Io)return t&&n&&t===n&&n!==i}var oI="reconnectStart",aI="reconnectEnd",$w="updateWaypoints",Qs="connect-ok",Lu="connect-not-ok",Fw="connect-hover",jw="djs-updating",Hw="djs-dragging",zw=1100;function Gw(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,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=kh(i.getLayer("overlays"));at(f).add("djs-dragging"),i.addMarker(c,Hw),i.addMarker(c,jw)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,Fw),l===$w)return;s?(i.removeMarker(c,Lu),i.addMarker(c,Qs)):s===!1&&(i.removeMarker(c,Qs),i.addMarker(c,Lu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],zw,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Fw),i.removeMarker(s,c?Qs:Lu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),y={x:o.x,y:o.y},_=a.hints||{},x={};r&&(_.connectionStart&&(x.connectionStart=_.connectionStart),_.connectionEnd&&(x.connectionEnd=_.connectionEnd),p===oI?Du(a)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||d,x.target=g):p===aI?Du(a)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=d,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,h[c]=y),p===$w&&(h=e.cropWaypoints(f,h)),x.waypoints=h,r.drawPreview(a,s,x)),On(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],zw,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,rn(c),i.removeMarker(s,jw),i.removeMarker(s,Hw),l&&(i.removeMarker(l,Qs),i.removeMarker(l,u?Qs:Lu)),r&&r.cleanUp(a)})}Gw.$inject=["bendpointMove","injector","eventBus","canvas"];var Vw="connect-hover",Ww="djs-updating";function Uw(e,t,n){return Lh(e,t,e[t]+n)}function Lh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function sI(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 Lh(t,i,s)}function qw(e){return e==="x"?"y":"x"}function Yw(e,t,n){var i,r;return e.original?e.original:(i=je(t),r=qw(n),Lh(e,r,i[r]))}function Kw(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),y=d-1,_=d,x=f.waypoints,m=x[y],v=x[_],E=Th(n,x,p),S,P,k;if(S=pr(m,v),!!S)return P=S==="v"?"x":"y",y===0&&(m=Yw(m,f.source,P)),_===x.length-1&&(v=Yw(v,f.target,P)),E?k=E.point:k={x:(m.x+v.x)/2,y:(m.y+v.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:_,segmentStart:m,segmentEnd:v,axis:P,dragPosition:k},i.init(p,k,"connectionSegment.move",{cursor:P==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){r.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,y=g[h],_=p.segmentEndIndex+f,x=g[_],m=qw(p.axis),v=sI(d,y,x,m);On(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,y){return vf(p[y-1],p[y+1],h)?(d=y<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Iw(g,f.segmentStart,f.segmentEnd),at(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Ww)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,y=f.segmentStart,_=f.segmentEnd,x=f.axis,m=f.originalWaypoints.slice(),v=Uw(y,x,p["d"+x]),E=Uw(_,x,p["d"+x]),S=m.length,P=0;m[g]=v,m[h]=E;var k,$;g<2&&(k=kn(d.source,v),g===1?k==="intersect"&&(m.shift(),m[0]=v,P--):k!=="intersect"&&(m.unshift(y),P++)),h>S-3&&($=kn(d.target,E),h===S-2?$==="intersect"&&(m.pop(),m[m.length-1]=E):$!=="intersect"&&m.push(_)),f.newWaypoints=d.waypoints=s(d,m),l(f,P,p),f.newSegmentStartIndex=g+P,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Vw)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Vw)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&rn(f.draggerGfx),n.removeMarker(d,Ww)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var y=u(g,h),_=y.waypoints,x=s(d,_),m=y.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+m}};o.updateWaypoints(d,x,v)})}Kw.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var cI=Math.abs,Xw=Math.round;function lI(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],cI(r-e)<=n)return r}function Zw(e){return{x:e.x,y:e.y}}function Qw(e){return{x:e.x+e.width,y:e.y+e.height}}function Ai(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Xw(e.x+e.width/2),y:Xw(e.y+e.height/2)}}function $a(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function ln(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 Jw(e){return e.children||[]}var uI=Math.abs,e0=Math.round,Ih=10;function t0(e){function t(o,a){if($e(o)){for(var s=o.length;s--;)if(uI(o[s]-a)<=Ih)return o[s]}else{o=+o;var c=a%o;if(c<Ih)return a-c;if(c>o-Ih)return a-c+o}return a}function n(o,a){if(o.waypoints)return tI(a,o);if(o.width)return{x:e0(o.width/2+o.x),y:e0(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},H(h,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;V(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&ln(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&ln(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},H(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.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||(ln(o,"x",c.x),ln(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,l=c&&n(c,o),u=o.x,p=o.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;V(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(u)!==-1)&&ln(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&ln(o,"y",d)}})}t0.$inject=["eventBus"];const pI={__depends__:[yr,Ji],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Bw],bendpointMove:["type",Dh],bendpointMovePreview:["type",Gw],connectionSegmentMove:["type",Kw],bendpointSnapping:["type",t0]};function n0(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,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!Uo(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Uo(u)&&u!==!1&&(s.source=l,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,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Bh(s)?u:l,connectionEnd:Bh(s)?l:u};fn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){fn(c)||(l=c,c=je(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}n0.$inject=["eventBus","dragging","modeling","rules"];function Bh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var fI=1100,dI=900,i0="connect-ok",r0="connect-not-ok";function o0(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,l=o.start,u=o.startPosition,p=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},g=f,h=d;Bh(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",dI,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?i0:r0)}),t.on(["connect.out","connect.cleanup"],fI,function(r){var o=r.hover;o&&(n.removeMarker(o,i0),n.removeMarker(o,r0))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}o0.$inject=["injector","eventBus","canvas"];const Nh={__depends__:[Ri,Ji,yr],__init__:["connectPreview"],connect:["type",n0],connectPreview:["type",o0]};var hI="djs-dragger";function Sr(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)}Sr.$inject=["injector","canvas","graphicsFactory","elementFactory"],Sr.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,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),as(i),r||(r=e.getConnection=mI(function(h,y,_){return g.getConnection(h,y,_)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?je(o):c,a?je(a):l]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Sr.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||je(n),o=t.connectionEnd||je(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ze(e,s)},Sr.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&&ds(o,s,!0)||e,t=i&&ds(a,s,!1)||t,[e,t]},Sr.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&rn(e.connectionPreviewGfx)},Sr.prototype.getConnection=function(e){var t=gI(e);return this._elementFactory.createConnection(t)},Sr.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return we(e,{pointerEvents:"none"}),at(e).add(hI),ze(this._canvas.getActiveLayer(),e),e},Sr.prototype.createNoopConnection=function(e,t){return ls([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function mI(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 gI(e){return fn(e)?e:{}}const yI={__init__:["connectionPreview"],connectionPreview:["type",Sr]},Iu="complex-preview";class a0{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(Iu);n.filter(s=>!vI(s)).forEach(s=>{let c;At(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(Fr(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(Fr(c),s),On(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 l=this._previewSupport.addDragger(s,a);At(s)?On(l,c.x,c.y):On(l,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 l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape(Fr(l),s,{width:c.width,height:c.height}),On(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){as(this._canvas.getLayer(Iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Iu)}hide(){this._canvas.hideLayer(Iu)}}a0.$inject=["canvas","graphicsFactory","previewSupport"];function vI(e){return e.hidden}const bI={__depends__:[Ma],__init__:["complexPreview"],complexPreview:["type",a0]},s0=Math.round;function Bu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Bu.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,l=o.createShape(V({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;V(l,{x:u.x-s0(l.width/2),y:u.y-s0(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=r.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Uo(d))})},Bu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Bu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const xI={__depends__:[su,bI,rh],__init__:["appendPreview"],appendPreview:["type",Bu]};var c0=Math.min,l0=Math.max;function $h(e){e.preventDefault()}function Js(e){e.stopPropagation()}function _I(e){return e.nodeType===Node.TEXT_NODE}function wI(e){return[].slice.call(e)}function Ni(e){this.container=e.container,this.parent=Nt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=_t("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=qn(this.autoResize,this),this.handlePaste=qn(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=Li(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(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 l=Li(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Le.bind(a,"keydown",this.keyHandler),Le.bind(a,"mousedown",Js),Le.bind(a,"paste",r.handlePaste),Le.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Le.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=EI(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=wI(a.childNodes),c,l;if(_I(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&qi(g)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},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=Nt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){$h(g),Js(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Le.bind(document,"mousemove",f),Le.bind(document,"mouseup",d)},f=function(g){$h(g),Js(g);var h=c0(l0(l+g.clientX-s,i),o),y=c0(l0(u+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){$h(g),Js(g),Le.unbind(document,"mousemove",f,!1),Le.unbind(document,"mouseup",d,!1)};Le.bind(n,"mousedown",p)}V(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"),Le.unbind(t,"keydown",this.keyHandler),Le.unbind(t,"mousedown",Js),Le.unbind(t,"input",this.autoResize),Le.unbind(t,"paste",this.handlePaste),Le.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),qi(n)),qi(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 EI(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function ai(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ni({container:t.getContainer(),keyHandler:qn(this._handleKey,this),resizeHandler:qn(this._handleResize,this),focusoutHandler:qn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ai.$inject=["eventBus","canvas"],ai.prototype.registerProvider=function(e){this._providers.push(e)},ai.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ai.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ai.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ai.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ai.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ai.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()}},ai.prototype.getValue=function(){return this._textbox.getValue()},ai.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()},ai.prototype._handleResize=function(e){this._fire("resize",e)},ai.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ai.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=kt(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 u0={__depends__:[Nl],__init__:["directEditing"],directEditing:["type",ai]};function SI(e){return function(t){var n=t.target,i=de(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===st(e);return!o||!a||!s||!c}}const RI={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 ue(e,t={}){var n=RI[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var CI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start")],MI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"})],AI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("timer-intermediate-catch"),ue("escalation-intermediate-throw"),ue("conditional-intermediate-catch"),ue("link-intermediate-catch"),ue("link-intermediate-throw"),ue("compensation-intermediate-throw"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw")],PI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-end"),ue("escalation-end"),ue("error-end"),ue("cancel-end"),ue("compensation-end"),ue("signal-end"),ue("terminate-end")],TI=[ue("exclusive-gateway"),ue("parallel-gateway"),ue("inclusive-gateway"),ue("complex-gateway"),ue("event-based-gateway")],kI=[ue("transaction"),ue("event-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("collapsed-subprocess")],OI=[ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("transaction"),ue("event-subprocess"),ue("collapsed-ad-hoc-subprocess")],p0=[ue("transaction"),ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("event-subprocess")],DI=p0,f0=[ue("task"),ue("user-task"),ue("service-task"),ue("send-task"),ue("receive-task"),ue("manual-task"),ue("rule-task"),ue("script-task"),ue("call-activity"),ue("collapsed-subprocess"),ue("expanded-subprocess"),ue("collapsed-ad-hoc-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],LI=[ue("data-store-reference")],II=[ue("data-object-reference")],BI=[ue("message-boundary"),ue("timer-boundary"),ue("escalation-boundary"),ue("conditional-boundary"),ue("error-boundary"),ue("cancel-boundary"),ue("signal-boundary"),ue("compensation-boundary"),ue("non-interrupting-message-boundary"),ue("non-interrupting-timer-boundary"),ue("non-interrupting-escalation-boundary"),ue("non-interrupting-conditional-boundary"),ue("non-interrupting-signal-boundary")],NI=[ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start"),ue("error-start"),ue("escalation-start"),ue("compensation-start"),ue("non-interrupting-message-start"),ue("non-interrupting-timer-start"),ue("non-interrupting-conditional-start"),ue("non-interrupting-signal-start"),ue("non-interrupting-escalation-start")],$I=[{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"}],FI=[ue("expanded-pool"),ue("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],jI={"bpmn:MessageEventDefinition":[ue("message-start"),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("message-end")],"bpmn:TimerEventDefinition":[ue("timer-start"),ue("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ue("conditional-start"),ue("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ue("signal-start"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw"),ue("signal-end")],"bpmn:ErrorEventDefinition":[ue("error-start"),ue("error-end")],"bpmn:EscalationEventDefinition":[ue("escalation-start"),ue("escalation-intermediate-throw"),ue("escalation-end")],"bpmn:CompensateEventDefinition":[ue("compensation-start"),ue("compensation-intermediate-throw"),ue("compensation-end")]};const d0={"start-event-non-interrupting":`
315
+ </svg>`},cI=900;function $a(e,t,n,i){e.registerProvider(cI,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}$a.$inject=["contextPad","popupMenu","translate","canvas"],$a.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},$a.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},$a.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${jw.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},$a.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),o={x:i.left,y:i.bottom+t};return o};var lI=["left","center","right","top","middle","bottom"];function Js(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Js.$inject=["popupMenu","alignElements","translate","rules"],Js.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Js.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Js.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return z(lI,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:jw[r],action:function(){t.trigger(e,r),i.close()}}}),o};function Du(e){Si.call(this,e)}Du.$inject=["eventBus"],Ce(Du,Si),Du.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=it(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=el(n),n.length<2?!1:n})};const uI={__depends__:[_L,Z_,Ih],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",$a],alignElementsMenuProvider:["type",Js],bpmnAlignElements:["type",Du]};function So(e,t,n,i){pe.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=gp(Kr(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Xr(s,function(p){return p.parent.id});z(u,function(p,f){$e(l)&&(p=p.filter(function(d){return Ot(l,Zr({id:d.id}))})),o._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}So.$inject=["eventBus","elementRegistry","modeling","rules"],Ce(So,pe),So.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Be(rn(e)),r=Be(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),il(V({},r,a))},So.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(pI(i,t)){var o=fI(Li(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},So.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},So.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},So.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function pI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function fI(e,t){var n="";return e=Be(e),t=Be(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Lu(e){e.invoke(So,this)}Lu.$inject=["injector"],Ce(Lu,So),Lu.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ec(e){Si.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ec.$inject=["eventBus"],Ce(ec,Si),ec.prototype.canResize=function(e,t){return!1};function Iu(e,t){ec.call(this,e),this._modeling=t}Ce(Iu,ec),Iu.$inject=["eventBus","modeling"],Iu.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return z(e,function(i){if(M(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const dI={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Lu],bpmnAutoResizeProvider:["type",Iu]};function Fa(e,t,n){this._canvas=n,this._opts=V({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Fa.$inject=["config.autoScroll","eventBus","canvas"],Fa.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)hI(r[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 hI(e,t,n){return t<e&&e<n}Fa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Fa.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Fa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Cr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const gI={__depends__:[vo],__init__:["autoScroll"],autoScroll:["type",Fa]};var Hw="djs-bendpoint",zw="djs-segment-dragger";function mI(e,t){var n=Cr(t),i=e._container.getBoundingClientRect(),o;o={x:i.left,y:i.top};var r=e.viewbox();return{x:r.x+(n.x-o.x)/r.scale,y:r.y+(n.y-o.y)/r.scale}}function Bh(e,t,n){var i=mI(e,n),o=Xf(t,i);return o}function Nh(e,t){var n=Oe("g");at(n).add(Hw),ze(e,n);var i=Oe("circle");we(i,{cx:0,cy:0,r:4}),at(i).add("djs-visual"),ze(n,i);var o=Oe("circle");return we(o,{cx:0,cy:0,r:10}),at(o).add("djs-hit"),ze(n,o),t&&at(n).add(t),n}function yI(e,t,n,i){var o=Oe("g");ze(e,o);var r=18,a=6,s=11,c=bI(t,n,i),l=a+s,u=Oe("rect");we(u,{x:-r/2,y:-a/2,width:r,height:a}),at(u).add("djs-visual"),ze(o,u);var p=Oe("rect");return we(p,{x:-c/2,y:-l/2,width:c,height:l}),at(p).add("djs-hit"),ze(o,p),rv(o,i==="v"?90:0),o}function Gw(e,t,n){var i=Oe("g"),o=Rf(t,n),r=po(t,n);return ze(e,i),yI(i,t,n,r),at(i).add(zw),at(i).add(r==="h"?"horizontal":"vertical"),On(i,o.x,o.y),i}function $h(e){return Math.abs(Math.round(e*2/3))}function vI(e,t){var n=xI(e,t);return nd(e,n)}function bI(e,t,n){var i=t.x-e.x,o=t.y-e.y;return $h(n==="h"?i:o)}function xI(e,t){for(var n=t.waypoints,i=1/0,o,r=0;r<n.length-1;r++){var a=n[r],s=n[r+1],c=Wv(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function Vw(e,t,n,i,o){function r(m,v,w){var S=m.index,P=m.point,T,D,$,N,H,X;return S<=0||m.bendpoint?!1:(T=v[S-1],D=v[S],$=Rf(T,D),N=po(T,D),H=Math.abs(P.x-$.x),X=Math.abs(P.y-$.y),N&&H<=w&&X<=w)}function a(m,v){var w=m.waypoints,S,P,T,D;return v.index<=0||v.bendpoint||(S={start:w[v.index-1],end:w[v.index]},P=po(S.start,S.end),!P)?null:(P==="h"?T=S.end.x-S.start.x:T=S.end.y-S.start.y,D=$h(T)/2,D)}function s(m,v){var w=v.waypoints,S=Bh(t,w,m),P;if(S){P=a(v,S);var T;if(r(S,w,P)?T=o.start(m,v,S.index):T=i.start(m,v,S.index,!S.bendpoint),T!==!1)return!0}}function c(m,v,w){Le.bind(m,v,function(S){n.triggerMouseEvent(v,S,w),S.stopPropagation()})}function l(m,v){var w=t.getLayer("overlays"),S=wt('.djs-bendpoints[data-element-id="'+Dr(m.id)+'"]',w);return!S&&v&&(S=Oe("g"),we(S,{"data-element-id":m.id}),at(S).add("djs-bendpoints"),ze(w,S),c(S,"mousedown",m),c(S,"click",m),c(S,"dblclick",m)),S}function u(m,v){return wt('.djs-segment-dragger[data-segment-idx="'+m+'"]',v)}function p(m,v){v.waypoints.forEach(function(w,S){var P=Nh(m);ze(m,P),On(P,w.x,w.y)}),Nh(m,"floating")}function f(m,v){for(var w=v.waypoints,S,P,T,D=1;D<w.length;D++)S=w[D-1],P=w[D],po(S,P)&&(T=Gw(m,S,P),we(T,{"data-segment-idx":D}),c(T,"mousemove",v))}function d(m){z(ls("."+Hw,m),function(v){on(v)})}function g(m){z(ls("."+zw,m),function(v){on(v)})}function h(m){var v=l(m);return v||(v=l(m,!0),p(v,m),f(v,m)),v}function y(m){var v=l(m);v&&(g(v),d(v),f(v,m),p(v,m))}function _(m,v){var w=wt(".floating",m),S=v.point;w&&(On(w,S.x,S.y),at(w).add("positioned"))}function x(m,v,w){var S=u(v.index,m),P=w[v.index-1],T=w[v.index],D=v.point,$=Rf(P,T),N=po(P,T),H,X;S&&(H=_I(S),X={x:D.x-$.x,y:D.y-$.y},N==="v"&&(X={x:X.y,y:X.x}),On(H,X.x,X.y))}e.on("connection.changed",function(m){y(m.element)}),e.on("connection.remove",function(m){var v=l(m.element);v&&on(v)}),e.on("element.marker.update",function(m){var v=m.element,w;v.waypoints&&(w=h(v),m.add?at(w).add(m.marker):at(w).remove(m.marker))}),e.on("element.mousemove",function(m){var v=m.element,w=v.waypoints,S,P;if(w){if(S=l(v,!0),P=Bh(t,w,m.originalEvent),!P)return;_(S,P),P.bendpoint||x(S,P,w)}}),e.on("element.mousedown",function(m){if(qo(m)){var v=m.originalEvent,w=m.element;if(w.waypoints)return s(v,w)}}),e.on("selection.changed",function(m){var v=m.newSelection,w=v[0];w&&w.waypoints&&h(w)}),e.on("element.hover",function(m){var v=m.element;v.waypoints&&h(v)}),e.on("element.out",function(m){var v=m.element;if(v.waypoints){var w=l(v);if(w){var S=wt(".floating",w);S&&at(S).remove("positioned")}}}),e.on("element.updateId",function(m){var v=m.element,w=m.newId;if(v.waypoints){var S=l(v);S&&we(S,{"data-element-id":w})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}Vw.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function _I(e){return wt(".djs-visual",e)}var Ww=Math.round,Br="reconnectStart",Nr="reconnectEnd",tc="updateWaypoints";function Fh(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=Br:!l&&c===d.length-1?g=Nr:g=tc;var h=g===tc?"connection.updateWaypoints":"connection.reconnect",y=o.allowed(h,{connection:s,source:p,target:f});if(y===!1&&(y=o.allowed(h,{connection:s,source:f,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===tc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===Br?p:l,target:f===Nr?p:u}),d){s.source=f===Br?p:l,s.target=f===Nr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===Nr?p:u,target:f===Br?p:l})),d&&(s.source=f===Nr?p:u,s.target=f===Br?p:l)}}),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!==tc&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,y=s.hints||{},_={x:Ww(a.x),y:Ww(a.y)};if(!c)return!1;h===tc?(p?f.splice(l,0,_):f[l]=_,y.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,AA(f),y)):(h===Br?(y.docking="source",Bu(s)&&(y.docking="target",y.newWaypoints=f.reverse())):h===Nr&&(y.docking="target",Bu(s)&&(y.docking="source",y.newWaypoints=f.reverse())),r.reconnect(u,d,g,_,y))},this)}Fh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Fh.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 Bu(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Br)return t&&i&&t===i&&n!==i;if(o===Nr)return t&&n&&t===n&&n!==i}var wI="reconnectStart",EI="reconnectEnd",Uw="updateWaypoints",nc="connect-ok",Nu="connect-not-ok",qw="connect-hover",Yw="djs-updating",Kw="djs-dragging",Xw=1100;function Zw(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var a=r.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p;var f=a.draggerGfx=Nh(i.getLayer("overlays"));at(f).add("djs-dragging"),i.addMarker(c,Kw),i.addMarker(c,Yw)}),n.on("bendpoint.move.hover",function(r){var a=r.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,qw),l===Uw)return;s?(i.removeMarker(c,Nu),i.addMarker(c,nc)):s===!1&&(i.removeMarker(c,nc),i.addMarker(c,Nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Xw,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,qw),i.removeMarker(s,c?nc:Nu))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),y={x:r.x,y:r.y},_=a.hints||{},x={};o&&(_.connectionStart&&(x.connectionStart=_.connectionStart),_.connectionEnd&&(x.connectionEnd=_.connectionEnd),p===wI?Bu(a)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||d,x.target=g):p===EI?Bu(a)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=d,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,h[c]=y),p===Uw&&(h=e.cropWaypoints(f,h)),x.waypoints=h,o.drawPreview(a,s,x)),On(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Xw,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,on(c),i.removeMarker(s,Yw),i.removeMarker(s,Kw),l&&(i.removeMarker(l,nc),i.removeMarker(l,u?nc:Nu)),o&&o.cleanUp(a)})}Zw.$inject=["bendpointMove","injector","eventBus","canvas"];var Qw="connect-hover",Jw="djs-updating";function e0(e,t,n){return jh(e,t,e[t]+n)}function jh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function SI(e,t,n,i){var o=Math.max(t[i],n[i]),r=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(r+a,e[i]),o-a);return jh(t,i,s)}function t0(e){return e==="x"?"y":"x"}function n0(e,t,n){var i,o;return e.original?e.original:(i=je(t),o=t0(n),jh(e,o,i[o]))}function i0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),y=d-1,_=d,x=f.waypoints,m=x[y],v=x[_],w=Bh(n,x,p),S,P,T;if(S=po(m,v),!!S)return P=S==="v"?"x":"y",y===0&&(m=n0(m,f.source,P)),_===x.length-1&&(v=n0(v,f.target,P)),w?T=w.point:T={x:(m.x+v.x)/2,y:(m.y+v.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:_,segmentStart:m,segmentEnd:v,axis:P,dragPosition:T},i.init(p,T,"connectionSegment.move",{cursor:P==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,y=g[h],_=p.segmentEndIndex+f,x=g[_],m=t0(p.axis),v=SI(d,y,x,m);On(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,y){return Sf(p[y-1],p[y+1],h)?(d=y<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Gw(g,f.segmentStart,f.segmentEnd),at(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Jw)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,y=f.segmentStart,_=f.segmentEnd,x=f.axis,m=f.originalWaypoints.slice(),v=e0(y,x,p["d"+x]),w=e0(_,x,p["d"+x]),S=m.length,P=0;m[g]=v,m[h]=w;var T,D;g<2&&(T=kn(d.source,v),g===1?T==="intersect"&&(m.shift(),m[0]=v,P--):T!=="intersect"&&(m.unshift(y),P++)),h>S-3&&(D=kn(d.target,w),h===S-2?D==="intersect"&&(m.pop(),m[m.length-1]=w):D!=="intersect"&&m.push(_)),f.newWaypoints=d.waypoints=s(d,m),l(f,P,p),f.newSegmentStartIndex=g+P,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Qw)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Qw)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&on(f.draggerGfx),n.removeMarker(d,Jw)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var y=u(g,h),_=y.waypoints,x=s(d,_),m=y.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+m}};r.updateWaypoints(d,x,v)})}i0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var RI=Math.abs,o0=Math.round;function CI(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],RI(o-e)<=n)return o}function r0(e){return{x:e.x,y:e.y}}function a0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ai(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:o0(e.x+e.width/2),y:o0(e.y+e.height/2)}}function ja(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function ln(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,o=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function s0(e){return e.children||[]}var MI=Math.abs,c0=Math.round,Hh=10;function l0(e){function t(r,a){if($e(r)){for(var s=r.length;s--;)if(MI(r[s]-a)<=Hh)return r[s]}else{r=+r;var c=a%r;if(c<Hh)return a-c;if(c>r-Hh)return a-c+r}return a}function n(r,a){if(r.waypoints)return vI(a,r);if(r.width)return{x:c0(r.width/2+r.x),y:c0(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,r)),d>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;V(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&ln(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&ln(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!Pt(s)||!c||!c.x||!c.y||(ln(r,"x",c.x),ln(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;V(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&ln(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&ln(r,"y",d)}})}l0.$inject=["eventBus"];const AI={__depends__:[vo,Ji],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Vw],bendpointMove:["type",Fh],bendpointMovePreview:["type",Zw],connectionSegmentMove:["type",i0],bendpointSnapping:["type",l0]};function u0(e,t,n,i){function o(a,s){return i.allowed("connection.create",{source:a,target:s})}function r(a,s){return o(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,l=a.hover,u;if(s.hover=l,u=s.canExecute=o(c,l),!Yr(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!Yr(u)&&u!==!1&&(s.source=l,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,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:zh(s)?u:l,connectionEnd:zh(s)?l:u};fn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){fn(c)||(l=c,c=je(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}u0.$inject=["eventBus","dragging","modeling","rules"];function zh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var PI=1100,TI=900,p0="connect-ok",f0="connect-not-ok";function d0(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(o){var r=o.context,a=r.canExecute,s=r.hover,c=r.source,l=r.start,u=r.startPosition,p=r.target,f=r.connectionStart||u,d=r.connectionEnd||{x:o.x,y:o.y},g=f,h=d;zh(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",TI,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?p0:f0)}),t.on(["connect.out","connect.cleanup"],PI,function(o){var r=o.hover;r&&(n.removeMarker(r,p0),n.removeMarker(r,f0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}d0.$inject=["injector","eventBus","canvas"];const Gh={__depends__:[Ri,Ji,vo],__init__:["connectPreview"],connect:["type",u0],connectPreview:["type",d0]};var kI="djs-dragger";function Ro(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)}Ro.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ro.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),us(i),o||(o=e.getConnection=OI(function(h,y,_){return g.getConnection(h,y,_)})),t&&(d=o(t,r,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[r?je(r):c,a?je(a):l]),this._connectionDocking&&(r||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,r,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Ro.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||je(n),r=t.connectionEnd||je(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);ze(e,s)},Ro.prototype.cropWaypoints=function(e,t,n,i){var o=this._graphicsFactory,r=n&&o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return e=n&&ys(r,s,!0)||e,t=i&&ys(a,s,!1)||t,[e,t]},Ro.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&on(e.connectionPreviewGfx)},Ro.prototype.getConnection=function(e){var t=DI(e);return this._elementFactory.createConnection(t)},Ro.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return we(e,{pointerEvents:"none"}),at(e).add(kI),ze(this._canvas.getActiveLayer(),e),e},Ro.prototype.createNoopConnection=function(e,t){return ds([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function OI(e){var t={};return function(n){var i=JSON.stringify(n),o=t[i];return o||(o=t[i]=e.apply(null,arguments)),o}}function DI(e){return fn(e)?e:{}}const LI={__init__:["connectionPreview"],connectionPreview:["type",Ro]},$u="complex-preview";class h0{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:o=[],resized:r=[]}=t,a=this._canvas.getLayer($u);n.filter(s=>!II(s)).forEach(s=>{let c;Pt(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(Ho(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(Ho(c),s),On(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 l=this._previewSupport.addDragger(s,a);Pt(s)?On(l,c.x,c.y):On(l,s.x+c.x,s.y+c.y)}),o.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"])}),r.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 l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape(Ho(l),s,{width:c.width,height:c.height}),On(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){us(this._canvas.getLayer($u)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer($u)}hide(){this._canvas.hideLayer($u)}}h0.$inject=["canvas","graphicsFactory","previewSupport"];function II(e){return e.hidden}const BI={__depends__:[Pa],__init__:["complexPreview"],complexPreview:["type",h0]},g0=Math.round;function Fu(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Fu.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(V({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;V(l,{x:u.x-g0(l.width/2),y:u.y-g0(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=r.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=o.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Yr(d))})},Fu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Fu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const NI={__depends__:[uu,BI,uh],__init__:["appendPreview"],appendPreview:["type",Fu]};var m0=Math.min,y0=Math.max;function Vh(e){e.preventDefault()}function ic(e){e.stopPropagation()}function $I(e){return e.nodeType===Node.TEXT_NODE}function FI(e){return[].slice.call(e)}function Ni(e){this.container=e.container,this.parent=Nt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=wt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=qn(this.autoResize,this),this.handlePaste=qn(this.handlePaste,this)}Ni.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Li(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(r.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 l=Li(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Le.bind(a,"keydown",this.keyHandler),Le.bind(a,"mousedown",ic),Le.bind(a,"paste",o.handlePaste),Le.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Le.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},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 o=this.autoResize(n);o&&this.resizeHandler(o)}},Ni.prototype.insertText=function(e){e=jI(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,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=FI(a.childNodes),c,l;if($I(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&qi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},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(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},Ni.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Nt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Vh(g),ic(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Le.bind(document,"mousemove",f),Le.bind(document,"mouseup",d)},f=function(g){Vh(g),ic(g);var h=m0(y0(l+g.clientX-s,i),r),y=m0(y0(u+g.clientY-c,o),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Vh(g),ic(g),Le.unbind(document,"mousemove",f,!1),Le.unbind(document,"mouseup",d,!1)};Le.bind(n,"mousedown",p)}V(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"),Le.unbind(t,"keydown",this.keyHandler),Le.unbind(t,"mousedown",ic),Le.unbind(t,"input",this.autoResize),Le.unbind(t,"paste",this.handlePaste),Le.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),qi(n)),qi(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 jI(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function ai(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ni({container:t.getContainer(),keyHandler:qn(this._handleKey,this),resizeHandler:qn(this._handleResize,this),focusoutHandler:qn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ai.$inject=["eventBus","canvas"],ai.prototype.registerProvider=function(e){this._providers.push(e)},ai.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ai.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ai.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ai.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ai.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ai.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),o=this.getValue(),r=e.context.text;(o!==r||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,o,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},ai.prototype.getValue=function(){return this._textbox.getValue()},ai.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()},ai.prototype._handleResize=function(e){this._fire("resize",e)},ai.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ai.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ot(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 v0={__depends__:[jl],__init__:["directEditing"],directEditing:["type",ai]};function HI(e){return function(t){var n=t.target,i=de(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===st(e);return!r||!a||!s||!c}}const zI={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 ue(e,t={}){var n=zI[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var GI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start")],VI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"})],WI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("timer-intermediate-catch"),ue("escalation-intermediate-throw"),ue("conditional-intermediate-catch"),ue("link-intermediate-catch"),ue("link-intermediate-throw"),ue("compensation-intermediate-throw"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw")],UI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-end"),ue("escalation-end"),ue("error-end"),ue("cancel-end"),ue("compensation-end"),ue("signal-end"),ue("terminate-end")],qI=[ue("exclusive-gateway"),ue("parallel-gateway"),ue("inclusive-gateway"),ue("complex-gateway"),ue("event-based-gateway")],YI=[ue("transaction"),ue("event-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("collapsed-subprocess")],KI=[ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("transaction"),ue("event-subprocess"),ue("collapsed-ad-hoc-subprocess")],b0=[ue("transaction"),ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("event-subprocess")],XI=b0,x0=[ue("task"),ue("user-task"),ue("service-task"),ue("send-task"),ue("receive-task"),ue("manual-task"),ue("rule-task"),ue("script-task"),ue("call-activity"),ue("collapsed-subprocess"),ue("expanded-subprocess"),ue("collapsed-ad-hoc-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],ZI=[ue("data-store-reference")],QI=[ue("data-object-reference")],JI=[ue("message-boundary"),ue("timer-boundary"),ue("escalation-boundary"),ue("conditional-boundary"),ue("error-boundary"),ue("cancel-boundary"),ue("signal-boundary"),ue("compensation-boundary"),ue("non-interrupting-message-boundary"),ue("non-interrupting-timer-boundary"),ue("non-interrupting-escalation-boundary"),ue("non-interrupting-conditional-boundary"),ue("non-interrupting-signal-boundary")],eB=[ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start"),ue("error-start"),ue("escalation-start"),ue("compensation-start"),ue("non-interrupting-message-start"),ue("non-interrupting-timer-start"),ue("non-interrupting-conditional-start"),ue("non-interrupting-signal-start"),ue("non-interrupting-escalation-start")],tB=[{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"}],nB=[ue("expanded-pool"),ue("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],iB={"bpmn:MessageEventDefinition":[ue("message-start"),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("message-end")],"bpmn:TimerEventDefinition":[ue("timer-start"),ue("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ue("conditional-start"),ue("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ue("signal-start"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw"),ue("signal-end")],"bpmn:ErrorEventDefinition":[ue("error-start"),ue("error-end")],"bpmn:EscalationEventDefinition":[ue("escalation-start"),ue("escalation-intermediate-throw"),ue("escalation-end")],"bpmn:CompensateEventDefinition":[ue("compensation-start"),ue("compensation-intermediate-throw"),ue("compensation-end")]};const _0={"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 Pi(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()}Pi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Pi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Pi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if($e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=SI(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,LI):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,II):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=jI[r]||[],!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=it(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(o=it(CI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Participant")?(o=it(FI,function(c){return st(e)!==c.target.isExpanded}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&jn(t.$parent)?(o=it(NI.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(o=it(MI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:EndEvent")?(o=it(PI.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):M(t,"bpmn:BoundaryEvent")?(o=it(BI,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(o=it(AI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Gateway")?(o=it(TI,a),this._createEntries(e,o)):M(t,"bpmn:Transaction")?(o=it(p0,a),this._createEntries(e,o)):jn(t)&&st(e)?(o=it(DI,a),this._createEntries(e,o)):M(t,"bpmn:AdHocSubProcess")&&st(e)?(o=it(OI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&st(e)?(o=it(kI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&!st(e)?(o=it(f0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,$I):M(t,"bpmn:FlowNode")?(o=it(f0,a),this._createEntries(e,o)):{})},Pi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!jn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Qv(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Pi.prototype._createEntries=function(e,t){var n={},i=this;return H(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Pi.prototype._createSequenceFlowEntries=function(e,t){var n=de(e),i={},r=this._modeling,o=this._moddle,a=this;return H(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(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&&M(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:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(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},Pi.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}},Pi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=de(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"}}}},Pi.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}}},Pi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Pi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=de(e),i=this,r=Jv(e),o=M(e,"bpmn:BoundaryEvent")?d0["intermediate-event-non-interrupting"]:d0["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 HI={__depends__:[Ph,bx,su],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Pi]};function ec(e,t,n,i,r,o,a,s,c,l,u,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!Cs(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}ec.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],ec.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},ec.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return $e(t)?Mr(e,n=>t.includes(n)):t},ec.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,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&V(u,g()),u;var p=e.businessObject;function f(m,v){r.start(m,v)}function d(m,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(m){var v=5,E=t.getPad(m).html,S=E.getBoundingClientRect(),P={x:S.left,y:S.bottom+v};return P}function y(m,v,E,S){function P(N,L){var z=i.createShape(V({type:m},S));o.start(N,z,{source:L})}var k=s?function(N,L){var z=i.createShape(V({type:m},S));s.append(L,z)}:P,$=s?function(N,L){return l.create(L,m,S),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:E,action:{dragstart:P,click:k,hover:$}}}function _(m){return function(v,E){n.splitLane(E,m),t.open(E,!0)}}if(tt(p,["bpmn:Lane","bpmn:Participant"])&&st(e)){var x=Gr(e);V(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(m,v){n.addLane(v,"top")}}}}),x.length<2&&((xn(e)?e.height>=120:e.width>=120)&&V(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&V(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),V(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(m,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?V(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):h0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!h0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!jn(p)&&V(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(m,v){var E=V(h(v),{cursor:{x:m.x,y:m.y}});a.open(v,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&V(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&V(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),tt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),M(p,"bpmn:TextAnnotation")&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),tt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&V(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(u,g()),u};function h0(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return H(o,function(a){a.$type===n&&(r=!0)}),i&&r}const zI={__depends__:[xI,u0,G_,Ri,Nh,Fl,HI],__init__:["contextPadProvider"],contextPadProvider:["type",ec]};var GI={horizontal:["x","width"],vertical:["y","height"]},m0=5;function Rr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return $e(i)?i:i?n:[]})}Rr.$inject=["modeling","rules"],Rr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Rr.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},Rr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(H(t,function(o){r=o(r,n,i)}),r):e},Rr.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=Hi(e,i);return H(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},Rr.prototype._setOrientation=function(e){var t=GI[e];this._axis=t[0],this._dimension=t[1]},Rr.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)},Rr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+m0,max:t+n-m0}};const VI={__init__:["distributeElements"],distributeElements:["type",Rr]};function Nu(e){Si.call(this,e)}Nu.$inject=["eventBus"],Ce(Nu,Si),Nu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=it(t,function(n){var i=tt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Zc(t),t.length<3?!1:t})};var g0={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Pi(e,t,n,i,o,r,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=o,this._rules=r,this._translate=a,this._moddleCopy=s,this._register()}Pi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Pi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Pi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if($e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=HI(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,ZI):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,QI):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=iB[o]||[],!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=it(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(r=it(GI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Participant")?(r=it(nB,function(c){return st(e)!==c.target.isExpanded}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&jn(t.$parent)?(r=it(eB.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(r=it(VI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:EndEvent")?(r=it(UI.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):M(t,"bpmn:BoundaryEvent")?(r=it(JI,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(r=it(WI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Gateway")?(r=it(qI,a),this._createEntries(e,r)):M(t,"bpmn:Transaction")?(r=it(b0,a),this._createEntries(e,r)):jn(t)&&st(e)?(r=it(XI,a),this._createEntries(e,r)):M(t,"bpmn:AdHocSubProcess")&&st(e)?(r=it(KI,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&st(e)?(r=it(YI,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&!st(e)?(r=it(x0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,tB):M(t,"bpmn:FlowNode")?(r=it(x0,a),this._createEntries(e,r)):{})},Pi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!jn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ab(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Pi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Pi.prototype._createSequenceFlowEntries=function(e,t){var n=de(e),i={},o=this._modeling,r=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&M(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Pi.prototype._createEntry=function(e,t,n){var i=this._translate,o=this._bpmnReplace.replaceElement,r=function(){return o(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||r,{label:i(a),className:e.className,action:n}},Pi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=de(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.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"}}}},Pi.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function o(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:o}}},Pi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function o(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:o}}},Pi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=de(e),i=this,o=sb(e),r=M(e,"bpmn:BoundaryEvent")?_0["intermediate-event-non-interrupting"]:_0["start-event-non-interrupting"],a=!n[o];return{"toggle-non-interrupting":{imageHtml:r,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[o]:!!a})}}}};const oB={__depends__:[Ih,Mx,uu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Pi]};function oc(e,t,n,i,o,r,a,s,c,l,u,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!Ts(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}oc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],oc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},oc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return $e(t)?Ao(e,n=>t.includes(n)):t},oc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&V(u,g()),u;var p=e.businessObject;function f(m,v){o.start(m,v)}function d(m,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(m){var v=5,w=t.getPad(m).html,S=w.getBoundingClientRect(),P={x:S.left,y:S.bottom+v};return P}function y(m,v,w,S){function P($,N){var H=i.createShape(V({type:m},S));r.start($,H,{source:N})}var T=s?function($,N){var H=i.createShape(V({type:m},S));s.append(N,H)}:P,D=s?function($,N){return l.create(N,m,S),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:w,action:{dragstart:P,click:T,hover:D}}}function _(m){return function(v,w){n.splitLane(w,m),t.open(w,!0)}}if(tt(p,["bpmn:Lane","bpmn:Participant"])&&st(e)){var x=Wo(e);V(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(m,v){n.addLane(v,"top")}}}}),x.length<2&&((xn(e)?e.height>=120:e.width>=120)&&V(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&V(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),V(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(m,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?V(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):w0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!w0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!jn(p)&&V(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(m,v){var w=V(h(v),{cursor:{x:m.x,y:m.y}});a.open(v,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&V(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&V(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),tt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),M(p,"bpmn:TextAnnotation")&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),tt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&V(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(u,g()),u};function w0(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return z(r,function(a){a.$type===n&&(o=!0)}),i&&o}const rB={__depends__:[NI,v0,Z_,Ri,Gh,zl,oB],__init__:["contextPadProvider"],contextPadProvider:["type",oc]};var aB={horizontal:["x","width"],vertical:["y","height"]},E0=5;function Co(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return $e(i)?i:i?n:[]})}Co.$inject=["modeling","rules"],Co.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Co.prototype.trigger=function(e,t){var n=this._modeling,i,o;if(!(e.length<3)&&(this._setOrientation(t),o=this._filterElements(e),i=this._createGroups(o),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Co.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(z(t,function(r){o=r(o,n,i)}),o):e},Co.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,o=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var r=Hi(e,i);return z(r,function(a,s){var c=n._findRange(a,i,o),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},Co.prototype._setOrientation=function(e){var t=aB[e];this._axis=t[0],this._dimension=t[1]},Co.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)},Co.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+E0,max:t+n-E0}};const sB={__init__:["distributeElements"],distributeElements:["type",Co]};function ju(e){Si.call(this,e)}ju.$inject=["eventBus"],Ce(ju,Si),ju.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=it(t,function(n){var i=tt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=el(t),t.length<3?!1:t})};var S0={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>`},WI=900;function tc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",WI,this)}tc.$inject=["popupMenu","distributeElements","translate","rules"],tc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},tc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},tc.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:g0.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:g0.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const UI={__depends__:[Ph,VI],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Nu],distributeElementsMenuProvider:["type",tc]};var y0="is not a registered action",qI="is already registered";function Ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ti.$inject=["eventBus","injector"],Ti.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),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=$e(p)?p:u;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&($e(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ti.prototype.trigger=function(e,t){if(!this._actions[e])throw Fh(e,y0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);H(e,function(i,r){n._registerAction(r,i)})},Ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Fh(e,qI);this._actions[e]=t},Ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw Fh(e,y0);this._actions[e]=void 0},Ti.prototype.getActions=function(){return Object.keys(this._actions)},Ti.prototype.isRegistered=function(e){return!!this._actions[e]};function Fh(e,t){return new Error(e+" "+t)}const YI={__init__:["editorActions"],editorActions:["type",Ti]};function $u(e){e.invoke(Ti,this)}Ce($u,Ti),$u.$inject=["injector"],$u.prototype._registerDefaultActions=function(e){Ti.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),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(y){return y!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),y=g.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),y=[],_=g.type;h.length&&(y=it(h,function(x){return!M(x,"bpmn:Lane")}),l.trigger(y,_))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;M(g,"bpmn:Collaboration")?y=n.filter(function(_){return M(_.parent,"bpmn:Collaboration")}):y=n.filter(function(_){return _!==g&&!M(_.parent,"bpmn:SubProcess")}),h=on(y),f.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const KI={__depends__:[YI],editorActions:["type",$u]};function v0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;tt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}v0.$inject=["eventBus"];function Bo(e,t){pe.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;Xn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Bo.$inject=["eventBus","gridSnapping","modeling"],Ce(Bo,pe),Bo.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},Bo.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},Bo.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),V(e,o),e},Bo.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),V(e,o),e};var XI=2e3;function b0(e,t){e.on(["spaceTool.move","spaceTool.end"],XI,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)}})}b0.$inject=["eventBus","gridSnapping"];const ZI={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Bo],gridSnappingSpaceToolBehavior:["type",b0]};var Fu=10;function jh(e,t,n){return n||(n="round"),Math[n](e/t)*t}var QI=1200,JI=800;function no(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",JI,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"],QI,function(o){var a=o.originalEvent;if(!(!r.active||a&&ni(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=tB(o,l,e);p&&(u.offset=p);var f=eB(o,l);f&&V(u,f),$a(o,l)||r.snapEvent(o,l,u)})}})}no.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);ln(e,t,i)},no.prototype.getGridSpacing=function(){return Fu},no.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=jh(e,Fu);var i,r;return t&&t.min&&(i=t.min,Fe(i)&&(i=jh(i+n,Fu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Fe(r)&&(r=jh(r+n,Fu,"floor"),e=Math.min(e,r))),e-=n,e},no.prototype.isActive=function(){return this.active},no.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},no.prototype.toggleActive=function(){this.setActive(!this.active)},no.$inject=["elementRegistry","eventBus","config.gridSnapping"];function eB(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&&(ju(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,l=r.max;return c&&(ju(t)?_0(s)?a.x.max=c.left:a.x.min=c.right:x0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(ju(t)?_0(s)?a.x.min=l.left:a.x.max=l.right:x0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function tB(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Fe(s[t])||(s||(s=o.snapOffset={}),Fe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(ju(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 ju(e){return e==="x"}function x0(e){return e.indexOf("n")!==-1}function _0(e){return e.indexOf("w")!==-1}const nB={__depends__:[ZI],__init__:["gridSnapping"],gridSnapping:["type",no]};var iB=2e3;function w0(e,t,n){e.on("autoPlace",iB,function(i){var r=i.source,o=je(r),a=i.shape,s=p_(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],M(a,"bpmn:TextAnnotation")&&(rB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}w0.$inject=["eventBus","gridSnapping","elementRegistry"];function rB(e){return e==="x"}var oB=1750;function E0(e,t,n){t.on(["create.start","shape.move.start"],oB,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!M(o,"bpmn:Participant")||!M(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}))}})}E0.$inject=["canvas","eventBus","gridSnapping"];var aB=3e3;function Hu(e,t,n){pe.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],aB,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||sB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Hu.$inject=["eventBus","gridSnapping","modeling"],Ce(Hu,pe),Hu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=uB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function sB(e){return e.length>3}function cB(e){return e==="h"}function lB(e){return e==="v"}function uB(e,t,n){var i=pr(t,n),r={};return cB(i)&&(r.y=e.snapValue(t.y)),lB(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}const pB={__depends__:[nB,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",w0],gridSnappingParticipantBehavior:["type",E0],gridSnappingLayoutConnectionBehavior:["type",Hu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",v0]};var fB=30,S0=30;function nc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(M(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(M(r,"bpmn:Participant"))return st(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(M(r,"bpmn:SubProcess"))return st(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}nc.$inject=["eventBus","interactionEvents"],nc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},nc.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=xn(e)?{width:fB,height:e.height}:{width:e.width,height:S0};return this._interactionEvents.createBoxHit(t,"all",n),!0},nc.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:S0}),!0};const dB={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",nc]};function zu(e){e.invoke(ka,this)}Ce(zu,ka),zu.$inject=["injector"],zu.prototype.registerBindings=function(e,t){ka.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 hB={__depends__:[hh],__init__:["keyboardBindings"],keyboardBindings:["type",zu]};var mB={moveSpeed:1,moveSpeedAccelerated:10},gB=1500,R0="left",C0="up",M0="right",A0="down",yB={ArrowLeft:R0,Left:R0,ArrowUp:C0,Up:C0,ArrowRight:M0,Right:M0,ArrowDown:A0,Down:A0},vB={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 P0(e,t,n,i,r){var o=this;this._config=V({},mB,e||{}),t.addListener(gB,function(a){var s=a.keyEvent,c=yB[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=vB[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}P0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const bB={__depends__:[hh,Ri],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",P0]};var T0=10;function ic(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=oT(u,p,l),c.newBounds=sT(d,f),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Be(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Ny(p),!xB(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}ic.prototype.canResize=function(e){var t=this._rules,n=Li(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},ic.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=V({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,k0(t,o),"resize",{autoActivate:!0,cursor:_B(o),data:{shape:t,context:r}})},ic.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:T0,height:T0},r=Sv(t,e.childrenBoxPadding),cT(n,t,i,r)},ic.$inject=["eventBus","rules","modeling","dragging"];function xB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function k0(e,t){var n=je(e),i=Be(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function _B(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 O0="djs-resizing",D0="resize-not-ok",wB=500;function L0(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,O0)),s.width>5&&we(c,{x:s.x,width:s.width}),s.height>5&&we(c,{y:s.y,height:s.height}),o.canExecute?at(c).remove(D0):at(c).add(D0)}function r(o){var a=o.shape,s=o.frame;s&&rn(o.frame),t.removeMarker(a,O0)}e.on("resize.move",wB,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}L0.$inject=["eventBus","canvas","previewSupport"];var Gu=-6,Vu=8,Wu=20,rc="djs-resizer",EB=["n","w","s","e","nw","ne","se","sw"];function io(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&&H(a,qn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}io.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Wr(o)&&i.activate(o,e,n)}Le.bind(t,"mousedown",r),Le.bind(t,"touchstart",r)},io.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=SB(i),a=Oe("g");at(a).add(rc),at(a).add(rc+"-"+e.id),at(a).add(rc+"-"+i),ze(r,a);var s=Oe("rect");we(s,{x:-Vu/2+o.x,y:-Vu/2+o.y,width:Vu,height:Vu}),at(s).add(rc+"-visual"),ze(a,s);var c=Oe("rect");return we(c,{x:-Wu/2+o.x,y:-Wu/2+o.y,width:Wu,height:Wu}),at(c).add(rc+"-hit"),ze(a,c),il(a,t,n),a},io.prototype.createResizer=function(e,t){var n=k0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},io.prototype.addResizer=function(e){var t=this;At(e)||H(EB,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},io.prototype.removeResizers=function(){var e=this._getResizersParent();as(e)},io.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},io.$inject=["eventBus","canvas","selection","resize"];function SB(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Gu:e.indexOf("w")!==-1&&(t.x=Gu),e.indexOf("s")!==-1?t.y=-Gu:e.indexOf("n")!==-1&&(t.y=Gu),t}const I0={__depends__:[Ji,yr,Ma],__init__:["resize","resizePreview","resizeHandles"],resize:["type",ic],resizePreview:["type",L0],resizeHandles:["type",io]};var RB=2e3;function oc(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"],RB,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 l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||tt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}oc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],oc.prototype.activate=function(e){var t=yi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={},o=n.style||{};return V(o,{backgroundColor:null,border:null}),(tt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||B0(e))&&V(r,{centerVertically:!0}),Hr(e)&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:r,style:o}),n}},oc.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(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||AB(e)){var g=xn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};V(o,h),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(MB(e)){var y=xn(e),_=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};V(o,_),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(tt(e,["bpmn:Task","bpmn:CallActivity"])||B0(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),CB(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,m=i.width+2*x;if(n.labelTarget&&(V(o,{width:m,height:i.height+2*x,x:i.x-x,y:i.y-x}),V(d,{fontSize:l+"px",lineHeight:u})),Hr(n)&&!al(n)&&!Je(n)){var v=Ef(e),E=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),S=l,P=wo.width*a+2*x;V(o,{width:P,height:S+2*x,x:E.x-P/2,y:E.y-S/2-x}),V(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:ma*a+"px",paddingBottom:ma*a+"px",paddingLeft:ma*a+"px",paddingRight:ma*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},oc.prototype.update=function(e,t,n,i){var r,o;M(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}),PB(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function B0(e){return M(e,"bpmn:SubProcess")&&!st(e)}function CB(e){return M(e,"bpmn:SubProcess")&&st(e)}function MB(e){return M(e,"bpmn:Participant")&&!st(e)}function AB(e){return M(e,"bpmn:Participant")&&st(e)}function PB(e){return!e||!e.trim()}var N0="djs-element-hidden",$0="djs-label-hidden";function F0(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,M(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Oe("path");we(p,{d:u,strokeWidth:2,stroke:TB(o)}),ze(s,p),ze(r,s),On(s,o.x,o.y)}M(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,N0):(M(o,"bpmn:Task")||M(o,"bpmn:CallActivity")||M(o,"bpmn:SubProcess")||M(o,"bpmn:Participant")||M(o,"bpmn:Lane"))&&t.addMarker(o,$0)}),e.on("directEditing.resize",function(c){if(M(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(o.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});we(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,N0),t.removeMarker(o,$0)),o=void 0,a=void 0,s&&(rn(s),s=void 0)})}F0.$inject=["eventBus","canvas","pathMap"];function TB(e,t){var n=ut(e);return n.get("stroke")||t||"black"}const kB={__depends__:[Hd,I0,u0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",oc],labelEditingPreview:["type",F0]};var OB=500,DB=1e3;function nr(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){sA(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){H(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],OB,function(o){var a=o.element,s=o.gfx,c=_t(".djs-outline",s);c&&i.updateOutline(a,c)})}nr.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=_t(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ze(t,n),this.updateOutline(e,n)),n},nr.prototype._createOutlineGfx=function(){var e=Oe("rect");return we(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},nr.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},nr.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&H(i,function(r){n=n||r.updateOutline(t,e)}),n||we(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},nr.prototype.updateConnectionOutline=function(e,t){var n=on(t);we(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},nr.prototype.registerProvider=function(e,t){t||(t=e,e=DB),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},nr.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},nr.prototype.getOutline=function(e){var t,n=this._getProviders();return H(n,function(i){yn(i.getOutline)&&(t=t||i.getOutline(e))}),t},nr.$inject=["eventBus","styles","elementRegistry"];var Uu=6;function Hh(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)})}Hh.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");as(t);var n=e.length>1,i=this._canvas.getContainer();if(at(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=LB(on(e)),o=Oe("rect");we(o,V({rx:3},r)),at(o).add("djs-selection-outline"),ze(t,o)}},Hh.$inject=["eventBus","canvas","selection"];function LB(e){return{x:e.x-Uu,y:e.y-Uu,width:e.width+Uu*2,height:e.height+Uu*2}}const zh={__depends__:[Ri],__init__:["outline","multiSelectionOutline"],outline:["type",nr],multiSelectionOutline:["type",Hh]},j0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],H0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},IB=15,qu=2;function z0(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>tt(g,j0));if(f.length===1){const g=f[0];Je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Je),h=f.find(y=>{var _;return(_=y.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!tt(p,j0)||!u(p)||(Je(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=ls([je(f),je(p)],H0),g=d.getAttribute("d"),y=r.isSelected(p)?c(p):l(p),_=ds(y,g);if(!_)return;const m=r.isSelected(f)?c(f):l(f),v=ds(m,g)||je(f);Es(v,_)<IB||(mf(d,[v,_]),ze(o,d))}function s(){os(`.${H0.class}`,o).forEach(rn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+ro(f,"x")-qu,y:p.y+ro(f,"y")-qu,width:ro(f,"width")+qu*2,height:ro(f,"height")+qu*2};return Rf(d,ro(f,"rx"))}if(f.cx){const d=ro(f,"r"),g={x:p.x+ro(f,"cx")-d,y:p.y+ro(f,"cy")-d,width:d*2,height:d*2};return sv(g)}}function l(p){return n.getShapePath(p)}function u(p){return r.isSelected(p)}}z0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function ro(e,t){return parseFloat(we(e,t)||0)}const BB={__depends__:[Ri,zh],__init__:["labelLink"],labelLink:["type",z0]};var NB=new Mo("tt");function $B(e){var t=Nt('<div class="djs-tooltip-container" />');return zn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function FB(e,t,n){zn(e,{left:t+"px",top:n+"px"})}function Gh(e,t){e.style.display=t===!1?"none":""}var G0="djs-tooltip",Vh="."+G0;function Kn(e,t){this._eventBus=e,this._canvas=t,this._ids=NB,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=$B(t.getContainer());var n=this;Jn.bind(this._tooltipRoot,Vh,"mousedown",function(i){i.stopPropagation()}),Jn.bind(this._tooltipRoot,Vh,"mouseover",function(i){n.trigger("mouseover",i)}),Jn.bind(this._tooltipRoot,Vh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Kn.$inject=["eventBus","canvas"],Kn.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=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Kn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(En(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Kn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Kn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Kn.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)}},Kn.prototype.remove=function(e){var t=this.get(e);t&&(qi(t.html),qi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Kn.prototype.show=function(){Gh(this._tooltipRoot)},Kn.prototype.hide=function(){Gh(this._tooltipRoot,!1)},Kn.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},Kn.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)),Xn(n)&&(n=Nt(n)),i=Nt('<div data-tooltip-id="'+t+'" class="'+G0+'">'),zn(i,{position:"absolute"}),i.appendChild(n),e.type&&St(i).add("djs-tooltip-"+e.type),e.className&&St(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Kn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;FB(n,t.x,t.y)},Kn.prototype._updateTooltipVisibilty=function(e){H(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Gh(i,r))})},Kn.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 jB={__init__:["tooltips"],tooltips:["type",Kn]};var HB="flow elements must be children of pools/participants",zB="Data object must be placed within a pool/participant.";function V0(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;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(r,n(HB)):M(a,"bpmn:DataObjectReference")&&i(r,n(zB)))})}V0.$inject=["eventBus","tooltips","translate"];const GB={__depends__:[jB],__init__:["modelingFeedback"],modelingFeedback:["type",V0]};var VB=500,WB=1250,UB=1500,Yu=Math.round;function qB(e){return{x:e.x+Yu(e.width/2),y:e.y+Yu(e.height/2)}}function W0(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",UB,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=YB(u),V(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",WB,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",VB,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Yu(l.x),l.y=Yu(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Wr(s)){var c=Ea(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(fn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!at(s.target).has("djs-hit-no-move")){var p=qB(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}W0.$inject=["eventBus","dragging","modeling","selection","rules"];function YB(e){var t=Yo(e,"id");return it(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var U0=499,Wh="djs-dragging",q0="drop-ok",Y0="drop-not-ok",K0="new-parent",X0="attach-ok";function Z0(e,t,n,i){function r(c){var l=o(c),u=KB(l);return u}function o(c){var l=us(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[X0,q0,Y0,K0].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,Wh),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",U0,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=r(u);if(!l.dragGroup){var d=Oe("g");we(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();ze(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=fp([p,o(u)]):p=o(u),H(p,function(h){t.addMarker(h,Wh)}),l.allDraggedElements=p,l.differentParents=XB(u)}),e.on("shape.move.move",U0,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,X0):l.canExecute&&f&&p.id!==f.id?a(p,K0):a(p,l.canExecute?q0:Y0)),On(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;H(u,function(f){t.removeMarker(f,Wh)}),p&&rn(p)}),this.makeDraggable=s}Z0.$inject=["eventBus","canvas","styles","previewSupport"];function KB(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=it(e,function(i){return At(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function XB(e){return P1(Yo(e,function(t){return t.parent&&t.parent.id}))!==1}const ZB={__depends__:[Nl,Ri,zh,Ji,yr,Ma],__init__:["move","movePreview"],move:["type",W0],movePreview:["type",Z0]};var Q0=".djs-palette-toggle",J0=".entry",QB=Q0+", "+J0,Uh="djs-palette-",JB="shown",qh="open",eE="two-column",eN=1e3;function un(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()})}un.$inject=["eventBus","canvas"],un.prototype.registerProvider=function(e,t){t||(t=e,e=eN),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},un.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(nN,{})},un.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},un.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Nt(un.HTML_MARKUP);n.appendChild(i),St(n).add(Uh+JB),Jn.bind(i,QB,"click",function(r){var o=r.delegateTarget;if(of(o,Q0))return e.toggle();e.trigger("click",r)}),Le.bind(i,"mousedown",function(r){r.stopPropagation()}),Jn.bind(i,J0,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},un.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},un.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=St(n),a=St(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(eE,r),a.toggle(Uh+eE,r),"open"in e&&(o.toggle(qh,e.open),a.toggle(Uh+qh,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},un.prototype._update=function(){var e=_t(".djs-palette-entries",this._container),t=this._entries=this.getEntries();qc(e),H(t,function(n,i){var r=n.group||"default",o=_t("[data-group="+ko(r)+"]",e);o||(o=Nt('<div class="group"></div>'),En(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Nt(a);if(o.appendChild(s),!n.separator&&(En(s,"data-action",i),n.title&&En(s,"title",n.title),n.className&&tN(s,n.className),n.imageUrl)){var c=Nt("<img>");En(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},un.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=En(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},un.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(yn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},un.prototype._layoutChanged=function(){this._toggleState({})},un.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},un.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},un.prototype.open=function(){this._toggleState({open:!0})},un.prototype.toggle=function(){this.isOpen()?this.close():this.open()},un.prototype.isActiveTool=function(e){return e&&this._activeTool===e},un.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=_t(".djs-palette-entries",this._container),this._toolsContainer=_t("[data-group=tools]",t)),n=this._toolsContainer,H(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=St(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},un.prototype.isOpen=function(){return St(this._container).has(qh)},un.prototype._getParentContainer=function(){return this._canvas.getContainer()},un.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function tN(e,t){var n=St(e),i=$e(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function nN(e,t){var n=t.getPaletteEntries();return yn(n)?n(e):(H(n,function(i,r){e[r]=i}),e)}const iN={__init__:["palette"],palette:["type",un]};var tE="crosshair",nE="selected",rN="djs-dragging-active-lasso";function oo(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Oe("rect");we(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ze(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&we(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const y of h)g.has(y)||t.removeMarker(y,nE);for(const y of g)h.has(y)||t.addMarker(y,nE)}},remove:function(p){this.update(p),p.frame&&rn(p.frame),l(!1)}};function l(p){at(t.getContainer()).toggle(rN,p)}function u(p){var f=i.getAll();return new Set(qo(ua(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=iE(p),f.add=Tl(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=iE(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Tl(p))return s.activateLasso(p.originalEvent),!0})}oo.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],oo.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:tE,data:{context:{}},keepSelection:!0})},oo.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:tE,data:{context:{}},keepSelection:!0})},oo.prototype._select=function(e){this._selection.select(e)},oo.prototype.select=function(e,t,n=[]){var i=qo(ua(e,t));this._select([...n,...i])},oo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},oo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function iE(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 oN={__depends__:[Hl,Ps],__init__:["lassoTool"],lassoTool:["type",oo]};var Yh=1500,rE="grab";function Fa(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",Yh,function(c){if(Cs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Yh,function(c){if(!(!oE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Yh,function(c){!oE(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!Cs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Fa.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Fa.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:rE,data:{context:n||{}}})},Fa.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:rE,data:{context:{reactivate:n}}})},Fa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Fa.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function oE(e){return hn("Space",e)}const aN={__depends__:[Hl,Ps],__init__:["handTool"],handTool:["type",Fa]};var aE="connect-ok",sE="connect-not-ok";function ja(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 l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?aE:sE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?aE:sE)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}ja.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ja.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ja.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ja.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ja.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const sN={__depends__:[Nh,Ji,yr,Hl,Ps],globalConnect:["type",ja]};function Kh(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)}Kh.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Kh.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function y(_){var x=n.createShape(V({type:p},h));t.start(_,x)}return{group:f,className:d,title:g,action:{dragstart:y,click:y}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return V(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const cN={__depends__:[iN,Fl,Rx,oN,aN,sN,bs],__init__:["paletteProvider"],paletteProvider:["type",Kh]};var lN=250;function Xh(e,t,n,i,r){pe.call(this,e);function o(s){var c=s.canExecute.replacements;H(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);V(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=_t('[data-element-id="'+ko(f.id)+'"]',s.dragGroup);g&&we(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;H(c,function(l,u){var p=_t('[data-element-id="'+ko(u)+'"]',s.dragGroup);p&&we(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",lN,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}Xh.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ce(Xh,pe);const uN={__depends__:[Ma],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Xh]};var pN=1250,Zh=40,fN=20,dN=10,cE=20,lE=["x","y"],hN=Math.abs;function uE(e){e.on(["connect.hover","connect.move","connect.end"],pN,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&ni(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&mN(t,o,bN(o)),o&&vN(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ai(r),tt(o,["bpmn:Event","bpmn:Gateway"])&&pE(t,Ai(o)),tt(o,["bpmn:Task","bpmn:SubProcess"])&&gN(t,o),M(a,"bpmn:BoundaryEvent")&&s===a.host&&yN(t)):fE(i,"bpmn:MessageFlow")?(M(r,"bpmn:Event")&&(n.connectionStart=Ai(r)),M(o,"bpmn:Event")&&pE(t,Ai(o))):n.connectionStart=n.initialConnectionStart)})}uE.$inject=["eventBus"];function mN(e,t,n){lE.forEach(function(i){var r=dE(i,t);e[i]<t[i]+n?ln(e,i,t[i]+n):e[i]>t[i]+r-n&&ln(e,i,t[i]+r-n)})}function gN(e,t){var n=Ai(t);lE.forEach(function(i){xN(e,t,i)&&ln(e,i,n[i])})}function yN(e){var t=e.context,n=t.source,i=t.target;if(!_N(t)){var r=Ai(n),o=kn(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],l;hN(c-r[s])<Zh&&(c>r[s]?l=r[s]+Zh:l=r[s]-Zh,ln(e,s,l))})}}function pE(e,t){ln(e,"x",t.x),ln(e,"y",t.y)}function fE(e,t){return e&&e.type===t}function vN(e,t){return Ar(t,function(n){return fE(e,n)})}function dE(e,t){return e==="x"?t.width:t.height}function bN(e){return M(e,"bpmn:Task")?dN:fN}function xN(e,t,n){return e[n]>t[n]+cE&&e[n]<t[n]+dE(n,t)-cE}function _N(e){var t=e.hover,n=e.source;return t&&n&&t===n}function ao(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}ao.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},ao.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},ao.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},ao.prototype.getSnapLocations=function(){return this._snapLocations},ao.prototype.setSnapLocations=function(e){this._snapLocations=e},ao.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Ku,n.initDefaults(this._defaultSnaps)),n};function Ku(){this._snapValues={}}Ku.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)},Ku.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&lI(e[n],r[n],i)},Ku.prototype.initDefaults=function(e){var t=this;H(e||{},function(n,i){H(n,function(r){t.add(i,r)})})};var wN=1250;function ir(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"],wN,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&ni(r.originalEvent))&&!($a(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}ir.$inject=["elementRegistry","eventBus","snapping"],ir.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new ao);var o;t.get(i.id)?o=Ai(i,e):o={x:e.x+Ai(i).x,y:e.y+Ai(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Je(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},ir.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return H(i,function(r){if(Je(r)){Je(t)&&e.add("mid",Ai(r));return}if(At(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);H(o,function(a){e.add("mid",a)});return}e.add("mid",Ai(r))}),!Fe(t.x)||!Fe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ai(t)),e},ir.prototype.getSnapTargets=function(e,t){return Jw(t).filter(function(n){return!EN(n)})};function EN(e){return!!e.hidden}var hE=1500;function Ha(e,t){t.invoke(ir,this),e.on(["create.move","create.end"],hE,MN),e.on(["create.move","create.end","shape.move.move","shape.move.end"],hE,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$a(n)&&SN(n,o)})}Ce(Ha,ir),Ha.$inject=["eventBus","injector"],Ha.prototype.initSnap=function(e){var t=ir.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return H(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",gE(o,i,e))}),H(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",gE(o,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ha.prototype.addSnapTargetPoints=function(e,t,n){ir.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);H(i,function(o){(CN(o)||RN([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Zw(o)),e.add("bottom-right",Qw(o)))});var r=this._elementRegistry;return H(t.incoming,function(o){if(r.get(t.id)){mE(i,o.source)||e.add("mid",je(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),H(t.outgoing,function(o){if(r.get(t.id)){mE(i,o.target)||e.add("mid",je(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ha.prototype.getSnapTargets=function(e,t){return ir.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function SN(e,t){var n=Be(t),i=_b(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=je(o),/top/.test(i)?ln(e,"y",n.top-a.y):/bottom/.test(i)&&ln(e,"y",n.bottom-a.y),/left/.test(i)?ln(e,"x",n.left-a.x):/right/.test(i)&&ln(e,"x",n.right-a.x)}function RN(e,t){return e.every(function(n){return M(n,t)})}function CN(e){return M(e,"bpmn:SubProcess")&&st(e)?!0:M(e,"bpmn:Participant")}function MN(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)&&ln(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&ln(e,"y",e.y)}}function mE(e,t){return e.indexOf(t)!==-1}function gE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var AN=1250;function ac(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],AN,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&ni(i.originalEvent))&&!$a(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),kN(s)&&ln(i,"x",i.x),ON(s)&&ln(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}ac.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new ao);var o=yE(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},ac.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return H(r,function(o){e.add("corner",Qw(o)),e.add("corner",Zw(o))}),e.add("corner",yE(t,i)),e},ac.$inject=["eventBus","snapping"],ac.prototype.getSnapTargets=function(e,t){return Jw(t).filter(function(n){return!PN(n,e)&&!At(n)&&!TN(n)&&!Je(n)})};function yE(e,t){var n=je(e),i=Be(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function PN(e,t){return e.host===t}function TN(e){return!!e.hidden}function kN(e){return e==="n"||e==="s"}function ON(e){return e==="e"||e==="w"}var DN=7,LN=1e3;function so(e){this._canvas=e,this._asyncHide=hp(qn(this.hide,this),LN)}so.$inject=["canvas"],so.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:$a(e,"x"),y:$a(e,"y")};H(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(H(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,DN),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),H(["x","y"],function(a){var s=o[a];fn(s)&&ln(e,a,s.originValue)})},so.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return we(n,{d:"M0,0 L0,0"}),at(n).add("djs-snap-line"),ze(t,n),{update:function(i){Fe(i)?e==="horizontal"?we(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):we(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):we(n,{display:"none"})}}},so.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},so.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},so.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},so.prototype.hide=function(){H(this._snapLines,function(e){e.update()})};const IN={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ir],resizeSnapping:["type",ac],snapping:["type",so]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",uE],createMoveSnapping:["type",Ha]};var vE=300;function We(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=_t(We.INPUT_SELECTOR,this._container),this._resultsContainer=_t(We.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}We.$inject=["canvas","eventBus","selection","translate"],We.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Jn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,We.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,We.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,We.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,We.INPUT_SELECTOR,"keydown",function(n){hn("ArrowUp",n)&&n.preventDefault(),hn("ArrowDown",n)&&n.preventDefault()}),t(this._container,We.INPUT_SELECTOR,"keyup",function(n){if(hn("Escape",n))return e.close();if(hn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(hn("ArrowUp",n))return e._scrollToDirection(!0);if(hn("ArrowDown",n))return e._scrollToDirection();hn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},We.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Jn.unbind(e.el,e.type,e.listener)})},We.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=_t(We.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},We.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},We.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)}},We.prototype._clearResults=function(){qc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},We.prototype._getCurrentResult=function(){return _t(We.RESULT_SELECTED_SELECTOR,this._resultsContainer)},We.prototype._createResultNode=function(e,t){var n=Nt(We.RESULT_HTML);return e.primaryTokens.length>0&&bE(n,e.primaryTokens,We.RESULT_PRIMARY_HTML),bE(n,e.secondaryTokens,We.RESULT_SECONDARY_HTML),En(n,We.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},We.prototype.registerProvider=function(e){this._searchProvider=e},We.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,St(this._canvas.getContainer()).add("djs-search-open"),St(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},We.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,St(this._canvas.getContainer()).remove("djs-search-open"),St(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},We.prototype.toggle=function(){this.isOpen()?this.close():this.open()},We.prototype.isOpen=function(){return this._open},We.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&St(t).remove(We.RESULT_SELECTED_CLASS);var n=En(e,We.RESULT_ID_ATTRIBUTE),i=this._results[n].element;St(e).add(We.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:vE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},We.prototype._select=function(e){var t=En(e,We.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:vE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},We.prototype._getBoxHtml=function(){const e=Nt(We.BOX_HTML),t=_t(We.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function bE(e,t,n){var i=BN(t),r=Nt(n);r.innerHTML=i,e.appendChild(r)}function BN(e){var t="";return e.forEach(function(n){var i=M_(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+We.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}We.CONTAINER_SELECTOR=".djs-search-container",We.INPUT_SELECTOR=".djs-search-input input",We.RESULTS_CONTAINER_SELECTOR=".djs-search-results",We.RESULT_SELECTOR=".djs-search-result",We.RESULT_SELECTED_CLASS="djs-search-result-selected",We.RESULT_SELECTED_SELECTOR="."+We.RESULT_SELECTED_CLASS,We.RESULT_ID_ATTRIBUTE="data-result-id",We.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",We.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},cB=900;function rc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",cB,this)}rc.$inject=["popupMenu","distributeElements","translate","rules"],rc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},rc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},rc.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,o={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:S0.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:S0.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const lB={__depends__:[Ih,sB],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ju],distributeElementsMenuProvider:["type",rc]};var R0="is not a registered action",uB="is already registered";function Ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ti.$inject=["eventBus","injector"],Ti.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=$e(p)?p:u;return r.cut(f.slice())}}}),o&&this.register("stepZoom",function(u){o.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&($e(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ti.prototype.trigger=function(e,t){if(!this._actions[e])throw Wh(e,R0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,o){n._registerAction(o,i)})},Ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Wh(e,uB);this._actions[e]=t},Ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw Wh(e,R0);this._actions[e]=void 0},Ti.prototype.getActions=function(){return Object.keys(this._actions)},Ti.prototype.isRegistered=function(e){return!!this._actions[e]};function Wh(e,t){return new Error(e+" "+t)}const pB={__init__:["editorActions"],editorActions:["type",Ti]};function Hu(e){e.invoke(Ti,this)}Ce(Hu,Ti),Hu.$inject=["injector"],Hu.prototype._registerDefaultActions=function(e){Ti.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(y){return y!==g});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),y=g.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),y=[],_=g.type;h.length&&(y=it(h,function(x){return!M(x,"bpmn:Lane")}),l.trigger(y,_))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;M(g,"bpmn:Collaboration")?y=n.filter(function(_){return M(_.parent,"bpmn:Collaboration")}):y=n.filter(function(_){return _!==g&&!M(_.parent,"bpmn:SubProcess")}),h=rn(y),f.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const fB={__depends__:[pB],editorActions:["type",Hu]};function C0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;tt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}C0.$inject=["eventBus"];function $r(e,t){pe.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;Xn(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}$r.$inject=["eventBus","gridSnapping","modeling"],Ce($r,pe),$r.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},$r.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},$r.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),V(e,r),e},$r.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),V(e,r),e};var dB=2e3;function M0(e,t){e.on(["spaceTool.move","spaceTool.end"],dB,function(n){var i=n.context;if(i.initialized){var o=i.axis,r;o==="x"?(r=t.snapValue(n.dx),n.x=n.x+r-n.dx,n.dx=r):(r=t.snapValue(n.dy),n.y=n.y+r-n.dy,n.dy=r)}})}M0.$inject=["eventBus","gridSnapping"];const hB={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",$r],gridSnappingSpaceToolBehavior:["type",M0]};var zu=10;function Uh(e,t,n){return n||(n="round"),Math[n](e/t)*t}var gB=1200,mB=800;function or(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",mB,function(){o.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"],gB,function(r){var a=r.originalEvent;if(!(!o.active||a&&ni(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=vB(r,l,e);p&&(u.offset=p);var f=yB(r,l);f&&V(u,f),ja(r,l)||o.snapEvent(r,l,u)})}})}or.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);ln(e,t,i)},or.prototype.getGridSpacing=function(){return zu},or.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Uh(e,zu);var i,o;return t&&t.min&&(i=t.min,Fe(i)&&(i=Uh(i+n,zu,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Fe(o)&&(o=Uh(o+n,zu,"floor"),e=Math.min(e,o))),e-=n,e},or.prototype.isActive=function(){return this.active},or.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},or.prototype.toggleActive=function(){this.setActive(!this.active)},or.$inject=["elementRegistry","eventBus","config.gridSnapping"];function yB(e,t){var n=e.context,i=n.createConstraints,o=n.resizeConstraints||{},r=n.gridSnappingContext,a=r.snapConstraints;if(a&&a[t])return a[t];a||(a=r.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Gu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=o.min,l=o.max;return c&&(Gu(t)?P0(s)?a.x.max=c.left:a.x.min=c.right:A0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Gu(t)?P0(s)?a.x.min=l.left:a.x.max=l.right:A0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function vB(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Fe(s[t])||(s||(s=r.snapOffset={}),Fe(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Gu(t)?s[t]+=o[t]+o.width/2:s[t]+=o[t]+o.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=o.width/2:/right/.test(a)&&(s[t]+=o.width/2):/top/.test(a)?s[t]-=o.height/2:/bottom/.test(a)&&(s[t]+=o.height/2)),s[t]}function Gu(e){return e==="x"}function A0(e){return e.indexOf("n")!==-1}function P0(e){return e.indexOf("w")!==-1}const bB={__depends__:[hB],__init__:["gridSnapping"],gridSnapping:["type",or]};var xB=2e3;function T0(e,t,n){e.on("autoPlace",xB,function(i){var o=i.source,r=je(o),a=i.shape,s=b_(o,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==r[c]&&(s[c]>r[c]?l.min=s[c]:l.max=s[c],M(a,"bpmn:TextAnnotation")&&(_B(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}T0.$inject=["eventBus","gridSnapping","elementRegistry"];function _B(e){return e==="x"}var wB=1750;function k0(e,t,n){t.on(["create.start","shape.move.start"],wB,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!M(r,"bpmn:Participant")||!M(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}k0.$inject=["canvas","eventBus","gridSnapping"];var EB=3e3;function Vu(e,t,n){pe.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],EB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||SB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Vu.$inject=["eventBus","gridSnapping","modeling"],Ce(Vu,pe),Vu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=MB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function SB(e){return e.length>3}function RB(e){return e==="h"}function CB(e){return e==="v"}function MB(e,t,n){var i=po(t,n),o={};return RB(i)&&(o.y=e.snapValue(t.y)),CB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=V({},t,o),n=V({},n,o)),[t,n]}const AB={__depends__:[bB,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",T0],gridSnappingParticipantBehavior:["type",k0],gridSnappingLayoutConnectionBehavior:["type",Vu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",C0]};var PB=30,O0=30;function ac(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(M(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(M(o,"bpmn:Participant"))return st(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(M(o,"bpmn:SubProcess"))return st(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}ac.$inject=["eventBus","interactionEvents"],ac.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},ac.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=xn(e)?{width:PB,height:e.height}:{width:e.width,height:O0};return this._interactionEvents.createBoxHit(t,"all",n),!0},ac.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:O0}),!0};const TB={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",ac]};function Wu(e){e.invoke(Da,this)}Ce(Wu,Da),Wu.$inject=["injector"],Wu.prototype.registerBindings=function(e,t){Da.prototype.registerBindings.call(this,e,t);function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("selectElements",function(i){var o=i.keyEvent;if(e.isKey(["a","A"],o)&&e.isCmd(o))return t.trigger("selectElements"),!0}),n("find",function(i){var o=i.keyEvent;if(e.isKey(["f","F"],o)&&e.isCmd(o))return t.trigger("find"),!0}),n("spaceTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["s","S"],o))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["l","L"],o))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["h","H"],o))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["c","C"],o))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["e","E"],o))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["r","R"],o))return t.trigger("replaceElement",o),!0})};const kB={__depends__:[xh],__init__:["keyboardBindings"],keyboardBindings:["type",Wu]};var OB={moveSpeed:1,moveSpeedAccelerated:10},DB=1500,D0="left",L0="up",I0="right",B0="down",LB={ArrowLeft:D0,Left:D0,ArrowUp:L0,Up:L0,ArrowRight:I0,Right:I0,ArrowDown:B0,Down:B0},IB={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 N0(e,t,n,i,o){var r=this;this._config=V({},OB,e||{}),t.addListener(DB,function(a){var s=a.keyEvent,c=LB[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return r.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=o.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=IB[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}N0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const BB={__depends__:[xh,Ri],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",N0]};var $0=10;function sc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=wT(u,p,l),c.newBounds=ST(d,f),c.canExecute=o.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=o.computeMinResizeBox(c)),c.resizeConstraints={min:Be(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Wy(p),!NB(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}sc.prototype.canResize=function(e){var t=this._rules,n=Li(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},sc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=V({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,F0(t,r),"resize",{autoActivate:!0,cursor:$B(r),data:{shape:t,context:o}})},sc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:$0,height:$0},o=Ov(t,e.childrenBoxPadding),RT(n,t,i,o)},sc.$inject=["eventBus","rules","modeling","dragging"];function NB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function F0(e,t){var n=je(e),i=Be(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function $B(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 j0="djs-resizing",H0="resize-not-ok",FB=500;function z0(e,t,n){function i(r){var a=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,j0)),s.width>5&&we(c,{x:s.x,width:s.width}),s.height>5&&we(c,{y:s.y,height:s.height}),r.canExecute?at(c).remove(H0):at(c).add(H0)}function o(r){var a=r.shape,s=r.frame;s&&on(r.frame),t.removeMarker(a,j0)}e.on("resize.move",FB,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}z0.$inject=["eventBus","canvas","previewSupport"];var Uu=-6,qu=8,Yu=20,cc="djs-resizer",jB=["n","w","s","e","nw","ne","se","sw"];function rr(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&z(a,qn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}rr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){qo(r)&&i.activate(r,e,n)}Le.bind(t,"mousedown",o),Le.bind(t,"touchstart",o)},rr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=HB(i),a=Oe("g");at(a).add(cc),at(a).add(cc+"-"+e.id),at(a).add(cc+"-"+i),ze(o,a);var s=Oe("rect");we(s,{x:-qu/2+r.x,y:-qu/2+r.y,width:qu,height:qu}),at(s).add(cc+"-visual"),ze(a,s);var c=Oe("rect");return we(c,{x:-Yu/2+r.x,y:-Yu/2+r.y,width:Yu,height:Yu}),at(c).add(cc+"-hit"),ze(a,c),al(a,t,n),a},rr.prototype.createResizer=function(e,t){var n=F0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},rr.prototype.addResizer=function(e){var t=this;Pt(e)||z(jB,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},rr.prototype.removeResizers=function(){var e=this._getResizersParent();us(e)},rr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},rr.$inject=["eventBus","canvas","selection","resize"];function HB(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Uu:e.indexOf("w")!==-1&&(t.x=Uu),e.indexOf("s")!==-1?t.y=-Uu:e.indexOf("n")!==-1&&(t.y=Uu),t}const G0={__depends__:[Ji,vo,Pa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",sc],resizePreview:["type",z0],resizeHandles:["type",rr]};var zB=2e3;function lc(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,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"],zB,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||tt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}lc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],lc.prototype.activate=function(e){var t=yi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var o={},r=n.style||{};return V(r,{backgroundColor:null,border:null}),(tt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||V0(e))&&V(o,{centerVertically:!0}),Go(e)&&(V(o,{resizable:!0,autoResize:!0}),V(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(V(o,{resizable:!0,autoResize:!0}),V(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:o,style:r}),n}},lc.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||WB(e)){var g=xn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};V(r,h),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(VB(e)){var y=xn(e),_=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};V(r,_),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(tt(e,["bpmn:Task","bpmn:CallActivity"])||V0(e))&&(V(r,{width:i.width,height:i.height}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),GB(e)&&(V(r,{width:i.width,x:i.x}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,m=i.width+2*x;if(n.labelTarget&&(V(r,{width:m,height:i.height+2*x,x:i.x-x,y:i.y-x}),V(d,{fontSize:l+"px",lineHeight:u})),Go(n)&&!ll(n)&&!Je(n)){var v=Pf(e),w=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),S=l,P=Sr.width*a+2*x;V(r,{width:P,height:S+2*x,x:w.x-P/2,y:w.y-S/2-x}),V(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(V(r,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:ya*a+"px",paddingBottom:ya*a+"px",paddingLeft:ya*a+"px",paddingRight:ya*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},lc.prototype.update=function(e,t,n,i){var o,r;M(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),UB(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function V0(e){return M(e,"bpmn:SubProcess")&&!st(e)}function GB(e){return M(e,"bpmn:SubProcess")&&st(e)}function VB(e){return M(e,"bpmn:Participant")&&!st(e)}function WB(e){return M(e,"bpmn:Participant")&&st(e)}function UB(e){return!e||!e.trim()}var W0="djs-element-hidden",U0="djs-label-hidden";function q0(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,M(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=i.path=Oe("path");we(p,{d:u,strokeWidth:2,stroke:qB(r)}),ze(s,p),ze(o,s),On(s,r.x,r.y)}M(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,W0):(M(r,"bpmn:Task")||M(r,"bpmn:CallActivity")||M(r,"bpmn:SubProcess")||M(r,"bpmn:Participant")||M(r,"bpmn:Lane"))&&t.addMarker(r,U0)}),e.on("directEditing.resize",function(c){if(M(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});we(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,W0),t.removeMarker(r,U0)),r=void 0,a=void 0,s&&(on(s),s=void 0)})}q0.$inject=["eventBus","canvas","pathMap"];function qB(e,t){var n=ft(e);return n.get("stroke")||t||"black"}const YB={__depends__:[qd,G0,v0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",lc],labelEditingPreview:["type",q0]};var KB=500,XB=1e3;function no(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function o(r){SA(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){z(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],KB,function(r){var a=r.element,s=r.gfx,c=wt(".djs-outline",s);c&&i.updateOutline(a,c)})}no.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=wt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ze(t,n),this.updateOutline(e,n)),n},no.prototype._createOutlineGfx=function(){var e=Oe("rect");return we(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},no.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},no.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(o){n=n||o.updateOutline(t,e)}),n||we(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},no.prototype.updateConnectionOutline=function(e,t){var n=rn(t);we(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},no.prototype.registerProvider=function(e,t){t||(t=e,e=XB),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},no.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},no.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){yn(i.getOutline)&&(t=t||i.getOutline(e))}),t},no.$inject=["eventBus","styles","elementRegistry"];var Ku=6;function qh(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(o){n.isSelected(o.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(o){var r=o.newSelection;i._updateMultiSelectionOutline(r)})}qh.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");us(t);var n=e.length>1,i=this._canvas.getContainer();if(at(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=ZB(rn(e)),r=Oe("rect");we(r,V({rx:3},o)),at(r).add("djs-selection-outline"),ze(t,r)}},qh.$inject=["eventBus","canvas","selection"];function ZB(e){return{x:e.x-Ku,y:e.y-Ku,width:e.width+Ku*2,height:e.height+Ku*2}}const Yh={__depends__:[Ri],__init__:["outline","multiSelectionOutline"],outline:["type",no],multiSelectionOutline:["type",qh]},Y0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],K0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},QB=15,Xu=2;function X0(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>tt(g,Y0));if(f.length===1){const g=f[0];Je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Je),h=f.find(y=>{var _;return(_=y.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!tt(p,Y0)||!u(p)||(Je(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=ds([je(f),je(p)],K0),g=d.getAttribute("d"),y=o.isSelected(p)?c(p):l(p),_=ys(y,g);if(!_)return;const m=o.isSelected(f)?c(f):l(f),v=ys(m,g)||je(f);Ms(v,_)<QB||(_f(d,[v,_]),ze(r,d))}function s(){ls(`.${K0.class}`,r).forEach(on)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+ar(f,"x")-Xu,y:p.y+ar(f,"y")-Xu,width:ar(f,"width")+Xu*2,height:ar(f,"height")+Xu*2};return kf(d,ar(f,"rx"))}if(f.cx){const d=ar(f,"r"),g={x:p.x+ar(f,"cx")-d,y:p.y+ar(f,"cy")-d,width:d*2,height:d*2};return gv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}X0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function ar(e,t){return parseFloat(we(e,t)||0)}const JB={__depends__:[Ri,Yh],__init__:["labelLink"],labelLink:["type",X0]};var eN=new Pr("tt");function tN(e){var t=Nt('<div class="djs-tooltip-container" />');return zn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function nN(e,t,n){zn(e,{left:t+"px",top:n+"px"})}function Kh(e,t){e.style.display=t===!1?"none":""}var Z0="djs-tooltip",Xh="."+Z0;function Kn(e,t){this._eventBus=e,this._canvas=t,this._ids=eN,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=tN(t.getContainer());var n=this;Jn.bind(this._tooltipRoot,Xh,"mousedown",function(i){i.stopPropagation()}),Jn.bind(this._tooltipRoot,Xh,"mouseover",function(i){n.trigger("mouseover",i)}),Jn.bind(this._tooltipRoot,Xh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Kn.$inject=["eventBus","canvas"],Kn.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=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Kn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(En(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Kn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Kn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Kn.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)}},Kn.prototype.remove=function(e){var t=this.get(e);t&&(qi(t.html),qi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Kn.prototype.show=function(){Kh(this._tooltipRoot)},Kn.prototype.hide=function(){Kh(this._tooltipRoot,!1)},Kn.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},Kn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Xn(n)&&(n=Nt(n)),i=Nt('<div data-tooltip-id="'+t+'" class="'+Z0+'">'),zn(i,{position:"absolute"}),i.appendChild(n),e.type&&Rt(i).add("djs-tooltip-"+e.type),e.className&&Rt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Kn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;nN(n,t.x,t.y)},Kn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Kh(i,o))})},Kn.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 iN={__init__:["tooltips"],tooltips:["type",Kn]};var oN="flow elements must be children of pools/participants",rN="Data object must be placed within a pool/participant.";function Q0(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(o,n(oN)):M(a,"bpmn:DataObjectReference")&&i(o,n(rN)))})}Q0.$inject=["eventBus","tooltips","translate"];const aN={__depends__:[iN],__init__:["modelingFeedback"],modelingFeedback:["type",Q0]};var sN=500,cN=1250,lN=1500,Zu=Math.round;function uN(e){return{x:e.x+Zu(e.width/2),y:e.y+Zu(e.height/2)}}function J0(e,t,n,i,o){function r(s,c,l,u){return o.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",lN,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=pN(u),V(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",cN,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",sN,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=r(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Zu(l.x),l.y=Zu(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(qo(s)){var c=Ra(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(fn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!at(s.target).has("djs-hit-no-move")){var p=uN(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}J0.$inject=["eventBus","dragging","modeling","selection","rules"];function pN(e){var t=Xr(e,"id");return it(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var eE=499,Zh="djs-dragging",tE="drop-ok",nE="drop-not-ok",iE="new-parent",oE="attach-ok";function rE(e,t,n,i){function o(c){var l=r(c),u=fN(l);return u}function r(c){var l=hs(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[oE,tE,nE,iE].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,Zh),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",eE,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Oe("g");we(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();ze(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=gp([p,r(u)]):p=r(u),z(p,function(h){t.addMarker(h,Zh)}),l.allDraggedElements=p,l.differentParents=dN(u)}),e.on("shape.move.move",eE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,oE):l.canExecute&&f&&p.id!==f.id?a(p,iE):a(p,l.canExecute?tE:nE)),On(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;z(u,function(f){t.removeMarker(f,Zh)}),p&&on(p)}),this.makeDraggable=s}rE.$inject=["eventBus","canvas","styles","previewSupport"];function fN(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=it(e,function(i){return Pt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function dN(e){return N1(Xr(e,function(t){return t.parent&&t.parent.id}))!==1}const hN={__depends__:[jl,Ri,Yh,Ji,vo,Pa],__init__:["move","movePreview"],move:["type",J0],movePreview:["type",rE]};var aE=".djs-palette-toggle",sE=".entry",gN=aE+", "+sE,Qh="djs-palette-",mN="shown",Jh="open",cE="two-column",yN=1e3;function un(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}un.$inject=["eventBus","canvas"],un.prototype.registerProvider=function(e,t){t||(t=e,e=yN),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},un.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(bN,{})},un.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},un.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Nt(un.HTML_MARKUP);n.appendChild(i),Rt(n).add(Qh+mN),Jn.bind(i,gN,"click",function(o){var r=o.delegateTarget;if(pf(r,aE))return e.toggle();e.trigger("click",o)}),Le.bind(i,"mousedown",function(o){o.stopPropagation()}),Jn.bind(i,sE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},un.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},un.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Rt(n),a=Rt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(cE,o),a.toggle(Qh+cE,o),"open"in e&&(r.toggle(Jh,e.open),a.toggle(Qh+Jh,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},un.prototype._update=function(){var e=wt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Xc(e),z(t,function(n,i){var o=n.group||"default",r=wt("[data-group="+Dr(o)+"]",e);r||(r=Nt('<div class="group"></div>'),En(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Nt(a);if(r.appendChild(s),!n.separator&&(En(s,"data-action",i),n.title&&En(s,"title",n.title),n.className&&vN(s,n.className),n.imageUrl)){var c=Nt("<img>");En(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},un.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=En(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},un.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(yn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},un.prototype._layoutChanged=function(){this._toggleState({})},un.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},un.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},un.prototype.open=function(){this._toggleState({open:!0})},un.prototype.toggle=function(){this.isOpen()?this.close():this.open()},un.prototype.isActiveTool=function(e){return e&&this._activeTool===e},un.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=wt(".djs-palette-entries",this._container),this._toolsContainer=wt("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Rt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},un.prototype.isOpen=function(){return Rt(this._container).has(Jh)},un.prototype._getParentContainer=function(){return this._canvas.getContainer()},un.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function vN(e,t){var n=Rt(e),i=$e(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function bN(e,t){var n=t.getPaletteEntries();return yn(n)?n(e):(z(n,function(i,o){e[o]=i}),e)}const xN={__init__:["palette"],palette:["type",un]};var lE="crosshair",uE="selected",_N="djs-dragging-active-lasso";function sr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Oe("rect");we(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ze(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&we(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const y of h)g.has(y)||t.removeMarker(y,uE);for(const y of g)h.has(y)||t.addMarker(y,uE)}},remove:function(p){this.update(p),p.frame&&on(p.frame),l(!1)}};function l(p){at(t.getContainer()).toggle(_N,p)}function u(p){var f=i.getAll();return new Set(Kr(fa(f,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=pE(p),f.add=Dl(p),f.lastMarked=new Set(o.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=pE(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Dl(p))return s.activateLasso(p.originalEvent),!0})}sr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],sr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:lE,data:{context:{}},keepSelection:!0})},sr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:lE,data:{context:{}},keepSelection:!0})},sr.prototype._select=function(e){this._selection.select(e)},sr.prototype.select=function(e,t,n=[]){var i=Kr(fa(e,t));this._select([...n,...i])},sr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},sr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function pE(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 wN={__depends__:[Vl,Ds],__init__:["lassoTool"],lassoTool:["type",sr]};var eg=1500,fE="grab";function Ha(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var a=this,s=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",eg,function(c){if(Ts(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(eg,function(c){if(!(!dE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(eg,function(c){!dE(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!Ts(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ha.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ha.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:fE,data:{context:n||{}}})},Ha.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:fE,data:{context:{reactivate:n}}})},Ha.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ha.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function dE(e){return hn("Space",e)}const EN={__depends__:[Vl,Ds],__init__:["handTool"],handTool:["type",Ha]};var hE="connect-ok",gE="connect-not-ok";function za(e,t,n,i,o,r,a){var s=this;this._dragging=t,this._rules=r,this._mouse=a,o.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?hE:gE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?hE:gE)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}za.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],za.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},za.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},za.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},za.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const SN={__depends__:[Gh,Ji,vo,Vl,Ds],globalConnect:["type",za]};function tg(e,t,n,i,o,r,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=o,this._handTool=r,this._globalConnect=a,this._translate=s,e.registerProvider(this)}tg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],tg.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function y(_){var x=n.createShape(V({type:p},h));t.start(_,x)}return{group:f,className:d,title:g,action:{dragstart:y,click:y}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return V(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const RN={__depends__:[xN,zl,Dx,wN,EN,SN,Es],__init__:["paletteProvider"],paletteProvider:["type",tg]};var CN=250;function ng(e,t,n,i,o){pe.call(this,e);function r(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);V(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=wt('[data-element-id="'+Dr(f.id)+'"]',s.dragGroup);g&&we(g,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=wt('[data-element-id="'+Dr(u)+'"]',s.dragGroup);p&&we(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",CN,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}ng.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ce(ng,pe);const MN={__depends__:[Pa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",ng]};var AN=1250,ig=40,PN=20,TN=10,mE=20,yE=["x","y"],kN=Math.abs;function vE(e){e.on(["connect.hover","connect.move","connect.end"],AN,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&ni(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&ON(t,r,BN(r)),r&&IN(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ai(o),tt(r,["bpmn:Event","bpmn:Gateway"])&&bE(t,Ai(r)),tt(r,["bpmn:Task","bpmn:SubProcess"])&&DN(t,r),M(a,"bpmn:BoundaryEvent")&&s===a.host&&LN(t)):xE(i,"bpmn:MessageFlow")?(M(o,"bpmn:Event")&&(n.connectionStart=Ai(o)),M(r,"bpmn:Event")&&bE(t,Ai(r))):n.connectionStart=n.initialConnectionStart)})}vE.$inject=["eventBus"];function ON(e,t,n){yE.forEach(function(i){var o=_E(i,t);e[i]<t[i]+n?ln(e,i,t[i]+n):e[i]>t[i]+o-n&&ln(e,i,t[i]+o-n)})}function DN(e,t){var n=Ai(t);yE.forEach(function(i){NN(e,t,i)&&ln(e,i,n[i])})}function LN(e){var t=e.context,n=t.source,i=t.target;if(!$N(t)){var o=Ai(n),r=kn(o,i,-10),a=[];/top|bottom/.test(r)&&a.push("x"),/left|right/.test(r)&&a.push("y"),a.forEach(function(s){var c=e[s],l;kN(c-o[s])<ig&&(c>o[s]?l=o[s]+ig:l=o[s]-ig,ln(e,s,l))})}}function bE(e,t){ln(e,"x",t.x),ln(e,"y",t.y)}function xE(e,t){return e&&e.type===t}function IN(e,t){return Po(t,function(n){return xE(e,n)})}function _E(e,t){return e==="x"?t.width:t.height}function BN(e){return M(e,"bpmn:Task")?TN:PN}function NN(e,t,n){return e[n]>t[n]+mE&&e[n]<t[n]+_E(n,t)-mE}function $N(e){var t=e.hover,n=e.source;return t&&n&&t===n}function cr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}cr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},cr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},cr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},cr.prototype.getSnapLocations=function(){return this._snapLocations},cr.prototype.setSnapLocations=function(e){this._snapLocations=e},cr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Qu,n.initDefaults(this._defaultSnaps)),n};function Qu(){this._snapValues={}}Qu.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)},Qu.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&CI(e[n],o[n],i)},Qu.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(o){t.add(i,o)})})};var FN=1250;function io(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(o){i.initSnap(o)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],FN,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ni(o.originalEvent))&&!(ja(o)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(o,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}io.$inject=["elementRegistry","eventBus","snapping"],io.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new cr);var r;t.get(i.id)?r=Ai(i,e):r={x:e.x+Ai(i).x,y:e.y+Ai(i).y};var a={x:r.x-i.width/2,y:r.y-i.height/2},s={x:r.x+i.width/2,y:r.y+i.height/2};return o.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),Je(i)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},io.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(o){if(Je(o)){Je(t)&&e.add("mid",Ai(o));return}if(Pt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);z(r,function(a){e.add("mid",a)});return}e.add("mid",Ai(o))}),!Fe(t.x)||!Fe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ai(t)),e},io.prototype.getSnapTargets=function(e,t){return s0(t).filter(function(n){return!jN(n)})};function jN(e){return!!e.hidden}var wE=1500;function Ga(e,t){t.invoke(io,this),e.on(["create.move","create.end"],wE,VN),e.on(["create.move","create.end","shape.move.move","shape.move.end"],wE,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!ja(n)&&HN(n,r)})}Ce(Ga,io),Ga.$inject=["eventBus","injector"],Ga.prototype.initSnap=function(e){var t=io.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",SE(r,i,e))}),z(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",SE(r,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ga.prototype.addSnapTargetPoints=function(e,t,n){io.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(r){(GN(r)||zN([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",r0(r)),e.add("bottom-right",a0(r)))});var o=this._elementRegistry;return z(t.incoming,function(r){if(o.get(t.id)){EE(i,r.source)||e.add("mid",je(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),z(t.outgoing,function(r){if(o.get(t.id)){EE(i,r.target)||e.add("mid",je(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ga.prototype.getSnapTargets=function(e,t){return io.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function HN(e,t){var n=Be(t),i=Pb(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=je(r),/top/.test(i)?ln(e,"y",n.top-a.y):/bottom/.test(i)&&ln(e,"y",n.bottom-a.y),/left/.test(i)?ln(e,"x",n.left-a.x):/right/.test(i)&&ln(e,"x",n.right-a.x)}function zN(e,t){return e.every(function(n){return M(n,t)})}function GN(e){return M(e,"bpmn:SubProcess")&&st(e)?!0:M(e,"bpmn:Participant")}function VN(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,o=n.right,r=n.bottom,a=n.left;(a&&a>=e.x||o&&o<=e.x)&&ln(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&ln(e,"y",e.y)}}function EE(e,t){return e.indexOf(t)!==-1}function SE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var WN=1250;function uc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],WN,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&ni(i.originalEvent))&&!ja(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),YN(s)&&ln(i,"x",i.x),KN(s)&&ln(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}uc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new cr);var r=RE(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},uc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return z(o,function(r){e.add("corner",a0(r)),e.add("corner",r0(r))}),e.add("corner",RE(t,i)),e},uc.$inject=["eventBus","snapping"],uc.prototype.getSnapTargets=function(e,t){return s0(t).filter(function(n){return!UN(n,e)&&!Pt(n)&&!qN(n)&&!Je(n)})};function RE(e,t){var n=je(e),i=Be(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function UN(e,t){return e.host===t}function qN(e){return!!e.hidden}function YN(e){return e==="n"||e==="s"}function KN(e){return e==="e"||e==="w"}var XN=7,ZN=1e3;function lr(e){this._canvas=e,this._asyncHide=yp(qn(this.hide,this),ZN)}lr.$inject=["canvas"],lr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:ja(e,"x"),y:ja(e,"y")};z(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,XN),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),z(["x","y"],function(a){var s=r[a];fn(s)&&ln(e,a,s.originValue)})},lr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return we(n,{d:"M0,0 L0,0"}),at(n).add("djs-snap-line"),ze(t,n),{update:function(i){Fe(i)?e==="horizontal"?we(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):we(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):we(n,{display:"none"})}}},lr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},lr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},lr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},lr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const QN={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",io],resizeSnapping:["type",uc],snapping:["type",lr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",vE],createMoveSnapping:["type",Ga]};var CE=300;function Ue(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=wt(Ue.INPUT_SELECTOR,this._container),this._resultsContainer=wt(Ue.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ue.$inject=["canvas","eventBus","selection","translate"],Ue.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:Jn.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ue.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ue.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ue.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ue.INPUT_SELECTOR,"keydown",function(n){hn("ArrowUp",n)&&n.preventDefault(),hn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ue.INPUT_SELECTOR,"keyup",function(n){if(hn("Escape",n))return e.close();if(hn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(hn("ArrowUp",n))return e._scrollToDirection(!0);if(hn("ArrowDown",n))return e._scrollToDirection();hn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ue.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Jn.unbind(e.el,e.type,e.listener)})},Ue.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(o){return!t._canvas.getRootElements().includes(o.element)}),!n.length){this._selection.select(null);return}n.forEach(function(o){var r=o.element.id,a=t._createResultNode(o,r);t._results[r]={element:o.element,node:a}});var i=wt(Ue.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ue.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ue.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)}},Ue.prototype._clearResults=function(){Xc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ue.prototype._getCurrentResult=function(){return wt(Ue.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ue.prototype._createResultNode=function(e,t){var n=Nt(Ue.RESULT_HTML);return e.primaryTokens.length>0&&ME(n,e.primaryTokens,Ue.RESULT_PRIMARY_HTML),ME(n,e.secondaryTokens,Ue.RESULT_SECONDARY_HTML),En(n,Ue.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ue.prototype.registerProvider=function(e){this._searchProvider=e},Ue.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,Rt(this._canvas.getContainer()).add("djs-search-open"),Rt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ue.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,Rt(this._canvas.getContainer()).remove("djs-search-open"),Rt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ue.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ue.prototype.isOpen=function(){return this._open},Ue.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Rt(t).remove(Ue.RESULT_SELECTED_CLASS);var n=En(e,Ue.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Rt(e).add(Ue.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:CE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ue.prototype._select=function(e){var t=En(e,Ue.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:CE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ue.prototype._getBoxHtml=function(){const e=Nt(Ue.BOX_HTML),t=wt(Ue.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function ME(e,t,n){var i=JN(t),o=Nt(n);o.innerHTML=i,e.appendChild(o)}function JN(e){var t="";return e.forEach(function(n){var i=I_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+Ue.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ue.CONTAINER_SELECTOR=".djs-search-container",Ue.INPUT_SELECTOR=".djs-search-input input",Ue.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ue.RESULT_SELECTOR=".djs-search-result",Ue.RESULT_SELECTED_CLASS="djs-search-result-selected",Ue.RESULT_SELECTED_SELECTOR="."+Ue.RESULT_SELECTED_CLASS,Ue.RESULT_ID_ATTRIBUTE="data-result-id",Ue.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ue.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>`,We.RESULT_HTML='<div class="djs-search-result"></div>',We.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',We.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const NN={__depends__:[bs,pu,Ri],searchPad:["type",We]};function Qh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Qh.$inject=["elementRegistry","searchPad","canvas","search"],Qh.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:yi(i),id:i.id})),e,{keys:["label","id"]}).map($N)};function $N(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const FN={__depends__:[NN,kw],__init__:["bpmnSearch"],bpmnSearch:["type",Qh]},jN="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",HN="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",zN={width:36,height:50},GN={width:50,height:50};function xE(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ki=5;function Xu(e,t){this._styles=t,e.registerProvider(this)}Xu.$inject=["outline","styles"],Xu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(iP(e))return n=Oe("rect"),we(n,V({x:-ki,y:-ki,rx:4,width:e.width+ki*2,height:e.height+ki*2},t)),n;if(!Je(e))return M(e,"bpmn:Gateway")?(n=Oe("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),we(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):tt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),we(n,V({x:-ki,y:-ki,rx:14,width:e.width+ki*2,height:e.height+ki*2},t))):M(e,"bpmn:EndEvent")?(n=Oe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki+1},t))):M(e,"bpmn:Event")?(n=Oe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki},t))):M(e,"bpmn:DataObjectReference")&&_E(e,"bpmn:DataObjectReference")?n=xE(jN,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&_E(e,"bpmn:DataStoreReference")&&(n=xE(HN,{x:-6,y:-6},t)),n},Xu.prototype.updateOutline=function(e,t){if(!Je(e))return tt(e,["bpmn:SubProcess","bpmn:Group"])?(we(t,{width:e.width+ki*2,height:e.height+ki*2}),!0):!!tt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function _E(e,t){var n;return t==="bpmn:DataObjectReference"?n=zN:t==="bpmn:DataStoreReference"&&(n=GN),e.width===n.width&&e.height===n.height}const VN={__depends__:[zh],__init__:["outlineProvider"],outlineProvider:["type",Xu]};var WN='<?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 rr(e){da.call(this,e)}Ce(rr,da),rr.Viewer=eo,rr.NavigatedViewer=Ws,rr.prototype.createDiagram=function(){return this.importXML(WN)},rr.prototype._interactionModules=[L_,B_,F_],rr.prototype._modelingModules=[qL,su,QL,XL,pI,Nh,yI,zI,hx,Fl,UI,KI,pB,dB,hB,bB,kB,BB,rh,GB,ZB,cN,uN,I0,IN,FN,VN],rr.prototype._modules=[].concat(eo.prototype._modules,rr.prototype._interactionModules,rr.prototype._modelingModules);var Zu=50,UN=new Mo,wE={min:.2,max:4},qN=10,YN=.1,KN=250,XN=100,ZN=2e3;function In(e,t,n,i,r){var o=this;this._canvas=i,this._elementRegistry=r,this._eventBus=n,this._injector=t,this._config=e||{},this._updateTimeout=null,this._firstDebounceTime=null,this._dirty=!1,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=UN.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!o._state._svgClientRect||Ju(o._state._svgClientRect))&&(o._state._svgClientRect=o._svg.getBoundingClientRect());var p=Qu({x:u.x-o._state._svgClientRect.left,y:u.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Jh(p,o._canvas),o._update()}function s(u){return function(f){var d=em(f);(!o._state._svgClientRect||Ju(o._state._svgClientRect))&&(o._state._svgClientRect=o._svg.getBoundingClientRect()),u&&a(d);var g=Qu({x:d.x-o._state._svgClientRect.left,y:d.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),h=i.viewbox(),y=JN(g,h),_=o._viewportDom.getBoundingClientRect(),x={x:d.x-_.left+1,y:d.y-_.top+1};V(o._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:y,offsetViewportDom:x,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),Le.bind(document,"mousemove",c),Le.bind(document,"mouseup",l)}}function c(u){var p=em(u);if(o._state.isDragging){(!o._state._svgClientRect||Ju(o._state._svgClientRect))&&(o._state._svgClientRect=o._svg.getBoundingClientRect());var f=o._state.offsetViewportDom,d=o._state.viewportClientRect,g=o._state.parentClientRect;V(o._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=SE(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});V(o._overlay.style,{clipPath:h});var y=Qu({x:p.x-o._state._svgClientRect.left,y:p.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Jh({x:y.x-o._state.offsetViewport.x,y:y.y-o._state.offsetViewport.y},o._canvas)}}function l(u){var p=em(u);o._state.isDragging&&(o._state.initialDragPosition.x===p.x&&o._state.initialDragPosition.y===p.y&&a(u),o._update(),V(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Le.unbind(document,"mousemove",c),Le.unbind(document,"mouseup",l))}Le.bind(this._viewportDom,"mousedown",s(!1)),Le.bind(this._svg,"mousedown",s(!0)),Le.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!o._state._svgClientRect||Ju(o._state._svgClientRect))&&(o._state._svgClientRect=o._svg.getBoundingClientRect()),!!r$(u,o._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*o$(u.deltaY)*-p;if(o._state.zoomDelta+=f,Math.abs(o._state.zoomDelta)>YN){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=a$(wE,qN*2),y=Math.round(g/h)*h;y+=h*d;var _=Math.pow(10,y);i.zoom(s$(wE,_),x),o._state.zoomDelta=0;var x=Qu({x:u.clientX-o._state._svgClientRect.left,y:u.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Jh(x,o._canvas),o._update()}}}),Le.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),o.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!o.isOpen()){o._dirty=!0;return}o._addElement(u.element),o._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!o.isOpen()){o._dirty=!0;return}o._removeElement(u.element),o._scheduleUpdate()}),n.on("elements.changed",KN,function(u){if(!o.isOpen()){o._dirty=!0;return}u.elements.forEach(function(p){o._updateElement(p)}),o._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,f=u.newId;o._updateElementId(p,f)}),n.on("canvas.viewbox.changed",function(){o._state.isDragging||o._update()}),n.on("canvas.resized",function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!o.isOpen()){o._dirty=!0;return}o._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(f){o._addElement(f)}),o._update()}),n.on("diagram.destroy",function(){o._updateTimeout&&(clearTimeout(o._updateTimeout),o._updateTimeout=null)})}In.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],In.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");St(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");St(i).add("toggle"),n.appendChild(i);var r=this._map=document.createElement("div");St(r).add("map"),n.appendChild(r);var o=this._svg=Oe("svg");we(o,{width:"100%",height:"100%"}),ze(r,o);var a=this._elementsGroup=Oe("g");ze(o,a);var s=this._viewportGroup=Oe("g");ze(o,s);var c=this._viewport=Oe("rect");at(c).add("viewport"),ze(s,c),Le.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");St(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");St(u).add("overlay"),this._parent.appendChild(u)},In.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Fe(this._config.debounceDelay)?this._config.debounceDelay:XN,n=Fe(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:ZN,i=Date.now();if(this._firstDebounceTime&&i-this._firstDebounceTime>=n){this._update();return}this._updateTimeout&&clearTimeout(this._updateTimeout),this._firstDebounceTime=this._firstDebounceTime||i,this._updateTimeout=setTimeout(function(){e._update()},t)}},In.prototype._rebuild=function(){this._clear();var e=this._canvas,t=e.getRootElement&&e.getRootElement();if(t&&t.children){var n=this;t.children.forEach(function(i){n._addElement(i)})}},In.prototype._update=function(){if(this.isOpen()){this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=null),this._firstDebounceTime=null;var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(RE(e)){var i,r,o,a,s=n.width-t.width,c=n.height-t.height;t.width<n.width?(i=t.x-s/2,o=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,o=t.width),t.height<n.height?(r=t.y-c/2,a=n.height,t.y+t.height<n.height&&(r=Math.min(0,t.y))):(r=t.y,a=t.height),i=i-Zu,r=r-Zu,o=o+Zu*2,a=a+Zu*2,this._lastViewbox={x:i,y:r,width:o,height:a},we(this._svg,{viewBox:i+", "+r+", "+o+", "+a}),we(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};V(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=SE(l,p);V(this._overlay.style,{clipPath:f})}}},In.prototype.open=function(){V(this._state,{isOpen:!0}),St(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},In.prototype.close=function(){V(this._state,{isOpen:!1}),St(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},In.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},In.prototype.isOpen=function(){return this._state.isOpen},In.prototype._updateElement=function(e){try{e.parent!==void 0&&e.parent!==null&&(this._removeElement(e),this._addElement(e))}catch(t){console.warn("Minimap#_updateElement errored",t)}},In.prototype._updateElementId=function(e,t){try{var n=_t("#"+ko(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},In.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},In.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)&&!e.hidden){var n,i,r,o=this._createElement(e),a=_t("#"+ko(this._prefixId(e.parent.id)),this._elementsGroup);if(o){var s=t$(e);return s!==-1?a?n$(o,a,s):this._elementsGroup.appendChild(o):this._elementsGroup.appendChild(o),QN(e)?(n=e.parent,i=0,r=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,r=-n.y),we(o,{transform:"translate("+i+" "+r+")"})):(i=e.x,r=e.y,a&&(n=e.parent,i-=n.x,r-=n.y),we(o,{transform:"translate("+i+" "+r+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),o}}},In.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&rn(t)},In.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Fr(t),n)){var i=c$(sf(n));return we(i,{id:this._prefixId(e.id)}),i}},In.prototype._clear=function(){as(this._elementsGroup)},In.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function QN(e){return e.waypoints}function JN(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}function Qu(e,t,n){var i=t.getBoundingClientRect(),r=e$(n,i.width/i.height),o=EE(e.x,0,i.width,r.x,r.x+r.width),a=EE(e.y,0,i.height,r.y,r.y+r.height);return{x:o,y:a}}function Jh(e,t){var n=t.viewbox(),i=n.width,r=n.height;t.viewbox({x:e.x-i/2,y:e.y-r/2,width:i,height:r})}function e$(e,t){var n=e.width/e.height,i=V({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var r=i.width*(1/t),o=i.y-(r-i.height)/2;V(i,{y:o,height:r})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;V(i,{x:s,width:a})}return i}function EE(e,t,n,i,r){var o=n-t,a=r-i;return(e-t)*a/o+i}function t$(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function n$(e,t,n){var i=i$(t),r=i[n];r?t.insertBefore(e,r):t.appendChild(e)}function i$(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function Ju(e){return e.width===0&&e.height===0}function r$(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var o$=Math.sign||function(e){return e>=0?1:-1};function a$(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10),r=Math.abs(n)+Math.abs(i);return r/t}function s$(e,t){return Math.max(e.min,Math.min(e.max,t))}function SE(e,t){var n=[or(t.left,t.top),or(t.left+t.width,t.top),or(t.left+t.width,t.top+t.height),or(t.left,t.top+t.height),or(t.left,e.height),or(e.width,e.height),or(e.width,0),or(0,0),or(0,e.height),or(t.left,e.height)].join(", ");return"polygon("+n+")"}function or(e,t){return e+"px "+t+"px"}function RE(e){return Mr(e,function(t){return fn(t)?RE(t):Fe(t)&&isFinite(t)})}function em(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function c$(e){return os("[id]",e).forEach(function(t){t.remove()}),e}var l$={__init__:["minimap"],minimap:["type",In]};const CE={closed:"미니맵",open:"접기"};class ME{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(ph,()=>this.rebuild()),t.on("minimap.toggle",r=>this.retitle(r.open)),this.retitle(n.isOpen())}rebuild(){const t=this.minimap;if(!t.isOpen()){t._dirty=!0;return}t._rebuild(),t._update()}retitle(t){const n=this.canvas.getContainer().querySelector(".djs-minimap .toggle");n==null||n.setAttribute("title",t?CE.open:CE.closed)}}ui(ME,"$inject",["eventBus","minimap","canvas"]);const u$={__depends__:[l$],__init__:["minimapI18n"],minimapI18n:["type",ME]},p$=ge.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=ge.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Ip(u);return r("imported",p),{warnings:p}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return ge.onMounted(async()=>{a=new rr({container:o.value,moddleExtensions:Cc,additionalModules:[S_,u$]}),i.xml&&await s(i.xml),r("ready")}),ge.watch(()=>i.xml,l=>{l&&a&&s(l)}),ge.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ge.openBlock(),ge.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),tm=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},f$=tm(p$,[["__scopeId","data-v-7847e007"]]),d$=["title","aria-expanded"],h$=["title","onClick"],m$={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},g$={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},y$={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},v$={key:0,class:"bwl-validation__body"},b$={key:0,class:"bwl-validation__empty"},x$={key:1,class:"bwl-validation__empty"},_$={key:2,class:"bwl-validation__list"},w$=["onClick"],E$={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},S$={class:"bwl-validation__msg"},R$=["title"],C$=tm(ge.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ge.computed(()=>v_(n.issues.value,n.describeElement)),r=ge.computed(()=>b_(i.value)),o=g=>Ta(g,n.changeScope.value),a=ge.computed(()=>uh(i.value,n.changeScope.value)),s=ge.ref({error:!0,warning:!0,info:!0}),c=ge.computed(()=>x_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=ge.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(ge.openBlock(),ge.createElementBlock("section",{class:ge.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ge.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[ge.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ge.openBlock(),ge.createElementBlock("svg",{class:ge.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ge.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ge.createElementVNode("span",null,"검증",-1))],8,d$),ge.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ge.withModifiers(()=>{},["stop"]))},[(ge.openBlock(),ge.createElementBlock(ge.Fragment,null,ge.renderList(u,y=>ge.createElementVNode("button",{key:y,type:"button",class:ge.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>f(y)},[(ge.openBlock(),ge.createElementBlock("svg",m$,[h[4]||(h[4]=ge.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(ge.openBlock(),ge.createElementBlock("path",g$)):(ge.openBlock(),ge.createElementBlock("path",y$))])),ge.createElementVNode("span",null,ge.toDisplayString(r.value[y]),1)],10,h$)),64))])]),l.value?(ge.openBlock(),ge.createElementBlock("div",v$,[i.value.length===0?(ge.openBlock(),ge.createElementBlock("p",b$,"발견된 문제가 없습니다.")):c.value.length===0?(ge.openBlock(),ge.createElementBlock("p",x$," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ge.openBlock(),ge.createElementBlock("ul",_$,[(ge.openBlock(!0),ge.createElementBlock(ge.Fragment,null,ge.renderList(c.value,y=>(ge.openBlock(),ge.createElementBlock("li",{key:y.key,class:ge.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:_=>d(y)},[h[5]||(h[5]=ge.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(ge.openBlock(),ge.createElementBlock("span",E$,"이번 변경")):ge.createCommentVNode("",!0),ge.createElementVNode("span",S$,ge.toDisplayString(y.message),1),ge.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},ge.toDisplayString(y.category),9,R$)],10,w$))),128))]))])):ge.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),M$={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},A$=["aria-checked","title","data-locale","onClick"],P$={class:"bwl-locale__label"},T$={key:0,class:"bwl-locale__badge"},k$=tm(ge.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(o){try{return new Intl.DisplayNames([o],{type:"language"}).of(o)??o}catch{return o}}const r=ge.computed(()=>{const o=n.i18n.value;return o?o.locales.map(a=>{const s=o.counts[a]??{untranslated:0,reviewRequested:0},c=a===o.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===o.displayLocale,design:a===o.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(o,a)=>r.value.length?(ge.openBlock(),ge.createElementBlock("div",M$,[(ge.openBlock(!0),ge.createElementBlock(ge.Fragment,null,ge.renderList(r.value,s=>(ge.openBlock(),ge.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:ge.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>ge.unref(n).setDisplayLocale(s.locale)},[ge.createElementVNode("span",P$,ge.toDisplayString(s.label),1),s.pending>0?(ge.openBlock(),ge.createElementBlock("span",T$,ge.toDisplayString(s.pending),1)):ge.createCommentVNode("",!0)],10,A$))),128))])):ge.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);Q.ADDABLE_FLOW_NODE_TYPES=dc,Q.APPLY_BPMN_OPS_SCHEMA=Q1,Q.BPMN_EVENT_DEFINITION_TYPES=mc,Q.BPMN_MODDLE_EXTENSIONS=Cc,Q.BWL_MODDLE_SCHEMA=mm,Q.BWL_NS=hm,Q.BWL_PREFIX=lp,Q.BWL_REVIEW_REQUEST_TYPE=yc,Q.BWL_SIDES=up,Q.BpmnDisplayLocaleSwitcher=k$,Q.BpmnModelerView=f$,Q.BpmnValidationPanel=C$,Q.EDITOR=ZC,Q.FLOW_LABEL_INDENT=Km,Q.GROUP_BORDER_MIN_RUN=Bp,Q.GROUP_BORDER_NEAR=ia,Q.HEADLESS_BPMN_MODULES=h_,Q.HEADLESS_TEXT_METRICS=ta,Q.I18N_DISPLAY_REDRAWN_EVENT=ph,Q.I18N_NS=L1,Q.I18N_PREFIX=xm,Q.I18N_REVIEW_REQUESTED_CLASS=w_,Q.I18N_TRANSLATION_TYPE=Xo,Q.I18N_UNTRANSLATED_CLASS=__,Q.I18nDisplay=fh,Q.I18nDisplayModule=S_,Q.IR_EVENT_DEFINITIONS=hc,Q.IR_FLOW_NODE_TYPES=po,Q.IR_TEXT_LOCALES=gc,Q.LABEL_FORK_MARGIN=Fp,Q.LABEL_SHAPE_MIN_DEPTH=sg,Q.SET_TRANSLATIONS_COMMAND=vp,Q.SEVERITY_ORDER=lh,Q.SYMBOLIC_OP_KINDS=_m,Q.SYMBOLIC_OP_SCHEMA=wm,Q.SetTranslationsHandler=bp,Q.TranslationCommands=_p,Q.TranslationCommandsModule=wp,Q.UNDO_EPISODE_COMMAND=pp,Q.UPDATE_TRANSLATION_COMMAND=xc,Q.UpdateTranslationHandler=yp,Q.applyBpmnOpBatch=ry,Q.applyBpmnOps=Xg,Q.applyLocaleBackfill=iM,Q.approximateTextWidth=na,Q.auditBpmnGeometry=ug,Q.auditBpmnGeometryXml=YR,Q.auditBpmnSemantics=ef,Q.auditBpmnSemanticsXml=FC,Q.auditGeometry=ht,Q.auditTargetsOf=hi,Q.axisSegmentsOf=vn,Q.blackBoxNameRect=Np,Q.buildBpmnOpBatch=qC,Q.buildRegistryIndex=fg,Q.containerBoundarySegments=aa,Q.countBySeverity=b_,Q.createBpmnEditorController=QC,Q.createBpmnModdle=Hm,Q.createHeadlessBpmnModeler=ED,Q.crossedShapesOf=bn,Q.crossingCost=di,Q.describeProcess=ey,Q.describeProcessXml=DC,Q.diffBpmnElements=iy,Q.diffBpmnElementsXml=WC,Q.documentLocalesOf=Ka,Q.edgeCrossCount=ts,Q.edgeCrossingPairsOf=Oc,Q.edgeCrossingStatsOf=ng,Q.executeAsUndoEpisode=ym,Q.followMovedEdgeLabels=Dg,Q.forwardThreePointCandidates=Lc,Q.geometryFindingKey=pt,Q.inferScriptLocale=nf,Q.installHeadlessBpmnDom=Gm,Q.irEventDefinitionOf=cp,Q.isAddableFlowNodeType=fm,Q.isChangeScopeMixed=uh,Q.isEdgeOverlapFinding=$p,Q.isInChangeScope=Ta,Q.isIrEventDefinition=dm,Q.isIrFlowNodeType=pm,Q.isIrTextLocale=S1,Q.labelRectsOf=vo,Q.labelShapeDepth=cg,Q.labelSlot=ho,Q.lineCrossesLabel=Vi,Q.lineThroughLabel=Zm,Q.lineThroughShapeLabel=ag,Q.loadBpmnXml=ea,Q.localeTextsOf=gp,Q.lowerOps=Yg,Q.oppositeOverlapCount=LR,Q.oppositeOverlapOf=Ym,Q.planBackEdgeBoundaryClearance=_g,Q.planCrossPoolRoute=vg,Q.planEdgeRepair=Gp,Q.planLabelLineClearance=Yp,Q.planLabelPlacement=Tg,Q.planLocaleBackfill=nM,Q.planMiddleSegmentShifts=hg,Q.planOppositeOverlapRepair=Eg,Q.planSegmentDetours=Dc,Q.planShapeLabelClearance=Bg,Q.redockIntroducedDetachedEndpoints=$g,Q.repairIntroducedBoundaryHugging=wg,Q.repairIntroducedCrossings=Vp,Q.repairIntroducedEdgeCrossings=gg,Q.repairIntroducedFakeMerges=Rg,Q.repairIntroducedLabelLines=Lg,Q.repairIntroducedOppositeOverlaps=Pg,Q.repairIntroducedShapeLabelLines=Ng,Q.repairIntroducedSharedSegmentLabels=Ig,Q.rerouteIntroducedCrossPoolEdges=bg,Q.resolverServicesOf=Gg,Q.reviewRequestValuesOf=xp,Q.reviewRequestsOf=Pr,Q.rootLangOf=mp,Q.saveBpmnXml=wR,Q.sceneCrossingCost=tg,Q.sceneFromDefinitions=lg,Q.sceneFromRegistry=Ue,Q.segmentShapeClearance=es,Q.shapesUnderLabel=ns,Q.sharedSegmentUnderLabel=kc,Q.sharedSpansOf=Tc,Q.sortPanelIssues=x_,Q.toPanelIssues=v_,Q.touchedElements=UC,Q.translationLocale=Nn,Q.translationsOf=Zo,Q.unreadableOverlapCount=fi,Q.unreadableOverlapOf=ra,Q.validateOps=zg,Q.warningMessages=Ip,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Ue.RESULT_HTML='<div class="djs-search-result"></div>',Ue.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ue.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const e$={__depends__:[Es,hu,Ri],searchPad:["type",Ue]};function og(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}og.$inject=["elementRegistry","searchPad","canvas","search"],og.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:yi(i),id:i.id})),e,{keys:["label","id"]}).map(t$)};function t$(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const n$={__depends__:[e$,Fw],__init__:["bpmnSearch"],bpmnSearch:["type",og]},i$="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",o$="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",r$={width:36,height:50},a$={width:50,height:50};function AE(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ki=5;function Ju(e,t){this._styles=t,e.registerProvider(this)}Ju.$inject=["outline","styles"],Ju.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(xP(e))return n=Oe("rect"),we(n,V({x:-ki,y:-ki,rx:4,width:e.width+ki*2,height:e.height+ki*2},t)),n;if(!Je(e))return M(e,"bpmn:Gateway")?(n=Oe("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),we(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):tt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),we(n,V({x:-ki,y:-ki,rx:14,width:e.width+ki*2,height:e.height+ki*2},t))):M(e,"bpmn:EndEvent")?(n=Oe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki+1},t))):M(e,"bpmn:Event")?(n=Oe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki},t))):M(e,"bpmn:DataObjectReference")&&PE(e,"bpmn:DataObjectReference")?n=AE(i$,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&PE(e,"bpmn:DataStoreReference")&&(n=AE(o$,{x:-6,y:-6},t)),n},Ju.prototype.updateOutline=function(e,t){if(!Je(e))return tt(e,["bpmn:SubProcess","bpmn:Group"])?(we(t,{width:e.width+ki*2,height:e.height+ki*2}),!0):!!tt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function PE(e,t){var n;return t==="bpmn:DataObjectReference"?n=r$:t==="bpmn:DataStoreReference"&&(n=a$),e.width===n.width&&e.height===n.height}const s$={__depends__:[Yh],__init__:["outlineProvider"],outlineProvider:["type",Ju]};var c$='<?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 oo(e){ga.call(this,e)}Ce(oo,ga),oo.Viewer=nr,oo.NavigatedViewer=Ks,oo.prototype.createDiagram=function(){return this.importXML(c$)},oo.prototype._interactionModules=[z_,V_,q_],oo.prototype._modelingModules=[uI,uu,gI,dI,AI,Gh,LI,rB,wx,zl,lB,fB,AB,TB,kB,BB,YB,JB,uh,aN,hN,RN,MN,G0,QN,n$,s$],oo.prototype._modules=[].concat(nr.prototype._modules,oo.prototype._interactionModules,oo.prototype._modelingModules);var ep=50,l$=new Pr,TE={min:.2,max:4},u$=10,p$=.1,f$=250,d$=100,h$=2e3;function In(e,t,n,i,o){var r=this;this._canvas=i,this._elementRegistry=o,this._eventBus=n,this._injector=t,this._config=e||{},this._updateTimeout=null,this._firstDebounceTime=null,this._dirty=!1,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=l$.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||np(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=tp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg(p,r._canvas),r._update()}function s(u){return function(f){var d=ag(f);(!r._state._svgClientRect||np(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=tp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),y=m$(g,h),_=r._viewportDom.getBoundingClientRect(),x={x:d.x-_.left+1,y:d.y-_.top+1};V(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:y,offsetViewportDom:x,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Le.bind(document,"mousemove",c),Le.bind(document,"mouseup",l)}}function c(u){var p=ag(u);if(r._state.isDragging){(!r._state._svgClientRect||np(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;V(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=OE(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});V(r._overlay.style,{clipPath:h});var y=tp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg({x:y.x-r._state.offsetViewport.x,y:y.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=ag(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),V(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Le.unbind(document,"mousemove",c),Le.unbind(document,"mouseup",l))}Le.bind(this._viewportDom,"mousedown",s(!1)),Le.bind(this._svg,"mousedown",s(!0)),Le.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||np(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!_$(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*w$(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>p$){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=E$(TE,u$*2),y=Math.round(g/h)*h;y+=h*d;var _=Math.pow(10,y);i.zoom(S$(TE,_),x),r._state.zoomDelta=0;var x=tp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg(x,r._canvas),r._update()}}}),Le.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",f$,function(u){if(!r.isOpen()){r._dirty=!0;return}u.elements.forEach(function(p){r._updateElement(p)}),r._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,f=u.newId;r._updateElementId(p,f)}),n.on("canvas.viewbox.changed",function(){r._state.isDragging||r._update()}),n.on("canvas.resized",function(){document.body.contains(r._parent)&&(r._state.isDragging||r._update(),r._state._svgClientRect=r._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(f){r._addElement(f)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}In.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],In.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Rt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Rt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Rt(o).add("map"),n.appendChild(o);var r=this._svg=Oe("svg");we(r,{width:"100%",height:"100%"}),ze(o,r);var a=this._elementsGroup=Oe("g");ze(r,a);var s=this._viewportGroup=Oe("g");ze(r,s);var c=this._viewport=Oe("rect");at(c).add("viewport"),ze(s,c),Le.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Rt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Rt(u).add("overlay"),this._parent.appendChild(u)},In.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Fe(this._config.debounceDelay)?this._config.debounceDelay:d$,n=Fe(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:h$,i=Date.now();if(this._firstDebounceTime&&i-this._firstDebounceTime>=n){this._update();return}this._updateTimeout&&clearTimeout(this._updateTimeout),this._firstDebounceTime=this._firstDebounceTime||i,this._updateTimeout=setTimeout(function(){e._update()},t)}},In.prototype._rebuild=function(){this._clear();var e=this._canvas,t=e.getRootElement&&e.getRootElement();if(t&&t.children){var n=this;t.children.forEach(function(i){n._addElement(i)})}},In.prototype._update=function(){if(this.isOpen()){this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=null),this._firstDebounceTime=null;var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(DE(e)){var i,o,r,a,s=n.width-t.width,c=n.height-t.height;t.width<n.width?(i=t.x-s/2,r=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,r=t.width),t.height<n.height?(o=t.y-c/2,a=n.height,t.y+t.height<n.height&&(o=Math.min(0,t.y))):(o=t.y,a=t.height),i=i-ep,o=o-ep,r=r+ep*2,a=a+ep*2,this._lastViewbox={x:i,y:o,width:r,height:a},we(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),we(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};V(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=OE(l,p);V(this._overlay.style,{clipPath:f})}}},In.prototype.open=function(){V(this._state,{isOpen:!0}),Rt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},In.prototype.close=function(){V(this._state,{isOpen:!1}),Rt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},In.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},In.prototype.isOpen=function(){return this._state.isOpen},In.prototype._updateElement=function(e){try{e.parent!==void 0&&e.parent!==null&&(this._removeElement(e),this._addElement(e))}catch(t){console.warn("Minimap#_updateElement errored",t)}},In.prototype._updateElementId=function(e,t){try{var n=wt("#"+Dr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},In.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},In.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)&&!e.hidden){var n,i,o,r=this._createElement(e),a=wt("#"+Dr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=v$(e);return s!==-1?a?b$(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),g$(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),we(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),we(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},In.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&on(t)},In.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Ho(t),n)){var i=R$(df(n));return we(i,{id:this._prefixId(e.id)}),i}},In.prototype._clear=function(){us(this._elementsGroup)},In.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function g$(e){return e.waypoints}function m$(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}function tp(e,t,n){var i=t.getBoundingClientRect(),o=y$(n,i.width/i.height),r=kE(e.x,0,i.width,o.x,o.x+o.width),a=kE(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function rg(e,t){var n=t.viewbox(),i=n.width,o=n.height;t.viewbox({x:e.x-i/2,y:e.y-o/2,width:i,height:o})}function y$(e,t){var n=e.width/e.height,i=V({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;V(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;V(i,{x:s,width:a})}return i}function kE(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function v$(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function b$(e,t,n){var i=x$(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function x$(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function np(e){return e.width===0&&e.height===0}function _$(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var w$=Math.sign||function(e){return e>=0?1:-1};function E$(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10),o=Math.abs(n)+Math.abs(i);return o/t}function S$(e,t){return Math.max(e.min,Math.min(e.max,t))}function OE(e,t){var n=[ro(t.left,t.top),ro(t.left+t.width,t.top),ro(t.left+t.width,t.top+t.height),ro(t.left,t.top+t.height),ro(t.left,e.height),ro(e.width,e.height),ro(e.width,0),ro(0,0),ro(0,e.height),ro(t.left,e.height)].join(", ");return"polygon("+n+")"}function ro(e,t){return e+"px "+t+"px"}function DE(e){return Ao(e,function(t){return fn(t)?DE(t):Fe(t)&&isFinite(t)})}function ag(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function R$(e){return ls("[id]",e).forEach(function(t){t.remove()}),e}var C$={__init__:["minimap"],minimap:["type",In]};const LE={closed:"미니맵",open:"접기"};class IE{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(yh,()=>this.rebuild()),t.on("minimap.toggle",o=>this.retitle(o.open)),this.retitle(n.isOpen())}rebuild(){const t=this.minimap;if(!t.isOpen()){t._dirty=!0;return}t._rebuild(),t._update()}retitle(t){const n=this.canvas.getContainer().querySelector(".djs-minimap .toggle");n==null||n.setAttribute("title",t?LE.open:LE.closed)}}ui(IE,"$inject",["eventBus","minimap","canvas"]);const M$={__depends__:[C$],__init__:["minimapI18n"],minimapI18n:["type",IE]},A$=me.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=me.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=$p(u);return o("imported",p),{warnings:p}}catch(u){throw o("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return me.onMounted(async()=>{a=new oo({container:r.value,moddleExtensions:Tc,additionalModules:[O_,M$]}),i.xml&&await s(i.xml),o("ready")}),me.watch(()=>i.xml,l=>{l&&a&&s(l)}),me.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(me.openBlock(),me.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),sg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},P$=sg(A$,[["__scopeId","data-v-7847e007"]]),T$=["title","aria-expanded"],k$=["title","onClick"],O$={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},D$={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},L$={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},I$={key:0,class:"bwl-validation__body"},B$={key:0,class:"bwl-validation__empty"},N$={key:1,class:"bwl-validation__empty"},$$={key:2,class:"bwl-validation__list"},F$=["onClick"],j$={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},H$={class:"bwl-validation__msg"},z$=["title"],G$=sg(me.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=me.computed(()=>C_(n.issues.value,n.describeElement)),o=me.computed(()=>M_(i.value)),r=g=>Oa(g,n.changeScope.value),a=me.computed(()=>mh(i.value,n.changeScope.value)),s=me.ref({error:!0,warning:!0,info:!0}),c=me.computed(()=>A_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=me.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(me.openBlock(),me.createElementBlock("section",{class:me.normalizeClass(["bwl-validation",{"is-open":l.value}])},[me.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[me.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(me.openBlock(),me.createElementBlock("svg",{class:me.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[me.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=me.createElementVNode("span",null,"검증",-1))],8,T$),me.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=me.withModifiers(()=>{},["stop"]))},[(me.openBlock(),me.createElementBlock(me.Fragment,null,me.renderList(u,y=>me.createElementVNode("button",{key:y,type:"button",class:me.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>f(y)},[(me.openBlock(),me.createElementBlock("svg",O$,[h[4]||(h[4]=me.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(me.openBlock(),me.createElementBlock("path",D$)):(me.openBlock(),me.createElementBlock("path",L$))])),me.createElementVNode("span",null,me.toDisplayString(o.value[y]),1)],10,k$)),64))])]),l.value?(me.openBlock(),me.createElementBlock("div",I$,[i.value.length===0?(me.openBlock(),me.createElementBlock("p",B$,"발견된 문제가 없습니다.")):c.value.length===0?(me.openBlock(),me.createElementBlock("p",N$," 선택한 심각도에 해당하는 항목이 없습니다. ")):(me.openBlock(),me.createElementBlock("ul",$$,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(c.value,y=>(me.openBlock(),me.createElementBlock("li",{key:y.key,class:me.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:_=>d(y)},[h[5]||(h[5]=me.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(y)?(me.openBlock(),me.createElementBlock("span",j$,"이번 변경")):me.createCommentVNode("",!0),me.createElementVNode("span",H$,me.toDisplayString(y.message),1),me.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},me.toDisplayString(y.category),9,z$)],10,F$))),128))]))])):me.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),V$={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},W$=["aria-checked","title","data-locale","onClick"],U$={class:"bwl-locale__label"},q$={key:0,class:"bwl-locale__badge"},Y$=sg(me.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(r){try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??r}catch{return r}}const o=me.computed(()=>{const r=n.i18n.value;return r?r.locales.map(a=>{const s=r.counts[a]??{untranslated:0,reviewRequested:0},c=a===r.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===r.displayLocale,design:a===r.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(r,a)=>o.value.length?(me.openBlock(),me.createElementBlock("div",V$,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(o.value,s=>(me.openBlock(),me.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:me.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>me.unref(n).setDisplayLocale(s.locale)},[me.createElementVNode("span",U$,me.toDisplayString(s.label),1),s.pending>0?(me.openBlock(),me.createElementBlock("span",q$,me.toDisplayString(s.pending),1)):me.createCommentVNode("",!0)],10,W$))),128))])):me.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);J.ADDABLE_FLOW_NODE_TYPES=yc,J.APPLY_BPMN_OPS_SCHEMA=aS,J.BPMN_EVENT_DEFINITION_TYPES=bc,J.BPMN_MODDLE_EXTENSIONS=Tc,J.BWL_MODDLE_SCHEMA=_g,J.BWL_NS=xg,J.BWL_PREFIX=fp,J.BWL_REVIEW_REQUEST_TYPE=_c,J.BWL_SIDES=dp,J.BpmnDisplayLocaleSwitcher=Y$,J.BpmnModelerView=P$,J.BpmnValidationPanel=G$,J.EDITOR=hM,J.FLOW_LABEL_INDENT=tm,J.GROUP_BORDER_MIN_RUN=Fp,J.GROUP_BORDER_NEAR=ra,J.HEADLESS_BPMN_MODULES=w_,J.HEADLESS_TEXT_METRICS=ia,J.I18N_DISPLAY_REDRAWN_EVENT=yh,J.I18N_NS=z1,J.I18N_PREFIX=Cg,J.I18N_REVIEW_REQUESTED_CLASS=T_,J.I18N_TRANSLATION_TYPE=Qr,J.I18N_UNTRANSLATED_CLASS=P_,J.I18nDisplay=vh,J.I18nDisplayModule=O_,J.IR_EVENT_DEFINITIONS=vc,J.IR_FLOW_NODE_TYPES=dr,J.IR_TEXT_LOCALES=xc,J.LABEL_FORK_MARGIN=zp,J.LABEL_SHAPE_MIN_DEPTH=dm,J.SET_TRANSLATIONS_COMMAND=_p,J.SEVERITY_ORDER=gh,J.SYMBOLIC_OP_KINDS=Mg,J.SYMBOLIC_OP_SCHEMA=Ag,J.SetTranslationsHandler=wp,J.TranslationCommands=Sp,J.TranslationCommandsModule=Rp,J.UNDO_EPISODE_COMMAND=hp,J.UPDATE_TRANSLATION_COMMAND=Sc,J.UpdateTranslationHandler=xp,J.applyBpmnOpBatch=fy,J.applyBpmnOps=oy,J.applyLocaleBackfill=xM,J.approximateTextWidth=oa,J.auditBpmnGeometry=mm,J.auditBpmnGeometryXml=nC,J.auditBpmnSemantics=sf,J.auditBpmnSemanticsXml=nM,J.auditGeometry=ut,J.auditTargetsOf=hi,J.axisSegmentsOf=vn,J.blackBoxNameRect=jp,J.buildBpmnOpBatch=uM,J.buildRegistryIndex=vm,J.containerBoundarySegments=sa,J.countBySeverity=M_,J.createBpmnEditorController=gM,J.createBpmnModdle=qg,J.createHeadlessBpmnModeler=jD,J.crossedShapesOf=bn,J.crossingCost=di,J.describeProcess=cy,J.describeProcessXml=XC,J.diffBpmnElements=py,J.diffBpmnElementsXml=cM,J.documentLocalesOf=Za,J.edgeCrossCount=is,J.edgeCrossingPairsOf=ca,J.edgeCrossingStatsOf=cm,J.executeAsUndoEpisode=Eg,J.followMovedEdgeLabels=Hm,J.forwardThreePointCandidates=Nc,J.geometryFindingKey=ct,J.inferScriptLocale=lf,J.installHeadlessBpmnDom=Kg,J.irEventDefinitionOf=pp,J.isAddableFlowNodeType=vg,J.isChangeScopeMixed=mh,J.isEdgeOverlapFinding=Hp,J.isInChangeScope=Oa,J.isIrEventDefinition=bg,J.isIrFlowNodeType=yg,J.isIrTextLocale=O1,J.labelRectsOf=xr,J.labelShapeDepth=hm,J.labelSlot=gr,J.lineCrossesLabel=Vi,J.lineThroughLabel=im,J.lineThroughShapeLabel=fm,J.loadBpmnXml=na,J.localeTextsOf=bp,J.lowerOps=ny,J.oppositeOverlapCount=zR,J.oppositeOverlapOf=em,J.planBackEdgeBoundaryClearance=Pm,J.planCrossPoolRoute=Cm,J.planEdgeRepair=qp,J.planLabelLineClearance=ef,J.planLabelPlacement=$m,J.planLocaleBackfill=bM,J.planMiddleSegmentShifts=xm,J.planOppositeOverlapRepair=km,J.planSegmentDetours=Bc,J.planShapeLabelClearance=Vm,J.redockIntroducedDetachedEndpoints=Um,J.repairIntroducedBoundaryHugging=Tm,J.repairIntroducedCrossings=Yp,J.repairIntroducedEdgeCrossings=_m,J.repairIntroducedFakeMerges=Dm,J.repairIntroducedLabelLines=zm,J.repairIntroducedOppositeOverlaps=Nm,J.repairIntroducedShapeLabelLines=Wm,J.repairIntroducedSharedSegmentLabels=Gm,J.rerouteIntroducedCrossPoolEdges=Mm,J.resolverServicesOf=Zm,J.reviewRequestValuesOf=Ep,J.reviewRequestsOf=To,J.rootLangOf=vp,J.saveBpmnXml=TR,J.sceneCrossingCost=sm,J.sceneFromDefinitions=gm,J.sceneFromRegistry=We,J.segmentShapeClearance=ns,J.shapesUnderLabel=os,J.sharedEndpointCrossingPairsOf=Lo,J.sharedSegmentUnderLabel=Ic,J.sharedSpansOf=Lc,J.sortPanelIssues=A_,J.toPanelIssues=C_,J.touchedElements=lM,J.translationLocale=Nn,J.translationsOf=Jr,J.unreadableOverlapCount=fi,J.unreadableOverlapOf=br,J.validateOps=Xm,J.warningMessages=$p,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));