@g1cloud/bpmn-modeler-next 5.0.0-beta.77 → 5.0.0-beta.78

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,13 +1,13 @@
1
- (function(re,Ee){typeof exports=="object"&&typeof module<"u"?Ee(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ee):(re=typeof globalThis<"u"?globalThis:re||self,Ee(re.BpmnModeler={},re.Vue))})(this,(function(re,Ee){"use strict";var v6=Object.defineProperty;var x6=(re,Ee,Tr)=>Ee in re?v6(re,Ee,{enumerable:!0,configurable:!0,writable:!0,value:Tr}):re[Ee]=Tr;var an=(re,Ee,Tr)=>x6(re,typeof Ee!="symbol"?Ee+"":Ee,Tr);const Tr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Nc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function um(e){return Tr.includes(e)}function pm(e){return Nc.includes(e)}const $c=["timer"],Fc={timer:"bpmn:TimerEventDefinition"};function dm(e){return typeof e=="string"&&$c.includes(e)}function Np(e){if(e.length===1)return $c.find(t=>Fc[t]===e[0])}const jc=["ko","en","ja","zh"];function RR(e){return typeof e=="string"&&jc.includes(e)}const fm="http://g1project.net/spec/bpmn/bwl/1.0",$p="bwl",Fp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Hc="bwl:ReviewRequest",hm={name:"bwl-hints",uri:fm,prefix:$p,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"}]}]},jp="bwl.undoEpisode",gm=new WeakSet;function MR(e){gm.has(e)||(e.register(jp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),gm.add(e))}function mm(e,t){MR(e);const n={run:t};if(e.execute(jp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function ym(e){return e._stackIdx+1}function vm(e,t){const{_stack:n,_stackIdx:i}=e;if(i<t)return 0;const o=n[t].id;for(let r=t;r<=i;r++)n[r].id=o;return i-t+1}function Hp(e){return Array.prototype.concat.apply([],e)}const us=Object.prototype.toString,CR=Object.prototype.hasOwnProperty;function Pr(e){return e===void 0}function mn(e){return e!==void 0}function da(e){return e==null}function Ze(e){return us.call(e)==="[object Array]"}function yn(e){return us.call(e)==="[object Object]"}function Je(e){return us.call(e)==="[object Number]"}function wn(e){const t=us.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ii(e){return us.call(e)==="[object String]"}function AR(e){if(!Ze(e))throw new Error("must supply array")}function oi(e,t){return!da(e)&&CR.call(e,t)}function Ft(e,t){const n=Gc(t);let i;return W(e,function(o,r){if(n(o,r))return i=o,!1}),i}function xm(e,t){const n=Gc(t);let i=Ze(e)?-1:void 0;return W(e,function(o,r){if(n(o,r))return i=r,!1}),i}function dt(e,t){const n=Gc(t);let i=[];return W(e,function(o,r){n(o,r)&&i.push(o)}),i}function W(e,t){let n,i;if(Pr(e))return;const o=Ze(e)?DR:OR;for(let r in e)if(oi(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function TR(e,t){if(Pr(e))return[];AR(e);const n=Gc(t);return e.filter(function(i,o){return!n(i,o)})}function ri(e,t,n){return W(e,function(i,o){n=t(n,i,o)}),n}function Ho(e,t){return!!ri(e,function(n,i,o){return n&&t(i,o)},!0)}function zo(e,t){return!!Ft(e,t)}function Hn(e,t){let n=[];return W(e,function(i,o){n.push(t(i,o))}),n}function zc(e){return e&&Object.keys(e)||[]}function PR(e){return zc(e).length}function fa(e){return Hn(e,t=>t)}function ha(e,t,n={}){return t=zp(t),W(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function bm(e,...t){e=zp(e);let n={};return W(t,o=>ha(o,e,n)),Hn(n,function(o,r){return o[0]})}const kR=bm;function Xi(e,t){t=zp(t);let n=[];return W(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)}),Hn(n,i=>i.v)}function ga(e){return function(t){return Ho(e,function(n,i){return t[i]===n})}}function zp(e){return wn(e)?e:t=>t[e]}function Gc(e){return wn(e)?e:t=>t===e}function OR(e){return e}function DR(e){return Number(e)}function Gp(e,t){let n,i,o,r;function a(p){let d=Date.now(),f=p?0:r+t-d;if(f>0)return s(f);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 Zn(e,t){return e.bind(t)}function J(e,...t){return Object.assign(e,...t)}function LR(e,t,n){let i=e;return W(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];mn(a)&&da(s)&&(s=i[o]=isNaN(+a)?{}:[]),Pr(a)?Pr(n)?delete i[o]:i[o]=n:i=s}),e}function Fi(e,t){let n={},i=Object(e);return W(t,function(o){o in i&&(n[o]=e[o])}),n}function Zi(e,t){let n={},i=Object(e);return W(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function A(e,t){var n=we(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function pt(e,t){return zo(t,function(n){return A(e,n)})}function we(e){return e&&e.businessObject||e}function vt(e){return e&&e.di}const IR="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",wm="i18n",kr="i18n:Translation";function Or(e){if(e){if(A(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(A(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Go(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,kr)})}function Rn(e){return e.get("xml:lang")}function Vo(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,Hc)})}function ps(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 Wp(e,t,n){const i=Or(e);if(!i)return{};const o=i.target[i.key]??"",r=Go(e).filter(u=>Rn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Rn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of ps(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(d=>Rn(d)===u&&a(d));p&&(l[u]=a(p))}return l}const Vc="bwl.updateTranslation";class Up{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=Or(c),u=[];t.undo=u;const p=Go(c).filter(k=>Rn(k)),d=s??(l?l.target[l.key]??"":""),f=a??o,g=(k=>{if(!k)return[];const N=p.filter(G=>G.body===k).map(Rn);return N.length?N:[f]})(d),y=s!==void 0&&d&&!g.includes(t.locale)?g[0]:t.locale,_=k=>{var N;return((N=p.find(G=>Rn(G)===k&&G.body))==null?void 0:N.body)??(g.includes(k)?d:"")},h=k=>Vo(c).some(N=>N.locale===k),v=_(y);if(v===i)return[];const b=!!v&&!h(y),E=b?r.filter(k=>k!==y&&_(k)&&!h(k)):[],M=()=>{let k=c.extensionElements;return k||(k=this.moddle.create("bpmn:ExtensionElements",{values:[]}),k.$parent=c,c.extensionElements=k,u.push(()=>delete c.extensionElements)),k.get("values")},B=(k,N)=>{const G=M();let q=G.find(Y=>{var ae;return((ae=Y.$instanceOf)==null?void 0:ae.call(Y,kr))&&Rn(Y)===k});if(q){const Y=q.body;q.body=N,u.push(()=>q.body=Y)}else q=this.moddle.create(kr,{body:N}),q.set("xml:lang",k),q.$parent=c.extensionElements,G.push(q),u.push(()=>G.splice(G.indexOf(q),1))},P=k=>{const N=M(),G=N.indexOf(k);N.splice(G,1),u.push(()=>N.splice(G,0,k))};if(s===void 0){if(y===o&&l){if(d&&!p.some(N=>N.body===d)){const N=a&&a!==o?a:void 0;N&&B(N,d)}const k=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{k?l.target[l.key]=d:delete l.target[l.key]})}B(y,i)}else(p.some(k=>Rn(k)===y)||!d&&y!==f)&&B(y,i);if(!b)for(const k of Vo(c).filter(N=>N.locale===y))P(k);for(const k of E){const N=M(),G=this.moddle.create(Hc,{locale:k,sourceLocale:y,previous:v});G.$parent=c.extensionElements,N.push(G),u.push(()=>N.splice(N.indexOf(G),1))}for(const k of Vo(c).filter(N=>N.sourceLocale===y&&(N.previous??"")===i))P(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):[]}}an(Up,"$inject",["moddle"]);const qp="bwl.setTranslations",BR=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Yp{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,!Or(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")},d=_=>{const h=p(),v=h.indexOf(_);v<0||(h.splice(v,1),u.push(()=>h.splice(v,0,_)))},f=_=>Go(l).find(h=>Rn(h)===_);if(i===null)for(const _ of a){const h=f(_);h&&d(h)}else if(i)for(const _ of a){const h=i[_];if(h===void 0)continue;const v=f(_);if(v){if(v.body===h)continue;const M=v.body;v.body=h,u.push(()=>v.body=M);continue}if(_===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(kr,{body:h});E.set("xml:lang",_),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const g=[...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 Vo(l)){const h=g.findIndex(v=>BR(_,v));h>=0?g.splice(h,1):d(_)}for(const _ of g){const h=p(),v=this.moddle.create(Hc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});v.$parent=l.extensionElements,h.push(v),u.push(()=>h.splice(h.indexOf(v),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):[]}}an(Yp,"$inject",["moddle"]);function Kp(e){return Vo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Xp{constructor(t){t.registerHandler(Vc,Up),t.registerHandler(qp,Yp)}}an(Xp,"$inject",["commandStack"]);const Zp={__init__:["translationCommands"],translationCommands:["type",Xp]},_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"],NR={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},$R={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(jc.map(e=>[e,{type:"string"}])),additionalProperties:!1},FR={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},jR={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},HR={type:"string",enum:[...$c],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},zR={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Nc]},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},GR={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},VR={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},WR={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},UR={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},qR={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},YR={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},KR={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},XR={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},ZR={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Fp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function On(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const JR={"participant.add":On("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":On("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":On("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":On("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:[...Nc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":On("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":On("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},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":On("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":On("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":On("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":On("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":On("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":On("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":On("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":On("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":On("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":On("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":On("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...jc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":On("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Em={anyOf:_m.map(e=>JR[e])},QR={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:FR,irParticipant:jR,irNode:zR,irFlowCondition:GR,irSequenceFlow:VR,irMessageFlow:WR,irDataStore:UR,irDataAssociation:qR,irTextAnnotation:YR,irAssociation:KR,irGroup:XR,bwlPlacement:ZR,eventDefinition:HR,localeTexts:$R,nullableString:NR,symbolicOp:Em}};function Jp(){}Jp.prototype.get=function(e){return this.$model.properties.get(this,e)},Jp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Sm(e,t){this.model=e,this.properties=t}Sm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Jp.prototype);W(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}),W(a,Zn(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 eM=J(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Rm=J(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Qp(e,t){var n=Rm[e];return n?n(t):t}function ed(e){return!!eM[e]}function Mm(e){return!!Rm[e]}function zn(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 yi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}yi.prototype.build=function(){return Fi(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},yi.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)},yi.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},yi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=zn(o[0],i),a=zn(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},yi.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},yi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},yi.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},yi.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},yi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},yi.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")},yi.prototype.hasProperty=function(e){return this.propertiesByName[e]},yi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(W(e.properties,Zn(function(r){r=J({},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 Wo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,W(e,Zn(this.registerPackage,this))}Wo.prototype.getPackage=function(e){return this.packageMap[e]},Wo.prototype.getPackages=function(){return this.packages},Wo.prototype.registerPackage=function(e){e=J({},e);var t=this.packageMap;Cm(t,e,"prefix"),Cm(t,e,"uri"),W(e.types,Zn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Wo.prototype.registerType=function(e,t){e=J({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:J({},e.meta||{})});var n=zn(e.name,t.prefix),i=n.name,o=Object.create(null);W(e.properties,Zn(function(r){var a=zn(r.name,n.prefix),s=a.name;ed(r.type)||(r.type=zn(r.type,a.prefix).name),J(r,{ns:a,name:s}),o[s]=r},this)),J(e,{ns:n,name:i,propertiesByName:o}),W(e.extends,Zn(function(r){var a=zn(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},Wo.prototype.mapTypes=function(e,t,n){var i=ed(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=zn(c,ed(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+">");W(i.superClass,n?a:s),t(i,!n),W(i.traits,a)},Wo.prototype.getEffectiveDescriptor=function(e){var t=zn(e),n=new yi(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},Wo.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 Dr(e){this.model=e}Dr.prototype.set=function(e,t,n){if(!ii(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;tM(n)?i?delete e[o]:delete e.$attrs[td(t)]:i?o in e?e[o]=n:Am(e,i,n):e.$attrs[td(t)]=n},Dr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[td(t)];var i=n.name;return!e[i]&&n.isMany&&Am(e,n,[]),e[i]},Dr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=J({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Dr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Dr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Dr.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 tM(e){return typeof e>"u"}function Am(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function td(e){return e.replace(/^:/,"")}function wi(e,t={}){this.properties=new Dr(this),this.factory=new Sm(this,this.properties),this.registry=new Wo(e,this.properties),this.typeCache=Object.create(null),this.config=t}wi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},wi.prototype.getType=function(e){var t=this.typeCache,n=ii(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},wi.prototype.createAny=function(e,t,n){var i=zn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){LR(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}),W(n,function(a,s){yn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},wi.prototype.getPackage=function(e){return this.registry.getPackage(e)},wi.prototype.getPackages=function(){return this.registry.getPackages()},wi.prototype.getElementDescriptor=function(e){return e.$descriptor},wi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},wi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},wi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Tm=String.fromCharCode,nM=Object.prototype.hasOwnProperty,iM=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ds={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ds).forEach(function(e){ds[e.toUpperCase()]=ds[e]});function oM(e,t,n,i){return i?nM.call(ds,i)?ds[i]:"&"+i+";":Tm(t||parseInt(n,16))}function Lr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(iM,oM):e}var Pm="non-whitespace outside of root node";function Uo(e){return new Error(e)}function rM(e){return"missing namespace for prefix <"+e+">"}function Wc(e){return{get:e,enumerable:!0}}function aM(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var km=Symbol("nameCache");function nd(e){return e+"$uri"}function sM(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[nd(i)]=n;return t}function Uc(){return{line:0,column:0}}function cM(e){throw e}function Om(e){if(!this)return new Om(e);var t=e&&e.proxy,n,i,o,r,a=cM,s,c,l,u,p=Uc,d=!1,f=!1,m="",g=!1,y=!1,_=null,h=!1,v,b,E,M;function B(G){G instanceof Error||(G=Uo(G)),_=G,a(G,p)}function P(G){s&&(G instanceof Error||(G=Uo(G)),s(G,p))}this.on=function(G,q){if(typeof q!="function")throw Uo("required args <name, cb>");switch(G){case"openTag":i=q;break;case"text":n=q;break;case"closeTag":o=q;break;case"error":a=q;break;case"warn":s=q;break;case"cdata":r=q;break;case"attention":u=q;break;case"question":l=q;break;case"comment":c=q;break;default:throw Uo("unsupported event: "+G)}return this},this.ns=function(G){if(typeof G>"u"&&(G={}),typeof G!="object")throw Uo("required args <nsMap={}>");var q=Object.create(null),Y;for(Y in G)q[Y]=G[Y];return y=!0,M=q,this};function k(){v=y?[]:null,b=y?sM(M):null,E=[],p=Uc,h=!1,_=null,f=!1,m=""}this.parse=function(G){if(typeof G!="string")throw Uo("required args <xml=string>");if(d)throw Uo("parse during stream; call end() first");return k(),N(G),p=Uc,h=!1,_},this.write=function(G){if(typeof G!="string")throw Uo("required args <xml=string>");return d||(k(),d=!0),_||(m=N(m+G,!0)||""),this},this.end=function(){return d||k(),d=!1,_||N(m),m="",p=Uc,h=!1,_},this.stop=function(){h=!0};function N(G,q=!1){var Y=null,ae=null,X,Me=0,Te=!1,Pe=!1,fe=0,z=0,se,V,Z,pe,ve,$e,F,C,R,U="",ee=0,he;function ke(yt,on){var En=yt.indexOf(":");if(En===-1)return yt;var An=b[yt.substring(0,En)];return An?on===An?yt.substr(En+1):An+yt.substr(En):(P(rM(yt.substring(0,En))),null)}function at(){if(he!==null)return he;var yt,on,En=y&&b.xmlns,An=y&&g?[]:null,$t=ee,gn=U,Tn=gn.length,gi,Un,Bi,ti,Wt,Sr={},ns=new Set,ni,_t,At;e:for(;$t<Tn;$t++)if(ni=!1,_t=gn.charCodeAt($t),!(_t===32||_t<14&&_t>8)){for((_t<65||_t>122||_t>90&&_t<97)&&_t!==95&&_t!==58&&(P("illegal first char attribute name"),ni=!0),At=$t+1;At<Tn;At++)if(_t=gn.charCodeAt(At),!(_t>96&&_t<123||_t>64&&_t<91||_t>47&&_t<59||_t===46||_t===45||_t===95)){if(_t===32||_t<14&&_t>8){P("missing attribute value"),$t=At;continue e}if(_t===61)break;P("illegal attribute name char"),ni=!0}if(Wt=gn.substring($t,At),Wt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),ni=!0),_t=gn.charCodeAt(At+1),_t===34)At=gn.indexOf('"',$t=At+2),At===-1&&(At=gn.indexOf("'",$t),At!==-1&&(P("attribute value quote missmatch"),ni=!0));else if(_t===39)At=gn.indexOf("'",$t=At+2),At===-1&&(At=gn.indexOf('"',$t),At!==-1&&(P("attribute value quote missmatch"),ni=!0));else for(P("missing attribute value quotes"),ni=!0,At=At+1;At<Tn&&(_t=gn.charCodeAt(At+1),!(_t===32||_t<14&&_t>8));At++);for(At===-1&&(P("missing closing quotes"),At=Tn,ni=!0),ni||(Bi=gn.substring($t,At)),$t=At;At+1<Tn&&(_t=gn.charCodeAt(At+1),!(_t===32||_t<14&&_t>8));At++)$t===At&&(P("illegal character after attribute end"),ni=!0);if($t=At+1,ni)continue e;if(ns.has(Wt)){P("attribute <"+Wt+"> already defined");continue}if(ns.add(Wt),!y){Sr[Wt]=Bi;continue}if(g){if(Un=Wt==="xmlns"?"xmlns":Wt.charCodeAt(0)===120&&Wt.substr(0,6)==="xmlns:"?Wt.substr(6):null,Un!==null){if(yt=Lr(Bi),on=nd(Un),ti=M[yt],!ti){if(Un==="xmlns"||on in b&&b[on]!==yt)do ti="ns"+Me++;while(typeof b[ti]<"u");else ti=Un;M[yt]=ti}b[Un]!==ti&&(gi||(b=aM(b),gi=!0),b[Un]=ti,Un==="xmlns"&&(b[nd(ti)]=yt,En=ti),b[on]=yt),Sr[Wt]=Bi;continue}An.push(Wt,Bi);continue}Wt=ke(Wt,En),Wt!==null&&(Sr[Wt]=Bi)}if(g)for($t=0,Tn=An.length;$t<Tn;$t++)Wt=ke(An[$t++],En),Bi=An[$t],Wt!==null&&(Sr[Wt]=Bi);return he=Sr}function ut(){for(var yt=/(\r\n|\r|\n)/g,on=0,En=0,An=0,$t=z,gn,Tn;fe>=An&&(gn=yt.exec(G),!(!gn||($t=gn[0].length+gn.index,$t>fe)));)on+=1,An=$t;return fe==-1?(En=$t,Tn=G.substring(z)):z===0?Tn=G.substring(z,fe):(En=fe-An,Tn=z==-1?G.substring(fe):G.substring(fe,z+1)),{data:Tn,line:on,column:En}}for(p=ut,t&&(R=Object.create({},{name:Wc(function(){return F}),originalName:Wc(function(){return C}),attrs:Wc(at),ns:Wc(function(){return b})}));z!==-1;){if(G.charCodeAt(z)===60?fe=z:fe=G.indexOf("<",z),fe===-1){if(q)return G.substring(z);if(E.length)return B("unexpected end of file");if(!f)return B("missing start tag");z<G.length&&G.substring(z).trim()&&P(Pm);return}if(f||(f=!0),z!==fe){if(E.length){if(n&&(n(G.substring(z,fe),Lr,p),h))return}else if(G.substring(z,fe).trim()&&(P(Pm),h))return}if(pe=G.charCodeAt(fe+1),pe===33){if(Z=G.charCodeAt(fe+2),Z===91&&G.substr(fe+3,6)==="CDATA["){if(z=G.indexOf("]]>",fe),z===-1)return q?G.substring(fe):B("unclosed cdata");if(r&&(r(G.substring(fe+9,z),p),h))return;z+=3;continue}if(Z===45&&G.charCodeAt(fe+3)===45){if(z=G.indexOf("-->",fe),z===-1)return q?G.substring(fe):B("unclosed comment");if(c&&(c(G.substring(fe+4,z),Lr,p),h))return;z+=3;continue}}if(pe===63){if(z=G.indexOf("?>",fe),z===-1)return q?G.substring(fe):B("unclosed question");if(l&&(l(G.substring(fe,z+2),p),h))return;z+=2;continue}for(se=fe+1;;se++){if(ve=G.charCodeAt(se),isNaN(ve))return q?G.substring(fe):(z=-1,B("unclosed tag"));if(ve===34)Z=G.indexOf('"',se+1),se=Z!==-1?Z:se;else if(ve===39)Z=G.indexOf("'",se+1),se=Z!==-1?Z:se;else if(ve===62){z=se;break}}if(pe===33){if(u&&(u(G.substring(fe,z+1),Lr,p),h))return;z+=1;continue}if(he={},pe===47){if(Te=!1,Pe=!0,!E.length)return B("missing open tag");if(se=F=E.pop(),Z=fe+2+se.length,G.substring(fe+2,Z)!==se)return B("closing tag mismatch");for(;Z<z;Z++)if(pe=G.charCodeAt(Z),!(pe===32||pe>8&&pe<14))return B("close tag")}else{if(G.charCodeAt(z-1)===47?(se=F=G.substring(fe+1,z-1),Te=!0,Pe=!0):(se=F=G.substring(fe+1,z),Te=!0,Pe=!1),!(pe>96&&pe<123||pe>64&&pe<91||pe===95||pe===58))return B("illegal first char nodeName");for(Z=1,V=se.length;Z<V;Z++)if(pe=se.charCodeAt(Z),!(pe>96&&pe<123||pe>64&&pe<91||pe>47&&pe<59||pe===45||pe===95||pe==46)){if(pe===32||pe<14&&pe>8){F=se.substring(0,Z),he=null;break}return B("invalid nodeName")}Pe||E.push(F)}if(y){X=b,Te&&(Pe||v.push(X),he===null&&(g=se.indexOf("xmlns",Z)!==-1)&&(ee=Z,U=se,at(),g=!1)),C=F,ae!==b&&(Y=b[km],Y===void 0&&(Y=b[km]=Object.create(null)),ae=b);var zt=Y[F];if(zt!==void 0)F=zt;else{if(pe=F.indexOf(":"),pe!==-1){if($e=b[F.substring(0,pe)],!$e)return B("missing namespace on <"+C+">");F=F.substr(pe+1)}else $e=b.xmlns;$e&&(F=$e+":"+F),Y[C]=F}}if(Te&&(ee=Z,U=se,i&&(t?i(R,Lr,Pe,p):i(F,at,Lr,Pe,p),h)))return;if(Pe){if(o&&(o(t?R:F,Lr,Te,p),h))return;y&&(Te?b=X:b=v.pop())}z+=1}}}function Dm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var id={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Lm="property";function Im(e){return e.xml&&e.xml.serialize}function lM(e){const t=Im(e);return t!==Lm&&(t||null)}function uM(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Bm(e,t){return Dm(t)?e.prefix+":"+uM(e.localName):e.name}function pM(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 dM(e,t,n){const i=zn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=zn(o);var a=n.getPackage(r.prefix);return pM(r,a)}function qo(e){return new Error(e)}function xo(e){return e.$descriptor}function fM(e){J(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw qo("expected element");var n=this.elementsById,i=xo(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 qo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function fs(){}fs.prototype.handleEnd=function(){},fs.prototype.handleText=function(){},fs.prototype.handleNode=function(){};function od(){}od.prototype=Object.create(fs.prototype),od.prototype.handleNode=function(){return this};function ma(){}ma.prototype=Object.create(fs.prototype),ma.prototype.handleText=function(e){this.body=(this.body||"")+e};function hs(e,t){this.property=e,this.context=t}hs.prototype=Object.create(ma.prototype),hs.prototype.handleNode=function(e){if(this.element)throw qo("expected no sub nodes");return this.element=this.createReference(e),this},hs.prototype.handleEnd=function(){this.element.id=this.body},hs.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function rd(e,t){this.element=t,this.propertyDesc=e}rd.prototype=Object.create(ma.prototype),rd.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Qp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function qc(){}qc.prototype=Object.create(ma.prototype),qc.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 qn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}qn.prototype=Object.create(qc.prototype),qn.prototype.addReference=function(e){this.context.addReference(e)},qn.prototype.handleText=function(e){var t=this.element,n=xo(t),i=n.bodyProperty;if(!i)throw qo("unexpected body text <"+e+">");ma.prototype.handleText.call(this,e)},qn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=xo(t),i=n.bodyProperty;i&&e!==void 0&&(e=Qp(i.type,e),t.set(i.name,e))},qn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=xo(n),o=this.context,r=new n({}),a=this.model,s;return W(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),W(p,function(d){o.addReference({element:r,property:u.ns.name,id:d})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Qp(u.type,c):l==="xmlns"?l=":"+l:(s=zn(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},qn.prototype.getPropertyForNode=function(e){var t=e.name,n=zn(t),i=this.type,o=this.model,r=xo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=lM(s);if(l){const u=e.attributes[l];if(u){const p=dM(u,e.ns,o),d=o.getType(p);return J({},s,{effectiveType:xo(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Bm(n,c),u=o.getType(l);if(s=Ft(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return J({},s,{effectiveType:xo(u).name})}else if(s=Ft(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw qo("unrecognized element <"+n.name+">")},qn.prototype.toString=function(){return"ElementDescriptor["+xo(this.type).name+"]"},qn.prototype.valueHandler=function(e,t){return new rd(e,t)},qn.prototype.referenceHandler=function(e){return new hs(e,this.context)},qn.prototype.handler=function(e){return e==="Element"?new ya(this.model,e,this.context):new qn(this.model,e,this.context)},qn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Mm(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?(J(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function ad(e,t,n){qn.call(this,e,t,n)}ad.prototype=Object.create(qn.prototype),ad.prototype.createElement=function(e){var t=e.name,n=zn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Bm(n,r)||t;if(!o.hasType(a))throw qo("unexpected element <"+e.originalName+">");return qn.prototype.createElement.call(this,e)};function ya(e,t,n){this.model=e,this.context=n}ya.prototype=Object.create(qc.prototype),ya.prototype.createElement=function(e){var t=e.name,n=zn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ya.prototype.handleChild=function(e){var t=new ya(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},ya.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function sd(e){e instanceof wi&&(e={model:e}),J(this,{lax:!1},e)}sd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof qn?(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 fM(J({},t,{rootHandler:i})),s=new Om({proxy:!0}),c=hM();i.context=a,c.push(i);function l(E,M,B){var P=M(),k=P.line,N=P.column,G=P.data;G.charAt(0)==="<"&&G.indexOf(" ")!==-1&&(G=G.slice(0,G.indexOf(" "))+">");var q="unparsable content "+(G?G+" ":"")+`detected
1
+ (function(re,Ee){typeof exports=="object"&&typeof module<"u"?Ee(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ee):(re=typeof globalThis<"u"?globalThis:re||self,Ee(re.BpmnModeler={},re.Vue))})(this,(function(re,Ee){"use strict";var v6=Object.defineProperty;var x6=(re,Ee,Tr)=>Ee in re?v6(re,Ee,{enumerable:!0,configurable:!0,writable:!0,value:Tr}):re[Ee]=Tr;var an=(re,Ee,Tr)=>x6(re,typeof Ee!="symbol"?Ee+"":Ee,Tr);const Tr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Nc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function um(e){return Tr.includes(e)}function pm(e){return Nc.includes(e)}const $c=["timer"],Fc={timer:"bpmn:TimerEventDefinition"};function dm(e){return typeof e=="string"&&$c.includes(e)}function Np(e){if(e.length===1)return $c.find(t=>Fc[t]===e[0])}const jc=["ko","en","ja","zh"];function MR(e){return typeof e=="string"&&jc.includes(e)}const fm="http://g1project.net/spec/bpmn/bwl/1.0",$p="bwl",Fp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Hc="bwl:ReviewRequest",hm={name:"bwl-hints",uri:fm,prefix:$p,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"}]}]},jp="bwl.undoEpisode",gm=new WeakSet;function CR(e){gm.has(e)||(e.register(jp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),gm.add(e))}function mm(e,t){CR(e);const n={run:t};if(e.execute(jp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function ym(e){return e._stackIdx+1}function vm(e,t){const{_stack:n,_stackIdx:i}=e;if(i<t)return 0;const o=n[t].id;for(let r=t;r<=i;r++)n[r].id=o;return i-t+1}function Hp(e){return Array.prototype.concat.apply([],e)}const us=Object.prototype.toString,AR=Object.prototype.hasOwnProperty;function Pr(e){return e===void 0}function mn(e){return e!==void 0}function da(e){return e==null}function Ze(e){return us.call(e)==="[object Array]"}function yn(e){return us.call(e)==="[object Object]"}function Je(e){return us.call(e)==="[object Number]"}function wn(e){const t=us.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ii(e){return us.call(e)==="[object String]"}function TR(e){if(!Ze(e))throw new Error("must supply array")}function oi(e,t){return!da(e)&&AR.call(e,t)}function Ft(e,t){const n=Gc(t);let i;return W(e,function(o,r){if(n(o,r))return i=o,!1}),i}function xm(e,t){const n=Gc(t);let i=Ze(e)?-1:void 0;return W(e,function(o,r){if(n(o,r))return i=r,!1}),i}function dt(e,t){const n=Gc(t);let i=[];return W(e,function(o,r){n(o,r)&&i.push(o)}),i}function W(e,t){let n,i;if(Pr(e))return;const o=Ze(e)?LR:DR;for(let r in e)if(oi(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function PR(e,t){if(Pr(e))return[];TR(e);const n=Gc(t);return e.filter(function(i,o){return!n(i,o)})}function ri(e,t,n){return W(e,function(i,o){n=t(n,i,o)}),n}function Ho(e,t){return!!ri(e,function(n,i,o){return n&&t(i,o)},!0)}function zo(e,t){return!!Ft(e,t)}function Hn(e,t){let n=[];return W(e,function(i,o){n.push(t(i,o))}),n}function zc(e){return e&&Object.keys(e)||[]}function kR(e){return zc(e).length}function fa(e){return Hn(e,t=>t)}function ha(e,t,n={}){return t=zp(t),W(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function bm(e,...t){e=zp(e);let n={};return W(t,o=>ha(o,e,n)),Hn(n,function(o,r){return o[0]})}const OR=bm;function Xi(e,t){t=zp(t);let n=[];return W(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)}),Hn(n,i=>i.v)}function ga(e){return function(t){return Ho(e,function(n,i){return t[i]===n})}}function zp(e){return wn(e)?e:t=>t[e]}function Gc(e){return wn(e)?e:t=>t===e}function DR(e){return e}function LR(e){return Number(e)}function Gp(e,t){let n,i,o,r;function a(p){let d=Date.now(),f=p?0:r+t-d;if(f>0)return s(f);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 Zn(e,t){return e.bind(t)}function J(e,...t){return Object.assign(e,...t)}function IR(e,t,n){let i=e;return W(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];mn(a)&&da(s)&&(s=i[o]=isNaN(+a)?{}:[]),Pr(a)?Pr(n)?delete i[o]:i[o]=n:i=s}),e}function Fi(e,t){let n={},i=Object(e);return W(t,function(o){o in i&&(n[o]=e[o])}),n}function Zi(e,t){let n={},i=Object(e);return W(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function A(e,t){var n=we(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function pt(e,t){return zo(t,function(n){return A(e,n)})}function we(e){return e&&e.businessObject||e}function vt(e){return e&&e.di}const BR="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",wm="i18n",kr="i18n:Translation";function Or(e){if(e){if(A(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(A(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Go(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,kr)})}function Rn(e){return e.get("xml:lang")}function Vo(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,Hc)})}function ps(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 Wp(e,t,n){const i=Or(e);if(!i)return{};const o=i.target[i.key]??"",r=Go(e).filter(u=>Rn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Rn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of ps(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(d=>Rn(d)===u&&a(d));p&&(l[u]=a(p))}return l}const Vc="bwl.updateTranslation";class Up{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=Or(c),u=[];t.undo=u;const p=Go(c).filter(k=>Rn(k)),d=s??(l?l.target[l.key]??"":""),f=a??o,g=(k=>{if(!k)return[];const N=p.filter(G=>G.body===k).map(Rn);return N.length?N:[f]})(d),y=s!==void 0&&d&&!g.includes(t.locale)?g[0]:t.locale,_=k=>{var N;return((N=p.find(G=>Rn(G)===k&&G.body))==null?void 0:N.body)??(g.includes(k)?d:"")},h=k=>Vo(c).some(N=>N.locale===k),v=_(y);if(v===i)return[];const b=!!v&&!h(y),E=b?r.filter(k=>k!==y&&_(k)&&!h(k)):[],M=()=>{let k=c.extensionElements;return k||(k=this.moddle.create("bpmn:ExtensionElements",{values:[]}),k.$parent=c,c.extensionElements=k,u.push(()=>delete c.extensionElements)),k.get("values")},B=(k,N)=>{const G=M();let q=G.find(Y=>{var ae;return((ae=Y.$instanceOf)==null?void 0:ae.call(Y,kr))&&Rn(Y)===k});if(q){const Y=q.body;q.body=N,u.push(()=>q.body=Y)}else q=this.moddle.create(kr,{body:N}),q.set("xml:lang",k),q.$parent=c.extensionElements,G.push(q),u.push(()=>G.splice(G.indexOf(q),1))},P=k=>{const N=M(),G=N.indexOf(k);N.splice(G,1),u.push(()=>N.splice(G,0,k))};if(s===void 0){if(y===o&&l){if(d&&!p.some(N=>N.body===d)){const N=a&&a!==o?a:void 0;N&&B(N,d)}const k=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{k?l.target[l.key]=d:delete l.target[l.key]})}B(y,i)}else(p.some(k=>Rn(k)===y)||!d&&y!==f)&&B(y,i);if(!b)for(const k of Vo(c).filter(N=>N.locale===y))P(k);for(const k of E){const N=M(),G=this.moddle.create(Hc,{locale:k,sourceLocale:y,previous:v});G.$parent=c.extensionElements,N.push(G),u.push(()=>N.splice(N.indexOf(G),1))}for(const k of Vo(c).filter(N=>N.sourceLocale===y&&(N.previous??"")===i))P(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):[]}}an(Up,"$inject",["moddle"]);const qp="bwl.setTranslations",NR=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Yp{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,!Or(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")},d=_=>{const h=p(),v=h.indexOf(_);v<0||(h.splice(v,1),u.push(()=>h.splice(v,0,_)))},f=_=>Go(l).find(h=>Rn(h)===_);if(i===null)for(const _ of a){const h=f(_);h&&d(h)}else if(i)for(const _ of a){const h=i[_];if(h===void 0)continue;const v=f(_);if(v){if(v.body===h)continue;const M=v.body;v.body=h,u.push(()=>v.body=M);continue}if(_===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(kr,{body:h});E.set("xml:lang",_),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const g=[...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 Vo(l)){const h=g.findIndex(v=>NR(_,v));h>=0?g.splice(h,1):d(_)}for(const _ of g){const h=p(),v=this.moddle.create(Hc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});v.$parent=l.extensionElements,h.push(v),u.push(()=>h.splice(h.indexOf(v),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):[]}}an(Yp,"$inject",["moddle"]);function Kp(e){return Vo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Xp{constructor(t){t.registerHandler(Vc,Up),t.registerHandler(qp,Yp)}}an(Xp,"$inject",["commandStack"]);const Zp={__init__:["translationCommands"],translationCommands:["type",Xp]},_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"],$R={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},FR={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(jc.map(e=>[e,{type:"string"}])),additionalProperties:!1},jR={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},HR={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},zR={type:"string",enum:[...$c],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},GR={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Nc]},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},VR={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},WR={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},UR={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},qR={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},YR={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},KR={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},XR={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},ZR={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},JR={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Fp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function On(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const QR={"participant.add":On("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":On("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":On("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":On("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:[...Nc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":On("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":On("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},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":On("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":On("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":On("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":On("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":On("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":On("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":On("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":On("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":On("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":On("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":On("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...jc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":On("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Em={anyOf:_m.map(e=>QR[e])},eM={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:jR,irParticipant:HR,irNode:GR,irFlowCondition:VR,irSequenceFlow:WR,irMessageFlow:UR,irDataStore:qR,irDataAssociation:YR,irTextAnnotation:KR,irAssociation:XR,irGroup:ZR,bwlPlacement:JR,eventDefinition:zR,localeTexts:FR,nullableString:$R,symbolicOp:Em}};function Jp(){}Jp.prototype.get=function(e){return this.$model.properties.get(this,e)},Jp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Sm(e,t){this.model=e,this.properties=t}Sm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Jp.prototype);W(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}),W(a,Zn(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 tM=J(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Rm=J(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Qp(e,t){var n=Rm[e];return n?n(t):t}function ed(e){return!!tM[e]}function Mm(e){return!!Rm[e]}function zn(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 yi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}yi.prototype.build=function(){return Fi(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},yi.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)},yi.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},yi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=zn(o[0],i),a=zn(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},yi.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},yi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},yi.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},yi.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},yi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},yi.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")},yi.prototype.hasProperty=function(e){return this.propertiesByName[e]},yi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(W(e.properties,Zn(function(r){r=J({},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 Wo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,W(e,Zn(this.registerPackage,this))}Wo.prototype.getPackage=function(e){return this.packageMap[e]},Wo.prototype.getPackages=function(){return this.packages},Wo.prototype.registerPackage=function(e){e=J({},e);var t=this.packageMap;Cm(t,e,"prefix"),Cm(t,e,"uri"),W(e.types,Zn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Wo.prototype.registerType=function(e,t){e=J({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:J({},e.meta||{})});var n=zn(e.name,t.prefix),i=n.name,o=Object.create(null);W(e.properties,Zn(function(r){var a=zn(r.name,n.prefix),s=a.name;ed(r.type)||(r.type=zn(r.type,a.prefix).name),J(r,{ns:a,name:s}),o[s]=r},this)),J(e,{ns:n,name:i,propertiesByName:o}),W(e.extends,Zn(function(r){var a=zn(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},Wo.prototype.mapTypes=function(e,t,n){var i=ed(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=zn(c,ed(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+">");W(i.superClass,n?a:s),t(i,!n),W(i.traits,a)},Wo.prototype.getEffectiveDescriptor=function(e){var t=zn(e),n=new yi(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},Wo.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 Dr(e){this.model=e}Dr.prototype.set=function(e,t,n){if(!ii(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;nM(n)?i?delete e[o]:delete e.$attrs[td(t)]:i?o in e?e[o]=n:Am(e,i,n):e.$attrs[td(t)]=n},Dr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[td(t)];var i=n.name;return!e[i]&&n.isMany&&Am(e,n,[]),e[i]},Dr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=J({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Dr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Dr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Dr.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 nM(e){return typeof e>"u"}function Am(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function td(e){return e.replace(/^:/,"")}function wi(e,t={}){this.properties=new Dr(this),this.factory=new Sm(this,this.properties),this.registry=new Wo(e,this.properties),this.typeCache=Object.create(null),this.config=t}wi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},wi.prototype.getType=function(e){var t=this.typeCache,n=ii(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},wi.prototype.createAny=function(e,t,n){var i=zn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){IR(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}),W(n,function(a,s){yn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},wi.prototype.getPackage=function(e){return this.registry.getPackage(e)},wi.prototype.getPackages=function(){return this.registry.getPackages()},wi.prototype.getElementDescriptor=function(e){return e.$descriptor},wi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},wi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},wi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Tm=String.fromCharCode,iM=Object.prototype.hasOwnProperty,oM=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ds={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ds).forEach(function(e){ds[e.toUpperCase()]=ds[e]});function rM(e,t,n,i){return i?iM.call(ds,i)?ds[i]:"&"+i+";":Tm(t||parseInt(n,16))}function Lr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(oM,rM):e}var Pm="non-whitespace outside of root node";function Uo(e){return new Error(e)}function aM(e){return"missing namespace for prefix <"+e+">"}function Wc(e){return{get:e,enumerable:!0}}function sM(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var km=Symbol("nameCache");function nd(e){return e+"$uri"}function cM(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[nd(i)]=n;return t}function Uc(){return{line:0,column:0}}function lM(e){throw e}function Om(e){if(!this)return new Om(e);var t=e&&e.proxy,n,i,o,r,a=lM,s,c,l,u,p=Uc,d=!1,f=!1,m="",g=!1,y=!1,_=null,h=!1,v,b,E,M;function B(G){G instanceof Error||(G=Uo(G)),_=G,a(G,p)}function P(G){s&&(G instanceof Error||(G=Uo(G)),s(G,p))}this.on=function(G,q){if(typeof q!="function")throw Uo("required args <name, cb>");switch(G){case"openTag":i=q;break;case"text":n=q;break;case"closeTag":o=q;break;case"error":a=q;break;case"warn":s=q;break;case"cdata":r=q;break;case"attention":u=q;break;case"question":l=q;break;case"comment":c=q;break;default:throw Uo("unsupported event: "+G)}return this},this.ns=function(G){if(typeof G>"u"&&(G={}),typeof G!="object")throw Uo("required args <nsMap={}>");var q=Object.create(null),Y;for(Y in G)q[Y]=G[Y];return y=!0,M=q,this};function k(){v=y?[]:null,b=y?cM(M):null,E=[],p=Uc,h=!1,_=null,f=!1,m=""}this.parse=function(G){if(typeof G!="string")throw Uo("required args <xml=string>");if(d)throw Uo("parse during stream; call end() first");return k(),N(G),p=Uc,h=!1,_},this.write=function(G){if(typeof G!="string")throw Uo("required args <xml=string>");return d||(k(),d=!0),_||(m=N(m+G,!0)||""),this},this.end=function(){return d||k(),d=!1,_||N(m),m="",p=Uc,h=!1,_},this.stop=function(){h=!0};function N(G,q=!1){var Y=null,ae=null,X,Me=0,Te=!1,Pe=!1,fe=0,z=0,se,V,Z,pe,ve,$e,F,C,R,U="",ee=0,he;function ke(yt,on){var En=yt.indexOf(":");if(En===-1)return yt;var An=b[yt.substring(0,En)];return An?on===An?yt.substr(En+1):An+yt.substr(En):(P(aM(yt.substring(0,En))),null)}function at(){if(he!==null)return he;var yt,on,En=y&&b.xmlns,An=y&&g?[]:null,$t=ee,gn=U,Tn=gn.length,gi,Un,Bi,ti,Wt,Sr={},ns=new Set,ni,_t,At;e:for(;$t<Tn;$t++)if(ni=!1,_t=gn.charCodeAt($t),!(_t===32||_t<14&&_t>8)){for((_t<65||_t>122||_t>90&&_t<97)&&_t!==95&&_t!==58&&(P("illegal first char attribute name"),ni=!0),At=$t+1;At<Tn;At++)if(_t=gn.charCodeAt(At),!(_t>96&&_t<123||_t>64&&_t<91||_t>47&&_t<59||_t===46||_t===45||_t===95)){if(_t===32||_t<14&&_t>8){P("missing attribute value"),$t=At;continue e}if(_t===61)break;P("illegal attribute name char"),ni=!0}if(Wt=gn.substring($t,At),Wt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),ni=!0),_t=gn.charCodeAt(At+1),_t===34)At=gn.indexOf('"',$t=At+2),At===-1&&(At=gn.indexOf("'",$t),At!==-1&&(P("attribute value quote missmatch"),ni=!0));else if(_t===39)At=gn.indexOf("'",$t=At+2),At===-1&&(At=gn.indexOf('"',$t),At!==-1&&(P("attribute value quote missmatch"),ni=!0));else for(P("missing attribute value quotes"),ni=!0,At=At+1;At<Tn&&(_t=gn.charCodeAt(At+1),!(_t===32||_t<14&&_t>8));At++);for(At===-1&&(P("missing closing quotes"),At=Tn,ni=!0),ni||(Bi=gn.substring($t,At)),$t=At;At+1<Tn&&(_t=gn.charCodeAt(At+1),!(_t===32||_t<14&&_t>8));At++)$t===At&&(P("illegal character after attribute end"),ni=!0);if($t=At+1,ni)continue e;if(ns.has(Wt)){P("attribute <"+Wt+"> already defined");continue}if(ns.add(Wt),!y){Sr[Wt]=Bi;continue}if(g){if(Un=Wt==="xmlns"?"xmlns":Wt.charCodeAt(0)===120&&Wt.substr(0,6)==="xmlns:"?Wt.substr(6):null,Un!==null){if(yt=Lr(Bi),on=nd(Un),ti=M[yt],!ti){if(Un==="xmlns"||on in b&&b[on]!==yt)do ti="ns"+Me++;while(typeof b[ti]<"u");else ti=Un;M[yt]=ti}b[Un]!==ti&&(gi||(b=sM(b),gi=!0),b[Un]=ti,Un==="xmlns"&&(b[nd(ti)]=yt,En=ti),b[on]=yt),Sr[Wt]=Bi;continue}An.push(Wt,Bi);continue}Wt=ke(Wt,En),Wt!==null&&(Sr[Wt]=Bi)}if(g)for($t=0,Tn=An.length;$t<Tn;$t++)Wt=ke(An[$t++],En),Bi=An[$t],Wt!==null&&(Sr[Wt]=Bi);return he=Sr}function ut(){for(var yt=/(\r\n|\r|\n)/g,on=0,En=0,An=0,$t=z,gn,Tn;fe>=An&&(gn=yt.exec(G),!(!gn||($t=gn[0].length+gn.index,$t>fe)));)on+=1,An=$t;return fe==-1?(En=$t,Tn=G.substring(z)):z===0?Tn=G.substring(z,fe):(En=fe-An,Tn=z==-1?G.substring(fe):G.substring(fe,z+1)),{data:Tn,line:on,column:En}}for(p=ut,t&&(R=Object.create({},{name:Wc(function(){return F}),originalName:Wc(function(){return C}),attrs:Wc(at),ns:Wc(function(){return b})}));z!==-1;){if(G.charCodeAt(z)===60?fe=z:fe=G.indexOf("<",z),fe===-1){if(q)return G.substring(z);if(E.length)return B("unexpected end of file");if(!f)return B("missing start tag");z<G.length&&G.substring(z).trim()&&P(Pm);return}if(f||(f=!0),z!==fe){if(E.length){if(n&&(n(G.substring(z,fe),Lr,p),h))return}else if(G.substring(z,fe).trim()&&(P(Pm),h))return}if(pe=G.charCodeAt(fe+1),pe===33){if(Z=G.charCodeAt(fe+2),Z===91&&G.substr(fe+3,6)==="CDATA["){if(z=G.indexOf("]]>",fe),z===-1)return q?G.substring(fe):B("unclosed cdata");if(r&&(r(G.substring(fe+9,z),p),h))return;z+=3;continue}if(Z===45&&G.charCodeAt(fe+3)===45){if(z=G.indexOf("-->",fe),z===-1)return q?G.substring(fe):B("unclosed comment");if(c&&(c(G.substring(fe+4,z),Lr,p),h))return;z+=3;continue}}if(pe===63){if(z=G.indexOf("?>",fe),z===-1)return q?G.substring(fe):B("unclosed question");if(l&&(l(G.substring(fe,z+2),p),h))return;z+=2;continue}for(se=fe+1;;se++){if(ve=G.charCodeAt(se),isNaN(ve))return q?G.substring(fe):(z=-1,B("unclosed tag"));if(ve===34)Z=G.indexOf('"',se+1),se=Z!==-1?Z:se;else if(ve===39)Z=G.indexOf("'",se+1),se=Z!==-1?Z:se;else if(ve===62){z=se;break}}if(pe===33){if(u&&(u(G.substring(fe,z+1),Lr,p),h))return;z+=1;continue}if(he={},pe===47){if(Te=!1,Pe=!0,!E.length)return B("missing open tag");if(se=F=E.pop(),Z=fe+2+se.length,G.substring(fe+2,Z)!==se)return B("closing tag mismatch");for(;Z<z;Z++)if(pe=G.charCodeAt(Z),!(pe===32||pe>8&&pe<14))return B("close tag")}else{if(G.charCodeAt(z-1)===47?(se=F=G.substring(fe+1,z-1),Te=!0,Pe=!0):(se=F=G.substring(fe+1,z),Te=!0,Pe=!1),!(pe>96&&pe<123||pe>64&&pe<91||pe===95||pe===58))return B("illegal first char nodeName");for(Z=1,V=se.length;Z<V;Z++)if(pe=se.charCodeAt(Z),!(pe>96&&pe<123||pe>64&&pe<91||pe>47&&pe<59||pe===45||pe===95||pe==46)){if(pe===32||pe<14&&pe>8){F=se.substring(0,Z),he=null;break}return B("invalid nodeName")}Pe||E.push(F)}if(y){X=b,Te&&(Pe||v.push(X),he===null&&(g=se.indexOf("xmlns",Z)!==-1)&&(ee=Z,U=se,at(),g=!1)),C=F,ae!==b&&(Y=b[km],Y===void 0&&(Y=b[km]=Object.create(null)),ae=b);var zt=Y[F];if(zt!==void 0)F=zt;else{if(pe=F.indexOf(":"),pe!==-1){if($e=b[F.substring(0,pe)],!$e)return B("missing namespace on <"+C+">");F=F.substr(pe+1)}else $e=b.xmlns;$e&&(F=$e+":"+F),Y[C]=F}}if(Te&&(ee=Z,U=se,i&&(t?i(R,Lr,Pe,p):i(F,at,Lr,Pe,p),h)))return;if(Pe){if(o&&(o(t?R:F,Lr,Te,p),h))return;y&&(Te?b=X:b=v.pop())}z+=1}}}function Dm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var id={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Lm="property";function Im(e){return e.xml&&e.xml.serialize}function uM(e){const t=Im(e);return t!==Lm&&(t||null)}function pM(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Bm(e,t){return Dm(t)?e.prefix+":"+pM(e.localName):e.name}function dM(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 fM(e,t,n){const i=zn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=zn(o);var a=n.getPackage(r.prefix);return dM(r,a)}function qo(e){return new Error(e)}function xo(e){return e.$descriptor}function hM(e){J(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw qo("expected element");var n=this.elementsById,i=xo(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 qo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function fs(){}fs.prototype.handleEnd=function(){},fs.prototype.handleText=function(){},fs.prototype.handleNode=function(){};function od(){}od.prototype=Object.create(fs.prototype),od.prototype.handleNode=function(){return this};function ma(){}ma.prototype=Object.create(fs.prototype),ma.prototype.handleText=function(e){this.body=(this.body||"")+e};function hs(e,t){this.property=e,this.context=t}hs.prototype=Object.create(ma.prototype),hs.prototype.handleNode=function(e){if(this.element)throw qo("expected no sub nodes");return this.element=this.createReference(e),this},hs.prototype.handleEnd=function(){this.element.id=this.body},hs.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function rd(e,t){this.element=t,this.propertyDesc=e}rd.prototype=Object.create(ma.prototype),rd.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Qp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function qc(){}qc.prototype=Object.create(ma.prototype),qc.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 qn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}qn.prototype=Object.create(qc.prototype),qn.prototype.addReference=function(e){this.context.addReference(e)},qn.prototype.handleText=function(e){var t=this.element,n=xo(t),i=n.bodyProperty;if(!i)throw qo("unexpected body text <"+e+">");ma.prototype.handleText.call(this,e)},qn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=xo(t),i=n.bodyProperty;i&&e!==void 0&&(e=Qp(i.type,e),t.set(i.name,e))},qn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=xo(n),o=this.context,r=new n({}),a=this.model,s;return W(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),W(p,function(d){o.addReference({element:r,property:u.ns.name,id:d})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Qp(u.type,c):l==="xmlns"?l=":"+l:(s=zn(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},qn.prototype.getPropertyForNode=function(e){var t=e.name,n=zn(t),i=this.type,o=this.model,r=xo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=uM(s);if(l){const u=e.attributes[l];if(u){const p=fM(u,e.ns,o),d=o.getType(p);return J({},s,{effectiveType:xo(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Bm(n,c),u=o.getType(l);if(s=Ft(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return J({},s,{effectiveType:xo(u).name})}else if(s=Ft(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw qo("unrecognized element <"+n.name+">")},qn.prototype.toString=function(){return"ElementDescriptor["+xo(this.type).name+"]"},qn.prototype.valueHandler=function(e,t){return new rd(e,t)},qn.prototype.referenceHandler=function(e){return new hs(e,this.context)},qn.prototype.handler=function(e){return e==="Element"?new ya(this.model,e,this.context):new qn(this.model,e,this.context)},qn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Mm(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?(J(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function ad(e,t,n){qn.call(this,e,t,n)}ad.prototype=Object.create(qn.prototype),ad.prototype.createElement=function(e){var t=e.name,n=zn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Bm(n,r)||t;if(!o.hasType(a))throw qo("unexpected element <"+e.originalName+">");return qn.prototype.createElement.call(this,e)};function ya(e,t,n){this.model=e,this.context=n}ya.prototype=Object.create(qc.prototype),ya.prototype.createElement=function(e){var t=e.name,n=zn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ya.prototype.handleChild=function(e){var t=new ya(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},ya.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function sd(e){e instanceof wi&&(e={model:e}),J(this,{lax:!1},e)}sd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof qn?(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 hM(J({},t,{rootHandler:i})),s=new Om({proxy:!0}),c=gM();i.context=a,c.push(i);function l(E,M,B){var P=M(),k=P.line,N=P.column,G=P.data;G.charAt(0)==="<"&&G.indexOf(" ")!==-1&&(G=G.slice(0,G.indexOf(" "))+">");var q="unparsable content "+(G?G+" ":"")+`detected
2
2
  line: `+k+`
3
3
  column: `+N+`
4
- nested error: `+E.message;if(B)return a.addWarning({message:q,error:E}),!0;throw qo(q)}function u(E,M){return l(E,M,!0)}function p(){var E=a.elementsById,M=a.references,B,P;for(B=0;P=M[B];B++){var k=P.element,N=E[P.id],G=xo(k).propertiesByName[P.property];if(N||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),G.isMany){var q=k.get(G.name),Y=q.indexOf(P);Y===-1&&(Y=q.length),N?q[Y]=N:q.splice(Y,1)}else k.set(G.name,N)}}function d(){c.pop().handleEnd()}var f=/^<\?xml /i,m=/ encoding="([^"]+)"/i,g=/^utf-8$/i;function y(E){if(f.test(E)){var M=m.exec(E),B=M&&M[1];!B||g.test(B)||a.addWarning({message:"unsupported document encoding <"+B+">, falling back to UTF-8"})}}function _(E,M){var B=c.peek();try{c.push(B.handleNode(E))}catch(P){l(P,M,r)&&c.push(new od)}}function h(E,M){try{c.peek().handleText(E)}catch(B){u(B,M)}}function v(E,M){E.trim()&&h(E,M)}var b=o.getPackages().reduce(function(E,M){return E[M.uri]=M.prefix,E},Object.entries(id).reduce(function(E,[M,B]){return E[B]=M,E},o.config&&o.config.nsMap||{}));return s.ns(b).on("openTag",function(E,M,B,P){var k=E.attrs||{},N=Object.keys(k).reduce(function(q,Y){var ae=M(k[Y]);return q[Y]=ae,q},{}),G={name:E.name,originalName:E.originalName,attributes:N,ns:E.ns};_(G,P)}).on("question",y).on("closeTag",d).on("cdata",h).on("text",function(E,M,B){v(M(E),B)}).on("error",l).on("warn",u),new Promise(function(E,M){var B;try{s.parse(e),p()}catch(q){B=q}var P=i.element;!B&&!P&&(B=qo("failed to parse document as <"+i.type.$descriptor.name+">"));var k=a.warnings,N=a.references,G=a.elementsById;return B?(B.warnings=k,M(B)):E({rootElement:P,elementsById:G,references:N,warnings:k})})},sd.prototype.handler=function(e){return new ad(this.model,e)};function hM(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var gM=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,mM=/<|>|'|"|&|\n\r|\n/g,Nm=/<|>|&/g;function Ji(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Ji.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Ji.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Ji.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Ji.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)},Ji.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Ji.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Ji.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Ji.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Ji.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 yM(e){return e.charAt(0).toLowerCase()+e.slice(1)}function vM(e,t){return Dm(t)?yM(e):e}function $m(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Fm(e){return ii(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function xM(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 bM(e,t){return t.isGeneric?J({localName:t.ns.localName},e):J({localName:vM(t.ns.localName,t.$pkg)},e)}function wM(e,t){return J({localName:t.ns.localName},e)}function _M(e){var t=e.$descriptor;return dt(t.properties,function(n){var i=n.name;if(n.isVirtual||!oi(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var EM={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},SM={"<":"lt",">":"gt","&":"amp"};function jm(e,t,n){return e=ii(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function RM(e){return jm(e,mM,EM)}function MM(e){return jm(e,Nm,SM)}function CM(e){return dt(e,function(t){return t.isAttr})}function AM(e){return dt(e,function(t){return!t.isAttr})}function cd(e){this.tagName=e}cd.prototype.build=function(e){return this.element=e,this},cd.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Ir(){}Ir.prototype.serializeValue=Ir.prototype.serializeTo=function(e){e.append(this.escape?MM(this.value):this.value)},Ir.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Nm)!==-1&&(this.escape=!0),this};function ld(e){this.tagName=e}$m(ld,Ir),ld.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function qt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}qt.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=_M(e),this.parseAttributes(CM(o)),this.parseContainments(AM(o))),this.parseGenericAttributes(e,i),this},qt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return bM(t,e)},qt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return wM(t,e)},qt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},qt.prototype.nsAttributeName=function(e){var t;if(ii(e)?t=zn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:J({localName:t.localName},n)},qt.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}))},qt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ir().build({type:"String"},t));var n=e.$children;n&&W(n,i=>{this.body.push(new qt(this).build(i))})},qt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=zn(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)}},qt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return W(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},qt.prototype.parseGenericAttributes=function(e,t){var n=this;W(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)}})},qt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;W(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new Ir().build(o,r[0]));else if(Mm(o.type))W(r,function(l){n.push(new ld(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)W(r,function(l){n.push(new cd(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Im(o);W(r,function(l){var u;c?c===Lm?u=new qt(t,o):u=new Yc(t,o,c):u=new qt(t),n.push(u.build(l))})}})},qt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Ji(i):t=i),t},qt.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},qt.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},qt.prototype.parseAttributes=function(e){var t=this,n=this.element;W(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];W(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},qt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Fm(e)},qt.prototype.addAttribute=function(e,t){var n=this.attrs;ii(t)&&(t=RM(t));var i=xm(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)},qt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=xM(n).concat(t)),W(t,function(i){e.append(" ").append(Fm(i.name)).append('="').append(i.value).append('"')})},qt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Ir;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),W(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Yc(e,t,n){qt.call(this,e,t),this.serialization=n}$m(Yc,qt),Yc.prototype.parseNsAttributes=function(e){var t=qt.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},Yc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function TM(){this.value="",this.write=function(e){this.value+=e}}function PM(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 kM(e){e=J({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new TM,r=new PM(o,e.format);e.preamble&&r.append(gM);var a=new qt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(OM(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function OM(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in id)n[i]=id[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 Kc(e,t){wi.call(this,e,t)}Kc.prototype=Object.create(wi.prototype),Kc.prototype.fromXML=function(e,t,n){ii(t)||(n=t,t="bpmn:Definitions");var i=new sd(J({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Kc.prototype.toXML=function(e,t){var n=new kM(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var DM="BPMN20",LM="http://www.omg.org/spec/BPMN/20100524/MODEL",IM="bpmn",BM=[],NM=[{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"}]}],$M=[{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"}]}],FM={tagAlias:"lowerCase",typePrefix:"t"},jM={name:DM,uri:LM,prefix:IM,associations:BM,types:NM,enumerations:$M,xml:FM},HM="BPMNDI",zM="http://www.omg.org/spec/BPMN/20100524/DI",GM="bpmndi",VM=[{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"]}],WM=[{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"}]}],UM=[],qM={name:HM,uri:zM,prefix:GM,types:VM,enumerations:WM,associations:UM},YM="DC",KM="http://www.omg.org/spec/DD/20100524/DC",XM="dc",ZM=[{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}]}],JM=[],QM={name:YM,uri:KM,prefix:XM,types:ZM,associations:JM},eC="DI",tC="http://www.omg.org/spec/DD/20100524/DI",nC="di",iC=[{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"}]}],oC=[],rC={tagAlias:"lowerCase"},aC={name:eC,uri:tC,prefix:nC,types:iC,associations:oC,xml:rC},sC="bpmn.io colors for BPMN",cC="http://bpmn.io/schema/bpmn/biocolor/1.0",lC="bioc",uC=[{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"}]}],pC=[],dC=[],fC={name:sC,uri:cC,prefix:lC,types:uC,enumerations:pC,associations:dC},hC="BPMN in Color",gC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",mC="color",yC=[{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"}]}],vC=[],xC=[],bC={name:hC,uri:gC,prefix:mC,types:yC,enumerations:vC,associations:xC};const wC={bpmn:jM,bpmndi:qM,dc:QM,di:aC,bioc:fC,color:bC};function Hm(e,t){const n=J({},wC,e);return new Kc(n,t)}const _C={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"}},gs={[wm]:_C,[$p]:hm};function zm(){return Hm(gs)}const Gm=zm();async function va(e){const{rootElement:t,warnings:n}=await Gm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function EC(e){const{xml:t}=await Gm.toXML(e,{format:!0});return t}function ud(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Qi={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Vm=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function SC(e){return Vm.test(e)}function RC(e){const t=Qi;return Vm.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 Br(e,t){let n=0;for(const i of e)n+=t*RC(i);return n}function Wm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&MC(e),CC(e),AC(e),TC(e)}function MC(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:Br(o,r),fontBoundingBoxAscent:r*Qi.ascentEm,fontBoundingBoxDescent:r*Qi.descentEm,actualBoundingBoxAscent:r*Qi.ascentEm,actualBoundingBoxDescent:r*Qi.descentEm}}};t.getContext=()=>n}function CC(e){if(e.SVGMatrix)return;class t{constructor(){an(this,"a",1);an(this,"b",0);an(this,"c",0);an(this,"d",1);an(this,"e",0);an(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 AC(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),d=Math.sin(u);a.a=p,a.b=d,a.c=-d,a.d=p,a.e=c-p*c+d*l,a.f=l-d*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 TC(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:Br(n,12),height:14}})}const Xc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),PC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),kC=1,Zc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),OC=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}`;case"merge-before-predecessor":return`mb|${e.merge}|${e.edge}`}}const Um=20,Jc=5,qm=3,DC=8,xa=15,pd=50,Ym=12,LC=Ym*1.2;function dd(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Br(r,Ym))),o=n.length*LC;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Km=1;function sn(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 Nr(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 sn(e))for(const s of sn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Km)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>=Um&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function fd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Xm(e,t){const n=Nr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function IC(e,t){let n=0;for(const i of t)i.id!==e.id&&Xm(e,i)&&n++;return n}function Jn(e,t){let n=0;for(const i of t)i.id!==e.id&&Nr(e,i)&&n++;return n}const Zm=15,Jm=20;function BC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Jm||t.at>n[1]+Jm)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 hd=20;function Qc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Km)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<Um||n.push([o-hd,r+hd])}return n}function el(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of sn(e)){const r=BC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Qc(o,sn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const NC=10,$C=1,FC=(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 jC(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 d=(f,m)=>{if(m===0)return f<=0;const g=f/m;if(m>0){if(g>p)return!1;g>u&&(u=g)}else{if(g<u)return!1;g<p&&(p=g)}return!0};return d(o-e.x,c)&&d(e.x-a,-c)&&d(r-e.y,l)&&d(e.y-s,-l)&&p>u}function gd(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 HC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ba=1;function ji(e,t){const n=e.x+ba,i=e.x+e.width-ba,o=e.y+ba,r=e.y+e.height-ba;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 wa(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 Qm(e,t){const n=e.label;if(!n)return null;if(sn(e).some(i=>ji(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(sn(i).some(o=>ji(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(wa(i).some(o=>ji(n,o)))return i.id;return null}function Ot(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(jC(e.waypoints[r],e.waypoints[r+1],o,OC)){i.push(o);break}}return i}const ms=(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))},zC=(e,t,n,i)=>ty(e,t,n,i)?0:Math.min(ms(e,n,i),ms(t,n,i),ms(n,e,t),ms(i,e,t)),ey=(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 bo(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,ms({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(ey(e,s)||ey(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,zC(e,t,s[l],s[(l+1)%s.length]));return c}function ty(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 md=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ny(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(ty(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ys(e,t){let n=0;for(const i of t)i.id===e.id||md(e,i)||ny(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id===e.id||md(e,i)||ys(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function iy(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++)ys(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function eo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ys(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 _i(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(md(n[i],n[o])&&ny(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 oy(e){const t=eo(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:GC(e)}}function GC(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 ry(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Zc.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 ay(e){var n;const t=(n=Ut(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ut(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 sy=e=>e?{members:e}:{},Dn=e=>e.shapes.filter(t=>!t.container);function VC(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 WC(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 cy(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(sn(i).some(o=>ji(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(wa(i).some(o=>ji(n,o)))return i.id;return null}function Yo(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 ly=3;function uy(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 vs(e,t){const n=[];for(const i of t.shapes){if(i.container||Zc.has(i.type))continue;const o=uy(e,i);o>=ly&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function yd(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function UC(e){const t=e.edges.filter(s=>s.type==="bpmn:SequenceFlow"&&!!s.source&&!!s.target),n=new Map,i=new Map;for(const s of t)n.set(s.source,[...n.get(s.source)??[],s.target]),i.set(s.target,[...i.get(s.target)??[],s.source]);const o=(s,c)=>{const l=new Set([s]),u=[s];for(;u.length;)for(const p of c.get(u.pop())??[])l.has(p)||(l.add(p),u.push(p));return l},r=new Map(e.shapes.map(s=>[s.id,s])),a=[];for(const[s,c]of i){const l=r.get(s);if(!l)continue;const u=o(s,n),p=[...new Set(c)].filter(f=>!u.has(f)&&r.has(f));if(p.length<2)continue;const d=p.map(f=>o(f,i));if([...d[0]].some(f=>d.every(m=>m.has(f)))){for(const f of p)if(!(l.x+l.width/2>=r.get(f).x))for(const m of t)m.source===f&&m.target===s&&a.push({kind:"merge-before-predecessor",merge:s,edge:m.id})}}return a}function ft(e,t={}){const n=[],i=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const v of Ot(h,i))n.push({kind:"edge-crosses-shape",edge:h.id,shape:v.id});const o=e.shapes.filter(h=>h.container&&PC.has(h.type));if(o.length){const h=(v,b)=>{const E=e.shapes.find(M=>M.id===b);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const b of Ot(v,o))v.endpoints.includes(b.id)||v.endpoints.some(E=>h(b,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}for(const h of e.edges){if(h.waypoints.length<2)continue;const v=[[h.source,h.waypoints[0]],[h.target,h.waypoints[h.waypoints.length-1]]];for(const[b,E]of v){if(!b)continue;const M=e.shapes.find(N=>N.id===b);if(!M||M.container)continue;const B=Math.max(M.x-E.x,E.x-(M.x+M.width),0),P=Math.max(M.y-E.y,E.y-(M.y+M.height),0),k=Math.hypot(B,P);k>NC&&n.push({kind:"edge-endpoint-detached",edge:h.id,shape:b,distance:Math.round(k)})}}for(const h of yd(e.shapes))n.push({kind:"pool-overlap",...h});const r=i.filter(h=>!h.attached);for(let h=0;h<r.length;h++)for(let v=h+1;v<r.length;v++){const b=r[h],E=r[v];if(!gd(b,E,kC))continue;const M=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:"shape-overlap",shapes:M,identical:HC(b,E)})}const a=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<a.length;h++)for(let v=h+1;v<a.length;v++){const b=a[h],E=a[v],M=Math.min(b.x+b.width,E.x+E.width)-Math.max(b.x,E.x),B=Math.min(b.y+b.height,E.y+E.height)-Math.max(b.y,E.y);if(M<=Jc||B<=Jc)continue;const P=b.id<E.id?[b.id,E.id]:[E.id,b.id],k=new Set(E.members);if(b.members.some(G=>k.has(G))){const G=ry(e,a,{x:Math.max(b.x,E.x),y:Math.max(b.y,E.y),right:Math.min(b.x+b.width,E.x+E.width),bottom:Math.min(b.y+b.height,E.y+E.height)});G.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:G});continue}const N=b.x<=E.x&&b.y<=E.y&&b.x+b.width>=E.x+E.width&&b.y+b.height>=E.y+E.height?b.id:E.x<=b.x&&E.y<=b.y&&E.x+E.width>=b.x+b.width&&E.y+E.height>=b.y+b.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:P,...N?{container:N}:{}})}const s=new Set(a.flatMap(h=>[...h.members])),c=h=>e.shapes.filter(v=>!v.container&&!Zc.has(v.type)&&v.x>=h.x&&v.y>=h.y&&v.x+v.width<=h.x+h.width&&v.y+v.height<=h.y+h.height);for(const h of a){const v=c(h);if(!v.length)continue;const b=new Set(h.members),E=v.filter(M=>!b.has(M.id));E.some(M=>s.has(M.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:E.map(M=>M.id).sort()}))}for(const h of a){const v=new Set(c(h).map(k=>k.id)),b=new Set(h.members),E=new Set([...v].filter(k=>!b.has(k)&&s.has(k)));if(!E.size)continue;let M=!1,B=!1,P=!1;for(const k of e.edges){if(k.type!=="bpmn:SequenceFlow"||!k.source||!k.target)continue;const N=E.has(k.source),G=E.has(k.target);!N&&G&&!v.has(k.source)?M=!0:N&&!G&&!v.has(k.target)?B=!0:N&&G&&(P=!0)}M&&B&&P&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...E].sort()})}const l=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<l.length;h++)for(let v=h+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const E=[l[h],l[v],l[b]],M={x:Math.max(...E.map(k=>k.x)),y:Math.max(...E.map(k=>k.y)),right:Math.min(...E.map(k=>k.x+k.width)),bottom:Math.min(...E.map(k=>k.y+k.height))};if(M.right-M.x<=Jc||M.bottom-M.y<=Jc)continue;const B=ry(e,[],M);if(!B.length)continue;const P=E.map(k=>k.id).sort();n.push({kind:"group-stack-unreadable",groups:P,shapes:B})}for(const h of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Zc.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[E,M,B,P,k]of b){const N=B==="h"?v.x:v.y,G=B==="h"?v.x+v.width:v.y+v.height;if(!(N<k&&P<G))continue;const q=B==="h"?v.y:v.x,Y=B==="h"?v.y+v.height:v.x+v.width;if(!(q<M&&M<Y))continue;const ae=Math.min(M-q,Y-M);ae<DC||n.push({kind:"group-cuts-shape",group:h.id,shape:v.id,side:E,depth:ae})}}const u=t.includeObservationOnly?e.shapes.filter(h=>h.type==="bpmn:Group"&&h.width>0&&h.height>0):[];if(u.length){const h=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 b=sn(v);if(b.length)for(const E of u){const M=E.x+E.width,B=E.y+E.height,P=v.endpoints.some(N=>{const G=h.get(N);return!!G&&E.x<G.x&&G.x<M&&E.y<G.y&&G.y<B});let k=null;for(const N of b){const[G,q,Y]=N.axis==="v"?[E.y,B,[["left",E.x],["right",M]]]:[E.x,M,[["top",E.y],["bottom",B]]],ae=Math.min(N.hi,q)-Math.max(N.lo,G);if(ae<pd)continue;const X=N.axis==="v"?E.x<N.at&&N.at<M:E.y<N.at&&N.at<B;if(!(X&&P))for(const[Me,Te]of Y){const Pe=Math.abs(N.at-Te);Pe<=xa&&(!k||Pe<k.distance)&&(k={side:Me,inside:X,distance:Pe,length:ae})}}k&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:k.side,inside:k.inside,distance:Math.round(k.distance),length:Math.round(k.length)})}}}const p=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const b=h.x<v.x+v.width&&v.x<h.x+h.width,E=h.y<v.y+v.height&&v.y<h.y+h.height,M=[["top",h.y,v.y,b],["bottom",h.y+h.height,v.y+v.height,b],["left",h.x,v.x,E],["right",h.x+h.width,v.x+v.width,E]];for(const[B,P,k,N]of M)N&&Math.abs(P-k)<=qm&&n.push({kind:"group-on-container-boundary",group:h.id,container:v.id,side:B})}const d=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<d.length;h++)for(let v=h+1;v<d.length;v++){const b=d[h],E=d[v],M=b.x<E.x+E.width&&E.x<b.x+b.width,B=b.y<E.y+E.height&&E.y<b.y+b.height,P=[["x",b.x+b.width,E.x,B],["x",E.x+E.width,b.x,B],["y",b.y+b.height,E.y,M],["y",E.y+E.height,b.y,M]];for(const[k,N,G,q]of P)if(q&&Math.abs(N-G)<=qm){n.push({kind:"group-on-group-boundary",groups:b.id<E.id?[b.id,E.id]:[E.id,b.id],axis:k});break}}for(let h=0;h<e.edges.length;h++)for(let v=h+1;v<e.edges.length;v++){const b=e.edges[h],E=e.edges[v],M=Nr(b,E);if(!M)continue;const B=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:M.kind==="opposite"?"edge-overlap-opposite":M.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:B,axis:M.axis,length:Math.round(M.length)})}for(const h of e.edges){if(!h.label)continue;const v=el(h,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:h.id,other:v.other,axis:v.axis})}for(const h of e.edges){if(!h.label)continue;const v=Qm(h,e);v&&n.push({kind:"label-over-line",edge:h.id,line:v})}if(t.includeObservationOnly){for(const h of e.edges)if(!(!h.label||h.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:b}of vs(h.label,e))n.push({kind:"label-over-shape",edge:h.id,shape:v,depth:Math.round(b)})}t.includeObservationOnly&&n.push(...UC(e));const f=new Set(i.map(h=>h.id)),m=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...i,...m.filter(v=>!f.has(v.id))]){if(!h.label)continue;const v=cy(h,e);v&&n.push({kind:"label-over-line",edge:h.id,line:v})}const g=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of m)for(const{owner:v,rect:b}of Yo(e))v===h.id||g.has(v)||gd(h.label,b,ba)&&n.push({kind:"pool-name-over-label",pool:h.id,label:v});const y=Yo(e);for(const h of i)if(h.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of y)v!==h.id&&gd(h,b,ba)&&n.push({kind:"annotation-over-label",annotation:h.id,label:v});const _=new Map(e.shapes.map(h=>[h.id,h]));for(const h of i){const v=h.parent??VC(h,e,_);if(!v)continue;const b=_.get(v);!b||!b.container||FC(b,h,$C)||h.type==="bpmn:TextAnnotation"&&!WC(h,b,e)||n.push({kind:"shape-outside-container",shape:h.id,container:b.id})}return n.sort((h,v)=>ct(h).localeCompare(ct(v)))}const Ut=e=>typeof e=="object"&&e!==null?e:void 0,tn=e=>typeof e=="number"?e:0,wo=e=>{const t=Ut(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function qC(e){const t=Ut(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=wo(r);a&&n.push(a)}}return n}function YC(e){const t=Ut(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:wo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:wo(t.targetRef);return n&&i?{source:n,target:i}:{}}function KC(e,t){const n=Ut(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=wo(n);return o?t.get(o):void 0}if(Xc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return wo(n)}function py(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ut(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ut(e))==null?void 0:s.rootElements)??[]){const d=Ut(p);if((d==null?void 0:d.$type)==="bpmn:Collaboration")for(const f of d.participants??[]){const m=Ut(f),g=wo(m),y=wo(m==null?void 0:m.processRef);g&&y?o.set(y,g):g&&r.add(g)}}for(const p of i){const d=Ut((c=Ut(p))==null?void 0:c.plane),f=(d==null?void 0:d.planeElement)??[];for(const m of f){const g=Ut(m);if(!g)continue;const y=Ut(g.bpmnElement),_=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!_)continue;const h=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",v=Ut(g.bounds);if(v){const E=g.isExpanded===!1&&h!=="bpmn:Participant",M=Ut((l=Ut(g.label))==null?void 0:l.bounds),B={id:_,type:h,x:tn(v.x),y:tn(v.y),width:tn(v.width),height:tn(v.height),container:Xc.has(h)&&!E,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:KC(y,o)}:{},...M?{label:{x:tn(M.x),y:tn(M.y),width:tn(M.width),height:tn(M.height)}}:{},...h==="bpmn:Group"?sy(ay(y)):{}},P=g.isHorizontal!==!1,k=typeof(y==null?void 0:y.name)=="string"?y.name:"";r.has(_)&&P&&k&&(B.label=dd(B,k)),t.push(B);continue}const b=g.waypoint;if(Array.isArray(b)){const E=Ut((u=Ut(g.label))==null?void 0:u.bounds);n.push({id:_,type:h,waypoints:b.map(M=>{var B,P;return{x:tn((B=Ut(M))==null?void 0:B.x),y:tn((P=Ut(M))==null?void 0:P.y)}}),endpoints:qC(y),...YC(y),...E?{label:{x:tn(E.x),y:tn(E.y),width:tn(E.width),height:tn(E.height)}}:{}})}}}return{shapes:t,edges:n}}function dy(e){return ft(py(e),{includeObservationOnly:!0})}async function XC(e){const{definitions:t,warnings:n}=await va(e);return{findings:dy(t),warnings:n}}function Ge(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 g=Ut(r.label),y=wo(r.source),_=wo(r.target);n.push({id:r.id,type:a,waypoints:s.map(h=>({x:tn(h.x),y:tn(h.y)})),endpoints:[y,_].filter(h=>!!h),...y&&_?{source:y,target:_}:{},...g&&typeof g.x=="number"?{label:{x:g.x,y:tn(g.y),width:tn(g.width),height:tn(g.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ut(r.businessObject),l=Ut(r.label);let u=Ut(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Ut(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",d=u&&Xc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,f={id:r.id,type:a,x:r.x,y:r.y,width:tn(r.width),height:tn(r.height),container:Xc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...d!==void 0?{parent:d}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:tn(l.y),width:tn(l.width),height:tn(l.height)}}:{},...a==="bpmn:Group"?sy(ay(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=Ut(r.di))==null?void 0:i.isHorizontal)!==!1&&(f.label=dd(f,m)),t.push(f)}return{shapes:t,edges:n}}const ZC={"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 JC(e,t){const n=ZC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function fy(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function hy(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 JC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&fy(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?fy(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 Np(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Vo(i.businessObject).map(o=>o.locale)}}}const $r=20,QC=4,Ve=(e,t)=>Math.abs(e-t)<.5,eA=15;function vd(e,t,n){let i=1/0;for(const o of t)if(!n.includes(o.id))for(let r=1;r<e.length;r++)i=Math.min(i,bo(e[r-1],e[r],o));return i}function tA(e,t,n=eA){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=Ve(i.x,o.x)&&!Ve(i.y,o.y),a=Ve(i.y,o.y)&&!Ve(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=_=>{const h=_?t.find(v=>v.id===_):void 0;return h?r?[h.x+10,h.x+h.width-10]:[h.y+10,h.y+h.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),m=Math.min(u,d);if(!(m>=f))return[];const g=r?i.x:i.y,y=[];for(let _=5;_<=400;_+=5)for(const h of[-1,1]){const v=g+h*_;if(v<f||v>m)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Ot({...e,waypoints:b},t).length||vd(b,t,s)<n||y.push(b)}return y}function xd(e,t,n,i){const o=e.edges.filter(d=>d.id!==t.id),r={...t,waypoints:n},a={...t,waypoints:[...i]};if(Gn(r,o)>Gn(a,o)||Jn(r,o)>Jn(a,o))return!1;const s=`L|${t.id}|${t.id}`,c=d=>ft({...e,edges:e.edges.map(f=>f.id===t.id?{...f,waypoints:d}:f)}).filter(f=>ct(f)!==s),l=c(n),u=`"${t.id}"`;if(l.some(d=>JSON.stringify(d).includes(u)))return!1;const p=new Set(c([...i]).map(ct));return l.every(d=>p.has(ct(d)))}function gy(e,t,n,i){for(const o of tA(t,n))if(xd(e,t,o,i))return o;return null}const nA=120;function my(e,t,n,i,o){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return[];const r=t.find(c=>c.id===e.endpoints[0]),a=t.find(c=>c.id===e.endpoints[1]);if(!r||!a)return[];if(a.x<r.x+r.width)return[];if(Math.min(r.y+r.height,a.y+a.height)-Math.max(r.y,a.y)<10)return[];const s=[];for(const[c,l]of[[0,0],[0,-25],[0,25],[-25,0],[25,0]])for(let u=$r;u<=nA;u+=5)for(const p of["top","bottom"]){const d=p==="top"?r.y:r.y+r.height,f=p==="top"?a.y:a.y+a.height,m=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,g=r.x+r.width/2+c,y=a.x+a.width/2+l,_=[{x:g,y:d},{x:g,y:m},{x:y,y:m},{x:y,y:f}];if(!rl(_,i)||Ot({...e,waypoints:_},t).length||Ot({...e,endpoints:[],waypoints:_},[r,a]).length||vd(_,t,e.endpoints)<$r)continue;const h=Ad(_,n);(o===void 0?h<Cd:h>=Cd||h<o)||s.push(_)}return s}function yy(e,t,n,i,o){const r=e.shapes.filter(c=>c.type==="bpmn:Participant"||c.type==="bpmn:Lane"),a=vy(e,t,i,my(t,n,r,o));if(a)return a;const s=Math.max(Ad(i,r),$r);return vy(e,t,i,my(t,n,r,o,s))}function vy(e,t,n,i){const o=new Map;for(const c of i){const l=c[1].y<c[0].y?"top":"bottom";if(!o.has(l)&&(xd(e,t,c,n)&&o.set(l,c),o.size===2))break}const r=e.edges.filter(c=>c.id!==t.id);let a=null,s=1/0;for(const c of["top","bottom"]){const l=o.get(c);if(!l)continue;const u=Gn({...t,waypoints:l},r);u<s&&(a=l,s=u)}return a}function tl(e,t,n,i=$r){if(Ve(e.y,t.y)&&!Ve(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(Ve(e.x,t.x)&&!Ve(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 xy(e,t,n,i=$r){if(n.length<2)return null;if(Ve(e.y,t.y)&&!Ve(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(f=>f.x))-i,s=Math.max(...n.map(f=>f.x+f.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(f=>f.y))-i,p=Math.max(...n.map(f=>f.y+f.height))+i,d=f=>[{x:c,y:e.y},{x:c,y:f},{x:l,y:f},{x:l,y:e.y}];return[d(u),d(p)]}if(Ve(e.x,t.x)&&!Ve(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(f=>f.y))-i,s=Math.max(...n.map(f=>f.y+f.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(f=>f.x))-i,p=Math.max(...n.map(f=>f.x+f.width))+i,d=f=>[{x:e.x,y:c},{x:f,y:c},{x:f,y:l},{x:e.x,y:l}];return[d(u),d(p)]}return null}function by(e,t,n=$r){if(e.length!==4)return null;const[i,o,r,a]=e;if(Ve(i.y,o.y)&&Ve(o.x,r.x)&&Ve(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(Ve(i.x,o.x)&&Ve(o.y,r.y)&&Ve(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 nl(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 il=30,iA=[0,-25,25,-40,40];function oA(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(d=>d.id===e.endpoints[0]),i=t.find(d=>d.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+il:s-il,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return iA.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Ot({...e,endpoints:[],waypoints:d},[n]).length===0)}const bd=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Fr=(e,t,n)=>Ot({...e,waypoints:t},n).length,rA=25;function wy(e,t,n){const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return{x:t.x+a*i,y:t.y+a*o}}function aA(e,t,n,i){const r=(d,f,m)=>(f.x-d.x)*(m.y-d.y)-(f.y-d.y)*(m.x-d.x),a=r(n,i,e),s=r(n,i,t);if(Math.abs(a)<1e-6&&Math.abs(s)<1e-6){const d=wy(i,e,t),f=wy(d,n,i);return Math.hypot(d.x-f.x,d.y-f.y)<1e-6?d:null}const c=r(e,t,n),l=r(e,t,i);if(a*s>1e-6||c*l>1e-6)return null;const u=(e.x-t.x)*(n.y-i.y)-(e.y-t.y)*(n.x-i.x);if(Math.abs(u)<1e-6)return null;const p=((e.x-n.x)*(n.y-i.y)-(e.y-n.y)*(n.x-i.x))/u;return{x:e.x+p*(t.x-e.x),y:e.y+p*(t.y-e.y)}}function sA(e,t,n){let i=0;for(const o of n){if(o.id===t.id||o.waypoints.length<2||o.target!==void 0&&o.target===t.target)continue;const r=o.waypoints[o.waypoints.length-1],a=o.waypoints[o.waypoints.length-2];for(let s=0;s+1<e.length;s++){const c=aA(e[s],e[s+1],a,r);if(c&&Math.hypot(c.x-r.x,c.y-r.y)<=rA){i++;break}}}return i}function ol(e,t,n,i){let o=[...e.waypoints],r=Fr(e,o,t);if(r===0)return null;let a=!1;for(const p of nl(e,t))if(Fr(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(sn),c=p=>sn({...e,waypoints:p}).some(d=>Qc(d,s).length>0),l=oA(e,t).filter(p=>Fr(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(d=>d.x>=n.x&&d.x<=n.x+n.width&&d.y>=n.y&&d.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(f=>f.id===e.endpoints[0]),d=t.find(f=>f.id===e.endpoints[1]);if(p&&d&&Ve(p.y+p.height/2,d.y+d.height/2)){const f=[o[0],o[o.length-1]];if(Ve(f[0].y,f[1].y)&&!Ve(f[0].x,f[1].x)){const m=t.filter(h=>!e.endpoints.includes(h.id)&&Ot({...e,waypoints:f},[h]).length>0),g=m.length>=2?xy(f[0],f[1],m):null,_=(g?g.map(h=>[f[0],...h,f[1]]):m.length===1?(tl(f[0],f[1],m[0])??[]).map(h=>[f[0],...h,f[1]]):m.length===0?[f]:[]).filter(h=>Fr(e,h,t)===0&&h.length<=o.length).sort((h,v)=>Number(u(v))-Number(u(h)));if(_.length)return _.find(h=>!c(h))??_[0]}}}for(let p=0;p+1<o.length;p++){const d=o[p],f=o[p+1],m=t.filter(_=>!e.endpoints.includes(_.id)&&Ot({...e,waypoints:[d,f]},[_]).length>0);if(m.length<2)continue;const g=xy(d,f,m);if(!g)continue;const y=g.map(_=>bd(o,p,_)).filter(_=>Fr(e,_,t)===0).sort((_,h)=>Number(u(h))-Number(u(_)));if(y.length)return y.find(_=>!c(_))??y[0]}for(let p=0;p<QC&&r>0;p++){let d=!1;for(let f=0;f+1<o.length&&!d;f++){const m=o[f],g=o[f+1];for(const y of t){if(e.endpoints.includes(y.id)||Ot({...e,waypoints:[m,g]},[y]).length===0)continue;const _=tl(m,g,y),v=[...(by(o,y)??[]).map((E,M)=>({pts:E,k:M,cross:Fr(e,E,t),tip:sA(E,e,i??[])})).sort((E,M)=>E.cross-M.cross||E.tip-M.tip||E.k-M.k).map(E=>E.pts),..._?_.map(E=>bd(o,f,E)):[]];if(!v.length)continue;const b=[...v].sort((E,M)=>Number(u(M))-Number(u(E)));for(const E of b){const M=Fr(e,E,t);if(M<r){o=E,r=M,d=!0,a=!0;break}}if(d)break}}if(!d)break}return a&&r===0?o:null}function wd(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=Dn(r),s=new Set,c=ft(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(d=>d.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const d=i.get(u);if(!d)continue;const f=d.parent,m=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,g=Ot(p,a);if(!n&&g.length&&g.every(M=>M.type==="bpmn:TextAnnotation")){s.add(u);continue}let y=ol(p,a,m,r.edges);const _=gy(r,p,a,y??p.waypoints);_&&(y=_);const h=yy(r,p,a,y??p.waypoints,m);if(h&&Gn({...p,waypoints:h},r.edges.filter(M=>M.id!==u))===0&&(y=h),!y){g.some(M=>M.type==="bpmn:TextAnnotation")&&s.add(u);continue}const v=r.edges.filter(M=>M.id!==u),b=Jn(p,v);Jn({...p,waypoints:y},v)>b||o.updateWaypoints(d,y)}return s}function cA(e,t,n,i){var f,m;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=g=>{const y=Ge(r);return[...eo(y),..._i(y)].filter(([_,h])=>_===g||h===g).length},c=(g,y)=>g.kind==="label-over-line"||g.kind==="label-over-shape"||g.kind==="label-on-shared-segment"?g.edge===y:g.kind==="annotation-over-label"||g.kind==="pool-name-over-label"?g.label===y:!1,l=g=>new Set(ft(Ge(r)).filter(y=>!c(y,g)).map(ct)),u=(g,y)=>Math.abs(g-y)<=1,p=(g,y,_,h,v)=>{const b=Dn(Ge(r));for(let E=0;E+3<g.length;E++){const[M,B,P,k]=[g[E],g[E+1],g[E+2],g[E+3]],N=u(M.y,k.y)&&u(M.x,B.x)&&u(P.x,k.x)&&u(B.y,P.y)&&Math.abs(B.y-M.y)>=5,G=u(M.x,k.x)&&u(M.y,B.y)&&u(P.y,k.y)&&u(B.x,P.x)&&Math.abs(B.x-M.x)>=5;if(!N&&!G)continue;const q={waypoints:[M,k],endpoints:_};if(Ot(q,[y]).length&&!Ot(q,b).length)return E}return-1},d=(g,y)=>[...g.slice(0,y+1),...g.slice(y+3)].filter((_,h,v)=>h===0||h===v.length-1||!(u(v[h-1].x,_.x)&&u(v[h+1].x,_.x)||u(v[h-1].y,_.y)&&u(v[h+1].y,_.y)));for(const g of t){const y=r.get(g.id);if(!y)continue;const _=new Set([...y.incoming??[],...y.outgoing??[]].map(b=>b.id)),h={...g,type:y.type,container:!1,attached:!1},v=r.getAll().filter(b=>{var E;return(b.type==="bpmn:SequenceFlow"||b.type==="bpmn:MessageFlow")&&n.has(b.id)&&!i.has(b.id)&&!_.has(b.id)&&(((E=b.waypoints)==null?void 0:E.length)??0)>=4}).sort((b,E)=>b.id.localeCompare(E.id));for(const b of v){const E=[(f=b.source)==null?void 0:f.id,(m=b.target)==null?void 0:m.id].filter(M=>!!M);for(;;){const M=b.waypoints.map(X=>({x:X.x,y:X.y})),B=p(M,h,E,b.id,b.type);if(B<0)break;const P=b.label,k=P&&{x:P.x,y:P.y},N=l(b.id),G=s(b.id);if(a.updateWaypoints(b,d(M,B)),P&&k){const X={x:k.x+P.width/2,y:k.y+P.height/2},Me=(Pe,fe)=>{const z=fe.x-Pe.x,se=fe.y-Pe.y,V=z*z+se*se,Z=V===0?0:Math.max(0,Math.min(1,((X.x-Pe.x)*z+(X.y-Pe.y)*se)/V));return Math.hypot(X.x-(Pe.x+Z*z),X.y-(Pe.y+Z*se))};let Te=0;for(let Pe=1;Pe+1<M.length;Pe++)Me(M[Pe],M[Pe+1])<Me(M[Te],M[Te+1])&&(Te=Pe);(Te<B||Te>B+2)&&(P.x!==k.x||P.y!==k.y)&&a.moveElements([P],{x:k.x-P.x,y:k.y-P.y})}const q=l(b.id),Y=[...q].filter(X=>!N.has(X)).length,ae=[...N].filter(X=>!q.has(X)).length;if(Y<=ae&&s(b.id)<=G){o.add(b.id);continue}a.updateWaypoints(b,M),P&&k&&(P.x!==k.x||P.y!==k.y)&&a.moveElements([P],{x:k.x-P.x,y:k.y-P.y});break}}}return o}const lA=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 xs(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 rl=(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),_d=(e,t)=>ys(e,[t])>0;function _y(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=Dn(r);let s=r;const c=new Set(ft(r).map(ct));for(const[l,u]of eo(r))if(!t.has(`${l}|${u}`))for(const[p,d]of[[l,u],[u,l]]){if(n.has(p))continue;const f=s.edges.find(B=>B.id===p),m=s.edges.find(B=>B.id===d);if(!f||!m)continue;const g=i.get(p);if(!g)continue;const y=xs(g),_=lA(m),h=[...nl(f,a)??[]],v=ol(f,[...a,..._],y,r.edges);v&&h.push(v);for(let B=0;B+1<f.waypoints.length;B++)for(const P of _)for(const k of tl(f.waypoints[B],f.waypoints[B+1],P)??[])h.push(bd(f.waypoints,B,k));const b=s.edges.filter(B=>B.id!==p),E=B=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:B}:P)}),M=h.find(B=>{const P={...f,waypoints:B};return _d(P,m)||!rl(B,y)||b.some(k=>k.id!==d&&!_d(f,k)&&_d(P,k))?!1:ft(E(B)).every(k=>c.has(ct(k)))});if(M){o.updateWaypoints(g,M),s=E(M);break}}}const uA=["top","bottom","left","right"],Ey={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},bs=20,pA=20;function dA(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&&Ve(e.y,t.y)&&o.push("top"),n&&Ve(e.y,t.y+t.height)&&o.push("bottom"),i&&Ve(e.x,t.x)&&o.push("left"),i&&Ve(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const fA=(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 Sy(e,t,n,i){const o=Ey[t],r=Ey[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],m=r[p];if(Ve(e[d],n[d]))return f===-m&&f*(n[p]-e[p])>=bs?[e,n]:null;let g;if(f===-m){const _=e[p]+f*bs,h=n[p]-f*bs;if(f*(h-_)<0)return null;g=Math.round((e[p]+n[p])/2)}else g=f>0?Math.max(e[p],n[p])+il:Math.min(e[p],n[p])-il;const y=(_,h)=>a?{x:h,y:_}:{x:_,y:h};return[e,y(g,e[d]),y(g,n[d]),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>=bs&&u>=bs?[e,c,n]:null}function hA(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?dA(a,r):null;if(!s)return[];const c=[];for(const l of uA){const u=fA(t,l),p=o?Sy(u,l,a,s):Sy(a,s,u,l);p&&c.push(p)}return c}const Ry=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 gA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ft(r).map(ct));let c=r;for(const[l,u]of _i(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(k=>k.id===l),d=c.edges.find(k=>k.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!_i({edges:[p,d]}).length)continue;const f=p.endpoints.find(k=>d.endpoints.includes(k)),m=f?a.get(f):void 0;if(!m||m.container)continue;const g=i.get(l),y=i.get(u);if(!g||!y)continue;const _=k=>n.has(k.id)?[k.waypoints]:[k.waypoints,...hA(k,m,a)],h=k=>k.length-2,v=_(p).flatMap(k=>_(d).map(N=>({pa:k,pb:N}))).filter(({pa:k,pb:N})=>k!==p.waypoints||N!==d.waypoints).map(k=>({...k,cost:Ry(k.pa)+Ry(k.pb)+pA*(h(k.pa)+h(k.pb))})).sort((k,N)=>k.cost-N.cost),b=xs(g),E=xs(y),M=_i(c).length,B=new Set(eo(c).map(([k,N])=>`${k}|${N}`)),P=v.find(({pa:k,pb:N})=>{const G={...p,waypoints:k},q={...d,waypoints:N};if(_i({edges:[G,q]}).length||Nr(G,q)||!rl(k,b)||!rl(N,E))return!1;const Y={...c,edges:c.edges.map(ae=>ae.id===l?G:ae.id===u?q:ae)};return _i(Y).length>=M||eo(Y).some(([ae,X])=>!B.has(`${ae}|${X}`))?!1:ft(Y).every(ae=>s.has(ct(ae)))});P&&(P.pa!==p.waypoints&&o.updateWaypoints(g,P.pa),P.pb!==d.waypoints&&o.updateWaypoints(y,P.pb),c={...c,edges:c.edges.map(k=>k.id===l?{...p,waypoints:P.pa}:k.id===u?{...d,waypoints:P.pb}:k)})}}const mA=40,yA=20;function vA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=_i(u);return{keys:new Set(ft(u).map(ct)),crossings:eo(u).length,shared:p.length,mine:p.filter(([d,f])=>d===l||f===l).length}},a=(l,u)=>{const p=Ge(i),d=p.edges.find(f=>f.id===l);return d?new Set(Ot({...d,waypoints:u},Dn(p)).map(f=>f.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,d=s(u)?u:s(p)?p:void 0;if(!d)continue;const f=d===u?p:u;if(!f||f.type==="bpmn:Participant")continue;const m=f.x+f.width/2;if(m>=d.x+10&&m<=d.x+d.width-10)continue;const g=m>d.x+d.width,y=d.y>f.y,_=y?f.y+f.height:f.y,h=y?d.y:d.y+d.height,v=Math.round((_+h)/2),b=N=>d===u?[...N].reverse():N,E=(l.waypoints??[]).map(N=>({x:N.x,y:N.y})),M=r(l.id),B=a(l.id,E)??new Set,P=g?d.x+d.width:d.x,k=d.x+d.width/2;for(let N=Math.min(mA,d.width/4);g?P-N>k:P+N<k;N+=yA){const G=Math.round(g?P-N:P+N),q=b([{x:m,y:_},{x:m,y:v},{x:G,y:v},{x:G,y:h}]),Y=a(l.id,q);if(!Y||[...Y].some(X=>!B.has(X)))continue;o.updateWaypoints(l,q);const ae=r(l.id);if(ae.crossings<=M.crossings&&ae.shared<=M.shared&&ae.mine<=M.mine&&[...ae.keys].every(X=>M.keys.has(X)))break;o.updateWaypoints(l,E)}}}const xA=10;function My(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 Cy(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(ae=>ae.type==="bpmn:Participant"&&ae.container),i=t.shapes.find(ae=>ae.id===e.endpoints[0]),o=t.shapes.find(ae=>ae.id===e.endpoints[1]);if(!i||!o)return null;const r=My(i,n),a=My(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(ae=>ae.id!==r.id&&ae.id!==a.id&&ae.y>=c.y+c.height&&ae.y+ae.height<=l.y).sort((ae,X)=>ae.y-X.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,m=(d.y+d.height+l.y)/2,g=s?f:m,y=s?m:f,_=e.waypoints[0],h=e.waypoints[e.waypoints.length-1],v=Dn(t),b=t.edges.filter(ae=>ae.id!==e.id),E=Gn(e,b),M=Ot(e,v).length;if(E===0&&M===0||M===0&&e.waypoints.length===2)return null;const B=Math.min(...u.map(ae=>ae.x)),P=Math.max(...u.map(ae=>ae.x+ae.width)),k=(_.x+h.x)/2,N=ae=>ae.filter((X,Me)=>Me===0||!(Ve(X.x,ae[Me-1].x)&&Ve(X.y,ae[Me-1].y)));let G,q;for(let ae=B;ae<=P;ae+=xA){const X=N([_,{x:_.x,y:g},{x:ae,y:g},{x:ae,y},{x:h.x,y},h]),Me={...e,waypoints:X};if(Ot(Me,v).length>0)continue;const Te=Gn(Me,b),Pe=Math.abs(ae-k);(!G||Te<G.cross||Te===G.cross&&Pe<G.detour)&&(G={pts:X,cross:Te,detour:Pe}),vd(X,v,e.endpoints)>=$r&&(!q||Te<q.cross||Te===q.cross&&Pe<q.detour)&&(q={pts:X,cross:Te,detour:Pe})}q&&G&&q!==G&&xd(t,e,q.pts,G.pts)&&(G=q);const Y=G&&(M>0?G.cross<=E:G.cross<E)?G.pts:null;if(M>0){const ae=gy(t,e,v,Y??e.waypoints);if(ae)return ae}return Y}const bA=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function wA(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ge(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Dn(a);for(const p of t.edges){if(!bA.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const d=i.get(p.id);if(!(d!=null&&d.waypoints)||((l=d.source)==null?void 0:l.id)!==p.source||((u=d.target)==null?void 0:u.id)!==p.target)continue;const f=r.get(p.source),m=r.get(p.target),g=s.get(p.source),y=s.get(p.target);if(!f||!m||!g||!y||!Ve(f.width,g.width)||!Ve(f.height,g.height)||!Ve(m.width,y.width)||!Ve(m.height,y.height))continue;const _=g.x-f.x,h=g.y-f.y;if(Ve(_,0)&&Ve(h,0)||!Ve(y.x-m.x,_)||!Ve(y.y-m.y,h))continue;const v=p.waypoints.map(M=>({x:M.x+_,y:M.y+h})),b=d.waypoints.map(M=>({x:M.x,y:M.y}));b.length===v.length&&b.every((M,B)=>Ve(M.x,v[B].x)&&Ve(M.y,v[B].y))||b.length===2&&(Ve(b[0].x,b[1].x)||Ve(b[0].y,b[1].y))&&Ot({...p,waypoints:b},c).length===0||Ot({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function Ay(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ge(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Cy(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Ed=20,Ty=10,Hi=10,Sd=40,_A=6,EA=40,Py=50;function SA(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=_A})}function Rd(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(Ve(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function RA(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function Md(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Ty;o<=n-t;o+=Ty)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function MA(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,d=t.x+t.width/2,f=(X,Me)=>Me>X.x+Hi&&Me<X.x+X.width-Hi,m=(X,Me)=>X.width<=2*Sd?X.x+X.width/2:Math.min(Math.max(Me,X.x+Sd),X.x+X.width-Sd),g=Math.max(e.x,t.x)+Hi,y=Math.min(e.x+e.width,t.x+t.width)-Hi;if(g<=y){const X=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((g+y)/2);r.push([{x:X,y:l},{x:X,y:u}])}const _=s?m(t,p):d,h=a?m(e,d):p;if(!a&&!f(e,_)){const X=_<e.x?e.x:e.x+e.width;for(const Me of Md(e.y+e.height/2,e.y+Hi,e.y+e.height-Hi))r.push([{x:X,y:Me},{x:_,y:Me},{x:_,y:u}])}if(!s&&!f(t,h)){const X=h<t.x?t.x:t.x+t.width;for(const Me of Md(t.y+t.height/2,t.y+Hi,t.y+t.height-Hi))r.push([{x:h,y:l},{x:h,y:Me},{x:X,y:Me}])}const v=(X,Me)=>{if(Math.abs(Me-X)<2*Hi)return[];const Te=Math.min(X,Me)+Hi,Pe=Math.max(X,Me)-Hi;return Md(Math.round((X+Me)/2),Te,Pe)};if(!a&&n)for(const X of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:X},{x:_,y:X},{x:_,y:u}]);if(!s&&i)for(const X of v(u,c?i.y:i.y+i.height))r.push([{x:h,y:l},{x:h,y:X},{x:d,y:X},{x:d,y:u}]);const b=Math.min(h,_),E=Math.max(h,_),M=[];for(const[X,Me]of o.filter(Te=>Te.x<E&&Te.x+Te.width>b).map(Te=>[Te.y,Te.y+Te.height]).sort((Te,Pe)=>Te[0]-Pe[0])){const Te=M[M.length-1];Te&&X<=Te[1]?Te[1]=Math.max(Te[1],Me):M.push([X,Me])}const B=[];for(let X=1;X<M.length;X++)M[X][0]-M[X-1][1]>=EA&&B.push(Math.round((M[X-1][1]+M[X][0])/2));M.length&&B.push(M[0][0]-Py,M[M.length-1][1]+Py);const P=(X,Me)=>Me<X.y?X.y:Me>X.y+X.height?X.y+X.height:void 0,k=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(X=>!!X)),N=e.y+e.height/2,G=t.y+t.height/2,q=G>N?1:-1,Y=(X,Me,Te)=>o.some(Pe=>!k.has(Pe.id)&&Pe.x<X&&X<Pe.x+Pe.width&&Pe.y<Math.max(Me,Te)-1&&Pe.y+Pe.height>Math.min(Me,Te)+1),ae=[];for(const X of B){const Me=P(e,X),Te=P(t,X);Me===void 0||Te===void 0||(X-N)*q<0&&Y(h,Me,X)||(X-G)*q>0&&Y(_,Te,X)||ae.push({pts:[{x:h,y:Me},{x:h,y:X},{x:_,y:X},{x:_,y:Te}],len:Math.abs(X-Me)+(E-b)+Math.abs(Te-X)})}return{inPools:r,outside:ae.sort((X,Me)=>X.len-Me.len).map(X=>X.pts)}}function CA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(f=>[f.id,f.waypoints])),a=n.shapes.filter(f=>f.type==="bpmn:Participant"),s=f=>{let m=f;for(;m&&m.type!=="bpmn:Participant";)m=m.parent;return m==null?void 0:m.id},c=()=>{const f=Ge(i);return{keys:new Set(ft(f).map(ct)),crossings:eo(f).length,shared:_i(f).length}},l=(f,m)=>f.length===m.length&&f.every((g,y)=>Ve(g.x,m[y].x)&&Ve(g.y,m[y].y)),u=f=>{const m=f.source,g=f.target;if(!m||!g)return"skip";const y=Ge(i),_=new Map(y.shapes.map(z=>[z.id,z])),h=s(m),v=s(g),b=new Set([h,v].filter(z=>!!z)),E=y.shapes.filter(z=>z.type==="bpmn:Participant"),M=(f.waypoints??[]).map(z=>({x:z.x,y:z.y})),B=Rd(M,b,E);if(B<Ed)return"skip";if(t.has(f.id)){const z=r.get(f.id);if(z&&l(z,M)||B-(z?Rd(z,b,a):0)<Ed)return"skip"}const P=_.get(m.id),k=_.get(g.id),N=y.edges.find(z=>z.id===f.id);if(!P||!k||!N)return"skip";const G=Dn(y),q=new Set(Ot(N,G).map(z=>z.id)),Y=Yo(y).filter(z=>z.owner!==f.id&&z.owner!==P.id&&z.owner!==k.id),ae=[...y.shapes.filter(z=>!z.container&&z.id!==P.id&&z.id!==k.id),...Y.map(z=>z.rect)],X=z=>sn({...N,waypoints:z}).some(se=>SA(se,ae)),Me=MA(P,k,h?_.get(h):void 0,v?_.get(v):void 0,E),Te=z=>z.map((se,V)=>({pts:se,i:V,key:se.length*2+(X(se)?1:0)})).sort((se,V)=>se.key-V.key||se.i-V.i).map(se=>se.pts),Pe=[...Te(Me.inPools),...Te(Me.outside)],fe=c();for(const z of Pe){if(Rd(z,b,E)>=Ed)continue;const se={...N,waypoints:z};if(Ot(se,G).some(pe=>!q.has(pe.id))||sn(se).some(pe=>RA(pe,y.shapes)||Y.some(ve=>ji(ve.rect,pe))))continue;o.updateWaypoints(f,z);const Z=c();if(Z.crossings<=fe.crossings&&Z.shared<=fe.shared&&[...Z.keys].every(pe=>fe.keys.has(pe)))return"fixed";o.updateWaypoints(f,M)}return"stuck"},p=i.getAll().filter(f=>f.type==="bpmn:MessageFlow"),d=[];for(const f of p)u(f)==="stuck"&&d.push(f);for(const f of d)u(f)}const zi=[25,-25,40,-40],_a=35;function AA(e,t,n=[]){const i=e.x+e.width/2,o=t.x+t.width/2,r=[],a=n.filter(s=>!s.container&&s.id!==e.id&&s.id!==t.id&&s.label).map(s=>({...s.label,id:`${s.id}:label`,type:"label",container:!1,attached:!1}));for(const s of[!0,!1]){const c=s?e.y:e.y+e.height,l=s?t.y:t.y+t.height,u=s?Math.min(e.y,t.y)-_a:Math.max(e.y+e.height,t.y+t.height)+_a,p=PA(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,TA]];for(const[f,m]of d)for(const g of[0,...zi])if(!(Math.abs(g)>=e.width/2-5))for(const y of[0,...zi]){if(Math.abs(y)>=t.width/2-5)continue;const _=i+g,h=o+y,v=[{x:_,y:c},{x:_,y:f},{x:h,y:f},{x:h,y:l}];m&&Ot({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:m+Math.abs(y)+Math.abs(g)})}}return r}const TA=45,al=20;function PA(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(y=>y.container&&(y.type==="bpmn:Lane"||y.type==="bpmn:Participant")&&r>=y.x&&r<=y.x+y.width&&e.y>=y.y&&e.y+e.height<=y.y+y.height).sort((y,_)=>y.width*y.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(y=>!y.container&&y.id!==e.id&&y.id!==t.id),d=p.filter(y=>y.x<c&&y.x+y.width>s&&(n?y.y<l&&y.y+y.height>i:y.y+y.height>l&&y.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(y=>y.label?[y.label]:[])].filter(y=>y.x<c&&y.x+y.width>s);if(n){let y=Math.min(...d.map(h=>h.y));for(let h=!0;h;){h=!1;for(const v of f)v.y<y&&v.y<l&&v.y+v.height>y-al&&(y=v.y,h=!0)}const _=Math.max(u.y,...f.filter(h=>h.y+h.height<=y).map(h=>h.y+h.height));return y-_>=al?Math.round((y+_)/2):null}let m=Math.max(...d.map(y=>y.y+y.height));for(let y=!0;y;){y=!1;for(const _ of f)_.y+_.height>m&&_.y+_.height>l&&_.y<m+al&&(m=_.y+_.height,y=!0)}const g=Math.min(u.y+u.height,...f.filter(y=>y.y>=m).map(y=>y.y));return g-m>=al?Math.round((m+g)/2):null}function sl(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 AA(n,i,[...t.values()]);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-_a:n.y+n.height+_a,p=[];for(const h of[0,...zi]){if(Math.abs(h)>=i.width/2-5)continue;const v=r+h;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(h)});for(const b of[0,...zi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(h)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const h of[0,...zi]){if(Math.abs(h)>=n.width/2-5)continue;const v=a+h;p.push({pts:[{x:v,y:m},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(h)})}const g=60,y=s?i.y+i.height:i.y,_=s?i.y+i.height+_a:i.y-_a;for(const h of[0,...zi]){if(Math.abs(h)>=i.width/2-5)continue;const v=r+h;for(const b of[0,...zi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:m},{x:E,y:_},{x:v,y:_},{x:v,y}],cost:g+Math.abs(h)+Math.abs(b)})}}return p}const Cd=30;function ky(e,t){return Ad(e,t)<Cd}function Ad(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=Ve(o.y,r.y)&&!Ve(o.x,r.x),s=Ve(o.x,r.x)&&!Ve(o.y,r.y);if(!(!a&&!s))for(const c of t)if(a){const l=Math.min(o.x,r.x);if(Math.max(o.x,r.x)<=c.x||l>=c.x+c.width)continue;n=Math.min(n,Math.abs(o.y-c.y),Math.abs(o.y-(c.y+c.height)))}else{const l=Math.min(o.y,r.y);if(Math.max(o.y,r.y)<=c.y||l>=c.y+c.height)continue;n=Math.min(n,Math.abs(o.x-c.x),Math.abs(o.x-(c.x+c.width)))}}return n}const cl=40;function kA(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-cl,a=o.x+o.width+cl,s=o.y-cl,c=o.y+o.height+cl;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],d={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},f={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(d.x<a&&f.x>r&&d.y<c&&f.y>s){i++;break}}}return i}function Oy(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(M=>M.container),i=new Map(t.shapes.map(M=>[M.id,M])),o=Dn(t),r=t.edges.filter(M=>M.id!==e.id),a=Jn(e,r),s=Gn(e,r),c=M=>kA(M,t.shapes,e.endpoints)+(ky(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const B=M.x+M.width/2,P=M.y+M.height/2;return n.find(k=>k.type==="bpmn:Lane"&&B>=k.x&&B<=k.x+k.width&&P>=k.y&&P<=k.y+k.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,m=M=>{if(!f||!d)return!1;for(let B=1;B<M.length-2;B++){const P=M[B],k=M[B+1];if(Ve(P.y,k.y)&&!Ve(P.x,k.x)&&P.y>d.y&&P.y<d.y+d.height)return!0}return!1},g=m(e.waypoints),_=(M=>{if(!M)return;const B=M.x+M.width/2,P=M.y+M.height/2;return n.filter(k=>k.type==="bpmn:Participant"&&B>=k.x&&B<=k.x+k.width&&P>=k.y&&P<=k.y+k.height).sort((k,N)=>k.width*k.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),h=M=>{if(!_)return 0;let B=0;for(let P=1;P<M.length-1;P++){const k=M[P];(k.x<_.x||k.x>_.x+_.width||k.y<_.y||k.y>_.y+_.height)&&B++}return B},v=h(e.waypoints);if(!ky(e.waypoints,n)&&!(f&&!g)&&v===0)return null;const b=M=>M.reduce((B,P,k)=>k?B+Math.abs(P.x-M[k-1].x)+Math.abs(P.y-M[k-1].y):0,0);let E;for(const{pts:M,cost:B}of sl(e,i)){const P={...e,waypoints:M};if(Ot(P,o).length>0)continue;const k=Jn(P,r);if(k>a)continue;const N=h(M);if(N>v)continue;const G=N<v&&k===0;if(!G&&Gn(P,r)>s)continue;const q=c(M),Y=m(M);if(!G&&!(Y&&!g)&&q>=l)continue;const X=Y?0:1,Me=b(M);(!E||N<E.out||N===E.out&&(X<E.lane||X===E.lane&&(k<E.opp||k===E.opp&&(q<E.sc||q===E.sc&&(B<E.cost||B===E.cost&&Me<E.len)))))&&(E={pts:M,out:N,sc:q,lane:X,opp:k,cost:B,len:Me})}return(E==null?void 0:E.pts)??null}function OA(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 DA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(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=Ge(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=Dn(s),u=s.edges.filter(y=>y.id!==a),p=Ot(c,l).length,d=Jn(c,u),f=Gn(c,u),m=n.has(a)?new Set(ft(s).map(ct)):null;if(c.waypoints.length>4){const y=i.get(a),_=y?yy(s,c,l,c.waypoints,xs(y)):null;if(y&&_&&_.length<c.waypoints.length){o.updateWaypoints(y,_);continue}}const g=nl(c,s.shapes);g.length===2&&OA(c,s)&&g.reverse();for(const y of g){if(y.length>=c.waypoints.length)continue;const _={...c,waypoints:y};if(Ot(_,l).length>p||Jn(_,u)>d||Gn(_,u)>f)continue;if(m){const v=new Set(ft({...s,edges:s.edges.map(M=>M.id===a?_:M)}).map(ct)),b=[...v].filter(M=>!m.has(M)).length,E=[...m].filter(M=>!v.has(M)).length;if(b>E)continue}const h=i.get(a);h&&o.updateWaypoints(h,y);break}}}function Dy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ge(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=Oy(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Td(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=Ve(n[0].x,n[1].x)&&!Ve(n[0].y,n[1].y),s=Ve(n[n.length-1].x,n[n.length-2].x)&&!Ve(n[n.length-1].y,n[n.length-2].y);for(const c of zi){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}const Ly=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function LA(e,t,n){const i=e.waypoints;if(i.length<2||!Ly(e.type))return[];const o=i[0],r=i[1],a=Ve(o.y,r.y)&&!Ve(o.x,r.x),s=Ve(o.x,r.x)&&!Ve(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(m=>{if(!Ly(m.type)||m.type===e.type||m.waypoints.length<2)return!1;const g=m.waypoints[0],y=m.waypoints[1];return!Ve(g.x,o.x)||!Ve(g.y,o.y)?!1:a?Ve(g.y,y.y)&&Math.sign(y.x-g.x)===c:Ve(g.x,y.x)&&Math.sign(y.y-g.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(m,g)=>a?g>m.y+5&&g<m.y+m.height-5:g>m.x+5&&g<m.x+m.width-5,f=[];for(const m of zi){const g=(a?o.y:o.x)+m;if(!d(u,g)||i.length===2&&(!p||!d(p,g)))continue;const y=i.map(_=>({..._}));for(const _ of[y[0],y[1]])a?_.y=g:_.x=g;f.push({pts:y,cost:Math.abs(m)})}return f}function IA(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,d=a?n.x+n.width:n.x,f=r?n.y+n.height:n.y,m=a?i.x:i.x+i.width,g=r?i.y:i.y+i.height,y=[];for(const _ of[0,...zi])Math.abs(_)<i.width/2-5&&y.push({pts:[{x:d,y:l},{x:u+_,y:l},{x:u+_,y:g}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&y.push({pts:[{x:c,y:f},{x:c,y:p+_},{x:m,y:p+_}],cost:Math.abs(_)});return y}const BA=[[1/2,0],[1/3,25],[2/3,25]],Iy=20;function NA(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=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of BA){const d=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:d,y:o},{x:d,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+Iy<=i.x&&s(n.x+n.width,i.x),i.x+i.width+Iy<=n.x&&s(n.x,i.x+i.width),a}function Pd(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 d of[0,...zi]){const f=u+d;f<=o||f>=r||p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:Math.abs(d)})}return p}const kd=2,$A=3;function FA(e,t,n){if(e.length<2)return!1;for(const i of n.shapes){if(!/Gateway$/.test(i.type)||t.endpoints.includes(i.id))continue;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,bo(e[a-1],e[a],i));if(o>kd)continue;const r=[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}].filter(a=>Dd(a,e)<=kd);if(r.length)for(const a of n.edges){if(a.id===t.id||!a.endpoints.includes(i.id)||a.waypoints.length<2)continue;if([a.waypoints[0],a.waypoints[a.waypoints.length-1]].some(c=>r.some(l=>Math.hypot(c.x-l.x,c.y-l.y)<=$A)&&Dd(c,e)<=kd))return!0}}return!1}function By(e,t,n={}){const i=new Map(t.shapes.map(m=>[m.id,m])),o=Dn(t),r=t.edges.filter(m=>m.id!==e.id),a=Jn(e,r);if(a===0)return null;const s=Gn(e,r);let c;const l=m=>m.reduce((g,y,_)=>_?g+Math.abs(y.x-m[_-1].x)+Math.abs(y.y-m[_-1].y):0,0),u=3,p=m=>{const g=m[0],y=m[m.length-1],_=Math.hypot(y.x-g.x,y.y-g.y);return _>=1&&l(m)/_>=u?1:0},d=p(e.waypoints),f=[...sl(e,i),...Pd(e,i),...Td(e,i),...LA(e,r,i),...n.sideEntry?NA(e,i):[]];for(const{pts:m,cost:g}of f){const y={...e,waypoints:m};if(Ot(y,o).length>0||FA(m,e,t))continue;const _=Jn(y,r),h=Gn(y,r),v=a-_+(d-p(m));if(_>=a||h-s>v)continue;const b=l(m);(!c||_<c.opposite||_===c.opposite&&(h<c.cross||h===c.cross&&(g<c.cost||g===c.cost&&b<c.len)))&&(c={pts:m,opposite:_,cross:h,cost:g,len:b})}return(c==null?void 0:c.pts)??null}function Ny(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Nr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function jA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Dn(t),o=t.edges.filter(d=>d.id!==e.id),r=Ny(e,o);if(r===0)return null;const a=Jn(e,o),s=Gn(e,o),c=d=>d.reduce((f,m,g)=>g?f+Math.abs(m.x-d[g-1].x)+Math.abs(m.y-d[g-1].y):0,0),l=2;let u;const p=[...sl(e,n),...Pd(e,n),...IA(e,n),...Td(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Ot(m,i).length>0)continue;const g=Ny(m,o);if(g>=r)continue;const y=Jn(m,o);if(y-g>a-r)continue;const _=Gn(m,o);if(_-s>(r-g)*l)continue;const h=c(d);(!u||g<u.fake||g===u.fake&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&h<u.length))))&&(u={pts:d,fake:g,unreadable:y,cross:_,cost:f,length:h})}return(u==null?void 0:u.pts)??null}function $y(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ft(Ge(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=Ge(i),l=c.edges.find(d=>d.id===s);if(!l)continue;const u=jA(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Fy(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 jy(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Nr(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:Fy(e,n)&&Fy(t,n)}function Hy(e,t,n){let i=0;for(const o of t)o.id!==e.id&&jy(e,o,n)&&i++;return i}function HA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Dn(t),o=t.edges.filter(d=>d.id!==e.id),r=Hy(e,o,n);if(r===0)return null;const a=Jn(e,o),s=Gn(e,o),c=d=>d.reduce((f,m,g)=>g?f+Math.abs(m.x-d[g-1].x)+Math.abs(m.y-d[g-1].y):0,0),l=2;let u;const p=[...sl(e,n),...Pd(e,n),...Td(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Ot(m,i).length>0)continue;const g=Hy(m,o,n);if(g>=r)continue;const y=Jn(m,o);if(y-g>a-r)continue;const _=Gn(m,o);if(_-s>(r-g)*l)continue;const h=c(d);(!u||g<u.chain||g===u.chain&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&h<u.length))))&&(u={pts:d,chain:g,unreadable:y,cross:_,cost:f,length:h})}return(u==null?void 0:u.pts)??null}function zA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ft(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(d=>r.edges.find(f=>f.id===d));if(!(!u||!p||!jy(u,p,a)))for(const d of l.edges)n.has(d)||c.add(d)}for(const l of[...c].sort()){const u=Ge(i),p=u.edges.find(m=>m.id===l);if(!p)continue;const d=HA(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function zy(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=Ge(o),c=ft(s).filter(d=>fd(d)&&!t.has(ct(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(fd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(m=>m.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const m=u(d)==="bpmn:SequenceFlow"?0:1,g=u(f)==="bpmn:SequenceFlow"?0:1;return m!==g?m-g:d.localeCompare(f)});for(const d of p){const f=Ge(o),m=f.edges.find(_=>_.id===d);if(!m)continue;const g=By(m,f,{sideEntry:i.has(d)});if(!g)continue;const y=o.get(d);y&&(r.updateWaypoints(y,g),a.add(d))}return a}const GA=10,VA=(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 Gy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!el(e,i))return null;const o=Dn(t),r=i.flatMap(sn);for(const a of sn(e)){let s=[[a.lo,a.hi]];for(const[f,m]of Qc(a,r))s=s.flatMap(([g,y])=>{const _=[];return f>g&&_.push([g,Math.min(y,f)]),m<y&&_.push([Math.max(g,m),y]),_.filter(([h,v])=>v>h)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,m])=>m-f>=c+GA*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Zm}:{x:a.at+Ln+n.width/2,y:u},d={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!el({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&VA(d,f)))return d}return null}const Ln=8;function Od(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=d=>{const f=d.axis==="h"?o:r,m=d.axis==="h"?r-d.at:o-d.at,g=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(m,g)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(sn),...t.shapes.filter(d=>d.container).flatMap(wa)],l=d=>!c.some(f=>ji(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Ln,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+Ln,s.at-Ln-n.width])for(const f of p){const m=n.y+f;if(m<s.lo||m+n.height>s.hi)continue;const g={...n,x:d,y:m};if(l(g))return g}else for(const d of[s.at-Ln-n.height,s.at+Ln])for(const f of p){const m=n.x+f;if(m<s.lo||m+n.width>s.hi)continue;const g={...n,x:m,y:d};if(l(g))return g}return null}const Vy=30,Dd=(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},Wy=(e,t)=>Dd({x:e.x+e.width/2,y:e.y+e.height/2},t);function WA(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(sn),...t.shapes.filter(c=>c.container).flatMap(wa)],r=Yo(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=>ji(c,l))&&!vs(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+Ln,c.at-Ln-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Ln,c.at-Ln-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 Uy(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=Ge(i),a=new Set(ft(r).map(ct));for(const[l,u]of t){const p=u.wps,d=i.get(l),f=d==null?void 0:d.label;if(!f||!(d!=null&&d.waypoints))continue;const m=d.waypoints[0].x-p[0].x,g=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((B,P)=>B.x-p[P].x===m&&B.y-p[P].y===g))){if(((s=d.source)==null?void 0:s.id)===u.source&&((c=d.target)==null?void 0:c.id)===u.target)continue;const B=r.edges.find(q=>q.id===l);if(!(B!=null&&B.label)||!vs(B.label,r).length&&!n.has(l))continue;let P={...B.label,x:u.label.x,y:u.label.y};if((vs(P,r).length||Wy(P,B.waypoints)>Vy)&&(P=null),!P&&Wy(B.label,B.waypoints)>Vy&&(P=WA(B,r)),!P)continue;const k=P;if(k.x===f.x&&k.y===f.y)continue;const N={...r,edges:r.edges.map(q=>q.id===l?{...q,label:k}:q)},G=ft(N);if(G.some(q=>!a.has(ct(q))))continue;o.moveElements([f],{x:k.x-f.x,y:k.y-f.y}),r=N,a=new Set(G.map(ct));continue}const _=u.label.x+m-f.x,h=u.label.y+g-f.y;if(_===0&&h===0)continue;const v=r.edges.find(B=>B.id===l);if(!(v!=null&&v.label))continue;const b={...v.label,x:v.label.x+_,y:v.label.y+h},E={...r,edges:r.edges.map(B=>B.id===l?{...B,label:b}:B)},M=ft(E);M.some(B=>!a.has(ct(B)))||(o.moveElements([f],{x:_,y:h}),r=E,a=new Set(M.map(ct)))}}function qy(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Od(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 Yy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=ft(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(d=>d.id===s.edge);if(!c)continue;const l=Gy(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 Ky(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(sn),...t.shapes.filter(d=>d.container).flatMap(wa)],o=i.filter(d=>ji(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=Yo(t).filter(d=>d.owner!==e.id).map(d=>d.rect),s=(d,f)=>d.x<f.x+f.width&&f.x<d.x+d.width&&d.y<f.y+f.height&&f.y<d.y+d.height,c=d=>!i.some(f=>ji(d,f))&&!r.some(f=>s(d,f))&&!a.some(f=>s(d,f)),l=[];for(const d of o)d.axis==="h"?l.push({...n,y:d.at-Ln-n.height},{...n,y:d.at+Ln}):l.push({...n,x:d.at-Ln-n.width},{...n,x:d.at+Ln});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+Ln},{...n,x:u-n.width/2,y:e.y-Ln-n.height},{...n,x:e.x+e.width+Ln,y:p-n.height/2},{...n,x:e.x-Ln-n.width,y:p-n.height/2}),l.find(c)??null}function Xy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=Ky(r,Ge(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 UA(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 Zy(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(ft(o).map(ct));const a=[...new Set(ft(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(g=>g.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(g=>({...g})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[g,y]of u){const _=g?o.shapes.find(v=>v.id===g):void 0;if(!_)continue;const h=UA(_,l[y]);h.x===l[y].x&&h.y===l[y].y||(l[y]=h,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(g=>g.id===s?{...g,waypoints:l}:g)},f=ft(d);if(f.some(g=>!r.has(ct(g))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),o=d,r=new Set(f.map(ct)))}}const Ld=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Jy(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 qA(e,t,n){const i=[],o=n?ps(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 Jy(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(!Ld(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,m]of Object.entries(u))typeof m!="string"||m===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${f}`}),p=!1):o.includes(f)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:f,locales:o}),p=!1);if(!p)continue;const d=o.filter(f=>!(f in u));d.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:d})}}),i}function Ei(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function YA(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(Ld(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=Jy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=Ei(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,m)=>Ei(f,"name",a(p[m])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=Ei(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,m)=>Ei(f,"name",a(p[m])))),s.push(d);break}case"node.add":s.push({...c,node:Ei(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:Ei(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:Ei(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:Ei(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:Ei(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:Ei(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(Ei(c,"text",a(l[0])));break;default:s.push(Ld(l[0].map)?Ei(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const KA=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Qy=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),ev={"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}]},ws=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ll=e=>typeof e=="string"&&e!=="";function XA(e){const t=[];function n(i,o,r,a){if(a===null){ll(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!ws(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)ll(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!ws(i)||!ll(i.kind)||!(i.kind in ev)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of ev[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const m of p.slice(0,-1)){if(!ws(d))break;d=d[m]}if(!ws(d))continue;const f=d[p[p.length-1]];if(!(f===void 0&&c.optional)&&!(f===null&&c.optional)){if(!l){n(o,c.path,f,c.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}f.forEach((m,g)=>n(o,`${u}[${g}]`,m,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;ws(c)&&!ll(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"&&!pm(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&&!dm(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 tv(e,t,n={}){const i=XA(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(g,y,_){if(!KA.test(y)){o.push({kind:"id-invalid",opIndex:g,id:y});return}if(t.categoryOf(y)!==void 0||r.has(y)){o.push({kind:"id-duplicate",opIndex:g,id:y});return}r.set(y,{..._,opIndex:g})}e.forEach((g,y)=>{var _;switch(g.kind){case"participant.add":s(y,g.participant.id,{category:"participant",lanes:(g.participant.lanes??[]).map(h=>h.id)});for(const h of g.participant.lanes??[])s(y,h.id,{category:"lane"});break;case"node.add":s(y,g.node.id,{category:"flowNode",participant:g.node.participant});break;case"sequenceFlow.add":s(y,g.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,g.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,g.dataStore.id,{category:"dataStore"});for(const h of g.associations??[])h.id&&s(y,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":g.association.id&&s(y,g.association.id,{category:"dataAssociation"});break;case"association.add":g.association.id&&s(y,g.association.id,{category:"association"});break;case"annotation.add":s(y,g.annotation.id,{category:"annotation"}),(_=g.association)!=null&&_.id&&s(y,g.association.id,{category:"association"});break;case"group.add":s(y,g.group.id,{category:"group"});break;case"participant.update":if(g.lanes){a.set(g.id,g.lanes.map(h=>h.id));for(const h of g.lanes)t.categoryOf(h.id)===void 0&&s(y,h.id,{category:"lane"})}break}});const c=g=>{var y;return((y=r.get(g))==null?void 0:y.category)??t.categoryOf(g)},l=g=>{const y=r.get(g);return y?y.category==="participant"?g:y.participant:t.categoryOf(g)==="participant"?g:t.participantOf(g)};function u(g,y,_,h){const v=c(y);if(v===void 0){o.push({kind:"ref-missing",opIndex:g,ref:y,role:_});return}if(h&&!h.includes(v)){o.push({kind:"ref-category",opIndex:g,ref:y,role:_,expected:h.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(g=>g.kind==="participant.add"),d=new Map;for(const g of e)g.kind==="node.add"?d.set(g.node.id,g.node.eventDefinition):g.kind==="node.update"&&g.type!==void 0&&d.set(g.id,g.eventDefinition);const f=g=>d.has(g)?d.get(g)==="timer":t.eventDefinitionOf(g)==="timer";return e.forEach((g,y)=>{var _,h;switch(g.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=g.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:y,id:g.node.id});break}if(u(y,v,"participant",["participant"])===void 0)break;b!==void 0&&((((_=r.get(v))==null?void 0:_.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:y,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:E,name:M,condition:B}=g.flow,P=u(y,b,"source",["flowNode"]),k=u(y,E,"target",["flowNode"]);P&&k&&l(b)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:y,id:v}),M!==void 0&&B!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:E}=g.flow,M=u(y,b,"source",["flowNode","participant"]),B=u(y,E,"target",["flowNode","participant"]);if(M&&B){const P=l(b),k=l(E);P!==void 0&&P===k&&o.push({kind:"message-flow-same-pool",opIndex:y,id:v})}for(const P of[b,E])f(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:y,id:v,ref:P});break}case"dataStore.add":{for(const v of g.associations??[]){if([v.source,v.target].filter(M=>M===g.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:y,source:v.source,target:v.target});continue}const E=v.source===g.dataStore.id?v.target:v.source;u(y,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=g.association,E=u(y,v,"source"),M=u(y,b,"target");if(E&&M){const B=new Set([E,M]);B.has("dataStore")&&B.has("flowNode")||o.push({kind:"data-association-ends",opIndex:y,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:E}=g.association,M=u(y,b,"source"),B=u(y,E,"target");M&&B&&M!=="annotation"&&B!=="annotation"&&o.push({kind:"association-detached",opIndex:y,annotation:v??`${b}->${E}`});break}case"annotation.add":{if(g.association){const{source:v,target:b}=g.association;if(v!==g.annotation.id&&b!==g.annotation.id)o.push({kind:"association-detached",opIndex:y,annotation:g.annotation.id});else{const E=v===g.annotation.id?b:v;u(y,E,"association")}}g.placement&&u(y,g.placement.anchor,"anchor");break}case"group.add":{for(const v of g.group.members??[]){const b=u(y,v,"member");b&&Qy.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(m(y,g.id,"participant")===void 0)break;if(g.lanes){const v=t.lanesOf(g.id),b=g.lanes.map(P=>P.id);for(const P of v)b.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:y,participant:g.id,lane:P});for(const P of b)t.categoryOf(P)!==void 0&&!v.includes(P)&&o.push({kind:"id-duplicate",opIndex:y,id:P});const E=b.filter(P=>v.includes(P)),M=P=>E.every((k,N)=>k===P[N]),B=(((h=t.laneDeclarationOrderOf)==null?void 0:h.call(t,g.id))??v).filter(P=>v.includes(P));E.length===v.length&&!M(v)&&!M(B)&&o.push({kind:"lane-reorder-unsupported",opIndex:y,participant:g.id})}break}case"node.update":{if(m(y,g.id,"flowNode")===void 0)break;if(g.lane!==void 0){const v=t.participantOf(g.id);(v?a.get(v)??t.lanesOf(v):[]).includes(g.lane)||o.push({kind:"lane-unknown",opIndex:y,lane:g.lane,participant:v??""})}break}case"sequenceFlow.update":{if(m(y,g.id,"sequenceFlow")===void 0)break;if(g.name!==void 0&&g.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:g.id}),g.source!==void 0||g.target!==void 0){const v=g.source===void 0||u(y,g.source,"source",["flowNode"])!==void 0,b=g.target===void 0||u(y,g.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(g.id),M=g.source??(E==null?void 0:E.source),B=g.target??(E==null?void 0:E.target);v&&b&&M!==void 0&&B!==void 0&&new Set([l(M),l(B),l(g.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:y,id:g.id})}break}case"messageFlow.update":m(y,g.id,"messageFlow");break;case"dataStore.update":m(y,g.id,"dataStore");break;case"annotation.update":{if(m(y,g.id,"annotation")===void 0)break;g.placement&&u(y,g.placement.anchor,"anchor");break}case"group.update":{if(m(y,g.id,"group")===void 0)break;for(const v of g.members??[]){const b=u(y,v,"member");b&&Qy.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":m(y,g.id);break;case"element.remove":{m(y,g.id)==="lane"&&o.push({kind:"ref-category",opIndex:y,ref:g.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...qA(e,t,n.i18n)),o;function m(g,y,_){if(r.has(y)){o.push({kind:"target-added-in-batch",opIndex:g,id:y});return}const h=t.categoryOf(y);if(h===void 0){o.push({kind:"ref-missing",opIndex:g,ref:y,role:"target"});return}if(_&&h!==_){o.push({kind:"ref-category",opIndex:g,ref:y,role:"target",expected:_,actual:h});return}return h}}const Id=12,nv=14,ZA=15,JA=100,QA=300,eT=30,tT=/[㐀-鿿]/,nT=1.1;function iv(e){let t=0;for(const n of e)tT.test(n)?t+=Id:SC(n)?t+=Br(n,Id):t+=Br(n,Id)*nT;return t}const ov="­";function iT(e,t){const n=e.split(/(\s|-|­)/g),i=[];let o=0,r;if(n.length>1)for(;r=n.shift();)if(r.length+o<t)i.push(r),o+=r.length;else{(r==="-"||r===ov)&&i.pop();break}return i[i.length-1]===ov&&(i[i.length-1]="-"),i.join("")}function oT(e,t,n){const i=Math.max(e.length*(n/t),1);return iT(e,i)||e.slice(0,Math.max(Math.round(i-1),1))}const rv=(e,t)=>e?t(e.replace(/\s+$/,"")):0;function rT(e,t,n=iv){const i=e.split(/­?\r?\n/),o=[];for(;i.length;){const r=i.shift();let a=r;for(;;){const s=rv(a,n);if(a===" "||a===""||s<Math.round(t)||a.length<2)break;a=oT(a,s,t)}a.length<r.length&&i.unshift(r.slice(a.length).trim()),o.push(a)}return o}function av(e){const t=e.length?e:[""],n=Math.max(0,...t.flatMap(r=>r.split(/­?\r?\n/).map(a=>rv(a,iv)))),i=Math.max(JA,Math.min(QA,Math.floor(n)+1+nv)),o=Math.max(...t.map(r=>rT(r,i-nv).length));return{width:i,height:Math.max(eT,o*ZA+10)}}const sv="bwlExactAnnotationBounds",aT=500;class cv{constructor(t){t.on("commandStack.shape.resize.preExecute",aT,({context:n})=>{var o,r;const i=(o=n==null?void 0:n.hints)==null?void 0:o[sv];!i||((r=n.shape)==null?void 0:r.type)!=="bpmn:TextAnnotation"||(n.newBounds={x:i.x,y:i.y,width:i.width,height:i.height})})}}an(cv,"$inject",["eventBus"]);const lv={__init__:["annotationExactResize"],annotationExactResize:["type",cv]};function uv(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 ul(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const pl={"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]},In=10,sT=300,cT=160,pv=20,Bd=100,dv=40,lT=10,uT=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function fv(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 dl=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function fl(e,t,n,i,o){const r=n,a=fv(e,t,i),s=a??i,c=(Y,ae,X=s)=>{const[Me,Te]=pl[Y];let Pe={x:t.x+t.width/2+Me*(t.width/2+r.width/2+ae),y:t.y+t.height/2+Te*(t.height/2+r.height/2+ae)};const fe=X.x+In+r.width/2,z=X.x+X.width-In-r.width/2,se=X.y+In+r.height/2,V=X.y+X.height-In-r.height/2,Z={x:Math.min(z,Math.max(fe,Pe.x)),y:Math.min(V,Math.max(se,Pe.y))};return(Z.x!==Pe.x||Z.y!==Pe.y)&&(Pe=Math.abs(Z.x-(t.x+t.width/2))<(t.width+r.width)/2+In&&Math.abs(Z.y-(t.y+t.height/2))<(t.height+r.height)/2+In?{x:t.x+t.width+In+r.width/2,y:Z.y}:Z),Pe},l=(i.children??[]).filter(Y=>!("waypoints"in Y&&Y.waypoints)&&Y.type!=="bpmn:Lane"&&Y.type!=="label"&&typeof Y.x=="number"&&Y.id!==o.selfId),u=Ge(e),p=Y=>{var X,Me;if(!o.selfId)return!1;const ae=e.get(Y);return!!ae&&(((X=ae.source)==null?void 0:X.id)===o.selfId||((Me=ae.target)==null?void 0:Me.id)===o.selfId)},d=u.edges.filter(Y=>!p(Y.id)).flatMap(sn),f=Yo(u).filter(Y=>Y.owner!==o.selfId).map(Y=>Y.rect),m=Y=>({x0:Y.x-r.width/2-In,x1:Y.x+r.width/2+In,y0:Y.y-r.height/2-In,y1:Y.y+r.height/2+In}),g=Y=>{const ae=m(Y);return l.some(X=>ae.x0<X.x+X.width&&ae.x1>X.x&&ae.y0<X.y+X.height&&ae.y1>X.y)},y=Y=>{const ae=m(Y);return d.some(X=>X.axis==="h"?X.at>ae.y0&&X.at<ae.y1&&X.lo<ae.x1&&X.hi>ae.x0:X.at>ae.x0&&X.at<ae.x1&&X.lo<ae.y1&&X.hi>ae.y0)},_=Y=>{const ae=m(Y);return f.some(X=>ae.x0<X.x+X.width&&ae.x1>X.x&&ae.y0<X.y+X.height&&ae.y1>X.y)},h=u.shapes.filter(Y=>Y.type==="bpmn:Group").flatMap(Y=>[{axis:"h",at:Y.y,lo:Y.x,hi:Y.x+Y.width},{axis:"h",at:Y.y+Y.height,lo:Y.x,hi:Y.x+Y.width},{axis:"v",at:Y.x,lo:Y.y,hi:Y.y+Y.height},{axis:"v",at:Y.x+Y.width,lo:Y.y,hi:Y.y+Y.height}]),v=Y=>{const ae=m(Y);return h.some(X=>X.axis==="h"?X.at>ae.y0&&X.at<ae.y1&&X.lo<ae.x1&&X.hi>ae.x0:X.at>ae.x0&&X.at<ae.x1&&X.lo<ae.y1&&X.hi>ae.y0)},b=Y=>g(Y)||y(Y)||_(Y)||v(Y),E=Y=>Y.x-r.width/2>=i.x&&Y.x+r.width/2<=i.x+i.width&&Y.y-r.height/2>=i.y&&Y.y+r.height/2<=i.y+i.height,M=Y=>E(Y)&&(!a||dl(Y,r,a));if(o.placement){const Y=fe=>fe.startsWith("top")?fe.replace(/^top/,"bottom"):fe.replace(/^bottom/,"top"),ae=fe=>fe.endsWith("left")?fe.replace(/left$/,"right"):fe.replace(/right$/,"left"),X=o.placement.side,Me=[X,Y(X),ae(X),Y(ae(X)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Te=o.placement.offset??50;let Pe=c(X,Te);if(b(Pe)||a&&!dl(Pe,r,a)){const fe=(z,se)=>{const V=new Set;for(const Z of Me){if(V.has(Z))continue;V.add(Z);const pe=c(Z,Te,z);if(se(pe)&&!b(pe))return Pe=pe,!0}return!1};!fe(s,M)&&a&&fe(i,E)}return Pe}const B=o.from,P=s.x+In+r.width/2,k=s.x+s.width-In-r.width/2,N=s.y+In+r.height/2,G=s.y+s.height-In-r.height/2;let q={x:Math.min(k,Math.max(P,B.x)),y:Math.min(G,Math.max(N,B.y))};if(b(q)){const Y=(t.width+r.width)/2+In,X=[{x:q.x+Y,y:q.y},{x:q.x-Y,y:q.y},{x:q.x,y:q.y-r.height-In},{x:q.x,y:q.y+r.height+In}].filter(M).find(Me=>!b(Me));X&&(q=X)}return q}function Gt(e,t){return e.filter(n=>n.kind===t)}function hv(e,t){const n=new Map,i=new Set(Gt(e,"node.add").map(s=>s.node.id)),o=Gt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&Gt(e,"sequenceFlow.add").find(d=>d.flow.source===l&&d.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(d=>d!==u&&JSON.stringify(d).includes(p))||(a.add(c),n.set(s.id,u))}return n}function pT(e,t,n){const i=new Map,o=new Set;for(const h of e){const v=i.get(h.source)??[];v.push(h.target),i.set(h.source,v),o.add(h.target)}const r=[...e.map(h=>h.source).filter(h=>!o.has(h)),...t,...e.map(h=>h.source)],a=new Map,s=new Set,c=h=>{a.set(h,"open");for(const v of i.get(h)??[]){const b=a.get(v);b==="open"?s.add(`${h}>${v}`):b||c(v)}a.set(h,"done")};for(const h of r)a.has(h)||c(h);const l=(h,v)=>!s.has(`${h}>${v}`),u=[],p=new Set,d=h=>{p.add(h);for(const v of i.get(h)??[])l(h,v)&&!p.has(v)&&d(v);u.push(h)};for(const h of r)p.has(h)||d(h);const f=new Map;for(const h of u.reverse()){const v=f.get(h)??0;f.set(h,v);for(const b of i.get(h)??[])l(h,b)&&(f.get(b)??-1)<v+1&&f.set(b,v+1)}const m=new Map;for(const h of e){if(!l(h.source,h.target)||!n(h.target))continue;const v=m.get(h.target)??[];v.includes(h.source)||v.push(h.source),m.set(h.target,v)}const g=new Map,y=(h,v)=>{let b=g.get(h);if(!b){b=new Set([h]);const E=[h];for(;E.length;){const M=E.pop();for(const B of i.get(M)??[])l(M,B)&&!b.has(B)&&(b.add(B),E.push(B))}g.set(h,b)}return b.has(v)},_=new Set;for(const h of e){const v=m.get(h.target);if(!v||v.length<2||!v.includes(h.source))continue;const b=f.get(h.source)??0;v.some(E=>E!==h.source&&(f.get(E)??0)>=b+2&&y(h.source,E))&&_.add(h.id)}return _}class gv extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const mv=new WeakMap;function dT(e){return mv.get(e)??new Set}const yv=new WeakMap;function fT(e,t){yv.set(e,t)}const vv=new WeakMap;function hT(e){return vv.get(e)??[]}function xv(e,t){var XS,ZS,JS,QS,eR,tR,nR,iR,oR,rR,aR,sR,cR,lR,uR,pR,dR,fR,hR,gR,mR,yR,vR,xR,bR,wR,_R,ER,SR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;mv.set(t,u);const p=[];vv.set(t,p);const d=()=>a.getRootElement(),f=x=>r.get(x),m=x=>{const w=f(x);if(!w)throw new Error(`하강 참조 해소 실패: ${x}`);return w},g=x=>{let w=x.parent;for(;w;){if(w.type==="bpmn:Participant")return w;w=w.parent}},y=(x,w)=>{if(!x)return;const S=w.x+w.width/2,O=w.y+w.height/2;let I;const T=$=>{for(const L of $.children??[])if(L.type==="bpmn:Lane"){const D=L;S>=D.x&&S<=D.x+D.width&&O>=D.y&&O<=D.y+D.height&&(I=D,T(D))}};return T(x),I},_=new Map;for(const x of r.filter(w=>!("waypoints"in w&&w.waypoints)&&w.type!=="bpmn:Lane"&&w.type!=="label"&&typeof w.x=="number"))_.set(x.id,{x:x.x,y:x.y});const h=Gt(e,"participant.add"),v=Gt(e,"node.add"),b=Gt(e,"sequenceFlow.add"),E=Gt(e,"messageFlow.add"),M=Gt(e,"dataStore.add"),B=Gt(e,"dataAssociation.add"),P=Gt(e,"annotation.add"),k=Gt(e,"group.add"),N=new Map(v.map(x=>[x.node.id,x])),G=hv(e,x=>{var w,S;return(S=(w=f(x))==null?void 0:w.source)==null?void 0:S.id}),q=new Set([...G.values()].map(x=>x.flow.id)),Y=b.filter(x=>!q.has(x.flow.id)),ae=new Set([...G.values()].map(x=>x.flow.target)),X=x=>Gt(e,"sequenceFlow.update").filter(w=>w.target===x).length+(ae.has(x)?1:0),Me=(x,w,S)=>{var L;const O=x.businessObject,I=(((L=O.extensionElements)==null?void 0:L.values)??[]).filter(D=>D.$type!==w),T=S?[...I,i.create(w,S)]:I;if(!T.length){O.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const $=i.create("bpmn:ExtensionElements",{values:T});T.forEach(D=>{D.$parent=$}),n.updateProperties(x,{extensionElements:$})},Te=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Gt(e,"element.remove")){const w=f(x.id);if(!w)continue;const S="waypoints"in w?[]:[...w.incoming??[],...w.outgoing??[]];n.removeElements([...S,w])}const Pe=x=>r.filter(w=>{var S;return w.type==="bpmn:Lane"&&((S=g(w))==null?void 0:S.id)===x}).sort((w,S)=>w.y-S.y),fe=[];for(const x of Gt(e,"participant.update")){const w=m(x.id);if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),!x.lanes)continue;const S=Pe(x.id);if(!S.length){n.splitLane(w,x.lanes.length),Pe(x.id).forEach((T,$)=>{const L=x.lanes[$];L&&n.updateProperties(T,{id:L.id,name:L.name})}),fe.push({pool:x.id,lanes:new Set(x.lanes.map(T=>T.id))});continue}const O=new Set(S.map(T=>T.id)),I=x.lanes.reduce((T,$,L)=>O.has($.id)?L:T,-1);x.lanes.forEach((T,$)=>{if(O.has(T.id)){n.updateProperties(m(T.id),{name:T.name});return}const L=$===I+1&&I>=0,D=$===0?n.addLane(Pe(x.id)[0],"top"):L?n.addLane(Pe(x.id).at(-1),"bottom"):n.addLane(m(x.lanes[$-1].id),"bottom");n.updateProperties(D,{id:T.id,name:T.name})})}const z=150,se=130,V=80,Z=90,pe=180,ve=30,$e=30,F=10,C=300,R=5,U=(x,w,S,O,I)=>{const T=S-w.width/2,$=O-w.height/2;return(x.children??[]).find(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="bpmn:Lane"&&L.type!=="label"&&!(I!=null&&I.has(L.id))&&typeof L.x=="number"&&T<L.x+L.width+$e&&T+w.width+$e>L.x&&$<L.y+L.height&&$+w.height>L.y)},ee=new Set;for(const x of h){ee.add(`pool:${x.participant.id}`);for(const w of x.participant.lanes??[])ee.add(w.id)}const he=new Map;for(const x of v){const w=x.node.lane??`pool:${x.node.participant??""}`;let S=he.get(w);S||he.set(w,S=new Set([0])),x.band!==void 0&&S.add(x.band)}const ke=new Map;for(const[x,w]of he){if(!ee.has(x))continue;const S=[...w].sort((T,$)=>T-$),O=S.map((T,$)=>$===0?0:$%2===1?Math.ceil($/2):-($/2)),I=Math.min(...O);ke.set(x,new Map(S.map((T,$)=>[T,O[$]-I])))}{const x=new Map;for(const w of h)(w.participant.lanes??[]).forEach((S,O)=>x.set(S.id,O));for(const[w,S]of ke){if(!x.has(w)||S.size<2)continue;const O=x.get(w),I=S.get(0)??0,T=new Set;for(const ne of v){if(ne.node.lane!==w||(ne.band??0)!==0||!ne.node.type.endsWith("Gateway"))continue;const de={in:new Set,out:new Set,cross:new Set};for(const oe of Y){const ie=oe.flow.source===ne.node.id;if(!ie&&oe.flow.target!==ne.node.id)continue;const ye=N.get(ie?oe.flow.target:oe.flow.source);if(!ye||ye.node.participant!==ne.node.participant||!ye.node.lane)continue;let me,te=!1;if(ye.node.lane!==w){const le=x.get(ye.node.lane);if(le===void 0)continue;me=le>O?"down":"up",te=!0}else{const le=S.get(ye.band??0)??I;me=le>I?"down":le<I?"up":void 0}me&&(de[ie?"out":"in"].add(me),te&&de.cross.add(me))}for(const oe of["up","down"])de.in.has(oe)&&de.out.has(oe)&&de.cross.has(oe)&&T.add(oe)}if(T.size!==1)continue;const[$]=T,L=Math.max(...S.values()),D=$==="down"?L:0;if(I===D)continue;const H=[...S.entries()].filter(([ne])=>ne!==0).sort((ne,de)=>ne[1]-de[1]),j=[...Array(L+1).keys()].filter(ne=>ne!==D),Q=new Map([[0,D]]);H.forEach(([ne],de)=>Q.set(ne,j[de])),ke.set(w,Q)}}const at=x=>{var w;return(((w=he.get(x))==null?void 0:w.size)??0)>1},ut=x=>x.band??(x.node.lane||!at(`pool:${x.node.participant??""}`)?void 0:0),zt=new Map,yt=x=>zt.get(x.node.id)??ut(x),on=new Set,En=new Set,An=new Set,$t=new Set,gn=new Set,Tn=x=>P.some(w=>{var S,O;return(((S=w.placement)==null?void 0:S.anchor)??(w.association?w.association.source===w.annotation.id?w.association.target:w.association.source:void 0))===x&&((O=w.placement)==null?void 0:O.side.startsWith("bottom"))});{const x=new Map;for(const O of Y)x.set(O.flow.target,(x.get(O.flow.target)??0)+1);const w=O=>{const I=[],T=new Set([O]),$=[O];for(;$.length;){const L=$.shift();I.push(L);for(const D of Y)D.flow.source!==L||T.has(D.flow.target)||(x.get(D.flow.target)??0)!==1||(T.add(D.flow.target),$.push(D.flow.target))}return I},S=(O,I)=>{var T;return((T=ke.get(O))==null?void 0:T.get(I))??I};for(const O of v){if(!O.node.type.endsWith("Gateway"))continue;const I=O.node.lane??`pool:${O.node.participant??""}`,T=ke.get(I);if(!T||T.size<2)continue;const $=yt(O);if($===void 0||S(I,$)!==S(I,0))continue;const L=S(I,$),D=Y.filter(oe=>oe.flow.source===O.node.id).map(oe=>N.get(oe.flow.target)).filter(oe=>!!oe&&(oe.node.lane??`pool:${oe.node.participant??""}`)===I),H=D.filter(oe=>{const ie=yt(oe);return ie!==void 0&&S(I,ie)===L&&(x.get(oe.node.id)??0)===1}),j=D.some(oe=>{const ie=yt(oe);return ie!==void 0&&S(I,ie)>L});if(H.length!==1||!j)continue;const Q=new Set(D.flatMap(oe=>w(oe.node.id)));if(!Y.some(oe=>oe.flow.target===O.node.id&&Q.has(oe.flow.source)))continue;const de=new Map;for(const[oe,ie]of T)de.set(oe,ie+1);de.set(-1,0),ke.set(I,de);for(const oe of w(H[0].node.id))N.has(oe)&&(zt.set(oe,-1),En.add(oe));on.add(O.node.id)}}{const x=j=>j.node.lane??`pool:${j.node.participant??""}`,w=j=>yt(j)??0,S=new Map(h.map((j,Q)=>({id:j.participant.id,order:j.order??Number.POSITIVE_INFINITY,declared:Q})).sort((j,Q)=>j.order!==Q.order?j.order-Q.order:j.declared-Q.declared).map((j,Q)=>[j.id,Q])),O=j=>j===void 0?void 0:S.get(j)??-1,I=j=>{var de;const Q=N.get(j);if(Q)return Q.node.participant;if(S.has(j))return j;const ne=f(j);if(ne)return ne.type==="bpmn:Participant"?ne.id:(de=g(ne))==null?void 0:de.id},T=new Map;for(const j of Y)T.set(j.flow.target,(T.get(j.flow.target)??0)+1);const $=j=>{const Q=[j],ne=new Set([j.node.id]);for(let de=0;de<Q.length;de++)for(const oe of Y){if(oe.flow.source!==Q[de].node.id||ne.has(oe.flow.target)||(T.get(oe.flow.target)??0)!==1)continue;const ie=N.get(oe.flow.target);!ie||ie.node.participant!==j.node.participant||(ne.add(ie.node.id),Q.push(ie))}return Q},L=j=>{const Q=new Set(j.map(oe=>oe.node.id)),ne=O(j[0].node.participant);if(ne===void 0)return;const de=new Set;for(const oe of E){const ie=Q.has(oe.flow.source)?oe.flow.target:Q.has(oe.flow.target)?oe.flow.source:void 0;if(ie===void 0)continue;const ye=O(I(ie));ye===void 0||ye===ne||de.add(ye<ne?"up":"down")}return de.size===1?[...de][0]:void 0},D=new Map;{const j=new Map;for(const ie of Y){if(!N.has(ie.flow.source)||!N.has(ie.flow.target))continue;const ye=j.get(ie.flow.source)??[];ye.push(ie.flow.target),j.set(ie.flow.source,ye)}const Q=new Map,ne=[],de=new Set,oe=ie=>{Q.set(ie,"open");for(const ye of j.get(ie)??[]){const me=Q.get(ye);me==="open"?de.add(`${ie}>${ye}`):me||oe(ye)}Q.set(ie,"done"),ne.push(ie)};for(const ie of v)Q.has(ie.node.id)||oe(ie.node.id);for(const ie of ne.reverse()){const ye=D.get(ie)??0;D.set(ie,ye);for(const me of j.get(ie)??[])!de.has(`${ie}>${me}`)&&(D.get(me)??-1)<ye+1&&D.set(me,ye+1)}}let H=-1e3;for(const j of v){if(!j.node.type.endsWith("Gateway"))continue;const Q=x(j),ne=ke.get(Q);if(!ne)continue;const de=ne.get(w(j))??0,oe=te=>(ne.get(w(te))??0)-de,ie=Y.filter(te=>te.flow.source===j.node.id).map(te=>N.get(te.flow.target)).filter(te=>!!te&&x(te)===Q&&(T.get(te.node.id)??0)===1&&!En.has(te.node.id)).map(te=>{const le=$(te);return{root:te,subtree:le,dir:L(le)}});if(ie.some(te=>te.dir==="up")&&ie.some(te=>te.dir==="down"))continue;const ye=Y.some(te=>{const le=te.flow.source===j.node.id?N.get(te.flow.target):void 0;return!!le&&x(le)===Q&&oe(le)===0});let me=!1;if(!ye){const te=Y.filter(ue=>ue.flow.source===j.node.id).map(ue=>N.get(ue.flow.target)).filter(ue=>!!ue&&x(ue)===Q&&(!!ue.node.lane||ut(ue)!==void 0)&&oe(ue)<0),le=te.length?Math.max(...te.map(oe)):void 0,ge=te.filter(ue=>oe(ue)===le);if(!Tn(j.node.id)&&ge.length===1&&(T.get(ge[0].node.id)??0)===1&&!on.has(j.node.id))continue;me=!0}for(const te of ie){const le=te.dir;if(!le||ie.some(_e=>_e!==te&&_e.dir===le))continue;const ge=oe(te.root);if(ge===0||(le==="up"?ge<0:ge>0)||Y.some(_e=>{const He=_e.flow.target===j.node.id?N.get(_e.flow.source):void 0;if(!He||x(He)!==Q)return!1;const st=oe(He);return le==="up"?st<0:st>0}))continue;const ue=[...ne].map(([_e,He])=>({band:_e,rel:He-de})).filter(_e=>le==="up"?_e.rel<0:_e.rel>0).sort((_e,He)=>Math.abs(He.rel)-Math.abs(_e.rel));if(!ue.length&&le==="down")continue;const Re=w(te.root),Ie=te.subtree.filter(_e=>x(_e)===Q&&w(_e)===Re),nt=new Set(te.subtree.map(_e=>_e.node.id)),Xe=Ie.map(_e=>D.get(_e.node.id)??0),Ae=Math.min(...Xe)-1,Se=Math.max(...Xe)+1,Ce=_e=>!v.some(He=>{if(nt.has(He.node.id)||x(He)!==Q||w(He)!==_e)return!1;if(!An.has(_e))return!0;const st=D.get(He.node.id)??0;return st>=Ae&&st<=Se});let ce=me?w(j):(XS=ue.find(_e=>Ce(_e.band)))==null?void 0:XS.band;if(ce===void 0){if(ce=H--,An.add(ce),le==="up"){const _e=new Map;for(const[He,st]of ne)_e.set(He,st+1);_e.set(ce,0),ke.set(Q,_e)}else ne.set(ce,Math.max(...ne.values())+1);(ZS=he.get(Q))==null||ZS.add(ce)}for(const _e of Ie)zt.set(_e.node.id,ce)}}{const j=ie=>{const ye=Y.find(me=>me.flow.target===ie.node.id);return ye?N.get(ye.flow.source):void 0},Q=ie=>{const ye=j(ie);if(!ye||!ye.node.type.endsWith("Gateway")||x(ye)!==x(ie))return!1;const me=ke.get(x(ye));if(!me)return!1;const te=me.get(w(ye))??0,le=Ie=>x(Ie)===x(ye)?(me.get(w(Ie))??0)-te:Number.NaN,ge=Y.filter(Ie=>Ie.flow.source===ye.node.id).map(Ie=>N.get(Ie.flow.target)).filter(Ie=>!!Ie&&(!!Ie.node.lane||ut(Ie)!==void 0));if(ge.some(Ie=>le(Ie)===0))return!1;const K=ge.filter(Ie=>Ie.node.lane===ye.node.lane&&le(Ie)<0);if(!K.length)return!1;const ue=Math.max(...K.map(le)),Re=K.filter(Ie=>le(Ie)===ue);return Re.length===1&&Re[0]===ie&&(T.get(ie.node.id)??0)===1&&!Tn(ye.node.id)&&!on.has(ye.node.id)},ne=new Set;for(const ie of v){if(!ie.node.type.endsWith("Gateway")||Tn(ie.node.id))continue;const ye=ke.get(x(ie));if(!ye)continue;const me=ye.get(w(ie))??0;let te;for(const le of Y){if(le.flow.source!==ie.node.id)continue;const ge=N.get(le.flow.target);if(!ge||x(ge)!==x(ie)||!ge.node.lane&&ut(ge)===void 0)continue;const K=ye.get(w(ge))??0;K<=me||(!te||K>te.row?te={id:ge.node.id,row:K,count:1}:K===te.row&&te.count++)}te&&te.count===1&&(T.get(te.id)??0)===1&&ne.add(te.id)}const de=new Set,oe=[...v].sort((ie,ye)=>Number(ne.has(ie.node.id))-Number(ne.has(ye.node.id)));for(const ie of oe){const ye=x(ie),me=ke.get(ye);if(!me)continue;const te=ie.node.id,le=E.filter(Oe=>Oe.flow.target===te);if(le.length!==1||!(T.get(te)??0)||!ie.node.lane&&ut(ie)===void 0||En.has(te)||$t.has(te))continue;const ge=(JS=N.get(le[0].flow.source))==null?void 0:JS.node.participant;if(!ge||ge===ie.node.participant)continue;const K=O(ie.node.participant),ue=O(ge);if(K===void 0||ue===void 0||K===ue)continue;const Re=ue<K,Ie=me.get(0)??0,nt=(me.get(w(ie))??Ie)-Ie;if(nt===0||(Re?nt<0:nt>0)||Q(ie))continue;let Xe;for(const[Oe,Ye]of me){if(An.has(Oe))continue;const Dt=Ye-Ie;(Re?Dt<0&&(!Xe||Dt<Xe.row):Dt>0&&(!Xe||Dt>Xe.row))&&(Xe={band:Oe,row:Dt})}if(!Xe)continue;const Ae=w(ie),Se=$(ie).filter(Oe=>x(Oe)===ye&&w(Oe)===Ae&&!En.has(Oe.node.id)),Ce=j(ie),ce=Ce!=null&&Ce.node.type.endsWith("Gateway")?`${Ce.node.id}|${ye}|${Xe.band}`:void 0,_e=Xe,He=!!ce&&ne.has(te)&&Y.some(Oe=>{if(Oe.flow.source!==Ce.node.id||Oe.flow.target===te)return!1;const Ye=N.get(Oe.flow.target);return!!Ye&&x(Ye)===ye&&!Se.includes(Ye)&&w(Ye)===_e.band});let st=Xe.band;if(ce&&(de.has(ce)||He)){if(st=H--,An.add(st),Re){const Oe=new Map;for(const[Ye,Dt]of me)Oe.set(Ye,Dt+1);Oe.set(st,0),ke.set(ye,Oe)}else me.set(st,Math.max(...me.values())+1);(QS=he.get(ye))==null||QS.add(st)}ce&&de.add(ce);for(const Oe of Se)zt.set(Oe.node.id,st),$t.add(Oe.node.id);Re&&ne.has(te)&&gn.add(te)}}}const gi=(x,w)=>{var S;return((S=ke.get(x))==null?void 0:S.get(w))??w},Un=(x,w,S,O)=>{const I=x?f(x):w?f(w):void 0;if(!I)return!1;const T=x?I.y+Math.min(I.height/2,Z):I.y+V;return Math.abs(T+gi(x??`pool:${w??""}`,S)*z-O)<=z/2},Bi=new Map;for(const[x,w]of he){let S=0;for(const O of w)S=Math.max(S,gi(x,O));Bi.set(x,S)}const ti=x=>pe+z*x,Wt=(x,w,S,O)=>{const I=d().children.filter(T=>!("waypoints"in T&&T.waypoints)&&T.type!=="label"&&T.id!==w&&!(O!=null&&O.has(T.id))&&typeof T.y=="number"&&T.y>=x);I.length&&n.moveElements(I,{x:0,y:S})},Sr=(x,w,S)=>{const O=x.type==="bpmn:Participant"?x:void 0;if(!O||O.children.some(L=>L.type==="bpmn:Lane"))return;const I=S+w.height/2+ve-O.y;if(O.height>=I)return;const T=I-O.height,$=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:I}),Wt($,O.id,T)},ns=(x,w,S)=>{const O=w-x.height;if(O<=0)return new Set;const I=g(x)??x,T=[],$=H=>{if(!(S!=null&&S.has(H.id))){T.push(H);for(const j of H.children??[])$(j)}};$(I);const L=x.y+x.height-10,D=l.calculateAdjustments(T,"y",O,L);return l.makeSpace(D.movingShapes,D.resizingShapes,{x:0,y:O},"s",L),new Set(D.movingShapes.map(H=>H.id))},ni=(x,w,S)=>{if(x){const $=m(x),L=ti(w);if($.height>=L)return;const D=L-$.height,H=g($),j=H?H.y+H.height:$.y+$.height,Q=ns($,L);Wt(j,H==null?void 0:H.id,D,Q);return}if(!S)return;const O=z*(w+1);if(S.height>=O)return;const I=O-S.height,T=S.y+S.height;n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:O}),Wt(T,S.id,I)},_t=new Map;for(const x of Y)_t.set(x.flow.target,(_t.get(x.flow.target)??0)+1);const At=x=>(_t.get(x)??0)<=1,IF=new Set(v.map(x=>x.node.id).filter(x=>X(x)===1&&!Y.some(w=>w.flow.target===x||w.flow.source===x&&N.has(w.flow.target)))),qg=new Map,yS=(x,w)=>{if(!x)return;const S=f(x);if(!S||S.height>=ti(w))return;const O=S.y+S.height-10,I=g(S);if(I)return new Set((I.children??[]).filter(T=>T.type!=="bpmn:Lane"&&typeof T.y=="number"&&T.y>O).map(T=>T.id))},Cp=(x,w,S)=>{if(!x)return!0;const O=f(x);return O?S-w.height/2>=O.y&&S+w.height/2<=O.y+O.height:!0},BF=10,NF=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:w}of fe){const S=f(x),O=Pe(x);if(!S||O.length<2)continue;const I=ti(0),T=BF,$=new Set(Gt(e,"node.update").filter(K=>K.lane!==void 0&&w.has(K.lane)).map(K=>K.id)),L=S.children??[],D=L.filter(K=>!("waypoints"in K&&K.waypoints)&&K.type!=="bpmn:Lane"&&K.type!=="label"&&typeof K.y=="number"),H=[];for(const K of D){H.push([K.y,K.y+K.height]);const ue=K.label;ue&&H.push([ue.y,ue.y+ue.height])}for(const K of L){const ue="waypoints"in K&&K.waypoints?K.label:void 0;ue&&ue.y+ue.height>S.y&&ue.y<S.y+S.height&&H.push([ue.y,ue.y+ue.height])}for(const K of d().children){if(K.type!=="bpmn:TextAnnotation")continue;const ue=K;ue.x<S.x+S.width&&ue.x+ue.width>S.x&&ue.y<S.y+S.height&&ue.y+ue.height>S.y&&H.push([ue.y,ue.y+ue.height])}H.sort((K,ue)=>K[0]-ue[0]);const j=S.y,Q=S.y+S.height,ne=[];let de=j;for(const[K,ue]of H)K>de&&ne.push([de,K]),de=Math.max(de,ue);const oe=D.filter(K=>NF.test(K.type)&&!$.has(K.id)),ie=(K,ue)=>oe.some(Re=>Re.y+Re.height/2>=K&&Re.y+Re.height/2<=ue),ye=K=>H.some(([ue,Re])=>ue<K-.5&&K+.5<Re),me=[];let te=j;for(const K of O.slice(1).map(ue=>ue.y)){const ue=te+2*T,Re=!ye(K)&&K>=ue&&K<=Q-2*T?[K]:[];for(const[nt,Xe]of ne){const Ae=Math.max(nt+T,ue),Se=Math.min(Xe-T,Q-2*T);Ae<=Se&&Re.push(Math.min(Math.max(K,Ae),Se))}Re.push(Math.max(de+T,ue));let Ie;for(const nt of Re){const Xe=!ie(te,nt)&&nt-te<I?D.filter(Ce=>Ce.y>=nt).length:0,Ae=Math.abs(nt-K),Se=Ie?Math.abs(Ie.y-K):0;(!Ie||Xe<Ie.cost||Xe===Ie.cost&&(Ae<Se||Ae===Se&&nt>Ie.y))&&(Ie={y:nt,cost:Xe})}me.push(Ie.y),te=Ie.y}const le=me[me.length-1]+2*T-Q;le>0&&(n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+le}),Wt(Q,S.id,le));const ge=[j,...me,S.y+S.height];O.forEach((K,ue)=>{const Re=ge[ue],Ie=ge[ue+1]-Re;(K.y!==Re||K.height!==Ie)&&n.resizeShape(K,{x:K.x,y:Re,width:K.width,height:Ie})});for(const K of O){if(K.height>=I||ie(K.y,K.y+K.height))continue;const ue=I-K.height,Re=S.y+S.height,Ie=ns(K,I);Wt(Re,S.id,ue,Ie)}}const Ap=h.map((x,w)=>({op:x,declared:w}));Ap.sort((x,w)=>{const S=x.op.order??Number.POSITIVE_INFINITY,O=w.op.order??Number.POSITIVE_INFINITY;return S!==O?S-O:x.declared-w.declared});let Tc=80;for(const x of r.getAll())x.parent===d()&&"height"in x&&typeof x.y=="number"&&(Tc=Math.max(Tc,x.y+x.height+60));const Yg=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===d()),$F=(()=>{if(!Yg.length)return;const x=Yg.filter(I=>!bv(I)),w=x.length?x:Yg,S=Math.min(...w.map(I=>I.x)),O=Math.max(...w.map(I=>I.x+I.width));return O>S?{x:S,width:O-S}:void 0})();for(const{op:x}of Ap){const w=x.participant,S=v.filter(ie=>ie.node.participant===w.id).length,O=((eR=w.lanes)==null?void 0:eR.length)??0,I=Math.max(1200,S*160+300),T=(w.lanes??[]).map(ie=>ti(Bi.get(ie.id)??0)),$=T.reduce((ie,ye)=>ie+ye,0);O&&$<300&&(T[O-1]+=300-$);const L=Math.max(300,z*((Bi.get(`pool:${w.id}`)??0)+1)),D=w.blackBox||S+O===0?120:O?Math.max(300,$):L,H=w.blackBox?$F:void 0,j=(H==null?void 0:H.x)??100,Q=(H==null?void 0:H.width)??I,ne=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:w.id,name:w.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...w.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Q,height:D,isExpanded:!0}),de=n.createShape(ne,{x:j+Q/2,y:Tc+D/2},d()),oe=w.lanes??[];if(oe.length&&n.splitLane(de,oe.length),oe.length){const ie=r.filter(ye=>{var me;return ye.type==="bpmn:Lane"&&((me=g(ye))==null?void 0:me.id)===w.id}).sort((ye,me)=>ye.y-me.y);if(ie.forEach((ye,me)=>{const te=oe[me];te&&n.updateProperties(ye,{id:te.id,name:te.name})}),T.some(ye=>ye!==de.height/O)){let ye=de.y;ie.forEach((me,te)=>{const le=T[te];n.resizeShape(me,{x:me.x,y:ye,width:me.width,height:le}),ye+=le})}}Tc=de.y+de.height+60}const FF=x=>{var O;const w=N.get(x);if(w)return w.node.participant??"";const S=f(x);return S?S.type==="bpmn:Participant"?S.id:((O=g(S))==null?void 0:O.id)??"":""},Pc=new Map,vS=x=>{let w=Pc.get(x);return w||Pc.set(x,w={nodes:[],flows:[]}),w};for(const x of v)vS(x.node.participant??"").nodes.push(x);for(const x of Y)vS(FF(x.flow.source)).flows.push(x);const Tp=x=>{var w;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((w=x.condition)==null?void 0:w.label)})},Kg=(x,w,S)=>o.createShape({type:ul(x.type),...x.eventDefinition?{eventDefinitionType:Fc[x.eventDefinition]}:{},businessObject:i.create(ul(x.type),{id:x.id,name:x.name,...w!==void 0?{"bwl:band":w}:{},...S!==void 0?{"bwl:afterColumn":S}:{}})}),jF=[...Ap.map(({op:x})=>x.participant.id).filter(x=>Pc.has(x)),...[...Pc.keys()].filter(x=>!h.some(w=>w.participant.id===x))],Xg=x=>x.endsWith("Gateway");for(const x of jF){const w=Pc.get(x),S=x?m(x):void 0,O=S?S.x+150:250;let I=S?S.y+80:120;const T=(K,ue,Re)=>{if(K){const Ie=m(K);return Ie.y+Math.min(Ie.height/2,Z)+gi(K,ue??0)*z}return ue!==void 0&&S?S.y+V+gi(`pool:${x}`,ue)*z:Re},$=(K,ue,Re)=>{if(K){const Ie=m(K);return Ie.y+Math.min(Ie.height/2,Z)+ue*z}return S?S.y+V+ue*z:Re},L=K=>K.participant?m(K.participant):d(),D=(K,ue,Re,Ie,nt,Xe,Ae,Se)=>{const Ce=Re!==void 0||Ie!==void 0,ce=Oe=>{const Ye=()=>ni(Re,Oe,S);Se?Se(Ye):Ye()},_e=gi(Re??`pool:${x}`,Ie??0);if((Ie===void 0||Un(Re,x,Ie,Ae??Number.NaN))&&Ae!==void 0&&Cp(Re,ue,Ae)&&!U(K,ue,nt,Ae))return{x:nt,y:Ae};if(Ce)for(let Oe=0;Oe<4;Oe++){const Ye=$(Re,_e+Oe,Xe);if(!U(K,ue,nt,Ye,yS(Re,_e+Oe)))return ce(_e+Oe),{x:nt,y:Ye}}const He=T(Re,Ie,Xe);Ce?ce(_e):Se?Se(()=>Sr(K,ue,ue.y+ue.height/2)):Sr(K,ue,He);let st=nt;for(let Oe=0;Oe<64;Oe++){const Ye=U(K,ue,st,He);if(!Ye)break;st=Ye.x+Ye.width+se+ue.width/2}return{x:st,y:He}},H=(K,ue,Re)=>{const Ie=r.getAll().filter(Xe=>{var Ae;return/Association$/.test(Xe.type)&&(((Ae=Xe.waypoints)==null?void 0:Ae.length)??0)>=2});if(!Ie.length)return Re;const nt=Xe=>{const Ae={id:ue.id,type:ue.type,x:Xe-ue.width/2,y:Re.y-ue.height/2,width:ue.width,height:ue.height};return Ie.some(Se=>Se.waypoints.some((Ce,ce)=>!!Se.waypoints[ce+1]&&bo(Ce,Se.waypoints[ce+1],Ae)<=F))};if(!nt(Re.x))return Re;for(let Xe=R;Xe<=C;Xe+=R){const Ae=Re.x+Xe;if(!nt(Ae)&&!U(K,ue,Ae,Re.y))return{x:Ae,y:Re.y}}return Re},j=new Set(w.flows.map(K=>K.flow.target)),Q=new Map,ne=K=>{if(K===void 0)return;const ue=r.get(K);if(!(!ue||typeof ue.x!="number"||typeof ue.width!="number"))return ue.x+ue.width+se},de=K=>{if(X(K)>0)return;const ue=w.flows.filter(Ie=>Ie.flow.source===K);if(ue.length!==1)return;const Re=r.get(ue[0].flow.target);return Re&&typeof Re.y=="number"&&typeof Re.height=="number"?Re.y+Re.height/2:void 0};for(const K of w.nodes){if(j.has(K.node.id))continue;const ue=Kg(K.node,K.band,K.afterColumn),Re=ut(K),Ie=K.node.lane?`${K.node.lane}|${Re??""}`:Re!==void 0?`band:${Re}`:"",nt=L(K.node),Xe=Q.get(Ie)??O,Ae=ne(K.afterColumn),Se=Ae===void 0?Xe:Math.max(Xe,Ae);let Ce;const ce=D(nt,ue,K.node.lane,Re,Se,I,de(K.node.id),IF.has(K.node.id)&&K.node.participant!==void 0?_e=>Ce=_e:void 0);if(Ce?n.createShape(ue,ce,nt,{autoResize:!1}):n.createShape(ue,ce,nt),Ce){const _e=K.node.lane?m(K.node.lane):nt;qg.set(K.node.id,{container:_e,relCy:ce.y-_e.y,grow:Ce})}Q.set(Ie,ce.x+ue.width+se),!K.node.lane&&Re===void 0&&(I+=160)}const oe=new Set,ie=new Map,ye=new Map;if(x&&ee.has(`pool:${x}`)){const K=new Map;for(const Se of w.flows)K.set(Se.flow.target,(K.get(Se.flow.target)??0)+1);const ue=Se=>T(Se.node.lane,yt(Se),Number.NaN),Re=new Set,Ie=Se=>{var _e;const Ce=(_e=N.get(Se))==null?void 0:_e.node.participant;if(Ce)return f(Ce);const ce=f(Se);if(ce)return ce.type==="bpmn:Participant"?ce:g(ce)},nt=Se=>{const Ce=[],ce=new Set([Se]),_e=[Se];for(;_e.length;){const He=_e.shift(),st=N.get(He);st&&Ce.push(st);for(const Oe of w.flows)Oe.flow.source!==He||ce.has(Oe.flow.target)||(K.get(Oe.flow.target)??0)!==1||(ce.add(Oe.flow.target),_e.push(Oe.flow.target))}return Ce},Xe=Se=>{if(!S)return;const Ce=new Set(Se.map(He=>He.node.id));let ce=!1,_e=!1;for(const He of E){if(!Ce.has(He.flow.source))continue;const st=Ie(He.flow.target);!st||st.id===S.id||(st.y<S.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const Se of w.nodes){if(!Xg(Se.node.type))continue;const Ce=T(Se.node.lane,ut(Se),Number.NaN);if(Number.isNaN(Ce))continue;const ce=[];for(const Oe of w.flows){if(Oe.flow.source!==Se.node.id)continue;const Ye=N.get(Oe.flow.target);if(!Ye||Ye.node.lane!==Se.node.lane||(K.get(Ye.node.id)??0)!==1)continue;const Dt=ut(Ye);if(Dt===void 0)continue;const Pn=T(Ye.node.lane,Dt,Number.NaN);if(Number.isNaN(Pn))continue;const kn=nt(Ye.node.id),xt=Xe(kn);xt&&ce.push({subtree:kn,band:Dt,row:Pn,dir:xt})}if(!ce.some(Oe=>Oe.dir==="up")||!ce.some(Oe=>Oe.dir==="down")||!ce.some(Oe=>Oe.dir==="up"&&ce.some(Ye=>Ye.dir==="down"&&Ye.row<Oe.row)))continue;const He=[...ce].sort((Oe,Ye)=>Oe.row-Ye.row);[...ce.filter(Oe=>Oe.dir==="up"),...ce.filter(Oe=>Oe.dir==="down")].sort((Oe,Ye)=>Oe.dir===Ye.dir?Oe.row-Ye.row:Oe.dir==="up"?-1:1).forEach((Oe,Ye)=>{const Dt=He[Ye].band;if(Dt!==Oe.band){Re.add(Se.node.id);for(const Pn of Oe.subtree)ut(Pn)===Oe.band&&zt.set(Pn.node.id,Dt)}})}const Ae=Se=>{if(!S)return;const Ce=new Set(Se.map(He=>He.node.id));let ce=!1,_e=!1;for(const He of E){if(!Ce.has(He.flow.target))continue;const st=Ie(He.flow.source);!st||st.id===S.id||(st.y<S.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const Se of w.nodes){if(!Xg(Se.node.type))continue;const Ce=Se.node.lane??`pool:${x}`,ce=ke.get(Ce);if(!ce||ce.size<2)continue;const _e=ce.get(0);if(_e===void 0)continue;const He=Math.max(...ce.values()),st=_e===He&&_e!==0?"down":void 0;if(!st)continue;const Oe=[];for(const xt of w.flows){if(xt.flow.source!==Se.node.id)continue;const qi=N.get(xt.flow.target);if(!qi||qi.node.lane!==Se.node.lane||(K.get(qi.node.id)??0)!==1)continue;const ss=yt(qi);ss!==void 0&&Oe.push({t:qi,subtree:nt(qi.node.id),band:ss})}const Ye=Oe.find(xt=>(ce.get(xt.band)??xt.band)===_e);if(!Ye||Ae(Ye.subtree)===st||Xe(Ye.subtree)===st)continue;const Dt=Oe.find(xt=>xt!==Ye&&Ae(xt.subtree)===st);if(!Dt)continue;const Pn=Ye.band,kn=Dt.band;for(const xt of Ye.subtree)yt(xt)===Pn&&zt.set(xt.node.id,kn);for(const xt of Dt.subtree)yt(xt)===kn&&zt.set(xt.node.id,Pn);Re.add(Se.node.id)}for(const Se of w.nodes){if(!Xg(Se.node.type))continue;const Ce=ue(Se);if(Number.isNaN(Ce)||Tn(Se.node.id))continue;let ce,_e=!1,He;for(const st of w.flows){if(st.flow.source!==Se.node.id)continue;const Oe=N.get(st.flow.target);if(!Oe||!Oe.node.lane&&ut(Oe)===void 0)continue;const Ye=ue(Oe);Number.isNaN(Ye)||(Math.abs(Ye-Ce)<.5&&(_e=!0),Ye>Ce?!ce||Ye>ce.row?ce={id:Oe.node.id,row:Ye,count:1}:Ye===ce.row&&ce.count++:Ye<Ce&&Oe.node.lane===Se.node.lane&&!$t.has(Oe.node.id)&&(!He||Ye>He.row?He={op:Oe,row:Ye,count:1}:Ye===He.row&&He.count++))}ce&&ce.count===1&&(K.get(ce.id)??0)===1&&!Re.has(Se.node.id)&&oe.add(ce.id),!_e&&He&&He.count===1&&(K.get(He.op.node.id)??0)===1&&!on.has(Se.node.id)&&ie.set(He.op.node.id,{lane:Se.node.lane,band:yt(Se)})}for(const Se of gn){const Ce=(tR=w.flows.find(ce=>ce.flow.target===Se))==null?void 0:tR.flow.source;Ce&&!Re.has(Ce)&&oe.add(Se)}}const me=pT(w.flows.map(K=>K.flow),w.nodes.map(K=>K.node.id),K=>N.has(K));let te=!1;const le=new Set;let ge=0;for(;ge++<w.nodes.length+2;){for(let Re=0;Re<w.nodes.length+w.flows.length+2;Re++){let Ie=!1,nt=!1;for(const Xe of w.flows){const Ae=Xe.flow;if(le.has(Ae.id))continue;const Se=f(Ae.source);if(!Se)continue;const Ce=f(Ae.target),ce=N.get(Ae.target);if(!Ce&&ce&&!te&&me.has(Ae.id)){nt=!0;continue}if(!Ce&&ce){const _e=Kg(ce.node,ce.band),He=yt(ce);if(ce.node.lane||He!==void 0){const st=L(ce.node),Oe=Se,Ye=Oe.x+(ye.get(Ae.source)??0)+Oe.width+se,Dt=ie.get(Ae.target),Pn=D(st,_e,Dt?Dt.lane:ce.node.lane,Dt?Dt.band:He,oe.has(Ae.target)?Oe.x+Oe.width/2:Ye,Number.NaN,Dt||!At(Ae.target)?void 0:Oe.y+Oe.height/2),kn=N.has(Ae.source)?Pn:H(st,_e,Pn),xt=n.createShape(_e,kn,st);oe.has(Ae.target)&&ye.set(Ae.target,Ye-(xt.x+xt.width/2)),n.connect(Se,xt,{type:"bpmn:SequenceFlow",businessObject:Tp(Ae)})}else s.append(Se,_e,{connection:{type:"bpmn:SequenceFlow",businessObject:Tp(Ae)}})}else if(Ce)n.connect(Se,Ce,{type:"bpmn:SequenceFlow",businessObject:Tp(Ae)});else continue;le.add(Ae.id),Ie=!0}if(!Ie){if(nt&&!te){te=!0;continue}break}te=!1}const K=w.nodes.filter(Re=>!f(Re.node.id));if(!K.length)break;const ue=K[0];{const Re=Kg(ue.node,ue.band),Ie=L(ue.node),nt=ut(ue);n.createShape(Re,D(Ie,Re,ue.node.lane,nt,O,I),Ie),!ue.node.lane&&nt===void 0&&(I+=160)}}}const xS=new Map;for(const[x,w]of G){const S=f(x),O=f(w.flow.target);if(!(S!=null&&S.target)||!O)continue;const I=S.label&&{x:S.label.x,y:S.label.y,width:S.label.width,height:S.label.height};xS.set(x,{waypoints:S.waypoints.map(L=>({x:L.x,y:L.y})),label:I});const T=S.target,$=L=>({x:L.x+L.width/2,y:L.y+L.height/2});n.reconnect(S,O,T,[$(O),$(T)]),n.layoutConnection(S,{waypoints:[]})}const bS=new Set;{const x=T=>T.endsWith("Task")||T==="bpmn:CallActivity"||T==="bpmn:SubProcess",w=T=>x(T)||T==="bpmn:EndEvent"||T==="bpmn:IntermediateThrowEvent"||T==="bpmn:IntermediateCatchEvent",S=T=>(T??[]).filter($=>$.type==="bpmn:SequenceFlow"),O=Gt(e,"sequenceFlow.update"),I=(T,$)=>{var L;return(L=y(T,$))==null?void 0:L.id};for(const T of O){if(T.source===void 0&&T.target===void 0||G.has(T.id))continue;const $=f(T.id);if(!$)continue;const L=T.source!==void 0?f(T.source):$.source,D=T.target!==void 0?f(T.target):$.target;if(!L||!D||L.id===D.id||N.has(L.id)||N.has(D.id)||!x(L.type)||!w(D.type)||L.parent!==D.parent||S(D.incoming).some(te=>te.id!==$.id)||S(D.outgoing).some(te=>te.id!==$.id)||O.some(te=>te!==T&&(te.target===D.id||te.source===D.id))||D.x>=L.x+L.width)continue;const H=L.parent,j=g(L),Q=L.x+L.width+se,ne=L.y+L.height/2,de=D.y+D.height/2,oe=I(j,L)===I(j,D),ie=new Set([D.id]),ye=[oe?ne:de,de].find(te=>!U(H,D,Q,te,ie));if(ye===void 0)continue;if(n.moveElements([D],{x:Q-(D.x+D.width/2),y:ye-de}),j){const te=D.x+D.width+Nd-(j.x+j.width);te>0&&hl(n,j,j.width+te)}const me=te=>({x:te.x+te.width/2,y:te.y+te.height/2});n.reconnect($,L,D,[me(L),me(D)]),Math.abs(me(L).y-me(D).y)>1&&n.layoutConnection($,{waypoints:[]}),bS.add(T.id)}}const Rr=40,HF=10,Pp=x=>{const w=j=>j.kind==="label-over-line"||j.kind==="label-over-shape"||j.kind==="label-on-shared-segment"?j.edge===x.id:j.kind==="annotation-over-label"||j.kind==="pool-name-over-label"?j.label===x.id:!1,S=()=>new Map(ft(Ge(r)).filter(j=>!w(j)).map(j=>[ct(j),j])),O=S(),I=j=>[...j].filter(([Q])=>!O.has(Q)).map(([,Q])=>Q),T=j=>I(j).length<=[...O.keys()].filter(Q=>!j.has(Q)).length,$=x.waypoints.map(j=>({x:j.x,y:j.y})),L=x.label,D=L&&{x:L.x,y:L.y};n.layoutConnection(x,{waypoints:[]});const H=S();if(!T(H)){if(I(H).every(j=>j.kind==="edge-crosses-shape"&&j.edge===x.id)){const j=Ge(r),Q=j.edges.find(ie=>ie.id===x.id),ne=Dn(j),de=Q?Ot(Q,ne):[],oe=Q&&de.length&&!de.every(ie=>ie.type==="bpmn:TextAnnotation")?ol(Q,ne,xs(x),j.edges):null;if(oe&&(n.updateWaypoints(x,oe),T(S())))return}n.updateWaypoints(x,$),L&&D&&(L.x!==D.x||L.y!==D.y)&&n.moveElements([L],{x:D.x-L.x,y:D.y-L.y})}},Zg=5,Ni=10,wS=200,kc=new Set([...Y.map(x=>x.flow.id),...E.map(x=>x.flow.id),...Gt(e,"sequenceFlow.update").map(x=>x.id),...Gt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),zF=(x,w,S,O,I,T)=>{const $=new Set(x.map(te=>te.id)),L=Math.min(...x.map(te=>te.x))+w-Ni,D=Math.max(...x.map(te=>te.x+te.width))+w+wS+Ni,H=Math.min(...x.map(te=>te.y+Math.min(0,...S)))-Ni,j=Math.max(...x.map(te=>te.y+te.height+Math.max(0,...S)))+Ni,Q=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const le=te;return kc.has(le.id)||!le.waypoints||le.waypoints.length<2||[le.source,le.target].some(K=>!K||$.has(K.id)||K.x>=O)?!1:le.waypoints.some((K,ue)=>{const Re=le.waypoints[ue+1];return!!Re&&Math.max(K.x,Re.x)>=L&&Math.min(K.x,Re.x)<=D&&Math.max(K.y,Re.y)>=H&&Math.min(K.y,Re.y)<=j})});if(!Q.length)return 0;const ne=te=>{const le=new Map;for(const ge of x)for(const K of S){const ue={id:ge.id,type:ge.type,x:ge.x+w+te,y:ge.y+K,width:ge.width,height:ge.height};for(const Re of Q){let Ie=1/0;for(let Xe=0;Xe+1<Re.waypoints.length;Xe++)Ie=Math.min(Ie,bo(Re.waypoints[Xe],Re.waypoints[Xe+1],ue));const nt=`${Re.id}|${ge.id}`;le.set(nt,Math.min(le.get(nt)??1/0,Ie))}}return le},de=[...ne(0)].filter(([,te])=>te<=Zg).map(([te])=>te);if(!de.length)return 0;let oe=0;for(let te=1;te<=wS;te++){const le=ne(te);if([...le.values()].every(ge=>ge>Zg)&&de.every(ge=>(le.get(ge)??1/0)>=Ni)){oe=te;break}}if(!oe)return 0;const ie=Math.min(...x.map(te=>te.x))+w+oe,ye=new Set(de.map(te=>te.slice(0,te.indexOf("|"))));return Q.some(te=>te.type==="bpmn:SequenceFlow"&&ye.has(te.id)&&te.waypoints.some((le,ge)=>{const K=te.waypoints[ge+1];if(!K||Math.min(le.y,K.y)>T||Math.max(le.y,K.y)<T||le.y===K.y)return!1;const ue=le.x+(T-le.y)*(K.x-le.x)/(K.y-le.y);return ue>I&&ue<ie}))?0:oe},$o=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],I=new Set([x]);for(let T=0;T<O.length;T++){const $=O[T].id;for(const L of Y){const D=L.flow.target;if(L.flow.source!==$||I.has(D)||!N.has(D))continue;I.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},GF=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],I=new Set([x]);for(let T=0;T<O.length;T++){const $=O[T].id;for(const L of Y){const D=L.flow.source;if(L.flow.target!==$||I.has(D)||!N.has(D))continue;I.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},$i=30,bi=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",is=(x,w)=>hl(n,x,w),Fo=(x,w,S=!1)=>{const O=new Set(x.flatMap(D=>D.subtree.map(H=>H.id)));for(const D of x){const H=(D.pool.children??[]).filter(bi).filter(Q=>!O.has(Q.id));if(D.subtree.some(Q=>H.some(ne=>Q.x+w<ne.x+ne.width+$i&&Q.x+w+Q.width+$i>ne.x&&Q.y<ne.y+ne.height&&Q.y+Q.height>ne.y)))return null}const I=x.map(D=>D.pool.width),T=S?r.filter(D=>Array.isArray(D.waypoints)).map(D=>({c:D,wps:D.waypoints.map(H=>({x:H.x,y:H.y}))})):[],$=r.filter(D=>D.type==="label").map(D=>({label:D,x:D.x,y:D.y}));n.moveElements(x.flatMap(D=>D.subtree),{x:w,y:0});const L=x.map(D=>{const j=Math.max(...D.subtree.map(Q=>Q.x+Q.width))+Nd-(D.pool.x+D.pool.width);return j>0&&is(D.pool,D.pool.width+j),j});return()=>{n.moveElements(x.flatMap(D=>D.subtree),{x:-w,y:0}),x.forEach((D,H)=>{L[H]>0&&is(D.pool,I[H])});for(const{c:D,wps:H}of T){const j=D.waypoints??[];j.length===H.length&&j.every((ne,de)=>Math.abs(ne.x-H[de].x)<=.5&&Math.abs(ne.y-H[de].y)<=.5)||n.updateWaypoints(D,H.map(ne=>({x:ne.x,y:ne.y})))}for(let D=0;D<3;D++){let H=0;for(const j of $){const Q=j.x-j.label.x,ne=j.y-j.label.y;Math.abs(Q)<=.5&&Math.abs(ne)<=.5||(n.moveElements([j.label],{x:Q,y:ne}),H++)}if(!H)break}}},Jg=x=>{var I,T;const w=new Map,S=new Map;for(const $ of r.getAll()){if($.type!=="bpmn:Participant")continue;const L=$;(L.children??[]).length||(w.set(L.id,L),S.set(L.id,[]))}for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const L=$,D=(I=L.source)==null?void 0:I.id,H=(T=L.target)==null?void 0:T.id;D&&H&&S.has(D)&&S.get(D).push(H),D&&H&&S.has(H)&&S.get(H).push(D)}const O=[];for(const[$,L]of S)L.length&&L.every(D=>x.has(D))&&O.push(w.get($));return O},_S=(x,w)=>{if(!x.length)return null;const S=new Set(x.map(j=>j.id)),O=r.getAll().filter(j=>j.type==="bpmn:Participant"&&!S.has(j.id)),I=Math.min(...O.filter(j=>(j.children??[]).length>0).map(j=>j.x)),T=new Set(x.filter(j=>Math.abs(j.x-I)<=2).map(j=>j.id));if(x.some(j=>{const Q=T.has(j.id)?j.x:j.x+w,ne=T.has(j.id)?j.width+w:j.width;return O.some(de=>Q<de.x+de.width+$i&&Q+ne+$i>de.x&&j.y<de.y+de.height&&j.y+j.height>de.y)}))return null;const L=r.filter(j=>j.type==="label").map(j=>({label:j,x:j.x,y:j.y})),D=x.filter(j=>!T.has(j.id)),H=x.filter(j=>T.has(j.id)).map(j=>({pool:j,was:{x:j.x,y:j.y,width:j.width,height:j.height}}));D.length&&n.moveElements(D,{x:w,y:0});for(const{pool:j,was:Q}of H)n.resizeShape(j,{...Q,width:Q.width+w});return()=>{for(const{pool:j,was:Q}of H)n.resizeShape(j,Q);D.length&&n.moveElements(D,{x:-w,y:0});for(let j=0;j<3;j++){let Q=0;for(const ne of L){const de=ne.x-ne.label.x,oe=ne.y-ne.label.y;Math.abs(de)<=.5&&Math.abs(oe)<=.5||(n.moveElements([ne.label],{x:de,y:oe}),Q++)}if(!Q)break}}},ES=(x,w,S)=>{const O=S.x+S.width/2,I=w.y>S.y,T=I?S.y+S.height:S.y,$=I?w.y:w.y+w.height,L=x.source===w?[{x:O,y:$},{x:O,y:T}]:[{x:O,y:T},{x:O,y:$}],D=Ge(r),H={...D.edges.find(j=>j.id===x.id),waypoints:L};return Ot(H,Dn(D)).length?!1:(n.updateWaypoints(x,L),!0)},VF=()=>{const x=r.filter($=>$.type==="bpmn:Participant"),w=Math.min(...x.filter($=>($.children??[]).length>0).map($=>$.x)),S=$=>h.some(L=>L.participant.id===$.id),O=$=>!!$&&$.type==="bpmn:Participant"&&!($.children??[]).length&&Math.abs($.x-w)<=2&&!S($),I=$=>!!$&&$.type==="bpmn:Participant"&&($.children??[]).length>0&&!S($),T=new Set;for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const L=$;if((L.waypoints??[]).length!==2)continue;const D=[L.source,L.target].find(Q=>O(Q)||I(Q)),H=D===L.source?L.target:L.source;if(!D||!H||H.type==="bpmn:Participant")continue;const j=H.x+H.width/2;I(D)&&(j<D.x||j>D.x+D.width)||T.add(L.id)}return T},WF=x=>{var S;const w=new Map;for(const O of x){const I=r.get(O);if(!I||(I.waypoints??[]).length===2)continue;const T=((S=I.source)==null?void 0:S.type)==="bpmn:Participant"?I.source:I.target,$=T===I.source?I.target:I.source;if($.x+$.width/2<=T.x+T.width)continue;const L=w.get(T.id)??{pool:T,msgs:[]};L.msgs.push({conn:I,other:$}),w.set(T.id,L)}for(const{pool:O,msgs:I}of w.values()){const T=Math.max(...I.map(({other:oe})=>oe.x+oe.width/2))+Bd;if(r.getAll().some(oe=>{if(oe.type!=="bpmn:Participant"||oe.id===O.id)return!1;const ie=oe;return O.x<ie.x+ie.width+$i&&T+$i>ie.x&&O.y<ie.y+ie.height&&O.y+O.height>ie.y}))continue;const L={x:O.x,y:O.y,width:O.width,height:O.height},D=[...O.incoming??[],...O.outgoing??[]],H=D.map(oe=>({c:oe,wps:(oe.waypoints??[]).map(ie=>({x:ie.x,y:ie.y}))})),j=D.flatMap(oe=>{const ie=oe.label;return ie?[{label:ie,x:ie.x,y:ie.y}]:[]}),Q=Mr();is(O,T-O.x);const ne=I.filter(({conn:oe,other:ie})=>ES(oe,O,ie)).length,de=Mr();if(!(ne>0&&de.messages>Q.messages&&de.lines>=Q.lines)){is(O,L.width);for(const{c:oe,wps:ie}of H){const ye=oe.waypoints??[];ye.length===ie.length&&ye.every((te,le)=>Math.abs(te.x-ie[le].x)<=.5&&Math.abs(te.y-ie[le].y)<=.5)||n.updateWaypoints(oe,ie.map(te=>({x:te.x,y:te.y})))}for(let oe=0;oe<3;oe++){let ie=0;for(const ye of j){const me=ye.x-ye.label.x,te=ye.y-ye.label.y;Math.abs(me)<=.5&&Math.abs(te)<=.5||(n.moveElements([ye.label],{x:me,y:te}),ie++)}if(!ie)break}}}},SS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:DataInputAssociation"&&w.type!=="bpmn:DataOutputAssociation")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},RS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:Association")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},UF=x=>{const w=[];for(const S of r.getAll()){if(S.type!=="bpmn:TextAnnotation")continue;const O=S;if(x.has(O.id))continue;const T=[...O.incoming??[],...O.outgoing??[]].filter(D=>D.type==="bpmn:Association").map(D=>D.source===O?D.target:D.source);if(!T.length||T.some(D=>D===void 0))continue;const $=D=>{if(!("waypoints"in D&&D.waypoints))return[D.id];const H=D,j=[H.source,H.target];return j.some(Q=>!Q)?[]:j.map(Q=>Q.id)},L=T.flatMap(D=>$(D));L.length&&L.every(D=>x.has(D))&&w.push(O)}return w},MS=()=>ft(Ge(r)).filter(x=>x.kind==="edge-crosses-shape").length,CS=x=>{const w=(x.children??[]).filter(bi);let S=0;for(let O=0;O<w.length;O++)for(let I=O+1;I<w.length;I++){const T=w[O],$=w[I];T.x<$.x+$.width&&T.x+T.width>$.x&&T.y<$.y+$.height&&T.y+T.height>$.y&&S++}return S},Mr=()=>{const x=Ge(r),w=S=>S.length>=2&&(S.every(O=>Math.abs(O.x-S[0].x)<.01)||S.every(O=>Math.abs(O.y-S[0].y)<.01));return{messages:x.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length,lines:x.edges.filter(S=>w(S.waypoints)).length}},AS=x=>{const w=new Map;for(const O of r.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const I=O;if(!I.waypoints||I.waypoints.length!==2)continue;const T=I.source,$=I.target;if(!T||!$)continue;const L=x.has(T.id);if(L===x.has($.id))continue;const D=L?$:T,H=g(D);if(!H||x.has(D.id))continue;const j=w.get(H.id);j?D.x<j.minX&&(j.minX=D.x):w.set(H.id,{pool:H,minX:D.x})}const S=[];for(const{pool:O,minX:I}of w.values()){const T=(O.children??[]).filter($=>bi($)&&!x.has($.id)&&$.x>=I);T.length&&S.push({subtree:T,pool:O})}return S},qF=(x,w,S)=>{const O=new Map(w.map($=>[$.pool.id,{subtree:[...$.subtree],pool:$.pool}])),I=new Set(x);for(const $ of w)for(const L of $.subtree)I.add(L.id);let T=!1;for(;;){let $=0;for(const L of AS(I)){if(L.pool===S)continue;const D=O.get(L.pool.id);D?D.subtree.push(...L.subtree):O.set(L.pool.id,{subtree:[...L.subtree],pool:L.pool});for(const H of L.subtree)I.add(H.id);$+=L.subtree.length}if(!$)break;T=!0}return T?[...O.values()]:null},YF=(x,w)=>{const S=new Map;for(const I of r.getAll()){if(I.type!=="bpmn:DataInputAssociation"&&I.type!=="bpmn:DataOutputAssociation")continue;const T=I,$=T.waypoints;if(!$||$.length<2||!$.every(de=>Math.abs(de.x-$[0].x)<1))continue;const L=T.source,D=T.target;if(!L||!D)continue;const H=x.has(L.id);if(H===x.has(D.id))continue;const j=H?D:L,Q=g(j);if(!Q||Q===w||Q===g(H?L:D))continue;const ne=S.get(Q.id);ne?j.x<ne.minX&&(ne.minX=j.x):S.set(Q.id,{pool:Q,minX:j.x})}const O=[];for(const{pool:I,minX:T}of S.values()){const $=(I.children??[]).filter(L=>bi(L)&&!x.has(L.id)&&L.x>=T);$.length&&O.push({subtree:$,pool:I})}return O},TS=x=>{const w=Ge(r),S=w.shapes.filter(I=>x.has(I.id)),O=new Set;for(const I of w.edges)if(!(I.type!=="bpmn:SequenceFlow"&&I.type!=="bpmn:MessageFlow"))for(const T of Ot(I,S))O.add(`${I.id}|${T.id}`);return O},Qg=new Map,KF=Gt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const w=G.get(x.id);return w?[{id:x.id,target:w.flow.target,source:w.flow.source}]:[]});for(const x of KF){if(x.target===void 0)continue;const w=N.get(x.target);if(!w)continue;const S=f(x.target),O=f(x.id);if(!S||!O)continue;const I=x.source!==void 0?f(x.source):O.source,T=O.target;if(!I||!T||T.id===S.id)continue;const $=xS.get(O.id)??{waypoints:O.waypoints,label:O.label},L=$.waypoints&&$.waypoints.length>=3&&Math.abs($.waypoints[0].x-$.waypoints[1].x)<1&&Math.abs($.waypoints[0].y-$.waypoints[1].y)>1?{x:$.waypoints[0].x,y:$.waypoints[0].y}:void 0,D=L?$.waypoints[1].y:void 0,H=L&&$.label?{x:$.label.x,y:$.label.y}:void 0,j=H&&$.label&&Math.abs(H.y+$.label.height/2-D)<=z/5&&H.x+$.label.width>L.x?H.x+$.label.width+6:void 0,Q=(I.outgoing??[]).filter(De=>De.type==="bpmn:SequenceFlow"&&De.id!==O.id&&De.target&&!kc.has(De.id)),ne=new Set(Q.map(De=>De.target.id)),de=De=>{const Tt={type:"bpmn:Task",x:De.x+2,y:De.y+2,width:De.width-4,height:De.height-4};return Q.find(Et=>(Et.waypoints??[]).some((Jt,Fe)=>!!Et.waypoints[Fe+1]&&bo(Jt,Et.waypoints[Fe+1],Tt)===0))},oe=$o(x.target),ie=new Set(oe.map(De=>De.id)),ye=qg.has(x.target)?{autoResize:!1}:void 0,me=Math.min(...oe.map(De=>De.x)),te=Math.max(...oe.map(De=>De.x+De.width)),le=I.x+I.width,ge=T.x+T.width<=I.x,K=(()=>{if(!ge)return;const De=g(S),Tt=((De==null?void 0:De.children)??[]).filter(ze=>bi(ze)&&!ie.has(ze.id)&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:Participant"),Et=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Jt=r.getAll().filter(ze=>{if(!Et.includes(ze.type))return!1;const jt=ze;return jt.id===O.id||kc.has(jt.id)||!jt.waypoints||jt.waypoints.length<2?!1:![jt.source,jt.target].some(Lt=>!Lt||ie.has(Lt.id))}),Fe=(ze,jt)=>oe.every(Lt=>{var ca;const Rt={id:Lt.id,type:Lt.type,x:Lt.x+ze,y:Lt.y+jt,width:Lt.width,height:Lt.height};return De&&(Rt.x<De.x||Rt.x+Rt.width>De.x+De.width||Rt.y<De.y||Rt.y+Rt.height>De.y+De.height)||!Cp((ca=N.get(Lt.id))==null?void 0:ca.node.lane,Lt,Lt.y+jt+Lt.height/2)||Tt.some(Xn=>Rt.x<Xn.x+Xn.width+Ni&&Rt.x+Rt.width+Ni>Xn.x&&Rt.y<Xn.y+Xn.height+Ni&&Rt.y+Rt.height+Ni>Xn.y)?!1:Jt.every(Xn=>{for(let yo=0;yo+1<Xn.waypoints.length;yo++)if(bo(Xn.waypoints[yo],Xn.waypoints[yo+1],Rt)<Ni)return!1;return!0})}),Ke=I.x+I.width/2,bt=I.y+I.height/2,it=$.waypoints??[],kt=it.length>=2&&Math.abs(it[0].y-it[1].y)<1&&it[1].x<it[0].x;return[...D!==void 0?[{cx:Ke,cy:D}]:[],...kt?[{cx:I.x-Rr-S.width/2,cy:it[0].y}]:[],{cx:Ke,cy:bt+z},{cx:Ke,cy:bt-z}].find(ze=>Fe(ze.cx-(S.x+S.width/2),ze.cy-(S.y+S.height/2)))})(),ue=ge&&!K?le:T.x,Re=(()=>{var bt;if(L||ge)return 0;const De=$.label,Tt=((bt=O.businessObject)==null?void 0:bt.name)??"";if(!De||De.width==null||!Tt.trim())return 0;const Et=le+Rr,Jt=I.y+I.height/2-S.height/2;if(Math.min(De.y+De.height,Jt+S.height)-Math.max(De.y,Jt)<3||De.x+De.width-Et<3)return 0;const Ke=De.x+De.width+HF-Et;return Ke<=S.width?Ke:0})();Re>0&&u.add(O.id);const Ie=S.y+S.height/2,nt=zF(oe,le+Rr+Re-me,[0,I.y+I.height/2-Ie,T.y+T.height/2-Ie],ue,le,I.y+I.height/2),Xe=le+Rr+Re+nt,Ae=(()=>{if(j===void 0)return 0;const De=le+Rr,Tt=I.y+I.height/2-S.height/2,Et={x:De,y:Tt,width:te-me,height:S.height},Jt=g(I);return((Jt==null?void 0:Jt.children)??[]).some(Ke=>bi(Ke)&&!ie.has(Ke.id)&&Ke.id!==I.id&&Ke.id!==T.id&&Ke.type!=="bpmn:Group"&&Ke.type!=="bpmn:Participant"&&Ke.x<Et.x+Et.width&&Ke.x+Ke.width>Et.x&&Ke.y<Et.y+Et.height&&Ke.y+Ke.height>Et.y)||de(Et)?Math.max(0,j-De):0})(),Se=K?0:te-me+Rr*2+nt+Ae+Re-(ge?0:T.x-le);let Ce=[];if(Se>0){const De=g(S),Tt=(De==null?void 0:De.children)??[],Et=it=>it.type==="bpmn:Lane";Ce=(()=>{const it=new Set;for(const Ue of Tt)bi(Ue)&&!ie.has(Ue.id)&&Ue.id!==I.id&&Ue.x>=ue&&it.add(Ue.id);const kt=[];for(const Ue of Tt){if(Ue.type!=="bpmn:DataStoreReference"&&Ue.type!=="bpmn:DataObjectReference")continue;const ze=Ue,Lt=[...ze.incoming??[],...ze.outgoing??[]].filter(Rt=>Rt.type==="bpmn:DataInputAssociation"||Rt.type==="bpmn:DataOutputAssociation").map(Rt=>Rt.source===ze?Rt.target:Rt.source);Lt.length&&Lt.every(Rt=>Rt!==void 0&&it.has(Rt.id))&&kt.push(ze)}return kt})();const Fe=Tt.filter(it=>!("waypoints"in it&&it.waypoints)&&!Et(it)&&it.type!=="label"&&!ie.has(it.id)&&it.id!==I.id&&it.x>=ue),Ke=Fe.flatMap(it=>it.labels??[]),bt=De?[De,...Tt.filter(it=>Et(it))]:[];if(Fe.length){const it=new Set(Fe.map(rt=>rt.id)),kt=AS(it),Ue=kt.length?qF(it,kt,De):null,ze=rt=>{const Mt=new Set(it);for(const Ht of rt)for(const jo of Ht.subtree)Mt.add(jo.id);return UF(Mt)},jt=ze(kt),Lt=Ue?ze(Ue):jt,Rt=Jg(it),ca=new Set(it);for(const rt of kt)for(const Mt of rt.subtree)ca.add(Mt.id);const Xn=kt.length?Jg(ca):Rt,yo=(()=>{if(!Ue)return[];const rt=new Set(it);for(const Mt of Ue)for(const Ht of Mt.subtree)rt.add(Ht.id);return Jg(rt)})(),cs=Ue??kt,la=(()=>{const rt=new Set(it);for(const Mt of cs)for(const Ht of Mt.subtree)rt.add(Ht.id);return YF(rt,De)})(),lm=la.length?ze([...cs,...la]):jt,Ki=new Set([...Fe,...bt].map(rt=>rt.id)),St=Tt.filter(rt=>{const Mt=rt.labelTarget;return rt.type==="label"&&!!Mt&&"waypoints"in Mt&&!!Mt.source&&!!Mt.target&&Ki.has(Mt.source.id)&&Ki.has(Mt.target.id)}),Sn=VF();n.createSpace([...Fe,...Ke,...St],bt,{x:Se,y:0},"e",ue-1);const Qt=(rt,Mt,Ht)=>{const jo=Mr(),Lp=Ht?TS(Ht):null,Ip=Fo(rt,Se,!!Ht);if(!Ip)return!1;const Ic=Mt.length?_S(Mt,Se):null,Bp=Mr(),en=!!Ht&&!!Lp&&[...TS(Ht)].some(pa=>!Lp.has(pa));return Bp.messages>jo.messages&&Bp.lines>=jo.lines&&!en?!0:(Ic==null||Ic(),Ip(),!1)},mi=la.length>0&&Qt([...cs,...la],Ue?yo:Xn,new Set(la.flatMap(rt=>rt.subtree.map(Mt=>Mt.id)))),ua=!mi&&Ue?Qt(Ue,yo):!1;let vo=mi||ua;!vo&&kt.length&&(vo=Qt(kt,Xn));const ls=mi?lm:ua?Lt:jt;if(!vo){for(const rt of kt){const Mt=Mr(),Ht=Fo([rt],Se);if(!Ht)continue;const jo=Mr();(jo.messages<=Mt.messages||jo.lines<Mt.lines)&&Ht()}if(Rt.length){const rt=Mr(),Mt=_S(Rt,Se);if(Mt){const Ht=Mr();(Ht.messages<=rt.messages||Ht.lines<rt.lines)&&Mt()}}}if(WF(Sn),ls.length){const rt=()=>new Set(ft(Ge(r)).map(Ht=>ct(Ht))),Mt=Ht=>{const jo=RS(),Lp=rt(),Ip=Ht.map(en=>({a:en,x:en.x,y:en.y})),Ic=r.filter(en=>en.type==="label").map(en=>({label:en,x:en.x,y:en.y}));n.moveElements(Ht,{x:Se,y:0});const Bp=[...rt()].filter(en=>!Lp.has(en));if(RS()<jo&&Bp.length===0)return!0;for(const{a:en,x:pa,y:Bc}of Ip)(en.x!==pa||en.y!==Bc)&&n.moveElements([en],{x:pa-en.x,y:Bc-en.y});for(const en of Ic){const pa=en.x-en.label.x,Bc=en.y-en.label.y;(pa!==0||Bc!==0)&&n.moveElements([en.label],{x:pa,y:Bc})}return!1};if(!Mt(ls)&&ls.length>1)for(const Ht of ls)Mt([Ht])}}}const ce=w.node.lane!==void 0?f(w.node.lane):w.node.participant!==void 0?f(w.node.participant):void 0,_e=De=>{if(!ce)return!0;const Tt=De.y+De.height/2;return Tt>=ce.y&&Tt<=ce.y+ce.height},He=!_e(I)&&_e(T),st=De=>De.y+De.height/2,Oe=()=>{const De=I.x+I.width,Tt=T.x,Et=st(T)-S.height/2,Jt=st(T)+S.height/2;return!r.getAll().some(Fe=>bi(Fe)&&Fe.type!=="bpmn:Participant"&&Fe.type!=="bpmn:Group"&&Fe.type!=="bpmn:TextAnnotation"&&Fe.id!==I.id&&Fe.id!==T.id&&Fe.id!==S.id&&Fe.x<Tt&&Fe.x+Fe.width>De&&Fe.y<Jt&&Fe.y+Fe.height>Et)},Ye=!He&&w.band!==void 0&&_e(T)&&!Un(w.node.lane,w.node.participant,w.band,st(I))&&Un(w.node.lane,w.node.participant,w.band,st(T))&&T.x>=I.x+I.width&&Oe(),Dt=He||Ye?T:I,Pn=Dt.y+Dt.height/2,kn=Pn-(S.y+S.height/2),xt=w.band!==void 0,qi=xt?[S]:oe,ss=(w.band===void 0||Un(w.node.lane,w.node.participant,w.band,Pn))&&At(x.target)&&qi.every(De=>{var Tt;return Cp((Tt=N.get(De.id))==null?void 0:Tt.node.lane,De,De.y+De.height/2+kn)}),y6=De=>Math.abs(De.y+De.height/2-(S.y+S.height/2))<=z/2;if(ss&&xt){const De=Math.abs(kn)<=z/2?oe.filter(Fe=>Fe.id!==S.id&&y6(Fe)):[],Tt=S.y+S.height/2,Jt=w.band!==void 0&&!Un(w.node.lane,w.node.participant,w.band,Tt)?oe.filter(Fe=>{var Ke,bt;return Fe.id!==S.id&&!De.includes(Fe)&&((Ke=N.get(Fe.id))==null?void 0:Ke.band)===w.band&&((bt=N.get(Fe.id))==null?void 0:bt.node.lane)===w.node.lane&&(Math.abs(Fe.y+Fe.height/2-Tt)<=z/2||Un(w.node.lane,w.node.participant,w.band,Fe.y+Fe.height/2))}).map(Fe=>({t:Fe,dy:Pn-(Fe.y+Fe.height/2)})).filter(({dy:Fe})=>Fe!==0):[];if(n.moveElements(oe,{x:Xe-me,y:0},void 0,ye),n.moveElements([S],{x:0,y:kn},void 0,ye),De.length){const Fe=()=>new Set(ft(Ge(r)).map(ze=>ct(ze))),Ke=Fe(),bt=r.filter(ze=>ze.type==="label").map(ze=>({label:ze,x:ze.x,y:ze.y}));n.moveElements(De,{x:0,y:kn});const it=Fe(),kt=[...it].filter(ze=>!Ke.has(ze)).length,Ue=[...Ke].filter(ze=>!it.has(ze)).length;if(kt>Ue){n.moveElements(De,{x:0,y:-kn});for(const ze of bt){const jt=ze.x-ze.label.x,Lt=ze.y-ze.label.y;(jt!==0||Lt!==0)&&n.moveElements([ze.label],{x:jt,y:Lt})}}}if(Jt.length){const Fe=new Set(oe.map(Ke=>Ke.id));for(const{t:Ke,dy:bt}of Jt)U(Ke.parent,Ke,Ke.x+Ke.width/2,Ke.y+Ke.height/2+bt,Fe)||n.moveElements([Ke],{x:0,y:bt})}}else n.moveElements(oe,{x:Xe-me,y:ss?kn:0},void 0,ye);const Yi=g(S);if(!ss&&w.node.lane===void 0&&w.band!==void 0&&Yi){const De=Yi.y+V+gi(`pool:${w.node.participant??""}`,w.band)*z,Tt=De-(S.y+S.height/2);Tt!==0&&!U(Yi,S,S.x+S.width/2,De,ie)&&n.moveElements([S],{x:0,y:Tt},void 0,ye)}if(K)n.moveElements(oe,{x:K.cx-(S.x+S.width/2),y:K.cy-(S.y+S.height/2)},void 0,ye);else if(Yi){const De=(Yi.children??[]).filter(Fe=>bi(Fe)&&!ie.has(Fe.id)&&Fe.type!=="bpmn:Group"&&Fe.type!=="bpmn:Participant"),Tt=(Fe,Ke,bt,it,kt)=>Fe.x+Ke<kt.x+kt.width+it&&Fe.x+Ke+Fe.width+it>kt.x&&Fe.y+bt<kt.y+kt.height+it&&Fe.y+bt+Fe.height+it>kt.y,Et=De.find(Fe=>Tt(S,0,0,0,Fe)),Jt=Et?void 0:de(S);if(Et||Jt){const Fe=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Ke=r.getAll().filter(St=>{if(!Fe.includes(St.type))return!1;const Sn=St;return kc.has(Sn.id)||!Sn.waypoints||Sn.waypoints.length<2?!1:![Sn.source,Sn.target].some(Qt=>!Qt||ie.has(Qt.id))}),bt=(St,Sn,Qt)=>{var mi;return Cp((mi=N.get(St.id))==null?void 0:mi.node.lane,St,St.y+Qt+St.height/2)&&St.x+Sn>=Yi.x&&St.x+Sn+St.width<=Yi.x+Yi.width&&St.y+Qt>=Yi.y&&St.y+Qt+St.height<=Yi.y+Yi.height},it=(St,Sn)=>oe.every(Qt=>bt(Qt,St,Sn)&&!De.some(mi=>Tt(Qt,St,Sn,Ni,mi))&&Ke.every(mi=>{const ua={id:Qt.id,type:Qt.type,x:Qt.x+St,y:Qt.y+Sn,width:Qt.width,height:Qt.height};for(let vo=0;vo+1<mi.waypoints.length;vo++)if(bo(mi.waypoints[vo],mi.waypoints[vo+1],ua)<Ni)return!1;return!0})),kt=S.y+S.height/2,Ue=[D,T.y+T.height/2].filter(St=>St!==void 0&&Math.abs(St-kt)>=1),ze=Et&&ne.has(Et.id)?Et:Jt==null?void 0:Jt.target,jt=ze?ze.x-S.x:0,Lt=Math.max(...oe.map(St=>St.x+St.width)),Rt=[...jt!==0?[jt]:[],...nt!==0?[-nt]:[],0],ca=j===void 0?[]:Rt.map(St=>Math.max(St,j-S.x)),Xn=St=>Lt+St+Rr<=T.x,yo=[...new Set([...ca,...Rt])].filter(Xn),cs=Et&&ne.has(Et.id)?[Et.x+Et.width+Rr-S.x]:[],la=j===void 0?[]:cs.map(St=>Math.max(St,j-S.x)),lm=[...new Set([...la,...cs])].filter(St=>Xn(St)&&!yo.includes(St));let Ki;for(const St of[yo,lm]){for(const Sn of Ue){for(const Qt of St)if(it(Qt,Sn-kt)){Ki={dx:Qt,dy:Sn-kt};break}if(Ki)break}if(Ki)break}if(Ki){const St=rt=>{const Mt=rt;return[Mt.edge,Mt.other,...Array.isArray(Mt.edges)?Mt.edges:[]].some(Ht=>typeof Ht=="string"&&kc.has(Ht))},Sn=()=>new Set(ft(Ge(r)).filter(rt=>!St(rt)).map(rt=>ct(rt))),Qt=Sn(),mi=r.filter(rt=>rt.type==="label").map(rt=>({label:rt,x:rt.x,y:rt.y}));n.moveElements(oe,{x:Ki.dx,y:Ki.dy},void 0,ye);const ua=Sn(),vo=[...ua].filter(rt=>!Qt.has(rt)).length,ls=[...Qt].filter(rt=>!ua.has(rt)).length;if(vo>ls){n.moveElements(oe,{x:-Ki.dx,y:-Ki.dy},void 0,ye);for(const rt of mi){const Mt=rt.x-rt.label.x,Ht=rt.y-rt.label.y;(Mt!==0||Ht!==0)&&n.moveElements([rt.label],{x:Mt,y:Ht})}}else L&&Qg.set(O.id,{exit:L,channelY:D,label:H})}}}{const De=new Set(oe.map(Ke=>Ke.id)),Tt=new Set(Y.map(Ke=>Ke.flow.id)),Et=20,Jt=Ke=>{const bt=Ke.source,it=Ke.target,kt=Math.min(bt.x,it.x)-Et,Ue=Math.max(bt.x+bt.width,it.x+it.width)+Et,ze=Math.min(bt.y,it.y)-Et,jt=Math.max(bt.y+bt.height,it.y+it.height)+Et;return Ke.waypoints.some(Lt=>Lt.x<kt||Lt.x>Ue||Lt.y<ze||Lt.y>jt)},Fe=new Map;for(const Ke of oe)for(const bt of[...Ke.incoming??[],...Ke.outgoing??[]])(G.has(bt.id)||bt.id!==x.id&&Tt.has(bt.id))&&!(De.has(bt.source.id)&&De.has(bt.target.id))&&Fe.set(bt.id,bt);for(const Ke of Fe.values())Jt(Ke)&&Pp(Ke)}const mo=Ce.length?g(Ce[0]):void 0;if(mo){const De={assoc:SS(),overlaps:CS(mo),crosses:MS()},Tt=Ce.map(Ue=>({st:Ue,x:Ue.x})),Et=r.filter(Ue=>Ue.type==="label").map(Ue=>({label:Ue,x:Ue.x,y:Ue.y})),Jt=Math.min(...Ce.flatMap(Ue=>[...Ue.incoming??[],...Ue.outgoing??[]].filter(ze=>ze.type==="bpmn:DataInputAssociation"||ze.type==="bpmn:DataOutputAssociation").map(ze=>(ze.source===Ue?ze.target:ze.source).x))),Fe=new Set(Ce.map(Ue=>Ue.id)),Ke=(mo.children??[]).filter(bi).filter(Ue=>!Fe.has(Ue.id));let bt=Jt;for(const Ue of[...Ce].sort((ze,jt)=>ze.x-jt.x)){let ze=bt;for(let jt=0;jt<100;jt++){const Lt=Ke.find(Rt=>ze<Rt.x+Rt.width+$i&&ze+Ue.width+$i>Rt.x&&Ue.y<Rt.y+Rt.height&&Ue.y+Ue.height>Rt.y);if(!Lt)break;ze=Lt.x+Lt.width+$i}ze!==Ue.x&&n.moveElements([Ue],{x:ze-Ue.x,y:0}),bt=ze+Ue.width+$i}const it=bt+150-(mo.x+mo.width);it>0&&is(mo,mo.width+it);const kt={assoc:SS(),overlaps:CS(mo),crosses:MS()};if(kt.assoc>=De.assoc||kt.overlaps>De.overlaps||kt.crosses>De.crosses){for(const{st:Ue,x:ze}of Tt)Ue.x!==ze&&n.moveElements([Ue],{x:ze-Ue.x,y:0});it>0&&is(mo,mo.width-it);for(const Ue of Et){const ze=Ue.x-Ue.label.x,jt=Ue.y-Ue.label.y;(ze!==0||jt!==0)&&n.moveElements([Ue.label],{x:ze,y:jt})}}}}for(const[x,w]of qg){const S=f(x);if(!S)continue;const O=w.container,I=Math.abs(S.y+S.height/2-O.y-w.relCy)>=.5,T=S.label,$=Math.min(S.y,T&&!T.hidden?T.y:S.y),L=Math.max(S.y+S.height,T&&!T.hidden?T.y+T.height:0);if(I&&$>=O.y&&L<=O.y+O.height)continue;const D=S.y;w.grow(),S.y!==D&&n.moveElements([S],{x:0,y:D-S.y},void 0,{autoResize:!1})}const PS=(x,w)=>{const S=w.target===x,O=m(w.source),I=m(w.target),T=S?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,I,w.id?{type:T,businessObject:i.create(T,{id:w.id})}:{type:T})},kS=x=>{for(const w of h){if(!w.participant.blackBox)continue;const S=f(w.participant.id);if(!S)continue;const O=[];for(const T of E){const $=T.flow.source===w.participant.id?T.flow.target:T.flow.target===w.participant.id?T.flow.source:void 0,L=$?f($):void 0;L&&typeof L.x=="number"&&L.type!=="bpmn:Participant"&&O.push(L)}if(!O.length)continue;if(!x&&w.order===void 0){const T=(()=>{var L;const $=new Map;for(const D of O){const H=g(D);if(!H)continue;const j=$.get(H.id);j?j.n+=1:$.set(H.id,{shape:H,n:1})}return(L=[...$.values()].sort((D,H)=>H.n-D.n)[0])==null?void 0:L.shape})();if(T){const $=H=>H.reduce((j,Q)=>j+Q,0)/H.length,L=$(O.map(H=>H.y+H.height/2))<T.y+T.height/2,D=r.filter(H=>H.type==="bpmn:Participant"&&H.id!==w.participant.id&&H.id!==T.id).filter(H=>L?H.y+H.height<=T.y+5:H.y>=T.y+T.height-5);if(D.length){const H=[...D.reduce((ge,K)=>ge.set(K.y,(ge.get(K.y)??0)+1),new Map)].sort((ge,K)=>K[1]-ge[1]||(L?K[0]-ge[0]:ge[0]-K[0]))[0][0],j=Math.min(S.width,sT),Q=cT,ne=O.map(ge=>ge.x+ge.width/2),de=Math.round($(ne)-j/2),oe=Math.max(...ne)+Bd,ie=ge=>({x:ge,width:Math.max(j,oe-ge)}),ye=D.filter(ge=>Math.min(ge.y+ge.height,H+Q)-Math.max(ge.y,H)>0),me=ge=>{const K=ie(ge);return ye.some(ue=>ue.x<K.x+K.width&&K.x<ue.x+ue.width)},te=ge=>{const K=ie(ge);return ne.filter(ue=>ue>=K.x+10&&ue<=K.x+K.width-10).length},le=(()=>{if(!me(de))return de;const ge=te(de);return ye.flatMap(K=>[K.x+K.width+pv,K.x-pv-j]).map(K=>Math.round(K)).filter(K=>!me(K)&&te(K)>=ge).sort((K,ue)=>Math.abs(K-de)-Math.abs(ue-de))[0]??de})();if(le!==S.x||H!==S.y||j!==S.width||Q!==S.height){const ge=()=>new Set(ft(Ge(r)).map(Xe=>ct(Xe))),K=ge(),ue={x:S.x,y:S.y,width:S.width,height:S.height};n.resizeShape(S,{x:le,y:H,width:j,height:Q});const Re=ge(),Ie=[...Re].filter(Xe=>!K.has(Xe)).length,nt=[...K].filter(Xe=>!Re.has(Xe)).length;Ie>nt&&n.resizeShape(S,ue)}}}}const I=Math.max(...O.map(T=>T.x+T.width/2))+Bd;if(I>S.x+S.width&&n.resizeShape(S,{x:S.x,y:S.y,width:I-S.x,height:S.height}),!!x)for(const T of E){const $=f(T.flow.id),L=T.flow.source===w.participant.id?T.flow.target:T.flow.target===w.participant.id?T.flow.source:void 0,D=L?f(L):void 0;if(!$||!D||D.type==="bpmn:Participant")continue;const H=D.x+D.width/2;H<S.x+10||H>S.x+S.width-10||ES($,S,D)}}};kS(!1);for(const x of E){const w=x.flow;n.connect(m(w.source),m(w.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:w.id,name:w.name})})}{const S=new Set([...Y.map(D=>D.flow.id),...E.map(D=>D.flow.id)].filter(D=>!!D)),O=r.filter(D=>!!D.waypoints),I=(D,H)=>Math.abs(H.x-D.x)<2?"L":Math.abs(H.x-(D.x+D.width))<2?"R":Math.abs(H.y-D.y)<2?"T":Math.abs(H.y-(D.y+D.height))<2?"B":void 0,T=new Map,$=(D,H,j)=>{if(!D||!H||typeof D.x!="number")return;const Q=I(D,H);if(!Q)return;let ne=T.get(D.id);ne||T.set(D.id,ne=new Map),ne.set(Q,[...ne.get(Q)??[],j])};for(const D of O){const H=D.waypoints;!H||H.length<2||($(D.source,H[0],{id:D.id,dir:"out"}),$(D.target,H[H.length-1],{id:D.id,dir:"in"}))}const L=new Set;for(const[D,H]of T){const j=f(D);if(!j||typeof j.x!="number")continue;const Q=te=>{var ge;const le=(ge=f(te.id))==null?void 0:ge.source;return!!le&&typeof le.x=="number"&&le.x+le.width/2>j.x+j.width/2};if(![...H.values()].some(te=>te.length>=3&&te.some(le=>le.dir==="out")&&te.some(le=>le.dir==="in"&&S.has(le.id)&&Q(le))))continue;const de=g(j);if(!de||L.has(de.id)||(de.children??[]).some(te=>te.type==="bpmn:Lane"))continue;const oe=(nR=H.get("T"))!=null&&nR.length?(iR=H.get("B"))!=null&&iR.length?void 0:"B":"T";if(!oe||(oe==="T"?j.y-de.y:de.y+de.height-(j.y+j.height))>=z)continue;const ye=(de.children??[]).filter(te=>!("waypoints"in te&&te.waypoints)&&te.type!=="label"&&typeof te.x=="number"),me=de.y+de.height;n.resizeShape(de,{x:de.x,y:de.y,width:de.width,height:de.height+z}),Wt(me,de.id,z),oe==="T"&&ye.length&&n.moveElements(ye,{x:0,y:z}),L.add(de.id)}}const em=20,OS=4,XF=3,ZF=2,JF=2,QF=[10,30,80],Ui=()=>{const x=Ge(r);return{bad:ft(x).filter(w=>w.kind==="edge-crosses-shape"||w.kind==="edge-overlap-opposite"||w.kind==="edge-overlap-mixed").length,crossings:iy(x),straight:x.edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.waypoints.length===2).length}},Cr=x=>{const w=Ge(r),S=w.edges.find(O=>O.id===x);return S?Ot(S,Dn(w)).length:0},Oc=x=>Cr(x)>0,os=x=>Ge(r).edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.id!==x&&w.waypoints.length===2).length,DS=(x,w,S)=>Fo([{subtree:x,pool:w}],S),LS=(x,w)=>w.bad>x.bad||w.crossings>x.crossings&&w.straight<=x.straight&&w.bad>=x.bad,rs=(x,w)=>LS(x,w)||w.straight<x.straight,ra=(x,w,S=()=>!0,O=LS,I=!1)=>{const T=Ui(),$=Fo(x,w,I);if(!$)return!1;const L=Ui();return O(T,L)||!S()?($(),!1):!0},e6=(x,w,S,O=()=>!0)=>ra([{subtree:x,pool:w}],S,O),aa=x=>{var w;return!!((w=N.get(x))!=null&&w.node.participant)},as=new Map;for(const x of E){if(!aa(x.flow.target))continue;const w=as.get(x.flow.target)??[];w.push(x),as.set(x.flow.target,w)}const Dc=[...as.keys()],tm=new Set(Y.map(x=>x.flow.target)),IS=x=>Ap.findIndex(({op:w})=>w.participant.id===x);Dc.sort((x,w)=>{var I,T;const S=tm.has(x)?1:0,O=tm.has(w)?1:0;return S!==O?S-O:IS((I=N.get(x))==null?void 0:I.node.participant)-IS((T=N.get(w))==null?void 0:T.node.participant)});const Ar=x=>x.x+x.width/2,t6=x=>{const w=new Map;for(const I of r.getAll()){const T=I;if(!T.waypoints||!T.source||!T.target)continue;(w.get(T.source.id)??w.set(T.source.id,[]).get(T.source.id)).push(T.target.id)}const S=new Set([x]),O=[x];for(let I=0;I<O.length;I++)for(const T of w.get(O[I])??[])S.has(T)||(S.add(T),O.push(T));return S},n6=(x,w)=>{const S=t6(w);let O;for(const I of r.getAll()){const T=I;if(T.type!=="bpmn:MessageFlow"||!T.source||!T.target||T.target.id!==x||S.has(T.source.id))continue;const $=T.source;if(typeof $.x!="number"||$.type==="bpmn:Participant")continue;const L=Ar($);(O===void 0||L>O)&&(O=L)}return O},nm=(x,w)=>{const S=f(x.flow.source);if(S)return S.type==="bpmn:Participant"?n6(S.id,w):Ar(S)},BS=x=>{let w;for(const S of as.get(x)??[]){const O=nm(S,x);O!==void 0&&(!w||O>w.cx)&&(w={op:S,cx:O})}return w==null?void 0:w.op},i6=x=>{const w=BS(x),S=f(x),O=w?nm(w,x):void 0;return S&&O!==void 0?O-Ar(S):void 0},NS=x=>{const w=i6(x);return w!==void 0&&Math.abs(w)<em},kp=(x,w,S,O,I)=>{var T;for(let $=!0;$;){$=!1;for(const L of E){if(L.flow.id===S)continue;const D=w.has(L.flow.source),H=w.has(L.flow.target);if(D===H||O(D?L.flow.source:L.flow.target))continue;const j=D?L.flow.target:L.flow.source;if(I(j)||!aa(j))continue;const Q=f(L.flow.id);if(!(Q!=null&&Q.waypoints)||Q.waypoints.length!==2)continue;const ne=f(j),de=(T=N.get(j))==null?void 0:T.node.participant;if(!ne||!de)continue;const oe=$o(j,ie=>ie.x>=ne.x).filter(ie=>!w.has(ie.id));if(!(!oe.length||oe.some(ie=>I(ie.id)))){for(const ie of oe)w.add(ie.id);x.set(de,[...x.get(de)??[],...oe]),$=!0}}}return[...x].map(([$,L])=>({subtree:L,pool:m($)}))},im=(x,w,S,O,I)=>kp(new Map([[w,[...x]]]),new Set(x.map(T=>T.id)),O,T=>T===S,T=>T===I),om=x=>{const w=BS(x);if(!w)return null;const S=f(x),O=f(w.flow.source),I=nm(w,x);if(!S||!O||I===void 0)return null;const T=I-Ar(S);if(T>=em){const $=N.get(x).node.participant,L=$o(x,H=>H.x>=S.x),D=$o(x,H=>H.x>=S.x&&!NS(H.id));return{groups:im(L,$,x,w.flow.id,w.flow.source),dx:T,cut:D.length<L.length?im(D,$,x,w.flow.id,w.flow.source):void 0}}if(-T>=em&&aa(w.flow.source)){const $=N.get(w.flow.source).node.participant,L=$o(w.flow.source,D=>D.x>=O.x&&!NS(D.id));return{groups:im(L,$,w.flow.source,w.flow.id,x),dx:-T}}return null},$S=()=>Dc.map(x=>({id:x,plan:om(x)})).filter(x=>!!x.plan).sort((x,w)=>Math.min(...x.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))-Math.min(...w.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))).map(x=>x.id),FS=()=>{var O;const x=r.getAll().filter(bi).filter(I=>I.type!=="bpmn:Participant"&&I.type!=="bpmn:Group").map(I=>[I.x,I.x+I.width]).sort((I,T)=>I[0]-T[0]);let w=((O=x[0])==null?void 0:O[1])??0,S=0;for(const[I,T]of x.slice(1))I>w&&(S=Math.max(S,I-w)),w=Math.max(w,T);return S},jS=x=>{if(!x.cut)return Fo(x.groups,x.dx);const w=Fo(x.groups,x.dx,!0);if(!w)return null;const S=Ui(),O=FS();w();const I=Fo(x.cut,x.dx,!0);if(I){const T=Ui();if(T.bad<=S.bad&&T.crossings<=S.crossings&&T.straight>=S.straight&&FS()<O)return I;I()}return Fo(x.groups,x.dx)};for(let x=0;x<3;x++){const w=Ui(),S=[];for(const I of $S()){const T=om(I);if(!T)continue;const $=jS(T);$&&S.push($)}if(!S.length)break;if(!rs(w,Ui()))continue;for(const I of S.reverse())I();let O=!1;for(const I of $S()){const T=om(I);if(!T)continue;const $=Ui(),L=jS(T);L&&(rs($,Ui())?L():O=!0)}if(!O)break}for(const x of Dc){if(tm.has(x))continue;const w=N.get(x);if(!w||w.node.lane!==void 0)continue;const S=ut(w);if(S===void 0)continue;const O=f(x),I=O?g(O):void 0;if(!O||!I)continue;const T=I.y+V+gi(`pool:${w.node.participant??""}`,S)*z,$=T-(O.y+O.height/2);$!==0&&!U(I,O,O.x+O.width/2,T)&&n.moveElements([O],{x:0,y:$})}const Op=()=>{const x=r.filter(O=>O.type==="bpmn:Participant"),w=new Map(x.map(O=>[O.id,O]));let S=0;for(const{pools:[O,I]}of yd(x)){const T=w.get(O),$=w.get(I);S+=(Math.min(T.x+T.width,$.x+$.width)-Math.max(T.x,$.x))*(Math.min(T.y+T.height,$.y+$.height)-Math.max(T.y,$.y))}return S},rm=new Set,HS=new Set;for(let x=0,w=!0;w&&x<XF;x++){w=!1;for(const S of Dc.flatMap(O=>as.get(O)??[])){if(rm.has(S.flow.id)||!Oc(S.flow.id))continue;const O=f(S.flow.target);if(!O)continue;const I=m(N.get(S.flow.target).node.participant),T=$o(S.flow.target,j=>j.x>=O.x),$=O.width+se,L=Cr(S.flow.id),D=os(S.flow.id),H=Op();for(let j=1;j<=OS;j++){const Q=()=>Cr(S.flow.id)>=L||Op()>H?!1:os(S.flow.id)>=D?!0:(HS.add(S.flow.id),!1);if(e6(T,I,$*j,Q)){rm.add(S.flow.id),w=!0;break}}}}const zS=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const w=x.source,S=x.target;return!!w&&!!S&&S.x+S.width<w.x}).length;for(const x of Dc.flatMap(w=>as.get(w)??[])){if(rm.has(x.flow.id)||!HS.has(x.flow.id)||!Oc(x.flow.id))continue;const w=f(x.flow.target);if(!w)continue;const S=m(N.get(x.flow.target).node.participant),O=$o(x.flow.target,ne=>ne.x>=w.x),I=new Set(O.map(ne=>ne.id)),T=new Map;for(const ne of r.filter(de=>de.type==="bpmn:MessageFlow")){if(((oR=ne.waypoints)==null?void 0:oR.length)!==2||!ne.source||!ne.target)continue;const de=I.has(ne.source.id);if(de===I.has(ne.target.id))continue;const oe=de?ne.target:ne.source,ie=(rR=N.get(oe.id))==null?void 0:rR.node.participant;!ie||T.has(oe.id)||T.set(oe.id,{subtree:[oe],pool:m(ie)})}if(!T.size)continue;const $=w.width+se,L=Cr(x.flow.id),D=os(x.flow.id),H=Op(),j=zS(),Q=()=>Cr(x.flow.id)<L&&os(x.flow.id)>=D&&Op()<=H&&zS()<=j;for(let ne=1;ne<=ZF&&!ra([{subtree:O,pool:S},...T.values()],$*ne,Q);ne++);}const am=E.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),GS=new Set(am.map(x=>x.id));for(const x of r.filter(w=>w.type==="bpmn:MessageFlow"))GS.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&am.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of am){if(!Oc(x.id))continue;const w=f(x.source),S=f(x.target);if(!w||!S)continue;let O,I,T;if(x.preexisting){const[L,D]=w.type==="bpmn:Participant"?[S,w]:[w,S];if(O=Ar(L),O<D.x||O>D.x+D.width)continue;[I,T]=L.y<D.y?[L.y+L.height,D.y]:[D.y+D.height,L.y]}else{if(w.type==="bpmn:Participant"||S.type==="bpmn:Participant"||(O=w.x+w.width/2,Math.abs(O-(S.x+S.width/2))>15))continue;[I,T]=w.y<S.y?[w.y+w.height,S.y]:[S.y+S.height,w.y]}const $=[...N.values()].map(L=>f(L.node.id)).filter(L=>!!L&&L.id!==w.id&&L.id!==S.id).filter(L=>L.x<=O&&O<=L.x+L.width&&L.y+L.height>I&&L.y<T).sort((L,D)=>L.x-D.x);for(const L of $){const D=(aR=N.get(L.id))==null?void 0:aR.node.participant,H=D?f(D):void 0;if(!D||!H)continue;const j=[...N.values()].filter(le=>le.node.participant===D).map(le=>le.node.id),Q=le=>le.map(ge=>f(ge)).filter(ge=>!!ge),de=[GF(L.id,le=>{var ge;return((ge=N.get(le.id))==null?void 0:ge.node.participant)===D}),Q(j)].filter(le=>le.length).map(le=>[{subtree:le,pool:H}]);if(x.preexisting){const le=Q(j);le.length&&de.push(kp(new Map([[D,[...le]]]),new Set(le.map(ge=>ge.id)),x.id,()=>!1,ge=>ge===w.id||ge===S.id))}const oe=L.width+se,ie=Cr(x.id),ye=os(x.id),me=()=>Cr(x.id)<ie&&os(x.id)>=ye;let te=!1;for(const le of de){for(let ge=1;ge<=OS;ge++)if(ra(le,oe*ge,me)){te=!0;break}if(te)break}if(!Oc(x.id))break}}const Dp=()=>{var w;const x=new Set;for(const S of ft(Ge(r)))S.kind!=="edge-crosses-shape"||GS.has(S.edge)||((w=f(S.edge))==null?void 0:w.type)==="bpmn:MessageFlow"&&x.add(`${S.edge}>${S.shape}`);return x},o6=(x,w)=>Ui().bad>=x&&[...Dp()].some(S=>!w.has(S)),VS=x=>{var w,S;return Cr(x)===0&&((S=(w=f(x))==null?void 0:w.waypoints)==null?void 0:S.length)===2},r6=(x,w,S)=>{const O=new Set(x.flatMap(T=>T.subtree.map($=>$.id))),I=[...Dp()].filter(T=>!S.has(T)).map(T=>T.split(">")[1]);return[...new Set(I)].filter(T=>O.has(T)&&T!==w.source&&T!==w.target)},a6=(x,w,S,O,I)=>{const T=x.map(H=>({...H,subtree:H.subtree.filter(j=>!I.includes(j.id))})).filter(H=>H.subtree.length),$=new Set(T.flatMap(H=>H.subtree.map(j=>j.id))),L=()=>I.every(H=>{const j=f(H);return!!j&&Y.filter(Q=>Q.flow.target===H&&$.has(Q.flow.source)).every(Q=>{const ne=f(Q.flow.source);return!!ne&&ne.x+ne.width<=j.x})});return ra(T,w,()=>VS(S.id)&&[...Dp()].every(H=>O.has(H))&&L(),rs,!0)};for(const x of E){if(!Oc(x.flow.id))continue;const w=f(x.flow.id);if(((sR=w==null?void 0:w.waypoints)==null?void 0:sR.length)!==2)continue;const S=f(x.flow.source),O=f(x.flow.target);if(!S||!O||S.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!aa(x.flow.source)||!aa(x.flow.target)||Math.abs(Ar(S)-Ar(O))>JF)continue;const I=Ar(S),T=w.waypoints.map(ie=>ie.y),[$,L]=[Math.min(...T),Math.max(...T)],D=Dn(Ge(r)).filter(ie=>ie.id!==S.id&&ie.id!==O.id&&ie.x<I&&I<ie.x+ie.width&&$<ie.y+ie.height&&ie.y<L);if(!D.length)continue;const H=(cR=N.get(x.flow.source))==null?void 0:cR.node.participant,j=(lR=N.get(x.flow.target))==null?void 0:lR.node.participant;if(!H||!j)continue;const Q=new Map;for(const[ie,ye,me]of[[x.flow.source,S,H],[x.flow.target,O,j]]){const te=Q.get(me)??[],le=$o(ie,ge=>ge.x>=ye.x).filter(ge=>!te.some(K=>K.id===ge.id));Q.set(me,[...te,...le])}const ne=new Set([...Q.values()].flat().map(ie=>ie.id)),de=kp(Q,ne,x.flow.id,ie=>ie===x.flow.source||ie===x.flow.target,()=>!1),oe=Math.max(...D.map(ie=>ie.x+ie.width));for(const ie of QF){const ye=oe+ie-I;if(ye<=0)continue;const me=Ui().bad,te=Dp();let le=[],ge=!0;const K=()=>!VS(x.flow.id)||ge&&(le=r6(de,x.flow,te),le.length)?!1:!o6(me,te);if(ra(de,ye,K,rs))break;if(le.length&&(a6(de,ye,x.flow,te,le)||(ge=!1,ra(de,ye,K,rs))))break}}{const x=T=>T.y+T.height/2,w=/(Task|Event|Gateway|CallActivity|SubProcess)$/,S=()=>{const T=Ge(r),$=new Set(ft(T).flatMap(H=>H.kind==="edge-crosses-shape"?[`${H.edge}|${H.shape}`]:[])),L=T.shapes.filter(H=>!H.container&&w.test(H.type)),D=new Set;for(const H of T.edges){if(H.type!=="bpmn:SequenceFlow"&&H.type!=="bpmn:MessageFlow")continue;const j=new Set(H.endpoints);for(const Q of[H.waypoints[0],H.waypoints[H.waypoints.length-1]])for(const ne of L)ne.x-4<=Q.x&&Q.x<=ne.x+ne.width+4&&ne.y-4<=Q.y&&Q.y<=ne.y+ne.height+4&&j.add(ne.id);for(const Q of L)if(!(j.has(Q.id)||$.has(`${H.id}|${Q.id}`))){for(let ne=0;ne+1<H.waypoints.length;ne++)if(bo(H.waypoints[ne],H.waypoints[ne+1],Q)<=Zg){D.add(`${H.id}|${Q.id}`);break}}}return D},O=()=>({...Ui(),grazes:S()}),I=[];for(const T of N.keys()){if(!aa(T))continue;const $=Y.filter(H=>H.flow.target===T);if($.length!==1)continue;const L=f($[0].flow.source),D=f(T);!L||!D||!N.has(L.id)||Math.abs(x(L)-x(D))>1||D.x-(L.x+L.width)<=se+1||I.push({id:T,pred:L,node:D})}I.sort((T,$)=>T.node.x-$.node.x);for(const{id:T}of I){const $=N.get(T),L=f(T),D=f(Y.find(le=>le.flow.target===T).flow.source);if(!L||!D)continue;const H=L.x-(D.x+D.width);if(H<=se+1)continue;const j=m($.node.participant),Q=$o(T,le=>le.x>=L.x),ne=-(H-se),de=(le,ge)=>ge.bad>le.bad||ge.crossings>le.crossings||ge.crossings===le.crossings&&ge.bad===le.bad||ge.straight<le.straight||[...ge.grazes].some(K=>!le.grazes.has(K)),oe=kp(new Map([[$.node.participant,[...Q]]]),new Set(Q.map(le=>le.id)),"",()=>!1,()=>!1),ie=oe.some(le=>le.pool!==j)||oe.reduce((le,ge)=>le+ge.subtree.length,0)>Q.length,ye=O(),me=DS(Q,j,ne);if(!me)continue;const te=O();if(ie&&!de(ye,te)){me();const le=Fo(oe,ne);if(le){const ge=O();if(!de(ye,ge)&&ge.bad<=te.bad&&ge.crossings<=te.crossings)continue;le()}DS(Q,j,ne);continue}de(ye,te)&&me()}}kS(!0);const s6=10,c6=400,l6=x=>[...x.incoming??[],...x.outgoing??[]].filter(w=>w.type==="bpmn:DataInputAssociation"||w.type==="bpmn:DataOutputAssociation").map(w=>w.source===x?w.target:w.source).filter(w=>!!w&&typeof w.y=="number"),u6=r.filter(x=>x.type==="bpmn:DataStoreReference"&&_.has(x.id)),p6=(x,w)=>{const S=x.x+x.width/2,O=x.y+x.height/2;let I;for(const T of u6){if((g(T)??d())!==w||T.y<x.y+x.height)continue;const $=Math.abs(T.x+T.width/2-S);$>c6||$<T.width||!l6(T).some(D=>D.height===x.height&&Math.abs(D.y+D.height/2-O)<=s6&&T.y>=D.y+D.height)||(!I||$<I.dx||$===I.dx&&T.id<I.id)&&(I={dx:$,id:T.id,cy:T.y+T.height/2})}return I==null?void 0:I.cy},d6=50,f6=(x,w)=>{const S=g(w);if(!S||x.y<w.y+w.height)return;const O=y(S,w),I=O??S,T=x.label,$=Math.max(x.y+x.height,T?T.y+T.height:0),L=I.y+I.height;if($<=L)return;const D=Math.ceil($+d6-L),H=S.y+S.height;if(O){const j=ns(O,O.height+D,new Set([x.id]));Wt(H,S.id,D,j)}else n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+D}),Wt(H,S.id,D)};for(const x of M){const w=x.associations??[],S=w.map($=>$.source===x.dataStore.id?$.target:$.source).map(f).find(Boolean),O=S?g(S)??d():d(),I=S?{x:S.x+S.width/2,y:p6(S,O)??S.y+S.height+110}:{x:200,y:Tc+60},T=n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},I,O);S&&f6(T,S);for(const $ of w)PS(x.dataStore.id,$)}for(const x of B){const S=m(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;PS(S,x.association)}let WS=0;const sa=10,US=40,h6=(x,w)=>{const S=w.map(D=>g(D)).filter(D=>!!D);for(const D of S){const H=sa,j=D.y,Q=D.y+D.height,ne=D.x,de=D.x+D.width;if(Math.abs(x.y-j)<H){const oe=j+H-x.y;x.y+=oe,x.height-=oe}if(Math.abs(x.y+x.height-Q)<H&&(x.height=Q-H-x.y),Math.abs(x.x-ne)<H){const oe=ne+H-x.x;x.x+=oe,x.width-=oe}Math.abs(x.x+x.width-de)<H&&(x.width=de-H-x.x)}if(!S.length)return;const O=Math.min(...S.map(D=>D.y)),I=Math.max(...S.map(D=>D.y+D.height)),T=O-x.y,$=x.y+x.height-I,L=US-sa;if(T>0!=$>0)if(T>0&&T<L){const D=T+sa;x.y+=D,x.height-=D}else $>0&&$<L&&(x.height-=$+sa)},g6=(x,w)=>{const S=sa,O=30,I=r.filter(T=>T.type==="bpmn:Group"&&T.id!==w);for(const T of I){const $=T.x,L=T.x+T.width,D=T.y,H=T.y+T.height,j=x.y<H&&D<x.y+x.height,Q=x.x<L&&$<x.x+x.width;if(j){if(Math.abs(x.x-L)<S){const ne=Math.min(L+S-x.x,O);ne>0&&x.width-ne>0&&(x.x+=ne,x.width-=ne)}if(Math.abs(x.x+x.width-$)<S){const ne=Math.min(x.x+x.width-($-S),O);ne>0&&x.width-ne>0&&(x.width-=ne)}}if(Q){if(Math.abs(x.y-H)<S){const ne=Math.min(H+S-x.y,O);ne>0&&x.height-ne>0&&(x.y+=ne,x.height-=ne)}if(Math.abs(x.y+x.height-D)<S){const ne=Math.min(x.y+x.height-(D-S),O);ne>0&&x.height-ne>0&&(x.height-=ne)}}}},sm=(x,w)=>{const S=US,O=Math.min(...x.map(D=>D.x))-S,I=Math.min(...x.map(D=>D.y))-S,T=Math.max(...x.map(D=>D.x+D.width))+S,$=Math.max(...x.map(D=>D.y+D.height))+S,L={x:O,y:I,width:T-O,height:$-I};return h6(L,x),g6(L,w),L};for(const x of k){const w=(x.group.members??[]).map(f).filter(I=>!!I);let S;w.length?S=sm(w,x.group.id):(S={x:300+WS*350,y:40,width:300,height:200},WS++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:S.width,height:S.height},{x:S.x+S.width/2,y:S.y+S.height/2},d());x.group.name&&n.updateLabel(O,x.group.name),(uR=x.group.members)!=null&&uR.length&&Me(O,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(I=>!!I.waypoints),w=new Map,S=(I,T)=>{!I||!T||(w.has(I)||w.set(I,new Set),w.get(I).add(T))};for(const I of x){const T=(pR=I.source)==null?void 0:pR.id,$=(dR=I.target)==null?void 0:dR.id;S(T,$),((fR=I.type)!=null&&fR.includes("DataOutputAssociation")||(hR=I.type)!=null&&hR.includes("DataInputAssociation")||I.type==="bpmn:Association")&&S($,T)}const O=r.filter(I=>I.type==="bpmn:Group");for(const I of O){const $=(((gR=I.businessObject.extensionElements)==null?void 0:gR.values)??[]).find(me=>me.$type==="bwl:Members"),L=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean);if(!L.length)continue;const D=new Set(L),H=[...L];for(;H.length;){const me=H.shift();for(const te of w.get(me)??[])D.has(te)||(D.add(te),H.push(te))}const j=I.x,Q=I.x+I.width,ne=I.y,de=I.y+I.height,oe=me=>Y.filter(te=>te.flow.target===me).length,ie=me=>{var le;const te=((le=f(me))==null?void 0:le.type)??"";if(te==="bpmn:StartEvent"&&oe(me)===0)return!1;if(te.endsWith("Gateway")){const ge=Y.filter(K=>K.flow.target===me).map(K=>K.flow.source);if(ge.length&&ge.every(K=>{var ue;return((ue=f(K))==null?void 0:ue.type)==="bpmn:StartEvent"&&oe(K)===0}))return!1}return!0},ye=r.filter(me=>bi(me)).filter(me=>me.type!=="bpmn:Group"&&me.type!=="bpmn:Participant"&&me.type!=="bpmn:TextAnnotation"&&!D.has(me.id)&&aa(me.id)&&ie(me.id)&&me.x<Q&&me.x+me.width>j&&me.y<de&&me.y+me.height>ne);if(ye.length)for(const me of[-1,1]){const te=ye.filter(Ae=>(Ae.x+Ae.width-j<=Q-Ae.x?-1:1)===me);if(!te.length)continue;const le=[];for(const Ae of te){const Se=le.find(Ce=>Ce.some(ce=>Ae.y<ce.y+ce.height&&Ae.y+Ae.height>ce.y));Se?Se.push(Ae):le.push([Ae])}const ge=new Map;for(const Ae of le){let Se=me<0?j-sa:Q+sa;for(const Ce of[...Ae].sort((ce,_e)=>me<0?_e.x-ce.x:ce.x-_e.x)){const ce=me<0?Math.min(Ce.x,Se-Ce.width):Math.max(Ce.x,Se);Se=me<0?ce-$i:ce+Ce.width+$i,ce!==Ce.x&&Math.sign(ce-Ce.x)===me&&ge.set(Ce.id,ce-Ce.x)}}const K=new Map,ue=Ae=>K.get(Ae)===Ae||!K.get(Ae)?Ae:ue(K.get(Ae));for(const Ae of te)K.set(Ae.id,Ae.id);for(const Ae of E){const Se=ge.has(Ae.flow.source)?Ae.flow.source:void 0,Ce=ge.has(Ae.flow.target)?Ae.flow.target:void 0;if(!Se||!Ce)continue;const ce=f(Ae.flow.id);((mR=ce==null?void 0:ce.waypoints)==null?void 0:mR.length)===2&&K.set(ue(Se),ue(Ce))}const Re=new Map;for(const Ae of te){if(!ge.has(Ae.id))continue;const Se=ue(Ae.id);Re.set(Se,[...Re.get(Se)??[],Ae])}const Ie=[...Re.values()].sort((Ae,Se)=>me<0?Math.min(...Ae.map(Ce=>Ce.x))-Math.min(...Se.map(Ce=>Ce.x)):Math.max(...Se.map(Ce=>Ce.x))-Math.max(...Ae.map(Ce=>Ce.x))),nt=[];let Xe=!0;for(const Ae of Ie){const Se=Ae.map(_e=>ge.get(_e.id)??0).reduce((_e,He)=>Math.abs(He)>Math.abs(_e)?He:_e,0),Ce=new Map;let ce=!0;for(const _e of Ae){const He=g(_e);if(!He){ce=!1;break}Ce.has(He.id)||Ce.set(He.id,{subtree:[],pool:He}),Ce.get(He.id).subtree.push(_e)}ce&&ra([...Ce.values()],Se,()=>!0,rs)?nt.push({shapes:Ae,dx:Se}):Xe=!1}if(!Xe)for(const Ae of nt.reverse())n.moveElements(Ae.shapes,{x:-Ae.dx,y:0})}}}{const x=new Set([...k.map(w=>w.group.id),...Gt(e,"group.update").map(w=>w.id)]);for(const w of r.filter(S=>S.type==="bpmn:Group")){if(x.has(w.id))continue;const O=(((yR=w.businessObject.extensionElements)==null?void 0:yR.values)??[]).find(L=>L.$type==="bwl:Members"),I=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(L=>!!L);!I.length||!I.some(L=>{const D=_.get(L.id);return!D||D.x!==L.x||D.y!==L.y})||!I.some(L=>L.x<w.x||L.y<w.y||L.x+L.width>w.x+w.width||L.y+L.height>w.y+w.height)||n.resizeShape(w,sm(I,w.id))}}{const w=new Map(Yo(Ge(r)).map(L=>[L.owner,L.rect])),S=r.filter(L=>!!L.waypoints),O=new Map,I=(L,D)=>{!L||!D||(O.has(L)||O.set(L,new Set),O.get(L).add(D))};for(const L of S){const D=(vR=L.source)==null?void 0:vR.id,H=(xR=L.target)==null?void 0:xR.id;I(D,H),((bR=L.type)!=null&&bR.includes("DataOutputAssociation")||(wR=L.type)!=null&&wR.includes("DataInputAssociation")||L.type==="bpmn:Association")&&I(H,D)}const T=L=>Y.filter(D=>D.flow.target===L).length,$=L=>{var H;const D=((H=f(L))==null?void 0:H.type)??"";if(D==="bpmn:StartEvent"&&T(L)===0)return!1;if(D.endsWith("Gateway")){const j=Y.filter(Q=>Q.flow.target===L).map(Q=>Q.flow.source);if(j.length&&j.every(Q=>{var ne;return((ne=f(Q))==null?void 0:ne.type)==="bpmn:StartEvent"&&T(Q)===0}))return!1}return!0};for(const L of r.filter(D=>D.type==="bpmn:Group")){const H=(((_R=L.businessObject.extensionElements)==null?void 0:_R.values)??[]).find(ce=>ce.$type==="bwl:Members"),j=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const Q=j.map(f).filter(ce=>!!ce);if(!Q.length||!(k.some(ce=>ce.group.id===L.id)||Gt(e,"group.update").some(ce=>ce.id===L.id)||Q.some(ce=>{const _e=_.get(ce.id);return!_e||_e.x!==ce.x||_e.y!==ce.y})))continue;const de=new Set(j),oe=[...j];for(;oe.length;){const ce=oe.shift();for(const _e of O.get(ce)??[])de.has(_e)||(de.add(_e),oe.push(_e))}const ie=L.x,ye=L.x+L.width,me=L.y,te=L.y+L.height,le=ce=>{const _e=w.get(ce.id),He={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return _e?[He,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[He]},ge=Q.flatMap(le),K=Math.min(...ge.map(ce=>ce.x)),ue=Math.max(...ge.map(ce=>ce.x+ce.width)),Re=Math.min(...ge.map(ce=>ce.y)),Ie=Math.max(...ge.map(ce=>ce.y+ce.height)),nt={L:K-ie,R:ye-ue,T:Re-me,B:te-Ie},Xe=new Set(j),Ae=ce=>ce.x>=ie&&ce.x+ce.width<=ye&&ce.y>=me&&ce.y+ce.height<=te,Se=r.filter(ce=>bi(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!Xe.has(ce.id)&&(!de.has(ce.id)||!Ae(ce))&&$(ce.id)&&ce.x<ye&&ce.x+ce.width>ie&&ce.y<te&&ce.y+ce.height>me);if(!Se.length)continue;const Ce={L:0,R:0,T:0,B:0};for(const ce of Se){const _e=le(ce),He=Math.min(..._e.map(xt=>xt.x)),st=Math.max(..._e.map(xt=>xt.x+xt.width)),Oe=Math.min(..._e.map(xt=>xt.y)),Ye=Math.max(..._e.map(xt=>xt.y+xt.height)),Dt={L:st-ie,R:ye-He,T:Ye-me,B:te-Oe},Pn=["L","R","T","B"].filter(xt=>Dt[xt]<=nt[xt]+.001);if(!Pn.length)continue;const kn=Pn.reduce((xt,qi)=>Dt[qi]<Dt[xt]?qi:xt,Pn[0]);Ce[kn]=Math.max(Ce[kn],Math.min(Dt[kn]+10,nt[kn]))}!Ce.L&&!Ce.R&&!Ce.T&&!Ce.B||n.resizeShape(L,{x:L.x+Ce.L,y:L.y+Ce.T,width:L.width-Ce.L-Ce.R,height:L.height-Ce.T-Ce.B})}}const qS=x=>{const w=x.waypoints;if(w!=null&&w.length){const O=w[Math.floor((w.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const S=x;return{x:S.x,y:S.y,width:S.width,height:S.height}};let Lc=0;const cm=yv.get(t),YS=(x,w)=>{var O;const S=(O=cm==null?void 0:cm.get(x))==null?void 0:O.texts;return S?[...new Set([w,...Object.values(S)])]:[w]};for(const x of P){const w=x.association,S=((ER=x.placement)==null?void 0:ER.anchor)??(w?w.source===x.annotation.id?w.target:w.source:void 0),O=S?f(S):void 0,I=O?qS(O):void 0,T=av(YS(x.annotation.id,x.annotation.text??""));let $;if(I&&x.placement){const[j,Q]=pl[x.placement.side],ne=x.placement.offset??50;$={x:I.x+I.width/2+j*(I.width/2+T.width/2+ne),y:I.y+I.height/2+Q*(I.height/2+T.height/2+ne)}}else I?($={x:I.x+I.width/2+180+Lc%3*260,y:I.y-110-Lc%2*95},Lc++):($={x:300+Lc*260,y:60},Lc++);const L=O?g(O)??d():d(),D=L;I&&typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant"&&($=fl(r,I,T,D,x.placement?{placement:x.placement}:{from:$}));const H=n.createShape({type:"bpmn:TextAnnotation",width:T.width,height:T.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},$,L);if(w){const j=Q=>Q===x.annotation.id?H:m(Q);n.connect(j(w.source),j(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}x.placement&&Me(H,"bwl:Placement",Te(x.placement))}for(const x of Gt(e,"association.add")){const w=x.association;n.connect(m(w.source),m(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}const m6=(x,w,S,O)=>{const I=x.parent;if(!I)return O;const T=x.x+x.width/2,$=new Set([x.id]);if(!U(I,x,T,O,$))return O;const L=w?w.y+Math.min(w.height/2,Z):S?S.y+V:void 0;if(L===void 0)return O;const D=Math.floor((O-L)/z+1e-6);for(let H=1;H<=3;H++){const j=D+H,Q=L+j*z,ne=yS(w==null?void 0:w.id,j);if(!U(I,x,T,Q,ne?new Set([...$,...ne]):$))return ni(w==null?void 0:w.id,j,S),Q}return O},KS=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of Gt(e,"node.update")){let w=m(x.id);if(x.type&&ul(x.type)!==w.type){const S=w.x+w.width/2,O=w.y+w.height/2,I=KS();w=c.replaceElement(w,{type:ul(x.type),...x.eventDefinition?{eventDefinitionType:Fc[x.eventDefinition]}:{}});const T=KS(),$=[...I].filter(H=>H!==x.id&&!T.has(H));if($.length)throw new gv({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:$});const L=Math.round(S-(w.x+w.width/2)),D=Math.round(O-(w.y+w.height/2));if(L!==0||D!==0){n.moveShape(w,{x:L,y:D});for(const H of[...w.incoming??[],...w.outgoing??[]])Pp(H)}}if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(w,{"bwl:band":x.band});const S=w.y+w.height/2,O=g(w),I=x.lane?m(x.lane):((O==null?void 0:O.children)??[]).find($=>$.type==="bpmn:Lane"&&S>=$.y&&S<=$.y+$.height);x.band!==void 0&&ni(I==null?void 0:I.id,x.band,O);const T=I?I.y+(x.band===void 0?I.height/2:Math.min(I.height/2,Z)+gi(I.id,x.band)*z):x.band!==void 0&&O?O.y+V+gi(`pool:${O.id}`,x.band)*z:void 0;if(T!==void 0){const $=m6(w,I,O,T),L=$===T?T-S:$-(w.y+w.height/2);L!==0&&(p.push({id:w.id,x:w.x,y:w.y,width:w.width,height:w.height}),n.moveElements([w],{x:0,y:L}))}}}for(const x of Gt(e,"sequenceFlow.update")){const w=m(x.id),S=G.get(x.id);if(S){const O=H=>({x:H.x+H.width/2,y:H.y+H.height/2}),I=m(S.flow.source),T=m(S.flow.target),$=n.connect(I,T,{type:"bpmn:SequenceFlow",businessObject:Tp(S.flow)}),L=Qg.get(x.id),D=T.y+T.height/2;L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1?n.updateWaypoints($,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]):(n.reconnect($,I,T,[O(I),O(T)]),Math.abs(D-(I.y+I.height/2))>1&&Pp($))}else if((x.source!==void 0||x.target!==void 0)&&!bS.has(x.id)){const O=w,I=x.source!==void 0?m(x.source):O.source,T=x.target!==void 0?m(x.target):O.target,$=H=>({x:H.x+H.width/2,y:H.y+H.height/2});n.reconnect(O,I,T,[$(I),$(T)]);const L=Qg.get(O.id),D=T.y+T.height/2;if(L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1){n.updateWaypoints(O,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]);const H=O.label;if(H&&L.label){const Q=Math.abs(L.label.y+H.height/2-L.channelY)<=z/5&&L.label.x+H.width>L.exit.x,ne=L.exit.x+6,de=T.x-6-H.width,oe=Q?de>=ne?{x:Math.max(ne,Math.min(L.label.x,de)),y:L.label.y+(D-L.channelY)}:void 0:L.label;oe&&(oe.x!==H.x||oe.y!==H.y)&&n.moveElements([H],{x:oe.x-H.x,y:oe.y-H.y})}}else Math.abs(D-(I.y+I.height/2))>1&&Pp(O)}x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(w,{name:((SR=x.condition)==null?void 0:SR.label)??void 0})}for(const x of Gt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Gt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Gt(e,"annotation.update")){const w=m(x.id);if(x.text!==void 0){n.updateProperties(w,{text:x.text});const S=av(YS(x.id,x.text));if(S.width!==w.width||S.height!==w.height){const O={x:w.x,y:w.y,width:S.width,height:S.height};n.resizeShape(w,O,void 0,{[sv]:O})}}if(x.placement===null)Me(w,"bwl:Placement",null);else if(x.placement){const S=m(x.placement.anchor),O=qS(S),I=g(S)??d(),T=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[$,L]=pl[x.placement.side],D=x.placement.offset??50,H={x:O.x+O.width/2+$*(O.width/2+w.width/2+D),y:O.y+O.height/2+L*(O.height/2+w.height/2+D)},j=T?fl(r,O,{width:w.width,height:w.height},I,{placement:x.placement,selfId:x.id}):H;n.moveElements([w],{x:j.x-(w.x+w.width/2),y:j.y-(w.y+w.height/2)}),Me(w,"bwl:Placement",Te(x.placement))}}for(const x of Gt(e,"group.update")){const w=m(x.id);if(x.name!==void 0&&n.updateLabel(w,x.name??""),x.members){const S=x.members.map(f).filter(O=>!!O);S.length&&n.resizeShape(w,sm(S,x.id)),Me(w,"bwl:Members",{refs:x.members.join(" ")})}}}function _s(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 gT(e,t,n){const i=(r,a)=>{const s=r.shapes.find(l=>l.id===a);if(s)return{x:s.x+s.width/2,y:s.y+s.height/2};const c=r.edges.find(l=>l.id===a);return c!=null&&c.waypoints.length?c.waypoints[Math.floor((c.waypoints.length-1)/2)]:void 0},o=new Set;for(const r of e.shapes){if(r.type!=="bpmn:TextAnnotation")continue;const a=i(e,r.id),s=i(t,r.id);if(!a||!s)continue;const c=s.x-a.x,l=s.y-a.y;if(Math.abs(c)<=2&&Math.abs(l)<=2)continue;const u=n(r.id),p=u?i(e,u):void 0,d=u?i(t,u):void 0;p&&d&&Math.abs(d.x-p.x-c)<=2&&Math.abs(d.y-p.y-l)<=2||o.add(r.id)}return o}function mT(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(f=>f.type==="bpmn:Association");if(!a.length)return 0;const s=f=>f.map(m=>m.original?{x:m.x,y:m.y,original:{x:m.original.x,y:m.original.y}}:{x:m.x,y:m.y}),c=(f,m)=>f.length===m.length&&f.every((g,y)=>{var _,h,v,b;return g.x===m[y].x&&g.y===m[y].y&&((_=g.original)==null?void 0:_.x)===((h=m[y].original)==null?void 0:h.x)&&((v=g.original)==null?void 0:v.y)===((b=m[y].original)==null?void 0:b.y)}),l=a.map(f=>s(f.waypoints)),u=new Set(a.map(f=>f.id));r.moveElements([t],{x:n,y:i});const p=Ge(o),d=[...eo(p),..._i(p)].filter(([f,m])=>u.has(f)!==u.has(m)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,m)=>{c(f.waypoints,l[m])||r.updateWaypoints(f,l[m])}),d}function yT(e,t,n,i=new Set,o=new Set){var g,y;const{elementRegistry:r}=e,a=e.modeling,s=_=>ft(_).filter(h=>!t.has(ct(h))),c=_=>{var h;return((h=r.get(_))==null?void 0:h.type)==="bpmn:TextAnnotation"},l=Ge(r),u=s(l),p=_=>!n.has(_),d=_=>u.some(h=>h.kind==="edge-crosses-shape"&&h.shape===_&&i.has(h.edge)||h.kind==="shape-overlap"&&h.shapes.includes(_)&&h.shapes.every(c)),f=[...new Set(u.flatMap(_s))].filter(_=>c(_)&&(!p(_)||d(_))),m=[...f.filter(_=>!p(_)),...f.filter(p)];if(m.length)for(const _ of m){const h=r.get(_);if(!h||typeof h.x!="number"||typeof h.width!="number")continue;let v=h.parent,b;for(;v;){if(v.type==="bpmn:Participant"){b=v;break}v=v.parent}if(!b){const V=h.x+h.width/2,Z=h.y+h.height/2;b=r.getAll().find(pe=>{if(pe.type!=="bpmn:Participant")return!1;const ve=pe;return typeof ve.x=="number"&&typeof ve.width=="number"&&V>=ve.x&&V<=ve.x+ve.width&&Z>=ve.y&&Z<=ve.y+ve.height})}if(!b||typeof b.x!="number"||typeof b.width!="number")continue;const M=(((g=h.businessObject.extensionElements)==null?void 0:g.values)??[]).find(V=>V.$type==="bwl:Placement"),B=[...h.incoming??[],...h.outgoing??[]].find(V=>V.type==="bpmn:Association"),P=(M!=null&&M.anchor?r.get(M.anchor):void 0)??(B?((y=B.source)==null?void 0:y.id)===_?B.target:B.source:void 0);if(!P)continue;const k=P.waypoints,N=k!=null&&k.length?{x:k[Math.floor((k.length-1)/2)].x,y:k[Math.floor((k.length-1)/2)].y,width:0,height:0}:{x:P.x,y:P.y,width:P.width,height:P.height},G={width:h.width,height:h.height},q={x:h.x+h.width/2,y:h.y+h.height/2},Y=M==null?void 0:M.side,ae=fv(r,N,b),X=[];if(Y&&Y in pl&&X.push(fl(r,N,G,b,{placement:{side:Y,offset:(M==null?void 0:M.offset)??null},selfId:_})),ae&&!dl(q,G,ae))for(const V of uT)X.push(fl(r,N,G,b,{placement:{side:V,offset:null},selfId:_}));for(const[V,Z]of[[-1,0],[1,0],[0,-1],[0,1]])for(let pe=1;pe<=lT;pe++)X.push({x:q.x+V*dv*pe,y:q.y+Z*dv*pe});const Me=p(_)?Ge(r):l,Te={...Me,edges:Me.edges.filter(V=>V.id!==(B==null?void 0:B.id))},Pe=s(Te),fe=Pe.filter(V=>_s(V).includes(_)).length;if(!fe)continue;let z,se=!1;for(const V of X){const Z=V.x-q.x,pe=V.y-q.y;if(!Z&&!pe||V.x-G.width/2<b.x||V.x+G.width/2>b.x+b.width||V.y-G.height/2<b.y||V.y+G.height/2>b.y+b.height||ae&&!dl(V,G,ae))continue;const ve={...Te,shapes:Te.shapes.map(R=>R.id===_?{...R,x:R.x+Z,y:R.y+pe}:R)},$e=o.has(_)?s(ve):ft(ve).filter(R=>!t.has(ct(R))||_s(R).includes(_)),F=$e.filter(R=>_s(R).includes(_)).length;if(F>=fe||$e.length>Pe.length)continue;const C=Math.abs(Z)+Math.abs(pe);if(se||((!z||F<z.mine||F===z.mine&&($e.length<z.all||$e.length===z.all&&C<z.dist))&&(z={x:V.x,y:V.y,mine:F,all:$e.length,dist:C}),z.mine===0&&z.all<Pe.length&&(se=!0)),F===0&&$e.length<Pe.length&&mT(e,h,Z,pe)===0){z={x:V.x,y:V.y,mine:F,all:$e.length,dist:C};break}}z&&a.moveElements([h],{x:z.x-q.x,y:z.y-q.y})}}const vT=60;function hl(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 xT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=_=>ft(_).filter(h=>!t.has(ct(h))),a=_=>_.filter(h=>h.kind==="pool-overlap"),s=new Map(n.shapes.map(_=>[_.id,_])),c=(_,h)=>h.x>=_.x&&h.y>=_.y&&h.x+h.width<=_.x+_.width&&h.y+h.height<=_.y+_.height,l=_=>{if(!s.get(_))return[_];const v=new Set,b=new Set([_]);for(let M=0;M<4;M++){let B=!1;for(const P of n.shapes)P.type!=="bpmn:Group"||v.has(P.id)||[...b].some(k=>{const N=s.get(k);return N&&c(P,N)})&&(v.add(P.id),B=!0);for(const P of n.shapes)P.type!=="bpmn:Participant"||b.has(P.id)||[...v].some(k=>{const N=s.get(k);return N&&c(N,P)})&&(b.add(P.id),B=!0);if(!B)break}const E=n.shapes.filter(M=>!M.parent&&!b.has(M.id)&&!v.has(M.id)&&M.type!=="bpmn:Group"&&M.type!=="bpmn:Participant").filter(M=>[...v].some(B=>{const P=s.get(B);return P&&c(P,M)})).map(M=>M.id);return[...b,...v,...E]},u=r(Ge(i)),p=a(u).length;if(!p)return;const d=u.length,f=[];let m=0,g=p,y=d;for(let _=0;_<6;_++){const h=Ge(i),v=a(r(h));if(!v.length)break;const b=new Map(h.shapes.map(k=>[k.id,k]));let E=null;for(const k of v){if(k.kind!=="pool-overlap")continue;const[N,G]=k.pools,q=b.get(N),Y=b.get(G);if(!q||!Y)continue;const[ae,X]=q.x<=Y.x?[q,Y]:[Y,q];if(k.contained)continue;const Me=s.get(ae.id),Te=s.get(X.id),Pe=Me&&Te?Math.max(Te.x-(Me.x+Me.width),0):vT,fe=ae.x+ae.width+Pe-X.x;if(fe<=0)continue;const z=l(X.id).filter(se=>i.get(se));z.length&&(!E||fe>E.dx)&&(E={movers:z,dx:fe})}if(!E)break;const M=E.movers.map(k=>i.get(k)).filter(k=>!!k&&typeof k.x=="number");if(!M.length)break;o.moveElements(M,{x:E.dx,y:0}),f.push({els:M,dx:E.dx});const B=r(Ge(i)),P=a(B).length;P<p&&B.length<=d&&(P<g||P===g&&B.length<y||m===0)&&(m=f.length,g=P,y=B.length)}for(const{els:_,dx:h}of f.slice(m).reverse())o.moveElements(_,{x:-h,y:0})}const Es=.5,Nd=150;function bT(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of wT(n))i.length<n.length&&i.some(r=>bv(e.elementRegistry.get(r.id)))||_T(e,i)}function wT(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)<=Es?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function bv(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 _T(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(h=>h.x+h.width),r=Math.max(...o);if(r-Math.min(...o)>Es)return;const a=t.map(h=>n.get(h.id)).filter(h=>!!h&&typeof h.x=="number");if(a.length<2)return;const s=new Map(t.map(h=>[h.id,h.x]));if(a.some(h=>Math.abs(h.x-s.get(h.id))>Es))return;const c=a.map(h=>h.x+h.width);if(Math.max(...c)-Math.min(...c)<=Es)return;const l=h=>h.x+h.width,u=h=>!!h&&typeof h.width=="number",p=h=>{const v={shapes:[],edges:[],lanes:[]},b=E=>{for(const M of E.children??[]){if("waypoints"in M&&M.waypoints){v.edges.push(M);continue}M.type!=="label"&&(M.type==="bpmn:Lane"?v.lanes.push(M):v.shapes.push(M),b(M))}};return b(h),v},d=new Map(a.map(h=>[h.id,p(h)]));let f=r;for(const h of a){const{shapes:v}=d.get(h.id),b=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+Nd))}const m=a.filter(h=>Math.abs(l(h)-f)>Es);if(!m.length)return;for(const h of m){const v=l(h),{shapes:b,edges:E,lanes:M}=d.get(h.id);if([...b.flatMap(k=>[l(k),...u(k.label)?[l(k.label)]:[]]),...E.flatMap(k=>[...k.waypoints.map(N=>N.x),...u(k.label)?[l(k.label)]:[]])].some(k=>k>f)||[...(h.incoming??[]).map(k=>k.waypoints[k.waypoints.length-1]),...(h.outgoing??[]).map(k=>k.waypoints[0])].some(k=>!k||k.x>f||Math.abs(k.x-v)<1))return;if(f>v){const k={x:v,y:h.y,width:f-v,height:h.height},N=new Set([h.id,...b.map(q=>q.id),...E.map(q=>q.id),...M.map(q=>q.id)]);if(n.getAll().some(q=>{var X;if("waypoints"in q&&q.waypoints||q.type==="bpmn:Group"||!u(q))return!1;const Y=q.type==="label"?(X=q.labelTarget)==null?void 0:X.id:q.id;if(!Y||N.has(Y)||N.has(q.id))return!1;const ae=q;return ae.x<k.x+k.width&&ae.x+ae.width>k.x&&ae.y<k.y+k.height&&ae.y+ae.height>k.y}))return}}const g=()=>new Set(ft(Ge(n)).map(ct)),y=g(),_=m.map(h=>h.width);for(const h of m)hl(i,h,f-h.x,{layout:!1});[...g()].every(h=>y.has(h))||m.forEach((h,v)=>hl(i,h,_[v],{layout:!1}))}function ET(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ft(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(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!p.length)continue;const d=p.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(d.length!==p.length)continue;const f=s(p),m=s(d),g=m.l+(l.x-f.l),y=m.t+(l.y-f.t),_=m.r+(l.x+l.width-f.r),h=m.b+(l.y+l.height-f.b),v={x:g,y,width:_-g,height:h-y};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const b=r(Ge(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(Ge(i)).length>b&&o.resizeShape(u,E)}}const gl=20,ml=10;function ST(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(ft(f,{includeObservationOnly:!0}).filter(m=>m.kind==="edge-along-group-boundary").map(ct)),s=Ge(o),c=ft(s,{includeObservationOnly:!0}).filter(f=>f.kind==="edge-along-group-boundary"&&!t.has(ct(f)));if(!c.length)return;const l=new Map(n.shapes.map(f=>[f.id,f])),u=new Map;for(const f of c)u.set(f.group,[...u.get(f.group)??[],f]);for(const[f,m]of u){const g=s.shapes.find($e=>$e.id===f);if(!((p=g==null?void 0:g.members)!=null&&p.length))continue;const y=l.get(f);if(!(!y||Math.abs(y.x-g.x)>=.5||Math.abs(y.y-g.y)>=.5||Math.abs(y.width-g.width)>=.5||Math.abs(y.height-g.height)>=.5))continue;const h=g.members.map($e=>o.get($e)).filter($e=>!!$e&&typeof $e.x=="number");if(!h.length)continue;const v=Math.min(...h.map($e=>$e.x)),b=Math.min(...h.map($e=>$e.y)),E=Math.max(...h.map($e=>$e.x+$e.width)),M=Math.max(...h.map($e=>$e.y+$e.height)),B=g.x,P=g.y,k=g.x+g.width,N=g.y+g.height;let G=B,q=P,Y=k,ae=N;for(const $e of m){const F=s.edges.find(R=>R.id===$e.edge);if(!F)continue;const C=F.endpoints.some(R=>{const U=s.shapes.find(ke=>ke.id===R);if(!U||U.container)return!1;const ee=U.x+U.width/2,he=U.y+U.height/2;return B<ee&&ee<k&&P<he&&he<N});for(const R of sn(F)){const U=R.axis==="v"?[P,N]:[B,k];Math.min(R.hi,U[1])-Math.max(R.lo,U[0])<pd||(R.axis==="v"?B<R.at&&R.at<k:P<R.at&&R.at<N)&&C||(R.axis==="v"?(Math.abs(R.at-B)<=xa&&(G=Math.max(G,R.at+gl)),Math.abs(R.at-k)<=xa&&(Y=Math.min(Y,R.at-gl))):(Math.abs(R.at-P)<=xa&&(q=Math.max(q,R.at+gl)),Math.abs(R.at-N)<=xa&&(ae=Math.min(ae,R.at-gl))))}}if(G>v-ml&&(G=B),q>b-ml&&(q=P),Y<E+ml&&(Y=k),ae<M+ml&&(ae=N),G===B&&q===P&&Y===k&&ae===N)continue;const X=o.get(f),Me={x:X.x,y:X.y,width:X.width,height:X.height},Te=Ge(o),Pe=new Set(ft(Te).map(ct)),fe=a(Te);r.resizeShape(X,{x:G,y:q,width:Y-G,height:ae-q});let z=Ge(o),se=ft(z).filter($e=>!Pe.has(ct($e)));const V=[];if(se.length>0&&se.every($e=>$e.kind==="label-over-line"&&!i.has($e.edge)&&z.edges.some(F=>F.id===$e.edge))){for(const $e of se){if($e.kind!=="label-over-line")continue;const F=z.edges.find(he=>he.id===$e.edge),C=F&&Od(F,z),R=(d=o.get($e.edge))==null?void 0:d.label;if(!C||!R)continue;const U=C.x-R.x,ee=C.y-R.y;r.moveElements([R],{x:U,y:ee}),V.push({label:R,dx:U,dy:ee})}z=Ge(o),se=ft(z).filter($e=>!Pe.has(ct($e)))}const pe=a(z),ve=[...pe].some($e=>!fe.has($e));if(se.length||ve||pe.size>=fe.size){for(const $e of V.reverse())r.moveElements([$e.label],{x:-$e.dx,y:-$e.dy});r.resizeShape(X,Me)}}}function RT(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Vp((o==null?void 0:o.$parent)??o),a=ps(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:Wp(u,i,r),requests:Kp(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 $d(e,t,n={}){var Te,Pe;const{i18n:i,lower:o=xv}=n,r=uv(e),a=hy(r.elementRegistry),s=tv(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=YA(t,a,i),u=i&&l.writes.size?RT(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ge(r.elementRegistry),d=new Set(ft(p).map(ct)),f=new Set(ft(p,{includeObservationOnly:!0}).map(ct)),m=new Set(hv(l.ops,fe=>{var z,se;return(se=(z=r.elementRegistry.get(fe))==null?void 0:z.source)==null?void 0:se.id}).keys()),g=new Set(p.edges.map(fe=>fe.id).filter(fe=>!m.has(fe))),y=new Set(t.flatMap(fe=>fe.kind==="sequenceFlow.update"&&(fe.source!==void 0||fe.target!==void 0)?[fe.id]:[])),_=()=>new Set(p.edges.filter(fe=>{var se;const z=(se=r.elementRegistry.get(fe.id))==null?void 0:se.waypoints;return z?!(z.length===fe.waypoints.length&&fe.waypoints.every((V,Z)=>Math.round(V.x)===Math.round(z[Z].x)&&Math.round(V.y)===Math.round(z[Z].y))):!1}).map(fe=>fe.id)),h=(fe,z)=>new Set([...fe].filter(se=>!z.has(se))),v=new Set(p.shapes.map(fe=>fe.id)),b=new Set(t.flatMap(fe=>fe.kind==="annotation.update"&&fe.placement?[fe.id]:[])),E=eo(p),M=E.length,B=new Set(E.map(([fe,z])=>`${fe}|${z}`)),P=_i(p),k=new Set(P.map(([fe,z])=>`${fe}|${z}`)),N=new Map;for(const fe of r.elementRegistry.filter(z=>"waypoints"in z&&!!z.waypoints))fe.label&&N.set(fe.id,{wps:fe.waypoints.map(z=>({x:z.x,y:z.y})),label:{x:fe.label.x,y:fe.label.y},source:(Te=fe.source)==null?void 0:Te.id,target:(Pe=fe.target)==null?void 0:Pe.id});const G=e.get("commandStack");try{fT(r,l.writes),mm(G,()=>{o(l.ops,r);for(const Z of(u==null?void 0:u.contexts())??[])G.execute(qp,Z);xT(r,d,p),bT(r,p),ET(r,d,p),wA(r,p,y),vA(r,g,v),Ay(r,g);const fe=wd(r,d),z=cA(r,hT(r),g,y);_y(r,B,g);const se=_(),V=zy(r,d,h(g,se),se);Dy(r,g),DA(r,g,y),$y(r,d,g),zA(r,d,g),gA(r,k,g),CA(r,g,p),Yy(r,d,h(g,_())),qy(r,g,new Set([...y,...V,...z])),Xy(r,v),yT(r,d,v,fe,b),wd(r,d,fe),ST(r,f,p,g),Zy(r,d),Uy(r,N,dT(r))})}catch(fe){return{ok:!1,issues:[fe instanceof gv?fe.issue:{kind:"lower-failed",message:fe instanceof Error?fe.message:String(fe)}],findings:[],stats:c}}const q=Ge(r.elementRegistry),Y=gT(p,q,fe=>{var V,Z,pe;const z=r.elementRegistry.get(fe),se=[...(z==null?void 0:z.incoming)??[],...(z==null?void 0:z.outgoing)??[]].find(ve=>ve.type==="bpmn:Association");return se&&(((V=se.source)==null?void 0:V.id)===fe?(Z=se.target)==null?void 0:Z.id:(pe=se.source)==null?void 0:pe.id)}),ae=ft(q,{includeObservationOnly:!0}).filter(fe=>!f.has(ct(fe))||_s(fe).some(z=>Y.has(z))),X=oy(q),Me=_i(q);return{ok:!0,issues:[],findings:ae,stats:{edgeCrossings:{before:M,after:X.pairs.length,pairs:X.pairs,solidPairs:X.solidPairs,dashedPairs:X.dashedPairs,mixedPairs:X.mixedPairs,crossPoolMessages:X.crossPoolMessages},sharedEndpointCrossings:{before:P.length,after:Me.length,pairs:Me}}}}function MT(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function wv(e,t){return typeof e.get=="function"?e.get(t):e[t]}function _v(e,t){const n=wv(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Ev(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function CT(e){return typeof e=="string"&&Fp.includes(e)}function Gi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Sv(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:{}},d=[],f=[],m=[],g=[],y=[],_=[],h=[],v=new Map,b=new Set,E=new Set,M=z=>{z&&b.add(z)},B=z=>{b.add(z),E.add(z)},P=z=>{const se=Ev(z,"bwl:Placement");if(!se)return;const V=typeof se.anchor=="string"?se.anchor:void 0;if(!V||!CT(se.side))return;const Z=typeof se.offset=="number"?se.offset:void 0;y.push({owner:z.id,anchor:V,side:se.side,...Z!==void 0?{offset:Z}:{}})},k=z=>{const se=Ev(z,"bwl:Members"),V=typeof(se==null?void 0:se.refs)=="string"?se.refs.split(/\s+/).filter(Boolean):[];V.length&&h.push({owner:z.id,refs:V})},N=z=>{var se;for(const V of z)switch(M(V.id),V.$type){case"bpmn:TextAnnotation":B(V.id),v.set(V.id,V),c.push({id:V.id,text:typeof V.text=="string"?V.text:""}),P(V);break;case"bpmn:Association":m.push({id:V.id,type:V.$type,source:Gi(V.sourceRef),target:Gi(V.targetRef)});break;case"bpmn:Group":{B(V.id),v.set(V.id,V);const Z=(se=V.categoryValueRef)==null?void 0:se.value;l.push({id:V.id,...typeof Z=="string"&&Z?{name:Z}:{}}),k(V);break}default:u.push({id:V.id,type:V.$type,reason:"type-outside-mvp"})}},G=z=>{for(const se of z.flowElements??[])M(se.id),u.push({id:se.id,type:se.$type,reason:"inside-container"}),(se.flowElements??[]).length&&G(se);for(const se of z.artifacts??[])M(se.id),u.push({id:se.id,type:se.$type,reason:"inside-container"})},q=(z,se)=>{const V=z.flowElements??[],Z=(z.laneSets??[]).flatMap(ve=>ve.lanes??[]),pe=new Map;for(const ve of Z){M(ve.id),v.set(ve.id,ve);for(const $e of ve.flowNodeRef??[]){const F=Gi($e);F&&pe.set(F,ve.id)}}for(const ve of V){if(M(ve.id),v.set(ve.id,ve),ve.$type==="bpmn:SequenceFlow"){d.push({id:ve.id,source:Gi(ve.sourceRef),target:Gi(ve.targetRef),...typeof ve.name=="string"&&ve.name?{name:ve.name}:{}});continue}if(ve.$type==="bpmn:DataStoreReference"){B(ve.id),s.push({id:ve.id,...ve.name?{name:ve.name}:{}});continue}const $e=MT(ve.$type),F=$e==="intermediateCatchEvent"?Np((ve.eventDefinitions??[]).map(ee=>ee.$type)):void 0;if(!um($e)||$e==="intermediateCatchEvent"&&!F){u.push({id:ve.id,type:ve.$type,reason:"type-outside-mvp"});continue}B(ve.id);const C=$e==="boundaryEvent"?Gi(ve.attachedToRef):void 0;a.push({id:ve.id,type:$e,...ve.name?{name:ve.name}:{},...se?{participant:se}:{},...pe.has(ve.id)?{lane:pe.get(ve.id)}:{},...C?{attachedTo:C}:{},...F?{eventDefinition:F}:{}}),$e==="subProcess"&&G(ve);const R=_v(ve,"bwl:band");R!==void 0&&(p.bands[ve.id]=R);const U=wv(ve,"bwl:afterColumn");typeof U=="string"&&U!==""&&_.push([ve.id,U]);for(const ee of ve.dataOutputAssociations??[])M(ee.id),g.push({id:ee.id,type:ee.$type,source:ve.id,target:Gi(ee.targetRef)});for(const ee of ve.dataInputAssociations??[])M(ee.id),g.push({id:ee.id,type:ee.$type,source:Gi((ee.sourceRef??[])[0]),target:ve.id})}N(z.artifacts??[])};if(i){const z=new Set;for(const se of i.participants??[]){B(se.id),v.set(se.id,se);const V=Gi(se.processRef);V&&z.add(V);const Z=V?o.get(V):void 0,pe=((Z==null?void 0:Z.laneSets)??[]).flatMap(C=>C.lanes??[]),ve=pe.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of ve)B(C.id);const $e=!Z||(Z.flowElements??[]).length===0&&pe.length===0&&(Z.artifacts??[]).length===0;r.push({id:se.id,...se.name?{name:se.name}:{},...$e?{blackBox:!0}:{},...ve.length?{lanes:ve}:{}});const F=_v(se,"bwl:poolOrder");F!==void 0&&(p.poolOrders[se.id]=F),Z&&q(Z,se.id)}for(const se of i.messageFlows??[])M(se.id),v.set(se.id,se),f.push({id:se.id,source:Gi(se.sourceRef),target:Gi(se.targetRef),...typeof se.name=="string"&&se.name?{name:se.name}:{}});N(i.artifacts??[]);for(const[se,V]of o)!z.has(se)&&(V.flowElements??[]).length>0&&u.push({id:se,type:V.$type,reason:"unreachable-process"})}else for(const z of o.values())q(z);const Y=[],ae=[],X=[],Me=[],Te=(z,se)=>!!z&&!!se&&E.has(z)&&E.has(se);for(const z of d){if(!Te(z.source,z.target)){u.push({id:z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Y.push({id:z.id,source:z.source,target:z.target,...z.name?{name:z.name}:{}}),E.add(z.id)}for(const z of f){if(!Te(z.source,z.target)){u.push({id:z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}ae.push({id:z.id,source:z.source,target:z.target,...z.name?{name:z.name}:{}}),E.add(z.id)}for(const z of g){if(!Te(z.source,z.target)){u.push({id:z.id??"",type:z.type,reason:"endpoint-outside-mvp"});continue}Me.push({...z.id?{id:z.id}:{},source:z.source,target:z.target}),z.id&&E.add(z.id)}for(const z of m){if(!Te(z.source,z.target)){u.push({id:z.id??"",type:z.type,reason:"endpoint-outside-mvp"});continue}X.push({...z.id?{id:z.id}:{},source:z.source,target:z.target})}const Pe=new Map(l.map(z=>[z.id,z]));for(const{owner:z,refs:se}of h){const V=se.filter(pe=>b.has(pe)),Z=Pe.get(z);Z&&V.length&&(Z.members=V)}for(const z of y)b.has(z.anchor)&&(p.placements[z.owner]={anchor:z.anchor,side:z.side,...z.offset!==void 0?{offset:z.offset}:{}});for(const[z,se]of _)b.has(se)&&(p.afterColumns[z]=se);const fe={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Y,...ae.length?{messageFlows:ae}:{},...s.length?{dataStores:s}:{},...Me.length?{dataAssociations:Me}:{},...c.length?{annotations:c}:{},...X.length?{associations:X}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:fe,hints:p,omitted:u,i18n:AT(fe,v,e,t.i18n)}:{definition:fe,hints:p,omitted:u}}function AT(e,t,n,i){const o=Vp(n),r=ps(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Wp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of Kp(u))r.includes(d.locale)&&a.push({id:c.id,...d})};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 TT(e,t={}){const{definitions:n,warnings:i}=await va(e);return{...Sv(n,t),warnings:i}}const PT=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Fd(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function kT(e){return Fd(e.processRef)!==void 0}function OT(e){const t=new Set,n=o=>{const r=Fd(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 DT(e){const t=[],n=i=>{for(const o of i.flowElements??[])PT.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 LT(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 jd(e){const t=[],n=e.rootElements??[],i=OT(e);for(const r of DT(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??[])kT(s)&&LT(r.get(Fd(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 IT(e){const{definitions:t,warnings:n}=await va(e);return{issues:jd(t),warnings:n}}const BT=.5,NT=8,$T=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Ea=e=>typeof e=="number"?e:Number(e??NaN),yl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function FT(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}=${yl(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=>`${yl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(yl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function jT(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?[Ea(s.x),Ea(s.y),Ea(s.width),Ea(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=yl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(d=>[Ea(d.x),Ea(d.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 Rv(e){const t=jT(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:")&&!$T.has(s)&&n.set(c,{type:s,props:FT(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 Mv(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 Cv(e,t,n={}){const i=n.moveTolerance??BT,o=Rv(e),r=Rv(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||Mv(p.geometry,u.geometry,i)||Mv(p.label,u.label,n.labelTolerance??NT))&&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 HT(e,t,n={}){const[i,o]=await Promise.all([va(e),va(t)]);return{...Cv(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function zT(e){return new Set([...e.added,...e.modified])}function Av(e){return e.get("moddle").ids}function Tv(e,t,n){const i=Object.prototype.hasOwnProperty.call(e,"nextPrefixed"),o=e.nextPrefixed;e.nextPrefixed=t;try{return n()}finally{i?e.nextPrefixed=o:delete e.nextPrefixed}}function Pv(e,t){const n=Av(e),i=n.nextPrefixed,o=[];return{value:Tv(n,function(a,s){const c=i.call(this,a,s);return o.push(c),c},t),generatedIds:o}}function kv(e,t,n){const i=Av(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:Tv(i,function(l,u){const p=t[r++];return p!==void 0&&p.startsWith(l)&&!this.assigned(p)?(this.claim(p,u),a++,p):(s++,o.call(this,l,u))},n),fed:a,missed:s,remaining:Math.max(0,t.length-r)}}function GT(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Ov(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>$d(e,t.ops,{i18n:i}),{value:a,generatedIds:s}=o?Pv(e,r):{value:r(),generatedIds:void 0};if(!a.ok)return{status:"rejected",issues:a.issues};const{xml:c}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:c??"",findings:a.findings,stats:a.stats,...s?{generatedIds:s}:{}}}const Ss=()=>typeof performance>"u"?Date.now():performance.now();function VT(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class Hd extends Error{constructor(t,n){super(n),this.reason=t}}async function Dv(e,t,{expectedXml:n,i18n:i}){const o=Ss(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(Ss()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(Ss()-o)};const a=e.get("commandStack"),s=ym(a),c=t.flatMap(p=>p.generatedIds);let l;try{r.run(()=>{const p=kv(e,c,()=>{t.forEach((d,f)=>{f>0&&r.atBatchBoundary();const m=$d(e,d.ops,{...i?{i18n:i}:{}});if(!m.ok)throw new Hd("rejected",`배치 ${f+1}/${t.length} — ${VT(m.issues)}`)})});if(p.missed||p.remaining)throw new Hd("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof Hd?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=vm(a,s);if(!l)try{const{xml:p}=await e.saveXML({format:!0});p!==n&&(l={reason:"xml"})}catch(p){l={reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}return l?(u&&a.undo(),{status:"diverged",...l,ms:Math.round(Ss()-o)}):{status:"replayed",ms:Math.round(Ss()-o)}}const WT=new Set(["lasso","lasso.selection","hand","hand.move"]),Lv=1e4,UT="bwl-edit-locked",Iv=new WeakMap;function qT(e){const t=Iv.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",Lv,()=>{var s;if(o)return WT.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"],Lv,()=>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(UT,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 Iv.set(e,a),a}const YT=Symbol("bpmn-editor"),zd={geometry:[],semantic:[]};function KT(){const e=Ee.ref(!1),t=Ee.ref(!0),n=Ee.ref(!1),i=Ee.shallowRef(zd),o=Ee.shallowRef(void 0),r=Ee.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=zd;return}const h=ft(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:h,semantic:v?jd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const h=p();if(!h||!a){r.value=void 0;return}const v=h.locales(),b={};for(const E of v)b[E]={untranslated:h.untranslatedCount(E),reviewRequested:h.reviewRequestedCount(E)};r.value={designLocale:a.designLocale,locales:v,displayLocale:h.getDisplayLocale()??a.designLocale,counts:b}}function f(){const h=p();h&&(h.configure(a),a&&s&&(s=h.setDisplayLocale(s)))}const m=()=>{l||(e.value=!0,u())};function g(h,v){qT(h).set(!v)}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function _(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:o,i18n:r,configureI18n(h){a=h,f(),d()},setDisplayLocale(h){var b;s=h;const v=(b=p())==null?void 0:b.setDisplayLocale(h);v&&(s=v),d()},setChangeScope(h){o.value=h===void 0?void 0:new Set(h)},requestFocus(h){if(!c)return;const v=c.get("elementRegistry").get(h);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(h){const v=c==null?void 0:c.get("elementRegistry").get(h),b=v==null?void 0:v.businessObject;if(!b)return;const E=typeof b.name=="string"&&b.name.trim()!==""?b.name:b.text;return{name:typeof E=="string"&&E.trim()!==""?E.trim():void 0,type:typeof b.$type=="string"?b.$type:""}},attach(h){c&&this.detach(),c=h,c.get("eventBus").on("commandStack.changed",m),t.value||g(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",m),c&&!t.value&&g(c,!0),c=void 0,i.value=zd,o.value=void 0,r.value=void 0},setEditable(h){t.value=h,c&&g(c,h)},async applyAgentBatch(h,v){const b=y();n.value=!0;try{const E=await Ov(b,h,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return E.status==="applied"&&(e.value=!1),E}finally{n.value=!1}},async replayAgentTurn(h,v){const b=y(),E=e.value;n.value=!0,l=!0;try{const M=await Dv(b,h,{expectedXml:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return e.value=M.status==="replayed"?!1:E,M}finally{l=!1,n.value=!1,u()}},async importXml(h){const{warnings:v}=await y().importXML(h);return e.value=!1,o.value=void 0,u(),{warnings:ud(v)}},async saveXml(){const{xml:h}=await y().saveXML({format:!0});return e.value=!1,h??""},undo:()=>{var h;return(h=_())==null?void 0:h.undo()},redo:()=>{var h;return(h=_())==null?void 0:h.redo()},canUndo:()=>{var h;return((h=_())==null?void 0:h.canUndo())??!1},canRedo:()=>{var h;return((h=_())==null?void 0:h.canRedo())??!1}}}const XT=new RegExp("\\p{Script=Hangul}","u"),ZT=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,JT=new RegExp("\\p{Script=Han}","u");function vl(e){const t=XT.test(e),n=ZT.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:JT.test(e)?"han":"other"}}function Bv(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 Nv(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=Or(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Go(a).filter(l=>Rn(l))})}return n}const Rs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function QT(e,t={}){const n=Bv(e),i=Nv(e);let o;const r={},a=[],s=[],c=[];for(const g of i){const y=g.trs.filter(_=>(_.body??"")===g.name).map(Rn);if(y.length){const _=[...y].sort().join("+");r[_]=(r[_]??0)+1,o=o?new Set([...o].filter(h=>y.includes(h))):new Set(y)}else g.trs.some(_=>_.body)?a.push(Rs(g)):c.push({e:g,inference:vl(g.name)});for(const _ of g.trs){const h=Rn(_),v=_.body??"",b=vl(v);b.locale&&b.locale!==h?s.push({...Rs(g),locale:h,script:b.script}):h==="ko"&&b.script==="han"&&g.trs.some(E=>E!==_&&E.body===v)&&s.push({...Rs(g),locale:h,script:"han"})}}const l=new Set(c.map(g=>g.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const g=l.size===1?[...l][0]:void 0;g&&o.has(g)?[u,p]=[g,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const d=n??u,f=[],m=[];for(const{e:g,inference:y}of c)y.locale?y.locale!==d&&f.push({...Rs(g),locale:y.locale}):m.push({...Rs(g),script:y.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:m,drift:a,matchedBy:r,scriptMismatch:s}}function eP(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Bv(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(Nv(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(d=>d.body))continue;const l=c.trs.find(d=>Rn(d)===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(kr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function $v(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;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const Gd=e=>Rn(e)||void 0,Fv=e=>e.body??"";function jv(e){const t=new Map;for(const n of $v(e)){const i=Go(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Gd(o),body:Fv(o)}))})}return t}const Hv=e=>JSON.stringify(e.map(t=>t.body).sort());class tP{constructor(){an(this,"byId",new Map);an(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};zv(this.byId,o,a),zv(this.byBodies,Hv(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Hv(t))??[]}}function zv(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function nP(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function Vd(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function iP(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const oP=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function rP(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=jv(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=nP(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(y=>y.doc===t.doc&&Vd(y.state,c)).sort((y,_)=>_.version-y.version).slice(0,1).map(y=>y.state)],["lineage",t.index.sameId(a).filter(y=>y.doc!==t.doc&&Vd(y.state,c)).map(y=>y.state)],["bodies",t.index.sameBodies(s.cells).filter(y=>!(y.doc===t.doc&&y.id===a)&&Vd(y.state,c)).map(y=>y.state)]].find(([,y])=>y.length);if(!p){if(!r(s))continue;for(const[y,_]of c)for(let h=0;h<_;h++)n.unresolved.push({...l,body:y,script:vl(y).script});continue}const[d,f]=p,m=f.map(y=>iP(s,y,c));if(m.some(y=>y.overflow)||new Set(m.map(oP)).size>1){n.ambiguous.push({...l,source:d});continue}const[g]=m;for(const y of g.stale)n.stale.push({...l,...y});g.cells.length&&n.restores.push({...l,source:d,cells:g.cells})}return n}function aP(e,t){if(!t.restores.length)return 0;const n=new Map($v(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=Go(r),s=new Set(a.map(Gd).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Gd(p)&&Fv(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Ne(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function sP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wd={exports:{}},Gv;function cP(){if(Gv)return Wd.exports;Gv=1;var e=Wd.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},Wd.exports}var lP=cP(),uP=sP(lP);function to(e){if(!(this instanceof to))return new to(e);e=e||[128,36,1],this._seed=e.length?uP.rack(e[0],e[1],e[2]):e}to.prototype.next=function(e){return this._seed(e||!0)},to.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},to.prototype.claim=function(e,t){this._seed.set(e,t||!0)},to.prototype.assigned=function(e){return this._seed.get(e)||!1},to.prototype.unclaim=function(e){delete this._seed.hats[e]},to.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const vn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};vn.td=vn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],vn.option=vn.optgroup=[1,'<select multiple="multiple">',"</select>"],vn.thead=vn.tbody=vn.colgroup=vn.caption=vn.tfoot=[1,"<table>","</table>"],vn.polyline=vn.ellipse=vn.polygon=vn.circle=vn.text=vn.line=vn.path=vn.rect=vn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Vt(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(vn,i)?vn[i]:vn._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 pP(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 Yn(e,...t){const n=e.style;return W(t,function(i){i&&W(i,function(o,r){n[r]=o})}),e}function Mn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const dP=Object.prototype.toString;function Pt(e){return new Ko(e)}function Ko(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ko.prototype.add=function(e){return this.list.add(e),this},Ko.prototype.remove=function(e){return dP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ko.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},Ko.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ko.prototype.array=function(){return Array.from(this.list)},Ko.prototype.has=Ko.prototype.contains=function(e){return this.list.contains(e)};function xl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function jr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function fP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bl={},Vv;function hP(){if(Vv)return bl;Vv=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return bl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},bl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},bl}var Wv=hP(),gP=fP(Wv),We=pP({__proto__:null,default:gP},[Wv]),Uv=["focus","blur"];function mP(e,t,n,i,o){return Uv.indexOf(n)!==-1&&(o=!0),We.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=jr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function yP(e,t,n,i){return Uv.indexOf(t)!==-1&&(i=!0),We.unbind(e,t,n,i)}var ai={bind:mP,unbind:yP};function Ud(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Ct(e,t){return t=t||document,t.querySelector(e)}function Ms(e,t){return t=t||document,t.querySelectorAll(e)}function no(e){e.parentNode&&e.parentNode.removeChild(e)}function vP(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function xP(e,t){return t.appendChild(vP(e,t))}function tt(e,t){return xP(t,e),e}var qd=2,qv={"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":qd,"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":qd,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function bP(e,t){return qv[t]?e.style[t]:e.getAttributeNS(null,t)}function Yv(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=qv[i];o?(o===qd&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function wP(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Yv(e,o,t[o])}function Le(e,t,n){if(typeof t=="string")if(n!==void 0)Yv(e,t,n);else return bP(e,t);else wP(e,t);return e}const _P=Object.prototype.toString;function gt(e){return new Xo(e)}function Xo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xo.prototype.add=function(e){return this.list.add(e),this},Xo.prototype.remove=function(e){return _P.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xo.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},Xo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xo.prototype.array=function(){return Array.from(this.list)},Xo.prototype.has=Xo.prototype.contains=function(e){return this.list.contains(e)};function Cs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Yd(e){return e.cloneNode(!0)}var Kd={svg:"http://www.w3.org/2000/svg"},Kv='<svg xmlns="'+Kd.svg+'"';function EP(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Kd.svg)===-1&&(e=Kv+e.substring(4)):(e=Kv+">"+e+"</svg>",t=!0);var n=SP(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function SP(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function je(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=EP(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Kd.svg,e),t&&Le(n,t),n}var Xd=null;function Xv(){return Xd===null&&(Xd=je("svg")),Xd}function Zv(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function RP(e,t,n,i,o,r){var a=Xv().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Zv(a,e);case 6:return Zv(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function As(e){return Xv().createSVGTransform()}var Jv=/([&<>]{1})/g,MP=/([&<>\n\r"]{1})/g,CP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Zd(e,t){function n(i,o){return CP[o]||o}return e.replace(t,n)}function Qv(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Zd(e.textContent,Jv));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,'="',Zd(r.value,MP),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Qv(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Zd(e.nodeValue,Jv),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function AP(e){for(var t=e.firstChild,n=[];t;)Qv(t,n),t=t.nextSibling;return n.join("")}function ex(e,t){return AP(e)}function cn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function TP(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function PP(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(TP(e,i))}function Ts(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),PP(n,t)),n.consolidate()}const kP=/^class[ {]/;function OP(e){return kP.test(e.toString())}function Jd(e){return Array.isArray(e)}function Qd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function wl(...e){e.length===1&&Jd(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const DP=/constructor\s*[^(]*\(\s*([^)]*)\)/m,LP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,IP=/\/\*([^*]*)\*\//m;function BP(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(OP(e)?DP:LP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(IP);return(o&&o[1]||i).trim()})||[]}function tx(e,t){const n=t||{get:function(v,b){if(i.push(v),b===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const b=i.join(" -> ");return i.length=0,new Error(b?`${v} (Resolving: ${b})`:v)};function c(v,b){if(!o[v]&&v.includes(".")){const E=v.split(".");let M=c(E.shift());for(;E.length;)M=M[E.shift()];return M}if(Qd(r,v))return r[v];if(Qd(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,b)}function l(v,b){if(typeof b>"u"&&(b={}),typeof v!="function")if(Jd(v))v=wl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const M=(v.$inject||BP(v)).map(B=>Qd(b,B)?b[B]:c(B));return{fn:v,dependencies:M}}function u(v){const{fn:b,dependencies:E}=l(v),M=Function.prototype.bind.call(b,null,...E);return new M}function p(v,b,E){const{fn:M,dependencies:B}=l(v,E);return M.apply(b,B)}function d(v){return wl(b=>v.get(b))}function f(v,b){if(b&&b.length){const E=Object.create(null),M=Object.create(null),B=[],P=[],k=[];let N,G,q,Y;for(let ae in o)N=o[ae],b.indexOf(ae)!==-1&&(N[2]==="private"?(G=B.indexOf(N[3]),G===-1?(q=N[3].createChild([],b),Y=d(q),B.push(N[3]),P.push(q),k.push(Y),E[ae]=[Y,ae,"private",q]):E[ae]=[k[G],ae,"private",P[G]]):E[ae]=[N[2],N[1]],M[ae]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&b.forEach(X=>{N[1].$scope.indexOf(X)!==-1&&(E[ae]=[N[2],N[1]],M[X]=!0)});b.forEach(ae=>{if(!M[ae])throw new Error('No provider for "'+ae+'". Cannot use provider from the parent!')}),v.unshift(E)}return new tx(v,a)}const m={factory:p,type:u,value:function(v){return v}};function g(v,b){const E=v.__init__||[];return function(){E.forEach(M=>{typeof M=="string"?b.get(M):b.invoke(M)})}}function y(v){const b=v.__exports__;if(b){const E=v.__modules__,M=Object.keys(v).reduce((G,q)=>(q!=="__exports__"&&q!=="__modules__"&&q!=="__init__"&&q!=="__depends__"&&(G[q]=v[q]),G),Object.create(null)),B=(E||[]).concat(M),P=f(B),k=wl(function(G){return P.get(G)});b.forEach(function(G){o[G]=[k,G,"private",P]});const N=(v.__init__||[]).slice();return N.unshift(function(){P.init()}),v=Object.assign({},v,{__init__:N}),g(v,P)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const M=v[E];if(M[2]==="private"){o[E]=M;return}const B=M[0],P=M[1];o[E]=[m[B],NP(B,P),B]}),g(v,a)}function _(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(_,v),v.indexOf(b)!==-1)?v:v.concat(b)}function h(v){const b=v.reduce(_,[]).map(y);let E=!1;return function(){E||(E=!0,b.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=f,this.init=h(e)}function NP(e,t){return e!=="value"&&Jd(t)&&(t=wl(t.slice())),t}var $P=1e3;function _o(e,t){var n=this;t=t||$P,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)})}_o.prototype.canRender=function(e){},_o.prototype.drawShape=function(e,t){},_o.prototype.drawConnection=function(e,t){},_o.prototype.getShapePath=function(e){},_o.prototype.getConnectionPath=function(e){};function Hr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function FP(e){return["M",e.x,e.y]}function ef(e){return["L",e.x,e.y]}function jP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function HP(e,t){const n=e.length,i=[FP(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(ef(a));continue}const c=Math.min(t,tf(a.x-r.x,a.y-r.y),tf(s.x-a.x,s.y-a.y));if(!c){i.push(ef(a));continue}const l=_l(a,r,c),u=_l(a,r,c*.5),p=_l(a,s,c),d=_l(a,s,c*.5);i.push(ef(l)),i.push(jP(u,d,p))}return i}function _l(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=tf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function tf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ps(e,t,n){Je(t)&&(n=t,t=null),t||(t={});const i=je("path",t);return Je(n)&&(i.dataset.cornerRadius=String(n)),nf(i,e)}function nf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Le(e,{d:Hr(HP(t,n))}),e}function El(e){var t=new Set(e);return dt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function zr(e,t,n){n=n||0,Ze(e)||(e=[e]),W(e,function(i,o){var r=t(i,o,n);Ze(r)&&r.length&&zr(r,t,n+1)})}function of(e,t,n){var i=new Set,o=new Set;return zr(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 ks(e,t){return of(e)}function zP(e,t,n){Pr(t)&&(t=!0),yn(t)&&(n=t,t=!0),n=n||{};var i=Os(n.allShapes),o=Os(n.allConnections),r=Os(n.enclosedElements),a=Os(n.enclosedConnections),s=Os(n.topLevel,t&&ha(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,W(u.incoming,c),W(u.outgoing,c),u.children}return zr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function ln(e,t){t=!!t,Ze(e)||(e=[e]);var n,i,o,r;return W(e,function(a){var s=a;a.waypoints&&!t&&(s=ln(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 Sa(e,t){var n={};return W(e,function(i){var o=i;o.waypoints&&(o=ln(o)),!Je(t.y)&&o.x>t.x&&(n[i.id]=i),!Je(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Je(t.width)&&Je(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Je(t.width)||!Je(t.height))&&(n[i.id]=i)}),n}function nx(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ix(e){return!!(e&&e.isFrame)}function Os(e,t){return J({},e||{},t||{})}var GP=1;function Zo(e,t){_o.call(this,e,GP),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})}Ne(Zo,_o),Zo.prototype.canRender=function(){return!0},Zo.prototype.drawShape=function(t,n,i){var o=je("rect");return Le(o,{x:0,y:0,width:n.width||0,height:n.height||0}),ix(n)?Le(o,J({},this.FRAME_STYLE,i||{})):Le(o,J({},this.SHAPE_STYLE,i||{})),tt(t,o),o},Zo.prototype.drawConnection=function(t,n,i){var o=Ps(n.waypoints,J({},this.CONNECTION_STYLE,i||{}));return tt(t,o),o},Zo.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 Hr(a)},Zo.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 Hr(r)},Zo.$inject=["eventBus","styles"];function VP(){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 J(r,{class:n})},this.style=function(n,i){!Ze(n)&&!i&&(i=n,n=[]);var o=ri(n,function(r,a){return J(r,e[a]||{})},{});return i?J(o,i):o},this.computeStyle=function(n,i,o){return Ze(i)||(o=i,i=[]),t.style(i||[],J({},o,n||{}))}}const WP={__init__:["defaultRenderer"],defaultRenderer:["type",Zo],styles:["type",VP]};function nn(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function rn(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 rf(e,t){return!e||!t?-1:e.indexOf(t)}function Ds(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function af(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=Ds(e,t);return Math.abs(o/r)<=i}var UP=2;function Eo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(qP(o,n))return r;return!1}function qP(e,t){const n=t[0];return Ho(t,function(i){return Math.abs(n[e]-i[e])<=UP})}function ox(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 sf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var YP=/,?([a-z]),?/gi,rx=parseFloat,un=Math,Jo=un.PI,io=un.min,oo=un.max,ax=un.pow,Qo=un.abs,KP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,XP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,sx=Array.isArray||function(e){return e instanceof Array};function ZP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function JP(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 QP(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 ZP(o,i)?(JP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function e2(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(KP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(XP,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=lf,n}function t2(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 n2(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 lf(){return this.join(",").replace(YP,"$1")}function i2(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=lf,t}function cx(e,t,n,i,o,r,a,s,c){var l=1-c,u=ax(l,3),p=ax(l,2),d=c*c,f=d*c,m=u*e+p*3*c*n+l*3*c*c*o+f*a,g=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:Sl(m),y:Sl(g)}}function lx(e){var t=l2(...e);return cf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function o2(e,t){return e=cf(e),t=cf(t),er(t,e.x,e.y)||er(t,e.x2,e.y)||er(t,e.x,e.y2)||er(t,e.x2,e.y2)||er(e,t.x,t.y)||er(e,t.x2,t.y)||er(e,t.x,t.y2)||er(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 ux(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 px(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],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,m=0;m<u;m++){var g=l*p[m]+l,y=ux(g,e,n,o,a),_=ux(g,t,i,r,s),h=y*y+_*_;f+=d[m]*un.sqrt(h)}return l*f}function r2(e,t,n,i,o,r,a,s){if(!(oo(e,n)<io(o,a)||io(e,n)>oo(o,a)||oo(t,i)<io(r,s)||io(t,i)>oo(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=Sl(c/u),d=Sl(l/u),f=+p.toFixed(2),m=+d.toFixed(2);if(!(f<+io(e,n).toFixed(2)||f>+oo(e,n).toFixed(2)||f<+io(o,a).toFixed(2)||f>+oo(o,a).toFixed(2)||m<+io(t,i).toFixed(2)||m>+oo(t,i).toFixed(2)||m<+io(r,s).toFixed(2)||m>+oo(r,s).toFixed(2)))return{x:p,y:d}}}}function Sl(e){return Math.round(e*1e11)/1e11}function a2(e,t,n){var i=lx(e),o=lx(t);if(!o2(i,o))return[];var r=px(...e),a=px(...t),s=fx(e)?1:~~(r/5)||1,c=fx(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,m;for(f=0;f<s+1;f++){var g=cx(...e,f/s);l[f]={x:g.x,y:g.y,t:f/s}}for(f=0;f<c+1;f++)g=cx(...t,f/c),u[f]={x:g.x,y:g.y,t:f/c};for(f=0;f<s;f++)for(m=0;m<c;m++){var y=l[f],_=l[f+1],h=u[m],v=u[m+1],b=Qo(_.x-y.x)<.01?"y":"x",E=Qo(v.x-h.x)<.01?"y":"x",M=r2(y.x,y.y,_.x,_.y,h.x,h.y,v.x,v.y),B;if(M){if(B=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[B])continue;p[B]=!0;var P=y.t+Qo((M[b]-y[b])/(_[b]-y[b]))*(_.t-y.t),k=h.t+Qo((M[E]-h[E])/(v[E]-h[E]))*(v.t-h.t);P>=0&&P<=1&&k>=0&&k<=1&&d.push({x:M.x,y:M.y,t1:P,t2:k})}}return d}function dx(e,t,n){e=mx(e),t=mx(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],m=0,g=e.length;m<g;m++){var y=e[m];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,h=t.length;_<h;_++){var v=t[_];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(d=[r,a,...v.slice(1)],r=d[6],a=d[7]):(d=[r,a,r,a,l,u,l,u],r=l,a=u);var b=a2(p,d);{for(var E=0,M=b.length;E<M;E++)b[E].segment1=m,b[E].segment2=_,b[E].bez1=p,b[E].bez2=d;f=f.concat(b)}}}}}return f}function s2(e){return sx(e)&&sx(e[0])}function c2(e){if(t2(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 d=1,f=l.length;d<f;d++)c[d]=+l[d]+(d%2?n:i)}else for(var m=0,g=l.length;m<g;m++)c[m]=l[m];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=lf,t}function fx(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Rl(e,t,n,i){return[e,t,n,i,n,i]}function hx(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 gx(e,t,n,i,o,r,a,s,c,l){var u=Jo*120/180,p=Jo/180*(+o||0),d=[],f,m=QP(function(F,C,R){var U=F*un.cos(R)-C*un.sin(R),ee=F*un.sin(R)+C*un.cos(R);return{x:U,y:ee}});if(l)B=l[0],P=l[1],E=l[2],M=l[3];else{f=m(e,t,-p),e=f.x,t=f.y,f=m(s,c,-p),s=f.x,c=f.y;var g=(e-s)/2,y=(t-c)/2,_=g*g/(n*n)+y*y/(i*i);_>1&&(_=un.sqrt(_),n=_*n,i=_*i);var h=n*n,v=i*i,b=(r==a?-1:1)*un.sqrt(Qo((h*v-h*y*y-v*g*g)/(h*y*y+v*g*g))),E=b*n*y/i+(e+s)/2,M=b*-i*g/n+(t+c)/2,B=un.asin(((t-M)/i).toFixed(9)),P=un.asin(((c-M)/i).toFixed(9));B=e<E?Jo-B:B,P=s<E?Jo-P:P,B<0&&(B=Jo*2+B),P<0&&(P=Jo*2+P),a&&B>P&&(B=B-Jo*2),!a&&P>B&&(P=P-Jo*2)}var k=P-B;if(Qo(k)>u){var N=P,G=s,q=c;P=B+u*(a&&P>B?1:-1),s=E+n*un.cos(P),c=M+i*un.sin(P),d=gx(s,c,n,i,o,0,a,G,q,[P,N,E,M])}k=P-B;var Y=un.cos(B),ae=un.sin(B),X=un.cos(P),Me=un.sin(P),Te=un.tan(k/4),Pe=4/3*n*Te,fe=4/3*i*Te,z=[e,t],se=[e+Pe*ae,t-fe*Y],V=[s+Pe*Me,c-fe*X],Z=[s,c];if(se[0]=2*z[0]-se[0],se[1]=2*z[1]-se[1],l)return[se,V,Z].concat(d);d=[se,V,Z].concat(d).join().split(",");for(var pe=[],ve=0,$e=d.length;ve<$e;ve++)pe[ve]=ve%2?m(d[ve-1],d[ve],p).y:m(d[ve],d[ve+1],p).x;return pe}function l2(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,m,g,y,_,h=0;h<2;++h){if(h==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,d=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,d=3*i-3*t),Qo(u)<1e-12){if(Qo(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}y=p*p-4*d*u,_=un.sqrt(y),!(y<0)&&(m=(-p+_)/(2*u),0<m&&m<1&&c.push(m),g=(-p-_)/(2*u),0<g&&g<1&&c.push(g))}for(var v=c.length,b=v,E;v--;)f=c[v],E=1-f,l[0][v]=E*E*E*e+3*E*E*f*n+3*E*f*f*o+f*f*f*a,l[1][v]=E*E*E*t+3*E*E*f*i+3*E*f*f*r+f*f*f*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:io(...l[0]),y0:io(...l[1]),x1:oo(...l[0]),y1:oo(...l[1])}}function mx(e){if(s2(e)||(e=e2(e)),n2(e))return e;for(var t=i2(c2(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,m){var g,y;if(!d)return["C",f.x,f.y,f.x,f.y,f.x,f.y];switch(!(d[0]in{T:1,Q:1})&&(f.qx=f.qy=null),d[0]){case"M":f.X=d[1],f.Y=d[2];break;case"A":d=["C",...gx(f.x,f.y,...d.slice(1))];break;case"S":m=="C"||m=="S"?(g=f.x*2-f.bx,y=f.y*2-f.by):(g=f.x,y=f.y),d=["C",g,y,...d.slice(1)];break;case"T":m=="Q"||m=="T"?(f.qx=f.x*2-f.qx,f.qy=f.y*2-f.qy):(f.qx=f.x,f.qy=f.y),d=["C",...hx(f.x,f.y,f.qx,f.qy,d[1],d[2])];break;case"Q":f.qx=d[1],f.qy=d[2],d=["C",...hx(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",...Rl(f.x,f.y,d[1],d[2])];break;case"H":d=["C",...Rl(f.x,f.y,d[1],f.y)];break;case"V":d=["C",...Rl(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",...Rl(f.x,f.y,f.X,f.Y)];break}return d},o=function(d,f){if(d[f].length>7){d[f].shift();for(var m=d[f];m.length;)r[f]="A",d.splice(f++,0,["C",...m.splice(0,6)]);d.splice(f,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=rx(u[p-4])||n.x,n.by=rx(u[p-3])||n.y}return t}function It(e){return yn(e)&&oi(e,"waypoints")}function lt(e){return yn(e)&&oi(e,"labelTarget")}function u2(e){return yn(e)&&da(e.parent)}function yx(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function So(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function qe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ml(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function p2(e){return So({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function d2(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var d=t[p-1];if(d){var f=l[l.length-1],m=f&&f.endLength||0,g=g2(d,u);l.push({start:d,end:u,startLength:m,endLength:m+g,length:g})}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 Qe(e){return It(e)?d2(e):p2(e)}function Bn(e,t,n){n=n||0,yn(n)||(n={x:n,y:n});var i=qe(e),o=qe(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 Ls(e,t,n){var i=f2(e,t);return i.length===1||i.length===2&&Ds(i[0],i[1])<1?So(i[0]):i.length>1?(i=Xi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),So(i[n?0:i.length-1])):null}function f2(e,t){return dx(e,t)}function h2(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Ds(n,o)===0||af(i,o,n)?e.splice(t,1):t++;return e}function g2(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cl(e,t){return Math.round(e*t)/t}function vx(e){return Je(e)?e+"px":e}function m2(e){for(;e.parent;)e=e.parent;return e}function y2(e){e=J({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Yn(n,{position:"relative",overflow:"hidden",width:vx(e.width),height:vx(e.height)}),t.appendChild(n),n}function xx(e,t,n){const i=je("g");gt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const v2="base",bx=0,x2=1,b2={shape:["x","y","width","height"],connection:["waypoints"]};function et(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||{})}et.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],et.prototype._init=function(e){const t=this._eventBus,n=this._container=y2(e),i=this._svg=je("svg");Le(i,{width:"100%",height:"100%"}),Mn(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")}),tt(n,i);const o=this._viewport=xx(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Gp(this._viewboxChanged,300)),this._restoreFocus=Gp(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)},et.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},et.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},et.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=nx(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},et.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},et.prototype.restoreFocus=function(){this._restoreFocus()},et.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},et.prototype.isFocused=function(){return this._focused},et.prototype.getDefaultLayer=function(){return this.getLayer(v2,bx)},et.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},et.prototype._getChildIndex=function(e){return ri(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},et.prototype._createLayer=function(e,t){typeof t>"u"&&(t=x2);const n=this._getChildIndex(t);return{group:xx(this._viewport,"layer-"+e,n),index:t,visible:!0}},et.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},et.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&&(cn(n),t.visible=!1),n},et.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],cn(t.group))},et.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},et.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(m2(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},et.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},et.prototype._findPlaneForRoot=function(e){return Ft(this._planes,function(t){return t.rootElement===e})},et.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},et.prototype._resolveElements=function(e){return Ze(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},et.prototype.getContainer=function(){return this._container},et.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&&(W([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),gt(o).add(t)):(e.markers.delete(t),gt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},et.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},et.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},et.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},et.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},et.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},et.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,bx);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},et.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},et.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},et.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)},et.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})},et.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})},et.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=b2[e];if(!Ho(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},et.prototype._setParent=function(e,t,n){rn(t.children,e,n),e.parent=t},et.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},et.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},et.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},et.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),nn(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},et.prototype.removeShape=function(e){return this._removeElement(e,"shape")},et.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},et.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},et.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},et.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},et.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);Ts(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Ts(t),o=a?a.matrix:RP(),s=Cl(o.a,1e3),c=Cl(-o.e||0,1e3),l=Cl(-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},et.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=J({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),wx(t,n)}),{x:n.e,y:n.f}},et.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(m=>m!=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=ln(r),s=qe(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 d=qe(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const m=Math.max(0,s.right-d.right),g=Math.min(0,s.left-d.left),y=Math.max(0,s.bottom-d.bottom),_=Math.min(0,s.top-d.top);u=m||g,p=y||_}this.scroll({dx:-u*l,dy:-p*l})},et.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)}),Cl(i.a,1e3)};function wx(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}et.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},et.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=J(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),wx(this._viewport,u),u},et.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},et.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}},et.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ra="data-element-id";function vi(e){this._elements={},this._eventBus=e}vi.$inject=["eventBus"],vi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Le(t,Ra,i),n&&Le(n,Ra,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},vi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Le(i.gfx,Ra,""),i.secondaryGfx&&Le(i.secondaryGfx,Ra,""),delete t[n])},vi.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)},vi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Le(t,Ra,i),t},vi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Le(e,Ra);var n=this._elements[t];return n&&n.element},vi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},vi.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}},vi.prototype.getAll=function(){return this.filter(function(e){return e})},vi.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)})},vi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},vi.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 w2(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 _2(e){return e.__refs_collection===!0}function E2(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function _x(e,t,n){var i=w2(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 S2(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 Si(e,t){if(!(this instanceof Si))return new Si(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Si.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?_x(this,t,e):S2(this,t,e)},Si.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return _2(n)||_x(this,t,e),n},Si.prototype.ensureBound=function(e,t){E2(e,t)||this.bind(e,t)},Si.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Si.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var uf=new Si({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ex=new Si({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Sx=new Si({name:"attachers",collection:!0},{name:"host"}),Rx=new Si({name:"outgoing",collection:!0},{name:"source"}),Mx=new Si({name:"incoming",collection:!0},{name:"target"});function Ma(){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)}}),uf.bind(this,"parent"),Ex.bind(this,"labels"),Rx.bind(this,"outgoing"),Mx.bind(this,"incoming")}function Is(){Ma.call(this),uf.bind(this,"children"),Sx.bind(this,"host"),Sx.bind(this,"attachers")}Ne(Is,Ma);function Cx(){Ma.call(this),uf.bind(this,"children")}Ne(Cx,Is);function Ax(){Is.call(this),Ex.bind(this,"labelTarget")}Ne(Ax,Is);function Tx(){Ma.call(this),Rx.bind(this,"source"),Mx.bind(this,"target")}Ne(Tx,Ma);var R2={connection:Tx,shape:Is,label:Ax,root:Cx};function M2(e,t){var n=R2[e];if(!n)throw new Error("unknown type: <"+e+">");return J(new n,t)}function C2(e){return e instanceof Ma}function Ro(){this._uid=12}Ro.prototype.createRoot=function(e){return this.create("root",e)},Ro.prototype.createLabel=function(e){return this.create("label",e)},Ro.prototype.createShape=function(e){return this.create("shape",e)},Ro.prototype.createConnection=function(e){return this.create("connection",e)},Ro.prototype.create=function(e,t){return t=J({},t||{}),t.id||(t.id=e+"_"+this._uid++),M2(e,t)};var Al="__fn",Px=1e3,A2=Array.prototype.slice;function si(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}si.prototype.on=function(e,t,n,i){if(e=Ze(e)?e:[e],wn(t)&&(i=n,n=t,t=Px),!Je(t))throw new Error("priority must be a number");var o=n;i&&(o=Zn(n,i),o[Al]=n[Al]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},si.prototype.once=function(e,t,n,i){var o=this;if(wn(t)&&(i=n,n=t,t=Px),!Je(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[Al]=n,this.on(e,t,r)},si.prototype.off=function(e,t){e=Ze(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},si.prototype.createEvent=function(e){var t=new Bs;return t.init(e),t},si.prototype.fire=function(e,t){var n,i,o,r;if(r=A2.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}},si.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},si.prototype._destroy=function(){this._listeners={}},si.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},si.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=T2(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},si.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},si.prototype._getListeners=function(e){return this._listeners[e]},si.prototype._setListeners=function(e,t){this._listeners[e]=t},si.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[Al]===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){J(this,e||{})};function T2(e,t){return e.apply(null,t)}function tr(e){return e.childNodes[0]}function P2(e){return e.parentNode.childNodes[1]}function Tl(e,t,n,i,o){var r=As();r.setTranslate(t,n);var a=As();a.setRotate(i||0,0,0);var s=As();s.setScale(1,1),Ts(e,[r,a,s])}function Nn(e,t,n){var i=As();i.setTranslate(t,n),Ts(e,i)}function kx(e,t){var n=As();n.setRotate(t,0,0),Ts(e,n)}function xi(e,t){this._eventBus=e,this._elementRegistry=t}xi.$inject=["eventBus","elementRegistry"],xi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=P2(t),n||(n=je("g"),gt(n).add("djs-children"),tt(t.parentNode,n))):n=t,n},xi.prototype._clear=function(e){var t=tr(e);return xl(t),t},xi.prototype._createContainer=function(e,t,n,i){var o=je("g");gt(o).add("djs-group"),typeof n<"u"?k2(o,t,t.childNodes[n]):tt(t,o);var r=je("g");gt(r).add("djs-element"),gt(r).add("djs-"+e),i&&gt(r).add("djs-frame"),tt(o,r);var a=je("g");return gt(a).add("djs-visual"),tt(r,a),r},xi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,ix(t))},xi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ri(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),W(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;W(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},xi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},xi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},xi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},xi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},xi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Nn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Le(n,"display","none"):Le(n,"display","block")}},xi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);cn(t.parentNode)};function k2(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const O2={__depends__:[WP],__init__:["canvas"],canvas:["type",et],elementRegistry:["type",vi],elementFactory:["type",Ro],eventBus:["type",si],graphicsFactory:["type",xi]};function D2(e){var t=new tx(e);return t.init(),t}function L2(e){e=e||{};var t={config:["value",e]},n=[t,O2].concat(e.modules||[]);return D2(n)}function nr(e,t){this._injector=t||L2(e),this.get("eventBus").fire("diagram.init")}nr.prototype.get=function(e,t){return this._injector.get(e,t)},nr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},nr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Vn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Qn(e,t){return e.$instanceOf(t)}function I2(e){return Ft(e.rootElements,function(t){return Qn(t,"bpmn:Process")||Qn(t,"bpmn:Collaboration")})}function B2(e){var t={},n=[],i={};function o(V,Z){return function(pe){V(pe,Z)}}function r(V){t[V.id]=V}function a(V){return t[V.id]}function s(V,Z){var pe=V.gfx;if(pe)throw new Error(`already rendered ${Vn(V)}`);return e.element(V,i[V.id],Z)}function c(V,Z){return e.root(V,i[V.id],Z)}function l(V,Z){try{var pe=i[V.id]&&s(V,Z);return r(V),pe}catch(ve){u(ve.message,{element:V,error:ve}),console.error(`failed to import ${Vn(V)}`,ve)}}function u(V,Z){e.error(V,Z)}var p=this.registerDi=function(Z){var pe=Z.bpmnElement;pe?i[pe.id]?u(`multiple DI elements defined for ${Vn(pe)}`,{element:pe}):i[pe.id]=Z:u(`no bpmnElement referenced in ${Vn(Z)}`,{element:Z})};function d(V){f(V.plane)}function f(V){p(V),W(V.planeElement,m)}function m(V){p(V)}this.handleDefinitions=function(Z,pe){var ve=Z.diagrams;if(pe&&ve.indexOf(pe)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!pe&&ve&&ve.length&&(pe=ve[0]),!pe)throw new Error("no diagram to display");i={},d(pe);var $e=pe.plane;if(!$e)throw new Error(`no plane for ${Vn(pe)}`);var F=$e.bpmnElement;if(!F)if(F=I2(Z),F)u(`correcting missing bpmnElement on ${Vn($e)} to ${Vn(F)}`),$e.bpmnElement=F,p($e);else throw new Error("no process or collaboration to display");var C=c(F,$e);if(Qn(F,"bpmn:Process")||Qn(F,"bpmn:SubProcess"))y(F,C);else if(Qn(F,"bpmn:Collaboration"))z(F,C),_(Z.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Vn($e)}: ${Vn(F)}`);g(n)};var g=this.handleDeferred=function(){for(var Z;n.length;)Z=n.shift(),Z()};function y(V,Z){Te(V,Z),k(V.ioSpecification,Z),P(V.artifacts,Z),r(V)}function _(V,Z){var pe=dt(V,function(ve){return!a(ve)&&Qn(ve,"bpmn:Process")&&ve.laneSets});pe.forEach(o(y,Z))}function h(V,Z){l(V,Z)}function v(V,Z){W(V,o(h,Z))}function b(V,Z){l(V,Z)}function E(V,Z){l(V,Z)}function M(V,Z){l(V,Z)}function B(V,Z){l(V,Z)}function P(V,Z){W(V,function(pe){Qn(pe,"bpmn:Association")?n.push(function(){B(pe,Z)}):B(pe,Z)})}function k(V,Z){V&&(W(V.dataInputs,o(E,Z)),W(V.dataOutputs,o(M,Z)))}var N=this.handleSubProcess=function(Z,pe){Te(Z,pe),P(Z.artifacts,pe)};function G(V,Z){var pe=l(V,Z);Qn(V,"bpmn:SubProcess")&&N(V,pe||Z),Qn(V,"bpmn:Activity")&&k(V.ioSpecification,Z),n.push(function(){W(V.dataInputAssociations,o(b,Z)),W(V.dataOutputAssociations,o(b,Z))})}function q(V,Z){l(V,Z)}function Y(V,Z){l(V,Z)}function ae(V,Z){n.push(function(){var pe=l(V,Z);V.childLaneSet&&X(V.childLaneSet,pe||Z),se(V)})}function X(V,Z){W(V.lanes,o(ae,Z))}function Me(V,Z){W(V,o(X,Z))}function Te(V,Z){Pe(V.flowElements,Z),V.laneSets&&Me(V.laneSets,Z)}function Pe(V,Z){W(V,function(pe){Qn(pe,"bpmn:SequenceFlow")?n.push(function(){q(pe,Z)}):Qn(pe,"bpmn:BoundaryEvent")?n.unshift(function(){G(pe,Z)}):Qn(pe,"bpmn:FlowNode")?G(pe,Z):Qn(pe,"bpmn:DataObject")||(Qn(pe,"bpmn:DataStoreReference")||Qn(pe,"bpmn:DataObjectReference")?Y(pe,Z):u(`unrecognized flowElement ${Vn(pe)} in context ${Vn(Z&&Z.businessObject)}`,{element:pe,context:Z}))})}function fe(V,Z){var pe=l(V,Z),ve=V.processRef;ve&&y(ve,pe||Z)}function z(V,Z){W(V.participants,o(fe,Z)),n.push(function(){v(V.messageFlows,Z)}),P(V.artifacts,Z)}function se(V){W(V.flowNodeRef,function(Z){var pe=Z.get("lanes");pe&&pe.push(V)})}}function Ox(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(g,y){return i.add(g,y)},element:function(g,y,_){return i.add(g,y,_)},error:function(g,y){s.push({message:g,context:y})}},d=new B2(p);u=u||l.diagrams&&l.diagrams[0];var f=N2(l,u);if(!f)throw new Error("no diagram to display");W(f,function(g){d.handleDefinitions(l,g)});var m=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(m+"_plane")||r.findRoot(m))}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 N2(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=$2(n));var o;A(i,"bpmn:Collaboration")?o=i:o=Ft(e.rootElements,function(l){if(A(l,"bpmn:Collaboration"))return Ft(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Hn(o.participants,function(l){return l.processRef}),r.push(o));var a=Dx(r),s=[t],c=[n];return W(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 Dx(e){var t=[];return W(e,function(n){n&&(t.push(n),t=t.concat(Dx(n.flowElements)))}),t}function $2(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var F2='<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>',Lx=F2,Ix={verticalAlign:"middle"},Bx={color:"#404040"},j2={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},H2={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},z2={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"},G2='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Lx+'</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>',ro;function V2(){ro=Vt(G2),Yn(ro,j2),Yn(Ct("svg",ro),Ix),Yn(Ct(".backdrop",ro),H2),Yn(Ct(".notice",ro),z2),Yn(Ct(".link",ro),Bx,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function W2(){ro||(V2(),ai.bind(ro,".backdrop","click",function(e){document.body.removeChild(ro)})),document.body.appendChild(ro)}const Pl=5,Nx="djs-outline-hidden";function Yt(e){e=J({},q2,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),K2(this._container)}Ne(Yt,nr),Yt.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(d){throw this._emit("import.parse.complete",{error:d}),d}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||[]),kl(s,r),s=U2(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw kl(r,[]),r}if(typeof t=="string"&&(i=Y2(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw kl(r,[]),r}try{this.clear()}catch(r){throw kl(r,[]),r}const{warnings:o}=await Ox(this,n,i);return{warnings:o}},Yt.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},Yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Ct(":scope > defs",i._svg),a=ex(o),s=r?"<defs>"+ex(r)+"</defs>":"",c=i.getContainer();Pt(c).add(Nx);let l;try{l=o.getBBox()}finally{Pt(c).remove(Nx)}const u=l.x-Pl,p=l.y-Pl,d=l.width+Pl*2,f=l.height+Pl*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+E.message;if(B)return a.addWarning({message:q,error:E}),!0;throw qo(q)}function u(E,M){return l(E,M,!0)}function p(){var E=a.elementsById,M=a.references,B,P;for(B=0;P=M[B];B++){var k=P.element,N=E[P.id],G=xo(k).propertiesByName[P.property];if(N||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),G.isMany){var q=k.get(G.name),Y=q.indexOf(P);Y===-1&&(Y=q.length),N?q[Y]=N:q.splice(Y,1)}else k.set(G.name,N)}}function d(){c.pop().handleEnd()}var f=/^<\?xml /i,m=/ encoding="([^"]+)"/i,g=/^utf-8$/i;function y(E){if(f.test(E)){var M=m.exec(E),B=M&&M[1];!B||g.test(B)||a.addWarning({message:"unsupported document encoding <"+B+">, falling back to UTF-8"})}}function _(E,M){var B=c.peek();try{c.push(B.handleNode(E))}catch(P){l(P,M,r)&&c.push(new od)}}function h(E,M){try{c.peek().handleText(E)}catch(B){u(B,M)}}function v(E,M){E.trim()&&h(E,M)}var b=o.getPackages().reduce(function(E,M){return E[M.uri]=M.prefix,E},Object.entries(id).reduce(function(E,[M,B]){return E[B]=M,E},o.config&&o.config.nsMap||{}));return s.ns(b).on("openTag",function(E,M,B,P){var k=E.attrs||{},N=Object.keys(k).reduce(function(q,Y){var ae=M(k[Y]);return q[Y]=ae,q},{}),G={name:E.name,originalName:E.originalName,attributes:N,ns:E.ns};_(G,P)}).on("question",y).on("closeTag",d).on("cdata",h).on("text",function(E,M,B){v(M(E),B)}).on("error",l).on("warn",u),new Promise(function(E,M){var B;try{s.parse(e),p()}catch(q){B=q}var P=i.element;!B&&!P&&(B=qo("failed to parse document as <"+i.type.$descriptor.name+">"));var k=a.warnings,N=a.references,G=a.elementsById;return B?(B.warnings=k,M(B)):E({rootElement:P,elementsById:G,references:N,warnings:k})})},sd.prototype.handler=function(e){return new ad(this.model,e)};function gM(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var mM=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,yM=/<|>|'|"|&|\n\r|\n/g,Nm=/<|>|&/g;function Ji(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Ji.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Ji.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Ji.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Ji.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)},Ji.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Ji.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Ji.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Ji.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Ji.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 vM(e){return e.charAt(0).toLowerCase()+e.slice(1)}function xM(e,t){return Dm(t)?vM(e):e}function $m(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Fm(e){return ii(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function bM(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 wM(e,t){return t.isGeneric?J({localName:t.ns.localName},e):J({localName:xM(t.ns.localName,t.$pkg)},e)}function _M(e,t){return J({localName:t.ns.localName},e)}function EM(e){var t=e.$descriptor;return dt(t.properties,function(n){var i=n.name;if(n.isVirtual||!oi(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var SM={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},RM={"<":"lt",">":"gt","&":"amp"};function jm(e,t,n){return e=ii(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function MM(e){return jm(e,yM,SM)}function CM(e){return jm(e,Nm,RM)}function AM(e){return dt(e,function(t){return t.isAttr})}function TM(e){return dt(e,function(t){return!t.isAttr})}function cd(e){this.tagName=e}cd.prototype.build=function(e){return this.element=e,this},cd.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Ir(){}Ir.prototype.serializeValue=Ir.prototype.serializeTo=function(e){e.append(this.escape?CM(this.value):this.value)},Ir.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Nm)!==-1&&(this.escape=!0),this};function ld(e){this.tagName=e}$m(ld,Ir),ld.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function qt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}qt.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=EM(e),this.parseAttributes(AM(o)),this.parseContainments(TM(o))),this.parseGenericAttributes(e,i),this},qt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return wM(t,e)},qt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return _M(t,e)},qt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},qt.prototype.nsAttributeName=function(e){var t;if(ii(e)?t=zn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:J({localName:t.localName},n)},qt.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}))},qt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ir().build({type:"String"},t));var n=e.$children;n&&W(n,i=>{this.body.push(new qt(this).build(i))})},qt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=zn(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)}},qt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return W(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},qt.prototype.parseGenericAttributes=function(e,t){var n=this;W(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)}})},qt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;W(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new Ir().build(o,r[0]));else if(Mm(o.type))W(r,function(l){n.push(new ld(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)W(r,function(l){n.push(new cd(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Im(o);W(r,function(l){var u;c?c===Lm?u=new qt(t,o):u=new Yc(t,o,c):u=new qt(t),n.push(u.build(l))})}})},qt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Ji(i):t=i),t},qt.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},qt.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},qt.prototype.parseAttributes=function(e){var t=this,n=this.element;W(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];W(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},qt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Fm(e)},qt.prototype.addAttribute=function(e,t){var n=this.attrs;ii(t)&&(t=MM(t));var i=xm(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)},qt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=bM(n).concat(t)),W(t,function(i){e.append(" ").append(Fm(i.name)).append('="').append(i.value).append('"')})},qt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Ir;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),W(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Yc(e,t,n){qt.call(this,e,t),this.serialization=n}$m(Yc,qt),Yc.prototype.parseNsAttributes=function(e){var t=qt.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},Yc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function PM(){this.value="",this.write=function(e){this.value+=e}}function kM(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 OM(e){e=J({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new PM,r=new kM(o,e.format);e.preamble&&r.append(mM);var a=new qt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(DM(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function DM(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in id)n[i]=id[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 Kc(e,t){wi.call(this,e,t)}Kc.prototype=Object.create(wi.prototype),Kc.prototype.fromXML=function(e,t,n){ii(t)||(n=t,t="bpmn:Definitions");var i=new sd(J({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Kc.prototype.toXML=function(e,t){var n=new OM(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var LM="BPMN20",IM="http://www.omg.org/spec/BPMN/20100524/MODEL",BM="bpmn",NM=[],$M=[{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"}]}],FM=[{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"}]}],jM={tagAlias:"lowerCase",typePrefix:"t"},HM={name:LM,uri:IM,prefix:BM,associations:NM,types:$M,enumerations:FM,xml:jM},zM="BPMNDI",GM="http://www.omg.org/spec/BPMN/20100524/DI",VM="bpmndi",WM=[{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"]}],UM=[{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"}]}],qM=[],YM={name:zM,uri:GM,prefix:VM,types:WM,enumerations:UM,associations:qM},KM="DC",XM="http://www.omg.org/spec/DD/20100524/DC",ZM="dc",JM=[{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}]}],QM=[],eC={name:KM,uri:XM,prefix:ZM,types:JM,associations:QM},tC="DI",nC="http://www.omg.org/spec/DD/20100524/DI",iC="di",oC=[{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"}]}],rC=[],aC={tagAlias:"lowerCase"},sC={name:tC,uri:nC,prefix:iC,types:oC,associations:rC,xml:aC},cC="bpmn.io colors for BPMN",lC="http://bpmn.io/schema/bpmn/biocolor/1.0",uC="bioc",pC=[{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"}]}],dC=[],fC=[],hC={name:cC,uri:lC,prefix:uC,types:pC,enumerations:dC,associations:fC},gC="BPMN in Color",mC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",yC="color",vC=[{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"}]}],xC=[],bC=[],wC={name:gC,uri:mC,prefix:yC,types:vC,enumerations:xC,associations:bC};const _C={bpmn:HM,bpmndi:YM,dc:eC,di:sC,bioc:hC,color:wC};function Hm(e,t){const n=J({},_C,e);return new Kc(n,t)}const EC={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"}},gs={[wm]:EC,[$p]:hm};function zm(){return Hm(gs)}const Gm=zm();async function va(e){const{rootElement:t,warnings:n}=await Gm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function SC(e){const{xml:t}=await Gm.toXML(e,{format:!0});return t}function ud(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Qi={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Vm=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function RC(e){return Vm.test(e)}function MC(e){const t=Qi;return Vm.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 Br(e,t){let n=0;for(const i of e)n+=t*MC(i);return n}function Wm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&CC(e),AC(e),TC(e),PC(e)}function CC(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:Br(o,r),fontBoundingBoxAscent:r*Qi.ascentEm,fontBoundingBoxDescent:r*Qi.descentEm,actualBoundingBoxAscent:r*Qi.ascentEm,actualBoundingBoxDescent:r*Qi.descentEm}}};t.getContext=()=>n}function AC(e){if(e.SVGMatrix)return;class t{constructor(){an(this,"a",1);an(this,"b",0);an(this,"c",0);an(this,"d",1);an(this,"e",0);an(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 TC(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),d=Math.sin(u);a.a=p,a.b=d,a.c=-d,a.d=p,a.e=c-p*c+d*l,a.f=l-d*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 PC(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:Br(n,12),height:14}})}const Xc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),kC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),OC=1,Zc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),DC=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}`;case"merge-before-predecessor":return`mb|${e.merge}|${e.edge}`}}const Um=20,Jc=5,qm=3,LC=8,xa=15,pd=50,Ym=12,IC=Ym*1.2;function dd(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Br(r,Ym))),o=n.length*IC;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Km=1;function sn(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 Nr(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 sn(e))for(const s of sn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Km)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>=Um&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function fd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Xm(e,t){const n=Nr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function BC(e,t){let n=0;for(const i of t)i.id!==e.id&&Xm(e,i)&&n++;return n}function Jn(e,t){let n=0;for(const i of t)i.id!==e.id&&Nr(e,i)&&n++;return n}const Zm=15,Jm=20;function NC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Jm||t.at>n[1]+Jm)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 hd=20;function Qc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Km)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<Um||n.push([o-hd,r+hd])}return n}function el(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of sn(e)){const r=NC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Qc(o,sn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const $C=10,FC=1,jC=(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 HC(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 d=(f,m)=>{if(m===0)return f<=0;const g=f/m;if(m>0){if(g>p)return!1;g>u&&(u=g)}else{if(g<u)return!1;g<p&&(p=g)}return!0};return d(o-e.x,c)&&d(e.x-a,-c)&&d(r-e.y,l)&&d(e.y-s,-l)&&p>u}function gd(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 zC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ba=1;function ji(e,t){const n=e.x+ba,i=e.x+e.width-ba,o=e.y+ba,r=e.y+e.height-ba;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 wa(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 Qm(e,t){const n=e.label;if(!n)return null;if(sn(e).some(i=>ji(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(sn(i).some(o=>ji(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(wa(i).some(o=>ji(n,o)))return i.id;return null}function Ot(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(HC(e.waypoints[r],e.waypoints[r+1],o,DC)){i.push(o);break}}return i}const ms=(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))},GC=(e,t,n,i)=>ty(e,t,n,i)?0:Math.min(ms(e,n,i),ms(t,n,i),ms(n,e,t),ms(i,e,t)),ey=(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 bo(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,ms({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(ey(e,s)||ey(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,GC(e,t,s[l],s[(l+1)%s.length]));return c}function ty(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 md=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ny(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(ty(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ys(e,t){let n=0;for(const i of t)i.id===e.id||md(e,i)||ny(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id===e.id||md(e,i)||ys(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function iy(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++)ys(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function eo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ys(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 _i(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(md(n[i],n[o])&&ny(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 oy(e){const t=eo(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:VC(e)}}function VC(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 ry(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Zc.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 ay(e){var n;const t=(n=Ut(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ut(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 sy=e=>e?{members:e}:{},Dn=e=>e.shapes.filter(t=>!t.container);function WC(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 UC(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 cy(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(sn(i).some(o=>ji(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(wa(i).some(o=>ji(n,o)))return i.id;return null}function Yo(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 ly=3;function uy(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 vs(e,t){const n=[];for(const i of t.shapes){if(i.container||Zc.has(i.type))continue;const o=uy(e,i);o>=ly&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function yd(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function qC(e){const t=e.edges.filter(s=>s.type==="bpmn:SequenceFlow"&&!!s.source&&!!s.target),n=new Map,i=new Map;for(const s of t)n.set(s.source,[...n.get(s.source)??[],s.target]),i.set(s.target,[...i.get(s.target)??[],s.source]);const o=(s,c)=>{const l=new Set([s]),u=[s];for(;u.length;)for(const p of c.get(u.pop())??[])l.has(p)||(l.add(p),u.push(p));return l},r=new Map(e.shapes.map(s=>[s.id,s])),a=[];for(const[s,c]of i){const l=r.get(s);if(!l)continue;const u=o(s,n),p=[...new Set(c)].filter(f=>!u.has(f)&&r.has(f));if(p.length<2)continue;const d=p.map(f=>o(f,i));if([...d[0]].some(f=>d.every(m=>m.has(f)))){for(const f of p)if(!(l.x+l.width/2>=r.get(f).x))for(const m of t)m.source===f&&m.target===s&&a.push({kind:"merge-before-predecessor",merge:s,edge:m.id})}}return a}function ft(e,t={}){const n=[],i=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const v of Ot(h,i))n.push({kind:"edge-crosses-shape",edge:h.id,shape:v.id});const o=e.shapes.filter(h=>h.container&&kC.has(h.type));if(o.length){const h=(v,b)=>{const E=e.shapes.find(M=>M.id===b);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const b of Ot(v,o))v.endpoints.includes(b.id)||v.endpoints.some(E=>h(b,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}for(const h of e.edges){if(h.waypoints.length<2)continue;const v=[[h.source,h.waypoints[0]],[h.target,h.waypoints[h.waypoints.length-1]]];for(const[b,E]of v){if(!b)continue;const M=e.shapes.find(N=>N.id===b);if(!M||M.container)continue;const B=Math.max(M.x-E.x,E.x-(M.x+M.width),0),P=Math.max(M.y-E.y,E.y-(M.y+M.height),0),k=Math.hypot(B,P);k>$C&&n.push({kind:"edge-endpoint-detached",edge:h.id,shape:b,distance:Math.round(k)})}}for(const h of yd(e.shapes))n.push({kind:"pool-overlap",...h});const r=i.filter(h=>!h.attached);for(let h=0;h<r.length;h++)for(let v=h+1;v<r.length;v++){const b=r[h],E=r[v];if(!gd(b,E,OC))continue;const M=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:"shape-overlap",shapes:M,identical:zC(b,E)})}const a=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<a.length;h++)for(let v=h+1;v<a.length;v++){const b=a[h],E=a[v],M=Math.min(b.x+b.width,E.x+E.width)-Math.max(b.x,E.x),B=Math.min(b.y+b.height,E.y+E.height)-Math.max(b.y,E.y);if(M<=Jc||B<=Jc)continue;const P=b.id<E.id?[b.id,E.id]:[E.id,b.id],k=new Set(E.members);if(b.members.some(G=>k.has(G))){const G=ry(e,a,{x:Math.max(b.x,E.x),y:Math.max(b.y,E.y),right:Math.min(b.x+b.width,E.x+E.width),bottom:Math.min(b.y+b.height,E.y+E.height)});G.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:G});continue}const N=b.x<=E.x&&b.y<=E.y&&b.x+b.width>=E.x+E.width&&b.y+b.height>=E.y+E.height?b.id:E.x<=b.x&&E.y<=b.y&&E.x+E.width>=b.x+b.width&&E.y+E.height>=b.y+b.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:P,...N?{container:N}:{}})}const s=new Set(a.flatMap(h=>[...h.members])),c=h=>e.shapes.filter(v=>!v.container&&!Zc.has(v.type)&&v.x>=h.x&&v.y>=h.y&&v.x+v.width<=h.x+h.width&&v.y+v.height<=h.y+h.height);for(const h of a){const v=c(h);if(!v.length)continue;const b=new Set(h.members),E=v.filter(M=>!b.has(M.id));E.some(M=>s.has(M.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:E.map(M=>M.id).sort()}))}for(const h of a){const v=new Set(c(h).map(k=>k.id)),b=new Set(h.members),E=new Set([...v].filter(k=>!b.has(k)&&s.has(k)));if(!E.size)continue;let M=!1,B=!1,P=!1;for(const k of e.edges){if(k.type!=="bpmn:SequenceFlow"||!k.source||!k.target)continue;const N=E.has(k.source),G=E.has(k.target);!N&&G&&!v.has(k.source)?M=!0:N&&!G&&!v.has(k.target)?B=!0:N&&G&&(P=!0)}M&&B&&P&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...E].sort()})}const l=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<l.length;h++)for(let v=h+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const E=[l[h],l[v],l[b]],M={x:Math.max(...E.map(k=>k.x)),y:Math.max(...E.map(k=>k.y)),right:Math.min(...E.map(k=>k.x+k.width)),bottom:Math.min(...E.map(k=>k.y+k.height))};if(M.right-M.x<=Jc||M.bottom-M.y<=Jc)continue;const B=ry(e,[],M);if(!B.length)continue;const P=E.map(k=>k.id).sort();n.push({kind:"group-stack-unreadable",groups:P,shapes:B})}for(const h of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Zc.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[E,M,B,P,k]of b){const N=B==="h"?v.x:v.y,G=B==="h"?v.x+v.width:v.y+v.height;if(!(N<k&&P<G))continue;const q=B==="h"?v.y:v.x,Y=B==="h"?v.y+v.height:v.x+v.width;if(!(q<M&&M<Y))continue;const ae=Math.min(M-q,Y-M);ae<LC||n.push({kind:"group-cuts-shape",group:h.id,shape:v.id,side:E,depth:ae})}}const u=t.includeObservationOnly?e.shapes.filter(h=>h.type==="bpmn:Group"&&h.width>0&&h.height>0):[];if(u.length){const h=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 b=sn(v);if(b.length)for(const E of u){const M=E.x+E.width,B=E.y+E.height,P=v.endpoints.some(N=>{const G=h.get(N);return!!G&&E.x<G.x&&G.x<M&&E.y<G.y&&G.y<B});let k=null;for(const N of b){const[G,q,Y]=N.axis==="v"?[E.y,B,[["left",E.x],["right",M]]]:[E.x,M,[["top",E.y],["bottom",B]]],ae=Math.min(N.hi,q)-Math.max(N.lo,G);if(ae<pd)continue;const X=N.axis==="v"?E.x<N.at&&N.at<M:E.y<N.at&&N.at<B;if(!(X&&P))for(const[Me,Te]of Y){const Pe=Math.abs(N.at-Te);Pe<=xa&&(!k||Pe<k.distance)&&(k={side:Me,inside:X,distance:Pe,length:ae})}}k&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:k.side,inside:k.inside,distance:Math.round(k.distance),length:Math.round(k.length)})}}}const p=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const b=h.x<v.x+v.width&&v.x<h.x+h.width,E=h.y<v.y+v.height&&v.y<h.y+h.height,M=[["top",h.y,v.y,b],["bottom",h.y+h.height,v.y+v.height,b],["left",h.x,v.x,E],["right",h.x+h.width,v.x+v.width,E]];for(const[B,P,k,N]of M)N&&Math.abs(P-k)<=qm&&n.push({kind:"group-on-container-boundary",group:h.id,container:v.id,side:B})}const d=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<d.length;h++)for(let v=h+1;v<d.length;v++){const b=d[h],E=d[v],M=b.x<E.x+E.width&&E.x<b.x+b.width,B=b.y<E.y+E.height&&E.y<b.y+b.height,P=[["x",b.x+b.width,E.x,B],["x",E.x+E.width,b.x,B],["y",b.y+b.height,E.y,M],["y",E.y+E.height,b.y,M]];for(const[k,N,G,q]of P)if(q&&Math.abs(N-G)<=qm){n.push({kind:"group-on-group-boundary",groups:b.id<E.id?[b.id,E.id]:[E.id,b.id],axis:k});break}}for(let h=0;h<e.edges.length;h++)for(let v=h+1;v<e.edges.length;v++){const b=e.edges[h],E=e.edges[v],M=Nr(b,E);if(!M)continue;const B=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:M.kind==="opposite"?"edge-overlap-opposite":M.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:B,axis:M.axis,length:Math.round(M.length)})}for(const h of e.edges){if(!h.label)continue;const v=el(h,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:h.id,other:v.other,axis:v.axis})}for(const h of e.edges){if(!h.label)continue;const v=Qm(h,e);v&&n.push({kind:"label-over-line",edge:h.id,line:v})}if(t.includeObservationOnly){for(const h of e.edges)if(!(!h.label||h.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:b}of vs(h.label,e))n.push({kind:"label-over-shape",edge:h.id,shape:v,depth:Math.round(b)})}t.includeObservationOnly&&n.push(...qC(e));const f=new Set(i.map(h=>h.id)),m=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...i,...m.filter(v=>!f.has(v.id))]){if(!h.label)continue;const v=cy(h,e);v&&n.push({kind:"label-over-line",edge:h.id,line:v})}const g=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of m)for(const{owner:v,rect:b}of Yo(e))v===h.id||g.has(v)||gd(h.label,b,ba)&&n.push({kind:"pool-name-over-label",pool:h.id,label:v});const y=Yo(e);for(const h of i)if(h.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of y)v!==h.id&&gd(h,b,ba)&&n.push({kind:"annotation-over-label",annotation:h.id,label:v});const _=new Map(e.shapes.map(h=>[h.id,h]));for(const h of i){const v=h.parent??WC(h,e,_);if(!v)continue;const b=_.get(v);!b||!b.container||jC(b,h,FC)||h.type==="bpmn:TextAnnotation"&&!UC(h,b,e)||n.push({kind:"shape-outside-container",shape:h.id,container:b.id})}return n.sort((h,v)=>ct(h).localeCompare(ct(v)))}const Ut=e=>typeof e=="object"&&e!==null?e:void 0,tn=e=>typeof e=="number"?e:0,wo=e=>{const t=Ut(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function YC(e){const t=Ut(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=wo(r);a&&n.push(a)}}return n}function KC(e){const t=Ut(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:wo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:wo(t.targetRef);return n&&i?{source:n,target:i}:{}}function XC(e,t){const n=Ut(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=wo(n);return o?t.get(o):void 0}if(Xc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return wo(n)}function py(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ut(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ut(e))==null?void 0:s.rootElements)??[]){const d=Ut(p);if((d==null?void 0:d.$type)==="bpmn:Collaboration")for(const f of d.participants??[]){const m=Ut(f),g=wo(m),y=wo(m==null?void 0:m.processRef);g&&y?o.set(y,g):g&&r.add(g)}}for(const p of i){const d=Ut((c=Ut(p))==null?void 0:c.plane),f=(d==null?void 0:d.planeElement)??[];for(const m of f){const g=Ut(m);if(!g)continue;const y=Ut(g.bpmnElement),_=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!_)continue;const h=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",v=Ut(g.bounds);if(v){const E=g.isExpanded===!1&&h!=="bpmn:Participant",M=Ut((l=Ut(g.label))==null?void 0:l.bounds),B={id:_,type:h,x:tn(v.x),y:tn(v.y),width:tn(v.width),height:tn(v.height),container:Xc.has(h)&&!E,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:XC(y,o)}:{},...M?{label:{x:tn(M.x),y:tn(M.y),width:tn(M.width),height:tn(M.height)}}:{},...h==="bpmn:Group"?sy(ay(y)):{}},P=g.isHorizontal!==!1,k=typeof(y==null?void 0:y.name)=="string"?y.name:"";r.has(_)&&P&&k&&(B.label=dd(B,k)),t.push(B);continue}const b=g.waypoint;if(Array.isArray(b)){const E=Ut((u=Ut(g.label))==null?void 0:u.bounds);n.push({id:_,type:h,waypoints:b.map(M=>{var B,P;return{x:tn((B=Ut(M))==null?void 0:B.x),y:tn((P=Ut(M))==null?void 0:P.y)}}),endpoints:YC(y),...KC(y),...E?{label:{x:tn(E.x),y:tn(E.y),width:tn(E.width),height:tn(E.height)}}:{}})}}}return{shapes:t,edges:n}}function dy(e){return ft(py(e),{includeObservationOnly:!0})}async function ZC(e){const{definitions:t,warnings:n}=await va(e);return{findings:dy(t),warnings:n}}function Ge(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 g=Ut(r.label),y=wo(r.source),_=wo(r.target);n.push({id:r.id,type:a,waypoints:s.map(h=>({x:tn(h.x),y:tn(h.y)})),endpoints:[y,_].filter(h=>!!h),...y&&_?{source:y,target:_}:{},...g&&typeof g.x=="number"?{label:{x:g.x,y:tn(g.y),width:tn(g.width),height:tn(g.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ut(r.businessObject),l=Ut(r.label);let u=Ut(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Ut(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",d=u&&Xc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,f={id:r.id,type:a,x:r.x,y:r.y,width:tn(r.width),height:tn(r.height),container:Xc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...d!==void 0?{parent:d}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:tn(l.y),width:tn(l.width),height:tn(l.height)}}:{},...a==="bpmn:Group"?sy(ay(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=Ut(r.di))==null?void 0:i.isHorizontal)!==!1&&(f.label=dd(f,m)),t.push(f)}return{shapes:t,edges:n}}const JC={"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 QC(e,t){const n=JC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function fy(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function hy(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 QC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&fy(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?fy(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 Np(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Vo(i.businessObject).map(o=>o.locale)}}}const $r=20,eA=4,Ve=(e,t)=>Math.abs(e-t)<.5,tA=15;function vd(e,t,n){let i=1/0;for(const o of t)if(!n.includes(o.id))for(let r=1;r<e.length;r++)i=Math.min(i,bo(e[r-1],e[r],o));return i}function nA(e,t,n=tA){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=Ve(i.x,o.x)&&!Ve(i.y,o.y),a=Ve(i.y,o.y)&&!Ve(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=_=>{const h=_?t.find(v=>v.id===_):void 0;return h?r?[h.x+10,h.x+h.width-10]:[h.y+10,h.y+h.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),m=Math.min(u,d);if(!(m>=f))return[];const g=r?i.x:i.y,y=[];for(let _=5;_<=400;_+=5)for(const h of[-1,1]){const v=g+h*_;if(v<f||v>m)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Ot({...e,waypoints:b},t).length||vd(b,t,s)<n||y.push(b)}return y}function xd(e,t,n,i){const o=e.edges.filter(d=>d.id!==t.id),r={...t,waypoints:n},a={...t,waypoints:[...i]};if(Gn(r,o)>Gn(a,o)||Jn(r,o)>Jn(a,o))return!1;const s=`L|${t.id}|${t.id}`,c=d=>ft({...e,edges:e.edges.map(f=>f.id===t.id?{...f,waypoints:d}:f)}).filter(f=>ct(f)!==s),l=c(n),u=`"${t.id}"`;if(l.some(d=>JSON.stringify(d).includes(u)))return!1;const p=new Set(c([...i]).map(ct));return l.every(d=>p.has(ct(d)))}function gy(e,t,n,i){for(const o of nA(t,n))if(xd(e,t,o,i))return o;return null}const iA=120;function my(e,t,n,i,o){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return[];const r=t.find(c=>c.id===e.endpoints[0]),a=t.find(c=>c.id===e.endpoints[1]);if(!r||!a)return[];if(a.x<r.x+r.width)return[];if(Math.min(r.y+r.height,a.y+a.height)-Math.max(r.y,a.y)<10)return[];const s=[];for(const[c,l]of[[0,0],[0,-25],[0,25],[-25,0],[25,0]])for(let u=$r;u<=iA;u+=5)for(const p of["top","bottom"]){const d=p==="top"?r.y:r.y+r.height,f=p==="top"?a.y:a.y+a.height,m=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,g=r.x+r.width/2+c,y=a.x+a.width/2+l,_=[{x:g,y:d},{x:g,y:m},{x:y,y:m},{x:y,y:f}];if(!rl(_,i)||Ot({...e,waypoints:_},t).length||Ot({...e,endpoints:[],waypoints:_},[r,a]).length||vd(_,t,e.endpoints)<$r)continue;const h=Ad(_,n);(o===void 0?h<Cd:h>=Cd||h<o)||s.push(_)}return s}function yy(e,t,n,i,o){const r=e.shapes.filter(c=>c.type==="bpmn:Participant"||c.type==="bpmn:Lane"),a=vy(e,t,i,my(t,n,r,o));if(a)return a;const s=Math.max(Ad(i,r),$r);return vy(e,t,i,my(t,n,r,o,s))}function vy(e,t,n,i){const o=new Map;for(const c of i){const l=c[1].y<c[0].y?"top":"bottom";if(!o.has(l)&&(xd(e,t,c,n)&&o.set(l,c),o.size===2))break}const r=e.edges.filter(c=>c.id!==t.id);let a=null,s=1/0;for(const c of["top","bottom"]){const l=o.get(c);if(!l)continue;const u=Gn({...t,waypoints:l},r);u<s&&(a=l,s=u)}return a}function tl(e,t,n,i=$r){if(Ve(e.y,t.y)&&!Ve(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(Ve(e.x,t.x)&&!Ve(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 xy(e,t,n,i=$r){if(n.length<2)return null;if(Ve(e.y,t.y)&&!Ve(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(f=>f.x))-i,s=Math.max(...n.map(f=>f.x+f.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(f=>f.y))-i,p=Math.max(...n.map(f=>f.y+f.height))+i,d=f=>[{x:c,y:e.y},{x:c,y:f},{x:l,y:f},{x:l,y:e.y}];return[d(u),d(p)]}if(Ve(e.x,t.x)&&!Ve(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(f=>f.y))-i,s=Math.max(...n.map(f=>f.y+f.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(f=>f.x))-i,p=Math.max(...n.map(f=>f.x+f.width))+i,d=f=>[{x:e.x,y:c},{x:f,y:c},{x:f,y:l},{x:e.x,y:l}];return[d(u),d(p)]}return null}function by(e,t,n=$r){if(e.length!==4)return null;const[i,o,r,a]=e;if(Ve(i.y,o.y)&&Ve(o.x,r.x)&&Ve(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(Ve(i.x,o.x)&&Ve(o.y,r.y)&&Ve(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 nl(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 il=30,oA=[0,-25,25,-40,40];function rA(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(d=>d.id===e.endpoints[0]),i=t.find(d=>d.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+il:s-il,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return oA.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Ot({...e,endpoints:[],waypoints:d},[n]).length===0)}const bd=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Fr=(e,t,n)=>Ot({...e,waypoints:t},n).length,aA=25;function wy(e,t,n){const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return{x:t.x+a*i,y:t.y+a*o}}function sA(e,t,n,i){const r=(d,f,m)=>(f.x-d.x)*(m.y-d.y)-(f.y-d.y)*(m.x-d.x),a=r(n,i,e),s=r(n,i,t);if(Math.abs(a)<1e-6&&Math.abs(s)<1e-6){const d=wy(i,e,t),f=wy(d,n,i);return Math.hypot(d.x-f.x,d.y-f.y)<1e-6?d:null}const c=r(e,t,n),l=r(e,t,i);if(a*s>1e-6||c*l>1e-6)return null;const u=(e.x-t.x)*(n.y-i.y)-(e.y-t.y)*(n.x-i.x);if(Math.abs(u)<1e-6)return null;const p=((e.x-n.x)*(n.y-i.y)-(e.y-n.y)*(n.x-i.x))/u;return{x:e.x+p*(t.x-e.x),y:e.y+p*(t.y-e.y)}}function cA(e,t,n){let i=0;for(const o of n){if(o.id===t.id||o.waypoints.length<2||o.target!==void 0&&o.target===t.target)continue;const r=o.waypoints[o.waypoints.length-1],a=o.waypoints[o.waypoints.length-2];for(let s=0;s+1<e.length;s++){const c=sA(e[s],e[s+1],a,r);if(c&&Math.hypot(c.x-r.x,c.y-r.y)<=aA){i++;break}}}return i}function ol(e,t,n,i){let o=[...e.waypoints],r=Fr(e,o,t);if(r===0)return null;let a=!1;for(const p of nl(e,t))if(Fr(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(sn),c=p=>sn({...e,waypoints:p}).some(d=>Qc(d,s).length>0),l=rA(e,t).filter(p=>Fr(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(d=>d.x>=n.x&&d.x<=n.x+n.width&&d.y>=n.y&&d.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(f=>f.id===e.endpoints[0]),d=t.find(f=>f.id===e.endpoints[1]);if(p&&d&&Ve(p.y+p.height/2,d.y+d.height/2)){const f=[o[0],o[o.length-1]];if(Ve(f[0].y,f[1].y)&&!Ve(f[0].x,f[1].x)){const m=t.filter(h=>!e.endpoints.includes(h.id)&&Ot({...e,waypoints:f},[h]).length>0),g=m.length>=2?xy(f[0],f[1],m):null,_=(g?g.map(h=>[f[0],...h,f[1]]):m.length===1?(tl(f[0],f[1],m[0])??[]).map(h=>[f[0],...h,f[1]]):m.length===0?[f]:[]).filter(h=>Fr(e,h,t)===0&&h.length<=o.length).sort((h,v)=>Number(u(v))-Number(u(h)));if(_.length)return _.find(h=>!c(h))??_[0]}}}for(let p=0;p+1<o.length;p++){const d=o[p],f=o[p+1],m=t.filter(_=>!e.endpoints.includes(_.id)&&Ot({...e,waypoints:[d,f]},[_]).length>0);if(m.length<2)continue;const g=xy(d,f,m);if(!g)continue;const y=g.map(_=>bd(o,p,_)).filter(_=>Fr(e,_,t)===0).sort((_,h)=>Number(u(h))-Number(u(_)));if(y.length)return y.find(_=>!c(_))??y[0]}for(let p=0;p<eA&&r>0;p++){let d=!1;for(let f=0;f+1<o.length&&!d;f++){const m=o[f],g=o[f+1];for(const y of t){if(e.endpoints.includes(y.id)||Ot({...e,waypoints:[m,g]},[y]).length===0)continue;const _=tl(m,g,y),v=[...(by(o,y)??[]).map((E,M)=>({pts:E,k:M,cross:Fr(e,E,t),tip:cA(E,e,i??[])})).sort((E,M)=>E.cross-M.cross||E.tip-M.tip||E.k-M.k).map(E=>E.pts),..._?_.map(E=>bd(o,f,E)):[]];if(!v.length)continue;const b=[...v].sort((E,M)=>Number(u(M))-Number(u(E)));for(const E of b){const M=Fr(e,E,t);if(M<r){o=E,r=M,d=!0,a=!0;break}}if(d)break}}if(!d)break}return a&&r===0?o:null}function wd(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=Dn(r),s=new Set,c=ft(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(d=>d.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const d=i.get(u);if(!d)continue;const f=d.parent,m=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,g=Ot(p,a);if(!n&&g.length&&g.every(M=>M.type==="bpmn:TextAnnotation")){s.add(u);continue}let y=ol(p,a,m,r.edges);const _=gy(r,p,a,y??p.waypoints);_&&(y=_);const h=yy(r,p,a,y??p.waypoints,m);if(h&&Gn({...p,waypoints:h},r.edges.filter(M=>M.id!==u))===0&&(y=h),!y){g.some(M=>M.type==="bpmn:TextAnnotation")&&s.add(u);continue}const v=r.edges.filter(M=>M.id!==u),b=Jn(p,v);Jn({...p,waypoints:y},v)>b||o.updateWaypoints(d,y)}return s}function lA(e,t,n,i){var f,m;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=g=>{const y=Ge(r);return[...eo(y),..._i(y)].filter(([_,h])=>_===g||h===g).length},c=(g,y)=>g.kind==="label-over-line"||g.kind==="label-over-shape"||g.kind==="label-on-shared-segment"?g.edge===y:g.kind==="annotation-over-label"||g.kind==="pool-name-over-label"?g.label===y:!1,l=g=>new Set(ft(Ge(r)).filter(y=>!c(y,g)).map(ct)),u=(g,y)=>Math.abs(g-y)<=1,p=(g,y,_,h,v)=>{const b=Dn(Ge(r));for(let E=0;E+3<g.length;E++){const[M,B,P,k]=[g[E],g[E+1],g[E+2],g[E+3]],N=u(M.y,k.y)&&u(M.x,B.x)&&u(P.x,k.x)&&u(B.y,P.y)&&Math.abs(B.y-M.y)>=5,G=u(M.x,k.x)&&u(M.y,B.y)&&u(P.y,k.y)&&u(B.x,P.x)&&Math.abs(B.x-M.x)>=5;if(!N&&!G)continue;const q={waypoints:[M,k],endpoints:_};if(Ot(q,[y]).length&&!Ot(q,b).length)return E}return-1},d=(g,y)=>[...g.slice(0,y+1),...g.slice(y+3)].filter((_,h,v)=>h===0||h===v.length-1||!(u(v[h-1].x,_.x)&&u(v[h+1].x,_.x)||u(v[h-1].y,_.y)&&u(v[h+1].y,_.y)));for(const g of t){const y=r.get(g.id);if(!y)continue;const _=new Set([...y.incoming??[],...y.outgoing??[]].map(b=>b.id)),h={...g,type:y.type,container:!1,attached:!1},v=r.getAll().filter(b=>{var E;return(b.type==="bpmn:SequenceFlow"||b.type==="bpmn:MessageFlow")&&n.has(b.id)&&!i.has(b.id)&&!_.has(b.id)&&(((E=b.waypoints)==null?void 0:E.length)??0)>=4}).sort((b,E)=>b.id.localeCompare(E.id));for(const b of v){const E=[(f=b.source)==null?void 0:f.id,(m=b.target)==null?void 0:m.id].filter(M=>!!M);for(;;){const M=b.waypoints.map(X=>({x:X.x,y:X.y})),B=p(M,h,E,b.id,b.type);if(B<0)break;const P=b.label,k=P&&{x:P.x,y:P.y},N=l(b.id),G=s(b.id);if(a.updateWaypoints(b,d(M,B)),P&&k){const X={x:k.x+P.width/2,y:k.y+P.height/2},Me=(Pe,fe)=>{const z=fe.x-Pe.x,se=fe.y-Pe.y,V=z*z+se*se,Z=V===0?0:Math.max(0,Math.min(1,((X.x-Pe.x)*z+(X.y-Pe.y)*se)/V));return Math.hypot(X.x-(Pe.x+Z*z),X.y-(Pe.y+Z*se))};let Te=0;for(let Pe=1;Pe+1<M.length;Pe++)Me(M[Pe],M[Pe+1])<Me(M[Te],M[Te+1])&&(Te=Pe);(Te<B||Te>B+2)&&(P.x!==k.x||P.y!==k.y)&&a.moveElements([P],{x:k.x-P.x,y:k.y-P.y})}const q=l(b.id),Y=[...q].filter(X=>!N.has(X)).length,ae=[...N].filter(X=>!q.has(X)).length;if(Y<=ae&&s(b.id)<=G){o.add(b.id);continue}a.updateWaypoints(b,M),P&&k&&(P.x!==k.x||P.y!==k.y)&&a.moveElements([P],{x:k.x-P.x,y:k.y-P.y});break}}}return o}const uA=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 xs(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 rl=(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),_d=(e,t)=>ys(e,[t])>0;function _y(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=Dn(r);let s=r;const c=new Set(ft(r).map(ct));for(const[l,u]of eo(r))if(!t.has(`${l}|${u}`))for(const[p,d]of[[l,u],[u,l]]){if(n.has(p))continue;const f=s.edges.find(B=>B.id===p),m=s.edges.find(B=>B.id===d);if(!f||!m)continue;const g=i.get(p);if(!g)continue;const y=xs(g),_=uA(m),h=[...nl(f,a)??[]],v=ol(f,[...a,..._],y,r.edges);v&&h.push(v);for(let B=0;B+1<f.waypoints.length;B++)for(const P of _)for(const k of tl(f.waypoints[B],f.waypoints[B+1],P)??[])h.push(bd(f.waypoints,B,k));const b=s.edges.filter(B=>B.id!==p),E=B=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:B}:P)}),M=h.find(B=>{const P={...f,waypoints:B};return _d(P,m)||!rl(B,y)||b.some(k=>k.id!==d&&!_d(f,k)&&_d(P,k))?!1:ft(E(B)).every(k=>c.has(ct(k)))});if(M){o.updateWaypoints(g,M),s=E(M);break}}}const pA=["top","bottom","left","right"],Ey={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},bs=20,dA=20;function fA(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&&Ve(e.y,t.y)&&o.push("top"),n&&Ve(e.y,t.y+t.height)&&o.push("bottom"),i&&Ve(e.x,t.x)&&o.push("left"),i&&Ve(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const hA=(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 Sy(e,t,n,i){const o=Ey[t],r=Ey[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],m=r[p];if(Ve(e[d],n[d]))return f===-m&&f*(n[p]-e[p])>=bs?[e,n]:null;let g;if(f===-m){const _=e[p]+f*bs,h=n[p]-f*bs;if(f*(h-_)<0)return null;g=Math.round((e[p]+n[p])/2)}else g=f>0?Math.max(e[p],n[p])+il:Math.min(e[p],n[p])-il;const y=(_,h)=>a?{x:h,y:_}:{x:_,y:h};return[e,y(g,e[d]),y(g,n[d]),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>=bs&&u>=bs?[e,c,n]:null}function gA(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?fA(a,r):null;if(!s)return[];const c=[];for(const l of pA){const u=hA(t,l),p=o?Sy(u,l,a,s):Sy(a,s,u,l);p&&c.push(p)}return c}const Ry=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 mA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ft(r).map(ct));let c=r;for(const[l,u]of _i(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(k=>k.id===l),d=c.edges.find(k=>k.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!_i({edges:[p,d]}).length)continue;const f=p.endpoints.find(k=>d.endpoints.includes(k)),m=f?a.get(f):void 0;if(!m||m.container)continue;const g=i.get(l),y=i.get(u);if(!g||!y)continue;const _=k=>n.has(k.id)?[k.waypoints]:[k.waypoints,...gA(k,m,a)],h=k=>k.length-2,v=_(p).flatMap(k=>_(d).map(N=>({pa:k,pb:N}))).filter(({pa:k,pb:N})=>k!==p.waypoints||N!==d.waypoints).map(k=>({...k,cost:Ry(k.pa)+Ry(k.pb)+dA*(h(k.pa)+h(k.pb))})).sort((k,N)=>k.cost-N.cost),b=xs(g),E=xs(y),M=_i(c).length,B=new Set(eo(c).map(([k,N])=>`${k}|${N}`)),P=v.find(({pa:k,pb:N})=>{const G={...p,waypoints:k},q={...d,waypoints:N};if(_i({edges:[G,q]}).length||Nr(G,q)||!rl(k,b)||!rl(N,E))return!1;const Y={...c,edges:c.edges.map(ae=>ae.id===l?G:ae.id===u?q:ae)};return _i(Y).length>=M||eo(Y).some(([ae,X])=>!B.has(`${ae}|${X}`))?!1:ft(Y).every(ae=>s.has(ct(ae)))});P&&(P.pa!==p.waypoints&&o.updateWaypoints(g,P.pa),P.pb!==d.waypoints&&o.updateWaypoints(y,P.pb),c={...c,edges:c.edges.map(k=>k.id===l?{...p,waypoints:P.pa}:k.id===u?{...d,waypoints:P.pb}:k)})}}const yA=40,vA=20;function xA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=_i(u);return{keys:new Set(ft(u).map(ct)),crossings:eo(u).length,shared:p.length,mine:p.filter(([d,f])=>d===l||f===l).length}},a=(l,u)=>{const p=Ge(i),d=p.edges.find(f=>f.id===l);return d?new Set(Ot({...d,waypoints:u},Dn(p)).map(f=>f.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,d=s(u)?u:s(p)?p:void 0;if(!d)continue;const f=d===u?p:u;if(!f||f.type==="bpmn:Participant")continue;const m=f.x+f.width/2;if(m>=d.x+10&&m<=d.x+d.width-10)continue;const g=m>d.x+d.width,y=d.y>f.y,_=y?f.y+f.height:f.y,h=y?d.y:d.y+d.height,v=Math.round((_+h)/2),b=N=>d===u?[...N].reverse():N,E=(l.waypoints??[]).map(N=>({x:N.x,y:N.y})),M=r(l.id),B=a(l.id,E)??new Set,P=g?d.x+d.width:d.x,k=d.x+d.width/2;for(let N=Math.min(yA,d.width/4);g?P-N>k:P+N<k;N+=vA){const G=Math.round(g?P-N:P+N),q=b([{x:m,y:_},{x:m,y:v},{x:G,y:v},{x:G,y:h}]),Y=a(l.id,q);if(!Y||[...Y].some(X=>!B.has(X)))continue;o.updateWaypoints(l,q);const ae=r(l.id);if(ae.crossings<=M.crossings&&ae.shared<=M.shared&&ae.mine<=M.mine&&[...ae.keys].every(X=>M.keys.has(X)))break;o.updateWaypoints(l,E)}}}const bA=10;function My(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 Cy(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(ae=>ae.type==="bpmn:Participant"&&ae.container),i=t.shapes.find(ae=>ae.id===e.endpoints[0]),o=t.shapes.find(ae=>ae.id===e.endpoints[1]);if(!i||!o)return null;const r=My(i,n),a=My(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(ae=>ae.id!==r.id&&ae.id!==a.id&&ae.y>=c.y+c.height&&ae.y+ae.height<=l.y).sort((ae,X)=>ae.y-X.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,m=(d.y+d.height+l.y)/2,g=s?f:m,y=s?m:f,_=e.waypoints[0],h=e.waypoints[e.waypoints.length-1],v=Dn(t),b=t.edges.filter(ae=>ae.id!==e.id),E=Gn(e,b),M=Ot(e,v).length;if(E===0&&M===0||M===0&&e.waypoints.length===2)return null;const B=Math.min(...u.map(ae=>ae.x)),P=Math.max(...u.map(ae=>ae.x+ae.width)),k=(_.x+h.x)/2,N=ae=>ae.filter((X,Me)=>Me===0||!(Ve(X.x,ae[Me-1].x)&&Ve(X.y,ae[Me-1].y)));let G,q;for(let ae=B;ae<=P;ae+=bA){const X=N([_,{x:_.x,y:g},{x:ae,y:g},{x:ae,y},{x:h.x,y},h]),Me={...e,waypoints:X};if(Ot(Me,v).length>0)continue;const Te=Gn(Me,b),Pe=Math.abs(ae-k);(!G||Te<G.cross||Te===G.cross&&Pe<G.detour)&&(G={pts:X,cross:Te,detour:Pe}),vd(X,v,e.endpoints)>=$r&&(!q||Te<q.cross||Te===q.cross&&Pe<q.detour)&&(q={pts:X,cross:Te,detour:Pe})}q&&G&&q!==G&&xd(t,e,q.pts,G.pts)&&(G=q);const Y=G&&(M>0?G.cross<=E:G.cross<E)?G.pts:null;if(M>0){const ae=gy(t,e,v,Y??e.waypoints);if(ae)return ae}return Y}const wA=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function _A(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ge(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Dn(a);for(const p of t.edges){if(!wA.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const d=i.get(p.id);if(!(d!=null&&d.waypoints)||((l=d.source)==null?void 0:l.id)!==p.source||((u=d.target)==null?void 0:u.id)!==p.target)continue;const f=r.get(p.source),m=r.get(p.target),g=s.get(p.source),y=s.get(p.target);if(!f||!m||!g||!y||!Ve(f.width,g.width)||!Ve(f.height,g.height)||!Ve(m.width,y.width)||!Ve(m.height,y.height))continue;const _=g.x-f.x,h=g.y-f.y;if(Ve(_,0)&&Ve(h,0)||!Ve(y.x-m.x,_)||!Ve(y.y-m.y,h))continue;const v=p.waypoints.map(M=>({x:M.x+_,y:M.y+h})),b=d.waypoints.map(M=>({x:M.x,y:M.y}));b.length===v.length&&b.every((M,B)=>Ve(M.x,v[B].x)&&Ve(M.y,v[B].y))||b.length===2&&(Ve(b[0].x,b[1].x)||Ve(b[0].y,b[1].y))&&Ot({...p,waypoints:b},c).length===0||Ot({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function Ay(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ge(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Cy(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Ed=20,Ty=10,Hi=10,Sd=40,EA=6,SA=40,Py=50;function RA(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=EA})}function Rd(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(Ve(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function MA(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function Md(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Ty;o<=n-t;o+=Ty)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function CA(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,d=t.x+t.width/2,f=(X,Me)=>Me>X.x+Hi&&Me<X.x+X.width-Hi,m=(X,Me)=>X.width<=2*Sd?X.x+X.width/2:Math.min(Math.max(Me,X.x+Sd),X.x+X.width-Sd),g=Math.max(e.x,t.x)+Hi,y=Math.min(e.x+e.width,t.x+t.width)-Hi;if(g<=y){const X=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((g+y)/2);r.push([{x:X,y:l},{x:X,y:u}])}const _=s?m(t,p):d,h=a?m(e,d):p;if(!a&&!f(e,_)){const X=_<e.x?e.x:e.x+e.width;for(const Me of Md(e.y+e.height/2,e.y+Hi,e.y+e.height-Hi))r.push([{x:X,y:Me},{x:_,y:Me},{x:_,y:u}])}if(!s&&!f(t,h)){const X=h<t.x?t.x:t.x+t.width;for(const Me of Md(t.y+t.height/2,t.y+Hi,t.y+t.height-Hi))r.push([{x:h,y:l},{x:h,y:Me},{x:X,y:Me}])}const v=(X,Me)=>{if(Math.abs(Me-X)<2*Hi)return[];const Te=Math.min(X,Me)+Hi,Pe=Math.max(X,Me)-Hi;return Md(Math.round((X+Me)/2),Te,Pe)};if(!a&&n)for(const X of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:X},{x:_,y:X},{x:_,y:u}]);if(!s&&i)for(const X of v(u,c?i.y:i.y+i.height))r.push([{x:h,y:l},{x:h,y:X},{x:d,y:X},{x:d,y:u}]);const b=Math.min(h,_),E=Math.max(h,_),M=[];for(const[X,Me]of o.filter(Te=>Te.x<E&&Te.x+Te.width>b).map(Te=>[Te.y,Te.y+Te.height]).sort((Te,Pe)=>Te[0]-Pe[0])){const Te=M[M.length-1];Te&&X<=Te[1]?Te[1]=Math.max(Te[1],Me):M.push([X,Me])}const B=[];for(let X=1;X<M.length;X++)M[X][0]-M[X-1][1]>=SA&&B.push(Math.round((M[X-1][1]+M[X][0])/2));M.length&&B.push(M[0][0]-Py,M[M.length-1][1]+Py);const P=(X,Me)=>Me<X.y?X.y:Me>X.y+X.height?X.y+X.height:void 0,k=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(X=>!!X)),N=e.y+e.height/2,G=t.y+t.height/2,q=G>N?1:-1,Y=(X,Me,Te)=>o.some(Pe=>!k.has(Pe.id)&&Pe.x<X&&X<Pe.x+Pe.width&&Pe.y<Math.max(Me,Te)-1&&Pe.y+Pe.height>Math.min(Me,Te)+1),ae=[];for(const X of B){const Me=P(e,X),Te=P(t,X);Me===void 0||Te===void 0||(X-N)*q<0&&Y(h,Me,X)||(X-G)*q>0&&Y(_,Te,X)||ae.push({pts:[{x:h,y:Me},{x:h,y:X},{x:_,y:X},{x:_,y:Te}],len:Math.abs(X-Me)+(E-b)+Math.abs(Te-X)})}return{inPools:r,outside:ae.sort((X,Me)=>X.len-Me.len).map(X=>X.pts)}}function AA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(f=>[f.id,f.waypoints])),a=n.shapes.filter(f=>f.type==="bpmn:Participant"),s=f=>{let m=f;for(;m&&m.type!=="bpmn:Participant";)m=m.parent;return m==null?void 0:m.id},c=()=>{const f=Ge(i);return{keys:new Set(ft(f).map(ct)),crossings:eo(f).length,shared:_i(f).length}},l=(f,m)=>f.length===m.length&&f.every((g,y)=>Ve(g.x,m[y].x)&&Ve(g.y,m[y].y)),u=f=>{const m=f.source,g=f.target;if(!m||!g)return"skip";const y=Ge(i),_=new Map(y.shapes.map(z=>[z.id,z])),h=s(m),v=s(g),b=new Set([h,v].filter(z=>!!z)),E=y.shapes.filter(z=>z.type==="bpmn:Participant"),M=(f.waypoints??[]).map(z=>({x:z.x,y:z.y})),B=Rd(M,b,E);if(B<Ed)return"skip";if(t.has(f.id)){const z=r.get(f.id);if(z&&l(z,M)||B-(z?Rd(z,b,a):0)<Ed)return"skip"}const P=_.get(m.id),k=_.get(g.id),N=y.edges.find(z=>z.id===f.id);if(!P||!k||!N)return"skip";const G=Dn(y),q=new Set(Ot(N,G).map(z=>z.id)),Y=Yo(y).filter(z=>z.owner!==f.id&&z.owner!==P.id&&z.owner!==k.id),ae=[...y.shapes.filter(z=>!z.container&&z.id!==P.id&&z.id!==k.id),...Y.map(z=>z.rect)],X=z=>sn({...N,waypoints:z}).some(se=>RA(se,ae)),Me=CA(P,k,h?_.get(h):void 0,v?_.get(v):void 0,E),Te=z=>z.map((se,V)=>({pts:se,i:V,key:se.length*2+(X(se)?1:0)})).sort((se,V)=>se.key-V.key||se.i-V.i).map(se=>se.pts),Pe=[...Te(Me.inPools),...Te(Me.outside)],fe=c();for(const z of Pe){if(Rd(z,b,E)>=Ed)continue;const se={...N,waypoints:z};if(Ot(se,G).some(pe=>!q.has(pe.id))||sn(se).some(pe=>MA(pe,y.shapes)||Y.some(ve=>ji(ve.rect,pe))))continue;o.updateWaypoints(f,z);const Z=c();if(Z.crossings<=fe.crossings&&Z.shared<=fe.shared&&[...Z.keys].every(pe=>fe.keys.has(pe)))return"fixed";o.updateWaypoints(f,M)}return"stuck"},p=i.getAll().filter(f=>f.type==="bpmn:MessageFlow"),d=[];for(const f of p)u(f)==="stuck"&&d.push(f);for(const f of d)u(f)}const zi=[25,-25,40,-40],_a=35;function TA(e,t,n=[]){const i=e.x+e.width/2,o=t.x+t.width/2,r=[],a=n.filter(s=>!s.container&&s.id!==e.id&&s.id!==t.id&&s.label).map(s=>({...s.label,id:`${s.id}:label`,type:"label",container:!1,attached:!1}));for(const s of[!0,!1]){const c=s?e.y:e.y+e.height,l=s?t.y:t.y+t.height,u=s?Math.min(e.y,t.y)-_a:Math.max(e.y+e.height,t.y+t.height)+_a,p=kA(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,PA]];for(const[f,m]of d)for(const g of[0,...zi])if(!(Math.abs(g)>=e.width/2-5))for(const y of[0,...zi]){if(Math.abs(y)>=t.width/2-5)continue;const _=i+g,h=o+y,v=[{x:_,y:c},{x:_,y:f},{x:h,y:f},{x:h,y:l}];m&&Ot({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:m+Math.abs(y)+Math.abs(g)})}}return r}const PA=45,al=20;function kA(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(y=>y.container&&(y.type==="bpmn:Lane"||y.type==="bpmn:Participant")&&r>=y.x&&r<=y.x+y.width&&e.y>=y.y&&e.y+e.height<=y.y+y.height).sort((y,_)=>y.width*y.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(y=>!y.container&&y.id!==e.id&&y.id!==t.id),d=p.filter(y=>y.x<c&&y.x+y.width>s&&(n?y.y<l&&y.y+y.height>i:y.y+y.height>l&&y.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(y=>y.label?[y.label]:[])].filter(y=>y.x<c&&y.x+y.width>s);if(n){let y=Math.min(...d.map(h=>h.y));for(let h=!0;h;){h=!1;for(const v of f)v.y<y&&v.y<l&&v.y+v.height>y-al&&(y=v.y,h=!0)}const _=Math.max(u.y,...f.filter(h=>h.y+h.height<=y).map(h=>h.y+h.height));return y-_>=al?Math.round((y+_)/2):null}let m=Math.max(...d.map(y=>y.y+y.height));for(let y=!0;y;){y=!1;for(const _ of f)_.y+_.height>m&&_.y+_.height>l&&_.y<m+al&&(m=_.y+_.height,y=!0)}const g=Math.min(u.y+u.height,...f.filter(y=>y.y>=m).map(y=>y.y));return g-m>=al?Math.round((m+g)/2):null}function sl(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 TA(n,i,[...t.values()]);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-_a:n.y+n.height+_a,p=[];for(const h of[0,...zi]){if(Math.abs(h)>=i.width/2-5)continue;const v=r+h;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(h)});for(const b of[0,...zi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(h)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const h of[0,...zi]){if(Math.abs(h)>=n.width/2-5)continue;const v=a+h;p.push({pts:[{x:v,y:m},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(h)})}const g=60,y=s?i.y+i.height:i.y,_=s?i.y+i.height+_a:i.y-_a;for(const h of[0,...zi]){if(Math.abs(h)>=i.width/2-5)continue;const v=r+h;for(const b of[0,...zi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:m},{x:E,y:_},{x:v,y:_},{x:v,y}],cost:g+Math.abs(h)+Math.abs(b)})}}return p}const Cd=30;function ky(e,t){return Ad(e,t)<Cd}function Ad(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=Ve(o.y,r.y)&&!Ve(o.x,r.x),s=Ve(o.x,r.x)&&!Ve(o.y,r.y);if(!(!a&&!s))for(const c of t)if(a){const l=Math.min(o.x,r.x);if(Math.max(o.x,r.x)<=c.x||l>=c.x+c.width)continue;n=Math.min(n,Math.abs(o.y-c.y),Math.abs(o.y-(c.y+c.height)))}else{const l=Math.min(o.y,r.y);if(Math.max(o.y,r.y)<=c.y||l>=c.y+c.height)continue;n=Math.min(n,Math.abs(o.x-c.x),Math.abs(o.x-(c.x+c.width)))}}return n}const cl=40;function OA(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-cl,a=o.x+o.width+cl,s=o.y-cl,c=o.y+o.height+cl;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],d={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},f={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(d.x<a&&f.x>r&&d.y<c&&f.y>s){i++;break}}}return i}function Oy(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(M=>M.container),i=new Map(t.shapes.map(M=>[M.id,M])),o=Dn(t),r=t.edges.filter(M=>M.id!==e.id),a=Jn(e,r),s=Gn(e,r),c=M=>OA(M,t.shapes,e.endpoints)+(ky(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const B=M.x+M.width/2,P=M.y+M.height/2;return n.find(k=>k.type==="bpmn:Lane"&&B>=k.x&&B<=k.x+k.width&&P>=k.y&&P<=k.y+k.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,m=M=>{if(!f||!d)return!1;for(let B=1;B<M.length-2;B++){const P=M[B],k=M[B+1];if(Ve(P.y,k.y)&&!Ve(P.x,k.x)&&P.y>d.y&&P.y<d.y+d.height)return!0}return!1},g=m(e.waypoints),_=(M=>{if(!M)return;const B=M.x+M.width/2,P=M.y+M.height/2;return n.filter(k=>k.type==="bpmn:Participant"&&B>=k.x&&B<=k.x+k.width&&P>=k.y&&P<=k.y+k.height).sort((k,N)=>k.width*k.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),h=M=>{if(!_)return 0;let B=0;for(let P=1;P<M.length-1;P++){const k=M[P];(k.x<_.x||k.x>_.x+_.width||k.y<_.y||k.y>_.y+_.height)&&B++}return B},v=h(e.waypoints);if(!ky(e.waypoints,n)&&!(f&&!g)&&v===0)return null;const b=M=>M.reduce((B,P,k)=>k?B+Math.abs(P.x-M[k-1].x)+Math.abs(P.y-M[k-1].y):0,0);let E;for(const{pts:M,cost:B}of sl(e,i)){const P={...e,waypoints:M};if(Ot(P,o).length>0||By(M,e,t))continue;const k=Jn(P,r);if(k>a)continue;const N=h(M);if(N>v)continue;const G=N<v&&k===0;if(!G&&Gn(P,r)>s)continue;const q=c(M),Y=m(M);if(!G&&!(Y&&!g)&&q>=l)continue;const X=Y?0:1,Me=b(M);(!E||N<E.out||N===E.out&&(X<E.lane||X===E.lane&&(k<E.opp||k===E.opp&&(q<E.sc||q===E.sc&&(B<E.cost||B===E.cost&&Me<E.len)))))&&(E={pts:M,out:N,sc:q,lane:X,opp:k,cost:B,len:Me})}return(E==null?void 0:E.pts)??null}function DA(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 LA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(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=Ge(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=Dn(s),u=s.edges.filter(y=>y.id!==a),p=Ot(c,l).length,d=Jn(c,u),f=Gn(c,u),m=n.has(a)?new Set(ft(s).map(ct)):null;if(c.waypoints.length>4){const y=i.get(a),_=y?yy(s,c,l,c.waypoints,xs(y)):null;if(y&&_&&_.length<c.waypoints.length){o.updateWaypoints(y,_);continue}}const g=nl(c,s.shapes);g.length===2&&DA(c,s)&&g.reverse();for(const y of g){if(y.length>=c.waypoints.length)continue;const _={...c,waypoints:y};if(Ot(_,l).length>p||Jn(_,u)>d||Gn(_,u)>f)continue;if(m){const v=new Set(ft({...s,edges:s.edges.map(M=>M.id===a?_:M)}).map(ct)),b=[...v].filter(M=>!m.has(M)).length,E=[...m].filter(M=>!v.has(M)).length;if(b>E)continue}const h=i.get(a);h&&o.updateWaypoints(h,y);break}}}function Dy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ge(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=Oy(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Td(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=Ve(n[0].x,n[1].x)&&!Ve(n[0].y,n[1].y),s=Ve(n[n.length-1].x,n[n.length-2].x)&&!Ve(n[n.length-1].y,n[n.length-2].y);for(const c of zi){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}const Ly=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function IA(e,t,n){const i=e.waypoints;if(i.length<2||!Ly(e.type))return[];const o=i[0],r=i[1],a=Ve(o.y,r.y)&&!Ve(o.x,r.x),s=Ve(o.x,r.x)&&!Ve(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(m=>{if(!Ly(m.type)||m.type===e.type||m.waypoints.length<2)return!1;const g=m.waypoints[0],y=m.waypoints[1];return!Ve(g.x,o.x)||!Ve(g.y,o.y)?!1:a?Ve(g.y,y.y)&&Math.sign(y.x-g.x)===c:Ve(g.x,y.x)&&Math.sign(y.y-g.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(m,g)=>a?g>m.y+5&&g<m.y+m.height-5:g>m.x+5&&g<m.x+m.width-5,f=[];for(const m of zi){const g=(a?o.y:o.x)+m;if(!d(u,g)||i.length===2&&(!p||!d(p,g)))continue;const y=i.map(_=>({..._}));for(const _ of[y[0],y[1]])a?_.y=g:_.x=g;f.push({pts:y,cost:Math.abs(m)})}return f}function BA(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,d=a?n.x+n.width:n.x,f=r?n.y+n.height:n.y,m=a?i.x:i.x+i.width,g=r?i.y:i.y+i.height,y=[];for(const _ of[0,...zi])Math.abs(_)<i.width/2-5&&y.push({pts:[{x:d,y:l},{x:u+_,y:l},{x:u+_,y:g}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&y.push({pts:[{x:c,y:f},{x:c,y:p+_},{x:m,y:p+_}],cost:Math.abs(_)});return y}const NA=[[1/2,0],[1/3,25],[2/3,25]],Iy=20;function $A(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=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of NA){const d=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:d,y:o},{x:d,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+Iy<=i.x&&s(n.x+n.width,i.x),i.x+i.width+Iy<=n.x&&s(n.x,i.x+i.width),a}function Pd(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 d of[0,...zi]){const f=u+d;f<=o||f>=r||p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:Math.abs(d)})}return p}const kd=2,FA=3;function By(e,t,n){if(e.length<2)return!1;for(const i of n.shapes){if(!/Gateway$/.test(i.type)||t.endpoints.includes(i.id))continue;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,bo(e[a-1],e[a],i));if(o>kd)continue;const r=[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}].filter(a=>Dd(a,e)<=kd);if(r.length)for(const a of n.edges){if(a.id===t.id||!a.endpoints.includes(i.id)||a.waypoints.length<2)continue;if([a.waypoints[0],a.waypoints[a.waypoints.length-1]].some(c=>r.some(l=>Math.hypot(c.x-l.x,c.y-l.y)<=FA)&&Dd(c,e)<=kd))return!0}}return!1}function Ny(e,t,n={}){const i=new Map(t.shapes.map(m=>[m.id,m])),o=Dn(t),r=t.edges.filter(m=>m.id!==e.id),a=Jn(e,r);if(a===0)return null;const s=Gn(e,r);let c;const l=m=>m.reduce((g,y,_)=>_?g+Math.abs(y.x-m[_-1].x)+Math.abs(y.y-m[_-1].y):0,0),u=3,p=m=>{const g=m[0],y=m[m.length-1],_=Math.hypot(y.x-g.x,y.y-g.y);return _>=1&&l(m)/_>=u?1:0},d=p(e.waypoints),f=[...sl(e,i),...Pd(e,i),...Td(e,i),...IA(e,r,i),...n.sideEntry?$A(e,i):[]];for(const{pts:m,cost:g}of f){const y={...e,waypoints:m};if(Ot(y,o).length>0||By(m,e,t))continue;const _=Jn(y,r),h=Gn(y,r),v=a-_+(d-p(m));if(_>=a||h-s>v)continue;const b=l(m);(!c||_<c.opposite||_===c.opposite&&(h<c.cross||h===c.cross&&(g<c.cost||g===c.cost&&b<c.len)))&&(c={pts:m,opposite:_,cross:h,cost:g,len:b})}return(c==null?void 0:c.pts)??null}function $y(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Nr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function jA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Dn(t),o=t.edges.filter(d=>d.id!==e.id),r=$y(e,o);if(r===0)return null;const a=Jn(e,o),s=Gn(e,o),c=d=>d.reduce((f,m,g)=>g?f+Math.abs(m.x-d[g-1].x)+Math.abs(m.y-d[g-1].y):0,0),l=2;let u;const p=[...sl(e,n),...Pd(e,n),...BA(e,n),...Td(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Ot(m,i).length>0)continue;const g=$y(m,o);if(g>=r)continue;const y=Jn(m,o);if(y-g>a-r)continue;const _=Gn(m,o);if(_-s>(r-g)*l)continue;const h=c(d);(!u||g<u.fake||g===u.fake&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&h<u.length))))&&(u={pts:d,fake:g,unreadable:y,cross:_,cost:f,length:h})}return(u==null?void 0:u.pts)??null}function Fy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ft(Ge(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=Ge(i),l=c.edges.find(d=>d.id===s);if(!l)continue;const u=jA(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function jy(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 Hy(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Nr(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:jy(e,n)&&jy(t,n)}function zy(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Hy(e,o,n)&&i++;return i}function HA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Dn(t),o=t.edges.filter(d=>d.id!==e.id),r=zy(e,o,n);if(r===0)return null;const a=Jn(e,o),s=Gn(e,o),c=d=>d.reduce((f,m,g)=>g?f+Math.abs(m.x-d[g-1].x)+Math.abs(m.y-d[g-1].y):0,0),l=2;let u;const p=[...sl(e,n),...Pd(e,n),...Td(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Ot(m,i).length>0)continue;const g=zy(m,o,n);if(g>=r)continue;const y=Jn(m,o);if(y-g>a-r)continue;const _=Gn(m,o);if(_-s>(r-g)*l)continue;const h=c(d);(!u||g<u.chain||g===u.chain&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&h<u.length))))&&(u={pts:d,chain:g,unreadable:y,cross:_,cost:f,length:h})}return(u==null?void 0:u.pts)??null}function zA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ft(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(d=>r.edges.find(f=>f.id===d));if(!(!u||!p||!Hy(u,p,a)))for(const d of l.edges)n.has(d)||c.add(d)}for(const l of[...c].sort()){const u=Ge(i),p=u.edges.find(m=>m.id===l);if(!p)continue;const d=HA(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function Gy(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=Ge(o),c=ft(s).filter(d=>fd(d)&&!t.has(ct(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(fd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(m=>m.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const m=u(d)==="bpmn:SequenceFlow"?0:1,g=u(f)==="bpmn:SequenceFlow"?0:1;return m!==g?m-g:d.localeCompare(f)});for(const d of p){const f=Ge(o),m=f.edges.find(_=>_.id===d);if(!m)continue;const g=Ny(m,f,{sideEntry:i.has(d)});if(!g)continue;const y=o.get(d);y&&(r.updateWaypoints(y,g),a.add(d))}return a}const GA=10,VA=(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 Vy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!el(e,i))return null;const o=Dn(t),r=i.flatMap(sn);for(const a of sn(e)){let s=[[a.lo,a.hi]];for(const[f,m]of Qc(a,r))s=s.flatMap(([g,y])=>{const _=[];return f>g&&_.push([g,Math.min(y,f)]),m<y&&_.push([Math.max(g,m),y]),_.filter(([h,v])=>v>h)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,m])=>m-f>=c+GA*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Zm}:{x:a.at+Ln+n.width/2,y:u},d={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!el({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&VA(d,f)))return d}return null}const Ln=8;function Od(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=d=>{const f=d.axis==="h"?o:r,m=d.axis==="h"?r-d.at:o-d.at,g=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(m,g)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(sn),...t.shapes.filter(d=>d.container).flatMap(wa)],l=d=>!c.some(f=>ji(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Ln,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+Ln,s.at-Ln-n.width])for(const f of p){const m=n.y+f;if(m<s.lo||m+n.height>s.hi)continue;const g={...n,x:d,y:m};if(l(g))return g}else for(const d of[s.at-Ln-n.height,s.at+Ln])for(const f of p){const m=n.x+f;if(m<s.lo||m+n.width>s.hi)continue;const g={...n,x:m,y:d};if(l(g))return g}return null}const Wy=30,Dd=(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},Uy=(e,t)=>Dd({x:e.x+e.width/2,y:e.y+e.height/2},t);function WA(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(sn),...t.shapes.filter(c=>c.container).flatMap(wa)],r=Yo(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=>ji(c,l))&&!vs(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+Ln,c.at-Ln-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Ln,c.at-Ln-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 qy(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=Ge(i),a=new Set(ft(r).map(ct));for(const[l,u]of t){const p=u.wps,d=i.get(l),f=d==null?void 0:d.label;if(!f||!(d!=null&&d.waypoints))continue;const m=d.waypoints[0].x-p[0].x,g=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((B,P)=>B.x-p[P].x===m&&B.y-p[P].y===g))){if(((s=d.source)==null?void 0:s.id)===u.source&&((c=d.target)==null?void 0:c.id)===u.target)continue;const B=r.edges.find(q=>q.id===l);if(!(B!=null&&B.label)||!vs(B.label,r).length&&!n.has(l))continue;let P={...B.label,x:u.label.x,y:u.label.y};if((vs(P,r).length||Uy(P,B.waypoints)>Wy)&&(P=null),!P&&Uy(B.label,B.waypoints)>Wy&&(P=WA(B,r)),!P)continue;const k=P;if(k.x===f.x&&k.y===f.y)continue;const N={...r,edges:r.edges.map(q=>q.id===l?{...q,label:k}:q)},G=ft(N);if(G.some(q=>!a.has(ct(q))))continue;o.moveElements([f],{x:k.x-f.x,y:k.y-f.y}),r=N,a=new Set(G.map(ct));continue}const _=u.label.x+m-f.x,h=u.label.y+g-f.y;if(_===0&&h===0)continue;const v=r.edges.find(B=>B.id===l);if(!(v!=null&&v.label))continue;const b={...v.label,x:v.label.x+_,y:v.label.y+h},E={...r,edges:r.edges.map(B=>B.id===l?{...B,label:b}:B)},M=ft(E);M.some(B=>!a.has(ct(B)))||(o.moveElements([f],{x:_,y:h}),r=E,a=new Set(M.map(ct)))}}function Yy(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Od(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 Ky(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=ft(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(d=>d.id===s.edge);if(!c)continue;const l=Vy(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 Xy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(sn),...t.shapes.filter(d=>d.container).flatMap(wa)],o=i.filter(d=>ji(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=Yo(t).filter(d=>d.owner!==e.id).map(d=>d.rect),s=(d,f)=>d.x<f.x+f.width&&f.x<d.x+d.width&&d.y<f.y+f.height&&f.y<d.y+d.height,c=d=>!i.some(f=>ji(d,f))&&!r.some(f=>s(d,f))&&!a.some(f=>s(d,f)),l=[];for(const d of o)d.axis==="h"?l.push({...n,y:d.at-Ln-n.height},{...n,y:d.at+Ln}):l.push({...n,x:d.at-Ln-n.width},{...n,x:d.at+Ln});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+Ln},{...n,x:u-n.width/2,y:e.y-Ln-n.height},{...n,x:e.x+e.width+Ln,y:p-n.height/2},{...n,x:e.x-Ln-n.width,y:p-n.height/2}),l.find(c)??null}function Zy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=Xy(r,Ge(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 UA(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 Jy(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(ft(o).map(ct));const a=[...new Set(ft(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(g=>g.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(g=>({...g})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[g,y]of u){const _=g?o.shapes.find(v=>v.id===g):void 0;if(!_)continue;const h=UA(_,l[y]);h.x===l[y].x&&h.y===l[y].y||(l[y]=h,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(g=>g.id===s?{...g,waypoints:l}:g)},f=ft(d);if(f.some(g=>!r.has(ct(g))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),o=d,r=new Set(f.map(ct)))}}const Ld=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Qy(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 qA(e,t,n){const i=[],o=n?ps(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 Qy(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(!Ld(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,m]of Object.entries(u))typeof m!="string"||m===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${f}`}),p=!1):o.includes(f)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:f,locales:o}),p=!1);if(!p)continue;const d=o.filter(f=>!(f in u));d.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:d})}}),i}function Ei(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function YA(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(Ld(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=Qy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=Ei(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,m)=>Ei(f,"name",a(p[m])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=Ei(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,m)=>Ei(f,"name",a(p[m])))),s.push(d);break}case"node.add":s.push({...c,node:Ei(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:Ei(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:Ei(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:Ei(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:Ei(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:Ei(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(Ei(c,"text",a(l[0])));break;default:s.push(Ld(l[0].map)?Ei(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const KA=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,ev=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),tv={"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}]},ws=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ll=e=>typeof e=="string"&&e!=="";function XA(e){const t=[];function n(i,o,r,a){if(a===null){ll(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!ws(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)ll(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!ws(i)||!ll(i.kind)||!(i.kind in tv)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of tv[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const m of p.slice(0,-1)){if(!ws(d))break;d=d[m]}if(!ws(d))continue;const f=d[p[p.length-1]];if(!(f===void 0&&c.optional)&&!(f===null&&c.optional)){if(!l){n(o,c.path,f,c.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}f.forEach((m,g)=>n(o,`${u}[${g}]`,m,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;ws(c)&&!ll(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"&&!pm(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&&!dm(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 nv(e,t,n={}){const i=XA(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(g,y,_){if(!KA.test(y)){o.push({kind:"id-invalid",opIndex:g,id:y});return}if(t.categoryOf(y)!==void 0||r.has(y)){o.push({kind:"id-duplicate",opIndex:g,id:y});return}r.set(y,{..._,opIndex:g})}e.forEach((g,y)=>{var _;switch(g.kind){case"participant.add":s(y,g.participant.id,{category:"participant",lanes:(g.participant.lanes??[]).map(h=>h.id)});for(const h of g.participant.lanes??[])s(y,h.id,{category:"lane"});break;case"node.add":s(y,g.node.id,{category:"flowNode",participant:g.node.participant});break;case"sequenceFlow.add":s(y,g.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,g.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,g.dataStore.id,{category:"dataStore"});for(const h of g.associations??[])h.id&&s(y,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":g.association.id&&s(y,g.association.id,{category:"dataAssociation"});break;case"association.add":g.association.id&&s(y,g.association.id,{category:"association"});break;case"annotation.add":s(y,g.annotation.id,{category:"annotation"}),(_=g.association)!=null&&_.id&&s(y,g.association.id,{category:"association"});break;case"group.add":s(y,g.group.id,{category:"group"});break;case"participant.update":if(g.lanes){a.set(g.id,g.lanes.map(h=>h.id));for(const h of g.lanes)t.categoryOf(h.id)===void 0&&s(y,h.id,{category:"lane"})}break}});const c=g=>{var y;return((y=r.get(g))==null?void 0:y.category)??t.categoryOf(g)},l=g=>{const y=r.get(g);return y?y.category==="participant"?g:y.participant:t.categoryOf(g)==="participant"?g:t.participantOf(g)};function u(g,y,_,h){const v=c(y);if(v===void 0){o.push({kind:"ref-missing",opIndex:g,ref:y,role:_});return}if(h&&!h.includes(v)){o.push({kind:"ref-category",opIndex:g,ref:y,role:_,expected:h.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(g=>g.kind==="participant.add"),d=new Map;for(const g of e)g.kind==="node.add"?d.set(g.node.id,g.node.eventDefinition):g.kind==="node.update"&&g.type!==void 0&&d.set(g.id,g.eventDefinition);const f=g=>d.has(g)?d.get(g)==="timer":t.eventDefinitionOf(g)==="timer";return e.forEach((g,y)=>{var _,h;switch(g.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=g.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:y,id:g.node.id});break}if(u(y,v,"participant",["participant"])===void 0)break;b!==void 0&&((((_=r.get(v))==null?void 0:_.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:y,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:E,name:M,condition:B}=g.flow,P=u(y,b,"source",["flowNode"]),k=u(y,E,"target",["flowNode"]);P&&k&&l(b)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:y,id:v}),M!==void 0&&B!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:E}=g.flow,M=u(y,b,"source",["flowNode","participant"]),B=u(y,E,"target",["flowNode","participant"]);if(M&&B){const P=l(b),k=l(E);P!==void 0&&P===k&&o.push({kind:"message-flow-same-pool",opIndex:y,id:v})}for(const P of[b,E])f(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:y,id:v,ref:P});break}case"dataStore.add":{for(const v of g.associations??[]){if([v.source,v.target].filter(M=>M===g.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:y,source:v.source,target:v.target});continue}const E=v.source===g.dataStore.id?v.target:v.source;u(y,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=g.association,E=u(y,v,"source"),M=u(y,b,"target");if(E&&M){const B=new Set([E,M]);B.has("dataStore")&&B.has("flowNode")||o.push({kind:"data-association-ends",opIndex:y,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:E}=g.association,M=u(y,b,"source"),B=u(y,E,"target");M&&B&&M!=="annotation"&&B!=="annotation"&&o.push({kind:"association-detached",opIndex:y,annotation:v??`${b}->${E}`});break}case"annotation.add":{if(g.association){const{source:v,target:b}=g.association;if(v!==g.annotation.id&&b!==g.annotation.id)o.push({kind:"association-detached",opIndex:y,annotation:g.annotation.id});else{const E=v===g.annotation.id?b:v;u(y,E,"association")}}g.placement&&u(y,g.placement.anchor,"anchor");break}case"group.add":{for(const v of g.group.members??[]){const b=u(y,v,"member");b&&ev.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(m(y,g.id,"participant")===void 0)break;if(g.lanes){const v=t.lanesOf(g.id),b=g.lanes.map(P=>P.id);for(const P of v)b.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:y,participant:g.id,lane:P});for(const P of b)t.categoryOf(P)!==void 0&&!v.includes(P)&&o.push({kind:"id-duplicate",opIndex:y,id:P});const E=b.filter(P=>v.includes(P)),M=P=>E.every((k,N)=>k===P[N]),B=(((h=t.laneDeclarationOrderOf)==null?void 0:h.call(t,g.id))??v).filter(P=>v.includes(P));E.length===v.length&&!M(v)&&!M(B)&&o.push({kind:"lane-reorder-unsupported",opIndex:y,participant:g.id})}break}case"node.update":{if(m(y,g.id,"flowNode")===void 0)break;if(g.lane!==void 0){const v=t.participantOf(g.id);(v?a.get(v)??t.lanesOf(v):[]).includes(g.lane)||o.push({kind:"lane-unknown",opIndex:y,lane:g.lane,participant:v??""})}break}case"sequenceFlow.update":{if(m(y,g.id,"sequenceFlow")===void 0)break;if(g.name!==void 0&&g.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:g.id}),g.source!==void 0||g.target!==void 0){const v=g.source===void 0||u(y,g.source,"source",["flowNode"])!==void 0,b=g.target===void 0||u(y,g.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(g.id),M=g.source??(E==null?void 0:E.source),B=g.target??(E==null?void 0:E.target);v&&b&&M!==void 0&&B!==void 0&&new Set([l(M),l(B),l(g.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:y,id:g.id})}break}case"messageFlow.update":m(y,g.id,"messageFlow");break;case"dataStore.update":m(y,g.id,"dataStore");break;case"annotation.update":{if(m(y,g.id,"annotation")===void 0)break;g.placement&&u(y,g.placement.anchor,"anchor");break}case"group.update":{if(m(y,g.id,"group")===void 0)break;for(const v of g.members??[]){const b=u(y,v,"member");b&&ev.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":m(y,g.id);break;case"element.remove":{m(y,g.id)==="lane"&&o.push({kind:"ref-category",opIndex:y,ref:g.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...qA(e,t,n.i18n)),o;function m(g,y,_){if(r.has(y)){o.push({kind:"target-added-in-batch",opIndex:g,id:y});return}const h=t.categoryOf(y);if(h===void 0){o.push({kind:"ref-missing",opIndex:g,ref:y,role:"target"});return}if(_&&h!==_){o.push({kind:"ref-category",opIndex:g,ref:y,role:"target",expected:_,actual:h});return}return h}}const Id=12,iv=14,ZA=15,JA=100,QA=300,eT=30,tT=/[㐀-鿿]/,nT=1.1;function ov(e){let t=0;for(const n of e)tT.test(n)?t+=Id:RC(n)?t+=Br(n,Id):t+=Br(n,Id)*nT;return t}const rv="­";function iT(e,t){const n=e.split(/(\s|-|­)/g),i=[];let o=0,r;if(n.length>1)for(;r=n.shift();)if(r.length+o<t)i.push(r),o+=r.length;else{(r==="-"||r===rv)&&i.pop();break}return i[i.length-1]===rv&&(i[i.length-1]="-"),i.join("")}function oT(e,t,n){const i=Math.max(e.length*(n/t),1);return iT(e,i)||e.slice(0,Math.max(Math.round(i-1),1))}const av=(e,t)=>e?t(e.replace(/\s+$/,"")):0;function rT(e,t,n=ov){const i=e.split(/­?\r?\n/),o=[];for(;i.length;){const r=i.shift();let a=r;for(;;){const s=av(a,n);if(a===" "||a===""||s<Math.round(t)||a.length<2)break;a=oT(a,s,t)}a.length<r.length&&i.unshift(r.slice(a.length).trim()),o.push(a)}return o}function sv(e){const t=e.length?e:[""],n=Math.max(0,...t.flatMap(r=>r.split(/­?\r?\n/).map(a=>av(a,ov)))),i=Math.max(JA,Math.min(QA,Math.floor(n)+1+iv)),o=Math.max(...t.map(r=>rT(r,i-iv).length));return{width:i,height:Math.max(eT,o*ZA+10)}}const cv="bwlExactAnnotationBounds",aT=500;class lv{constructor(t){t.on("commandStack.shape.resize.preExecute",aT,({context:n})=>{var o,r;const i=(o=n==null?void 0:n.hints)==null?void 0:o[cv];!i||((r=n.shape)==null?void 0:r.type)!=="bpmn:TextAnnotation"||(n.newBounds={x:i.x,y:i.y,width:i.width,height:i.height})})}}an(lv,"$inject",["eventBus"]);const uv={__init__:["annotationExactResize"],annotationExactResize:["type",lv]};function pv(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 ul(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const pl={"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]},In=10,sT=300,cT=160,dv=20,Bd=100,fv=40,lT=10,uT=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function hv(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 dl=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function fl(e,t,n,i,o){const r=n,a=hv(e,t,i),s=a??i,c=(Y,ae,X=s)=>{const[Me,Te]=pl[Y];let Pe={x:t.x+t.width/2+Me*(t.width/2+r.width/2+ae),y:t.y+t.height/2+Te*(t.height/2+r.height/2+ae)};const fe=X.x+In+r.width/2,z=X.x+X.width-In-r.width/2,se=X.y+In+r.height/2,V=X.y+X.height-In-r.height/2,Z={x:Math.min(z,Math.max(fe,Pe.x)),y:Math.min(V,Math.max(se,Pe.y))};return(Z.x!==Pe.x||Z.y!==Pe.y)&&(Pe=Math.abs(Z.x-(t.x+t.width/2))<(t.width+r.width)/2+In&&Math.abs(Z.y-(t.y+t.height/2))<(t.height+r.height)/2+In?{x:t.x+t.width+In+r.width/2,y:Z.y}:Z),Pe},l=(i.children??[]).filter(Y=>!("waypoints"in Y&&Y.waypoints)&&Y.type!=="bpmn:Lane"&&Y.type!=="label"&&typeof Y.x=="number"&&Y.id!==o.selfId),u=Ge(e),p=Y=>{var X,Me;if(!o.selfId)return!1;const ae=e.get(Y);return!!ae&&(((X=ae.source)==null?void 0:X.id)===o.selfId||((Me=ae.target)==null?void 0:Me.id)===o.selfId)},d=u.edges.filter(Y=>!p(Y.id)).flatMap(sn),f=Yo(u).filter(Y=>Y.owner!==o.selfId).map(Y=>Y.rect),m=Y=>({x0:Y.x-r.width/2-In,x1:Y.x+r.width/2+In,y0:Y.y-r.height/2-In,y1:Y.y+r.height/2+In}),g=Y=>{const ae=m(Y);return l.some(X=>ae.x0<X.x+X.width&&ae.x1>X.x&&ae.y0<X.y+X.height&&ae.y1>X.y)},y=Y=>{const ae=m(Y);return d.some(X=>X.axis==="h"?X.at>ae.y0&&X.at<ae.y1&&X.lo<ae.x1&&X.hi>ae.x0:X.at>ae.x0&&X.at<ae.x1&&X.lo<ae.y1&&X.hi>ae.y0)},_=Y=>{const ae=m(Y);return f.some(X=>ae.x0<X.x+X.width&&ae.x1>X.x&&ae.y0<X.y+X.height&&ae.y1>X.y)},h=u.shapes.filter(Y=>Y.type==="bpmn:Group").flatMap(Y=>[{axis:"h",at:Y.y,lo:Y.x,hi:Y.x+Y.width},{axis:"h",at:Y.y+Y.height,lo:Y.x,hi:Y.x+Y.width},{axis:"v",at:Y.x,lo:Y.y,hi:Y.y+Y.height},{axis:"v",at:Y.x+Y.width,lo:Y.y,hi:Y.y+Y.height}]),v=Y=>{const ae=m(Y);return h.some(X=>X.axis==="h"?X.at>ae.y0&&X.at<ae.y1&&X.lo<ae.x1&&X.hi>ae.x0:X.at>ae.x0&&X.at<ae.x1&&X.lo<ae.y1&&X.hi>ae.y0)},b=Y=>g(Y)||y(Y)||_(Y)||v(Y),E=Y=>Y.x-r.width/2>=i.x&&Y.x+r.width/2<=i.x+i.width&&Y.y-r.height/2>=i.y&&Y.y+r.height/2<=i.y+i.height,M=Y=>E(Y)&&(!a||dl(Y,r,a));if(o.placement){const Y=fe=>fe.startsWith("top")?fe.replace(/^top/,"bottom"):fe.replace(/^bottom/,"top"),ae=fe=>fe.endsWith("left")?fe.replace(/left$/,"right"):fe.replace(/right$/,"left"),X=o.placement.side,Me=[X,Y(X),ae(X),Y(ae(X)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Te=o.placement.offset??50;let Pe=c(X,Te);if(b(Pe)||a&&!dl(Pe,r,a)){const fe=(z,se)=>{const V=new Set;for(const Z of Me){if(V.has(Z))continue;V.add(Z);const pe=c(Z,Te,z);if(se(pe)&&!b(pe))return Pe=pe,!0}return!1};!fe(s,M)&&a&&fe(i,E)}return Pe}const B=o.from,P=s.x+In+r.width/2,k=s.x+s.width-In-r.width/2,N=s.y+In+r.height/2,G=s.y+s.height-In-r.height/2;let q={x:Math.min(k,Math.max(P,B.x)),y:Math.min(G,Math.max(N,B.y))};if(b(q)){const Y=(t.width+r.width)/2+In,X=[{x:q.x+Y,y:q.y},{x:q.x-Y,y:q.y},{x:q.x,y:q.y-r.height-In},{x:q.x,y:q.y+r.height+In}].filter(M).find(Me=>!b(Me));X&&(q=X)}return q}function Gt(e,t){return e.filter(n=>n.kind===t)}function gv(e,t){const n=new Map,i=new Set(Gt(e,"node.add").map(s=>s.node.id)),o=Gt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&Gt(e,"sequenceFlow.add").find(d=>d.flow.source===l&&d.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(d=>d!==u&&JSON.stringify(d).includes(p))||(a.add(c),n.set(s.id,u))}return n}function pT(e,t,n){const i=new Map,o=new Set;for(const h of e){const v=i.get(h.source)??[];v.push(h.target),i.set(h.source,v),o.add(h.target)}const r=[...e.map(h=>h.source).filter(h=>!o.has(h)),...t,...e.map(h=>h.source)],a=new Map,s=new Set,c=h=>{a.set(h,"open");for(const v of i.get(h)??[]){const b=a.get(v);b==="open"?s.add(`${h}>${v}`):b||c(v)}a.set(h,"done")};for(const h of r)a.has(h)||c(h);const l=(h,v)=>!s.has(`${h}>${v}`),u=[],p=new Set,d=h=>{p.add(h);for(const v of i.get(h)??[])l(h,v)&&!p.has(v)&&d(v);u.push(h)};for(const h of r)p.has(h)||d(h);const f=new Map;for(const h of u.reverse()){const v=f.get(h)??0;f.set(h,v);for(const b of i.get(h)??[])l(h,b)&&(f.get(b)??-1)<v+1&&f.set(b,v+1)}const m=new Map;for(const h of e){if(!l(h.source,h.target)||!n(h.target))continue;const v=m.get(h.target)??[];v.includes(h.source)||v.push(h.source),m.set(h.target,v)}const g=new Map,y=(h,v)=>{let b=g.get(h);if(!b){b=new Set([h]);const E=[h];for(;E.length;){const M=E.pop();for(const B of i.get(M)??[])l(M,B)&&!b.has(B)&&(b.add(B),E.push(B))}g.set(h,b)}return b.has(v)},_=new Set;for(const h of e){const v=m.get(h.target);if(!v||v.length<2||!v.includes(h.source))continue;const b=f.get(h.source)??0;v.some(E=>E!==h.source&&(f.get(E)??0)>=b+2&&y(h.source,E))&&_.add(h.id)}return _}class mv extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const yv=new WeakMap;function dT(e){return yv.get(e)??new Set}const vv=new WeakMap;function fT(e,t){vv.set(e,t)}const xv=new WeakMap;function hT(e){return xv.get(e)??[]}function bv(e,t){var ZS,JS,QS,eR,tR,nR,iR,oR,rR,aR,sR,cR,lR,uR,pR,dR,fR,hR,gR,mR,yR,vR,xR,bR,wR,_R,ER,SR,RR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;yv.set(t,u);const p=[];xv.set(t,p);const d=()=>a.getRootElement(),f=x=>r.get(x),m=x=>{const w=f(x);if(!w)throw new Error(`하강 참조 해소 실패: ${x}`);return w},g=x=>{let w=x.parent;for(;w;){if(w.type==="bpmn:Participant")return w;w=w.parent}},y=(x,w)=>{if(!x)return;const S=w.x+w.width/2,O=w.y+w.height/2;let I;const T=$=>{for(const L of $.children??[])if(L.type==="bpmn:Lane"){const D=L;S>=D.x&&S<=D.x+D.width&&O>=D.y&&O<=D.y+D.height&&(I=D,T(D))}};return T(x),I},_=new Map;for(const x of r.filter(w=>!("waypoints"in w&&w.waypoints)&&w.type!=="bpmn:Lane"&&w.type!=="label"&&typeof w.x=="number"))_.set(x.id,{x:x.x,y:x.y});const h=Gt(e,"participant.add"),v=Gt(e,"node.add"),b=Gt(e,"sequenceFlow.add"),E=Gt(e,"messageFlow.add"),M=Gt(e,"dataStore.add"),B=Gt(e,"dataAssociation.add"),P=Gt(e,"annotation.add"),k=Gt(e,"group.add"),N=new Map(v.map(x=>[x.node.id,x])),G=gv(e,x=>{var w,S;return(S=(w=f(x))==null?void 0:w.source)==null?void 0:S.id}),q=new Set([...G.values()].map(x=>x.flow.id)),Y=b.filter(x=>!q.has(x.flow.id)),ae=new Set([...G.values()].map(x=>x.flow.target)),X=x=>Gt(e,"sequenceFlow.update").filter(w=>w.target===x).length+(ae.has(x)?1:0),Me=(x,w,S)=>{var L;const O=x.businessObject,I=(((L=O.extensionElements)==null?void 0:L.values)??[]).filter(D=>D.$type!==w),T=S?[...I,i.create(w,S)]:I;if(!T.length){O.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const $=i.create("bpmn:ExtensionElements",{values:T});T.forEach(D=>{D.$parent=$}),n.updateProperties(x,{extensionElements:$})},Te=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Gt(e,"element.remove")){const w=f(x.id);if(!w)continue;const S="waypoints"in w?[]:[...w.incoming??[],...w.outgoing??[]];n.removeElements([...S,w])}const Pe=x=>r.filter(w=>{var S;return w.type==="bpmn:Lane"&&((S=g(w))==null?void 0:S.id)===x}).sort((w,S)=>w.y-S.y),fe=[];for(const x of Gt(e,"participant.update")){const w=m(x.id);if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),!x.lanes)continue;const S=Pe(x.id);if(!S.length){n.splitLane(w,x.lanes.length),Pe(x.id).forEach((T,$)=>{const L=x.lanes[$];L&&n.updateProperties(T,{id:L.id,name:L.name})}),fe.push({pool:x.id,lanes:new Set(x.lanes.map(T=>T.id))});continue}const O=new Set(S.map(T=>T.id)),I=x.lanes.reduce((T,$,L)=>O.has($.id)?L:T,-1);x.lanes.forEach((T,$)=>{if(O.has(T.id)){n.updateProperties(m(T.id),{name:T.name});return}const L=$===I+1&&I>=0,D=$===0?n.addLane(Pe(x.id)[0],"top"):L?n.addLane(Pe(x.id).at(-1),"bottom"):n.addLane(m(x.lanes[$-1].id),"bottom");n.updateProperties(D,{id:T.id,name:T.name})})}const z=150,se=130,V=80,Z=90,pe=180,ve=30,$e=30,F=10,C=300,R=5,U=(x,w,S,O,I)=>{const T=S-w.width/2,$=O-w.height/2;return(x.children??[]).find(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="bpmn:Lane"&&L.type!=="label"&&!(I!=null&&I.has(L.id))&&typeof L.x=="number"&&T<L.x+L.width+$e&&T+w.width+$e>L.x&&$<L.y+L.height&&$+w.height>L.y)},ee=new Set;for(const x of h){ee.add(`pool:${x.participant.id}`);for(const w of x.participant.lanes??[])ee.add(w.id)}const he=new Map;for(const x of v){const w=x.node.lane??`pool:${x.node.participant??""}`;let S=he.get(w);S||he.set(w,S=new Set([0])),x.band!==void 0&&S.add(x.band)}const ke=new Map;for(const[x,w]of he){if(!ee.has(x))continue;const S=[...w].sort((T,$)=>T-$),O=S.map((T,$)=>$===0?0:$%2===1?Math.ceil($/2):-($/2)),I=Math.min(...O);ke.set(x,new Map(S.map((T,$)=>[T,O[$]-I])))}{const x=new Map;for(const w of h)(w.participant.lanes??[]).forEach((S,O)=>x.set(S.id,O));for(const[w,S]of ke){if(!x.has(w)||S.size<2)continue;const O=x.get(w),I=S.get(0)??0,T=new Set;for(const ne of v){if(ne.node.lane!==w||(ne.band??0)!==0||!ne.node.type.endsWith("Gateway"))continue;const de={in:new Set,out:new Set,cross:new Set};for(const oe of Y){const ie=oe.flow.source===ne.node.id;if(!ie&&oe.flow.target!==ne.node.id)continue;const ye=N.get(ie?oe.flow.target:oe.flow.source);if(!ye||ye.node.participant!==ne.node.participant||!ye.node.lane)continue;let me,te=!1;if(ye.node.lane!==w){const le=x.get(ye.node.lane);if(le===void 0)continue;me=le>O?"down":"up",te=!0}else{const le=S.get(ye.band??0)??I;me=le>I?"down":le<I?"up":void 0}me&&(de[ie?"out":"in"].add(me),te&&de.cross.add(me))}for(const oe of["up","down"])de.in.has(oe)&&de.out.has(oe)&&de.cross.has(oe)&&T.add(oe)}if(T.size!==1)continue;const[$]=T,L=Math.max(...S.values()),D=$==="down"?L:0;if(I===D)continue;const H=[...S.entries()].filter(([ne])=>ne!==0).sort((ne,de)=>ne[1]-de[1]),j=[...Array(L+1).keys()].filter(ne=>ne!==D),Q=new Map([[0,D]]);H.forEach(([ne],de)=>Q.set(ne,j[de])),ke.set(w,Q)}}const at=x=>{var w;return(((w=he.get(x))==null?void 0:w.size)??0)>1},ut=x=>x.band??(x.node.lane||!at(`pool:${x.node.participant??""}`)?void 0:0),zt=new Map,yt=x=>zt.get(x.node.id)??ut(x),on=new Set,En=new Set,An=new Set,$t=new Set,gn=new Set,Tn=x=>P.some(w=>{var S,O;return(((S=w.placement)==null?void 0:S.anchor)??(w.association?w.association.source===w.annotation.id?w.association.target:w.association.source:void 0))===x&&((O=w.placement)==null?void 0:O.side.startsWith("bottom"))});{const x=new Map;for(const O of Y)x.set(O.flow.target,(x.get(O.flow.target)??0)+1);const w=O=>{const I=[],T=new Set([O]),$=[O];for(;$.length;){const L=$.shift();I.push(L);for(const D of Y)D.flow.source!==L||T.has(D.flow.target)||(x.get(D.flow.target)??0)!==1||(T.add(D.flow.target),$.push(D.flow.target))}return I},S=(O,I)=>{var T;return((T=ke.get(O))==null?void 0:T.get(I))??I};for(const O of v){if(!O.node.type.endsWith("Gateway"))continue;const I=O.node.lane??`pool:${O.node.participant??""}`,T=ke.get(I);if(!T||T.size<2)continue;const $=yt(O);if($===void 0||S(I,$)!==S(I,0))continue;const L=S(I,$),D=Y.filter(oe=>oe.flow.source===O.node.id).map(oe=>N.get(oe.flow.target)).filter(oe=>!!oe&&(oe.node.lane??`pool:${oe.node.participant??""}`)===I),H=D.filter(oe=>{const ie=yt(oe);return ie!==void 0&&S(I,ie)===L&&(x.get(oe.node.id)??0)===1}),j=D.some(oe=>{const ie=yt(oe);return ie!==void 0&&S(I,ie)>L});if(H.length!==1||!j)continue;const Q=new Set(D.flatMap(oe=>w(oe.node.id)));if(!Y.some(oe=>oe.flow.target===O.node.id&&Q.has(oe.flow.source)))continue;const de=new Map;for(const[oe,ie]of T)de.set(oe,ie+1);de.set(-1,0),ke.set(I,de);for(const oe of w(H[0].node.id))N.has(oe)&&(zt.set(oe,-1),En.add(oe));on.add(O.node.id)}}{const x=j=>j.node.lane??`pool:${j.node.participant??""}`,w=j=>yt(j)??0,S=new Map(h.map((j,Q)=>({id:j.participant.id,order:j.order??Number.POSITIVE_INFINITY,declared:Q})).sort((j,Q)=>j.order!==Q.order?j.order-Q.order:j.declared-Q.declared).map((j,Q)=>[j.id,Q])),O=j=>j===void 0?void 0:S.get(j)??-1,I=j=>{var de;const Q=N.get(j);if(Q)return Q.node.participant;if(S.has(j))return j;const ne=f(j);if(ne)return ne.type==="bpmn:Participant"?ne.id:(de=g(ne))==null?void 0:de.id},T=new Map;for(const j of Y)T.set(j.flow.target,(T.get(j.flow.target)??0)+1);const $=j=>{const Q=[j],ne=new Set([j.node.id]);for(let de=0;de<Q.length;de++)for(const oe of Y){if(oe.flow.source!==Q[de].node.id||ne.has(oe.flow.target)||(T.get(oe.flow.target)??0)!==1)continue;const ie=N.get(oe.flow.target);!ie||ie.node.participant!==j.node.participant||(ne.add(ie.node.id),Q.push(ie))}return Q},L=j=>{const Q=new Set(j.map(oe=>oe.node.id)),ne=O(j[0].node.participant);if(ne===void 0)return;const de=new Set;for(const oe of E){const ie=Q.has(oe.flow.source)?oe.flow.target:Q.has(oe.flow.target)?oe.flow.source:void 0;if(ie===void 0)continue;const ye=O(I(ie));ye===void 0||ye===ne||de.add(ye<ne?"up":"down")}return de.size===1?[...de][0]:void 0},D=new Map;{const j=new Map;for(const ie of Y){if(!N.has(ie.flow.source)||!N.has(ie.flow.target))continue;const ye=j.get(ie.flow.source)??[];ye.push(ie.flow.target),j.set(ie.flow.source,ye)}const Q=new Map,ne=[],de=new Set,oe=ie=>{Q.set(ie,"open");for(const ye of j.get(ie)??[]){const me=Q.get(ye);me==="open"?de.add(`${ie}>${ye}`):me||oe(ye)}Q.set(ie,"done"),ne.push(ie)};for(const ie of v)Q.has(ie.node.id)||oe(ie.node.id);for(const ie of ne.reverse()){const ye=D.get(ie)??0;D.set(ie,ye);for(const me of j.get(ie)??[])!de.has(`${ie}>${me}`)&&(D.get(me)??-1)<ye+1&&D.set(me,ye+1)}}let H=-1e3;for(const j of v){if(!j.node.type.endsWith("Gateway"))continue;const Q=x(j),ne=ke.get(Q);if(!ne)continue;const de=ne.get(w(j))??0,oe=te=>(ne.get(w(te))??0)-de,ie=Y.filter(te=>te.flow.source===j.node.id).map(te=>N.get(te.flow.target)).filter(te=>!!te&&x(te)===Q&&(T.get(te.node.id)??0)===1&&!En.has(te.node.id)).map(te=>{const le=$(te);return{root:te,subtree:le,dir:L(le)}});if(ie.some(te=>te.dir==="up")&&ie.some(te=>te.dir==="down"))continue;const ye=Y.some(te=>{const le=te.flow.source===j.node.id?N.get(te.flow.target):void 0;return!!le&&x(le)===Q&&oe(le)===0});let me=!1;if(!ye){const te=Y.filter(ue=>ue.flow.source===j.node.id).map(ue=>N.get(ue.flow.target)).filter(ue=>!!ue&&x(ue)===Q&&(!!ue.node.lane||ut(ue)!==void 0)&&oe(ue)<0),le=te.length?Math.max(...te.map(oe)):void 0,ge=te.filter(ue=>oe(ue)===le);if(!Tn(j.node.id)&&ge.length===1&&(T.get(ge[0].node.id)??0)===1&&!on.has(j.node.id))continue;me=!0}for(const te of ie){const le=te.dir;if(!le||ie.some(_e=>_e!==te&&_e.dir===le))continue;const ge=oe(te.root);if(ge===0||(le==="up"?ge<0:ge>0)||Y.some(_e=>{const He=_e.flow.target===j.node.id?N.get(_e.flow.source):void 0;if(!He||x(He)!==Q)return!1;const st=oe(He);return le==="up"?st<0:st>0}))continue;const ue=[...ne].map(([_e,He])=>({band:_e,rel:He-de})).filter(_e=>le==="up"?_e.rel<0:_e.rel>0).sort((_e,He)=>Math.abs(He.rel)-Math.abs(_e.rel));if(!ue.length&&le==="down")continue;const Re=w(te.root),Ie=te.subtree.filter(_e=>x(_e)===Q&&w(_e)===Re),nt=new Set(te.subtree.map(_e=>_e.node.id)),Xe=Ie.map(_e=>D.get(_e.node.id)??0),Ae=Math.min(...Xe)-1,Se=Math.max(...Xe)+1,Ce=_e=>!v.some(He=>{if(nt.has(He.node.id)||x(He)!==Q||w(He)!==_e)return!1;if(!An.has(_e))return!0;const st=D.get(He.node.id)??0;return st>=Ae&&st<=Se});let ce=me?w(j):(ZS=ue.find(_e=>Ce(_e.band)))==null?void 0:ZS.band;if(ce===void 0){if(ce=H--,An.add(ce),le==="up"){const _e=new Map;for(const[He,st]of ne)_e.set(He,st+1);_e.set(ce,0),ke.set(Q,_e)}else ne.set(ce,Math.max(...ne.values())+1);(JS=he.get(Q))==null||JS.add(ce)}for(const _e of Ie)zt.set(_e.node.id,ce)}}{const j=ie=>{const ye=Y.find(me=>me.flow.target===ie.node.id);return ye?N.get(ye.flow.source):void 0},Q=ie=>{const ye=j(ie);if(!ye||!ye.node.type.endsWith("Gateway")||x(ye)!==x(ie))return!1;const me=ke.get(x(ye));if(!me)return!1;const te=me.get(w(ye))??0,le=Ie=>x(Ie)===x(ye)?(me.get(w(Ie))??0)-te:Number.NaN,ge=Y.filter(Ie=>Ie.flow.source===ye.node.id).map(Ie=>N.get(Ie.flow.target)).filter(Ie=>!!Ie&&(!!Ie.node.lane||ut(Ie)!==void 0));if(ge.some(Ie=>le(Ie)===0))return!1;const K=ge.filter(Ie=>Ie.node.lane===ye.node.lane&&le(Ie)<0);if(!K.length)return!1;const ue=Math.max(...K.map(le)),Re=K.filter(Ie=>le(Ie)===ue);return Re.length===1&&Re[0]===ie&&(T.get(ie.node.id)??0)===1&&!Tn(ye.node.id)&&!on.has(ye.node.id)},ne=new Set;for(const ie of v){if(!ie.node.type.endsWith("Gateway")||Tn(ie.node.id))continue;const ye=ke.get(x(ie));if(!ye)continue;const me=ye.get(w(ie))??0;let te;for(const le of Y){if(le.flow.source!==ie.node.id)continue;const ge=N.get(le.flow.target);if(!ge||x(ge)!==x(ie)||!ge.node.lane&&ut(ge)===void 0)continue;const K=ye.get(w(ge))??0;K<=me||(!te||K>te.row?te={id:ge.node.id,row:K,count:1}:K===te.row&&te.count++)}te&&te.count===1&&(T.get(te.id)??0)===1&&ne.add(te.id)}const de=new Set,oe=[...v].sort((ie,ye)=>Number(ne.has(ie.node.id))-Number(ne.has(ye.node.id)));for(const ie of oe){const ye=x(ie),me=ke.get(ye);if(!me)continue;const te=ie.node.id,le=E.filter(Oe=>Oe.flow.target===te);if(le.length!==1||!(T.get(te)??0)||!ie.node.lane&&ut(ie)===void 0||En.has(te)||$t.has(te))continue;const ge=(QS=N.get(le[0].flow.source))==null?void 0:QS.node.participant;if(!ge||ge===ie.node.participant)continue;const K=O(ie.node.participant),ue=O(ge);if(K===void 0||ue===void 0||K===ue)continue;const Re=ue<K,Ie=me.get(0)??0,nt=(me.get(w(ie))??Ie)-Ie;if(nt===0||(Re?nt<0:nt>0)||Q(ie))continue;let Xe;for(const[Oe,Ye]of me){if(An.has(Oe))continue;const Dt=Ye-Ie;(Re?Dt<0&&(!Xe||Dt<Xe.row):Dt>0&&(!Xe||Dt>Xe.row))&&(Xe={band:Oe,row:Dt})}if(!Xe)continue;const Ae=w(ie),Se=$(ie).filter(Oe=>x(Oe)===ye&&w(Oe)===Ae&&!En.has(Oe.node.id)),Ce=j(ie),ce=Ce!=null&&Ce.node.type.endsWith("Gateway")?`${Ce.node.id}|${ye}|${Xe.band}`:void 0,_e=Xe,He=!!ce&&ne.has(te)&&Y.some(Oe=>{if(Oe.flow.source!==Ce.node.id||Oe.flow.target===te)return!1;const Ye=N.get(Oe.flow.target);return!!Ye&&x(Ye)===ye&&!Se.includes(Ye)&&w(Ye)===_e.band});let st=Xe.band;if(ce&&(de.has(ce)||He)){if(st=H--,An.add(st),Re){const Oe=new Map;for(const[Ye,Dt]of me)Oe.set(Ye,Dt+1);Oe.set(st,0),ke.set(ye,Oe)}else me.set(st,Math.max(...me.values())+1);(eR=he.get(ye))==null||eR.add(st)}ce&&de.add(ce);for(const Oe of Se)zt.set(Oe.node.id,st),$t.add(Oe.node.id);Re&&ne.has(te)&&gn.add(te)}}}const gi=(x,w)=>{var S;return((S=ke.get(x))==null?void 0:S.get(w))??w},Un=(x,w,S,O)=>{const I=x?f(x):w?f(w):void 0;if(!I)return!1;const T=x?I.y+Math.min(I.height/2,Z):I.y+V;return Math.abs(T+gi(x??`pool:${w??""}`,S)*z-O)<=z/2},Bi=new Map;for(const[x,w]of he){let S=0;for(const O of w)S=Math.max(S,gi(x,O));Bi.set(x,S)}const ti=x=>pe+z*x,Wt=(x,w,S,O)=>{const I=d().children.filter(T=>!("waypoints"in T&&T.waypoints)&&T.type!=="label"&&T.id!==w&&!(O!=null&&O.has(T.id))&&typeof T.y=="number"&&T.y>=x);I.length&&n.moveElements(I,{x:0,y:S})},Sr=(x,w,S)=>{const O=x.type==="bpmn:Participant"?x:void 0;if(!O||O.children.some(L=>L.type==="bpmn:Lane"))return;const I=S+w.height/2+ve-O.y;if(O.height>=I)return;const T=I-O.height,$=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:I}),Wt($,O.id,T)},ns=(x,w,S)=>{const O=w-x.height;if(O<=0)return new Set;const I=g(x)??x,T=[],$=H=>{if(!(S!=null&&S.has(H.id))){T.push(H);for(const j of H.children??[])$(j)}};$(I);const L=x.y+x.height-10,D=l.calculateAdjustments(T,"y",O,L);return l.makeSpace(D.movingShapes,D.resizingShapes,{x:0,y:O},"s",L),new Set(D.movingShapes.map(H=>H.id))},ni=(x,w,S)=>{if(x){const $=m(x),L=ti(w);if($.height>=L)return;const D=L-$.height,H=g($),j=H?H.y+H.height:$.y+$.height,Q=ns($,L);Wt(j,H==null?void 0:H.id,D,Q);return}if(!S)return;const O=z*(w+1);if(S.height>=O)return;const I=O-S.height,T=S.y+S.height;n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:O}),Wt(T,S.id,I)},_t=new Map;for(const x of Y)_t.set(x.flow.target,(_t.get(x.flow.target)??0)+1);const At=x=>(_t.get(x)??0)<=1,IF=new Set(v.map(x=>x.node.id).filter(x=>X(x)===1&&!Y.some(w=>w.flow.target===x||w.flow.source===x&&N.has(w.flow.target)))),qg=new Map,vS=(x,w)=>{if(!x)return;const S=f(x);if(!S||S.height>=ti(w))return;const O=S.y+S.height-10,I=g(S);if(I)return new Set((I.children??[]).filter(T=>T.type!=="bpmn:Lane"&&typeof T.y=="number"&&T.y>O).map(T=>T.id))},Cp=(x,w,S)=>{if(!x)return!0;const O=f(x);return O?S-w.height/2>=O.y&&S+w.height/2<=O.y+O.height:!0},BF=10,NF=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:w}of fe){const S=f(x),O=Pe(x);if(!S||O.length<2)continue;const I=ti(0),T=BF,$=new Set(Gt(e,"node.update").filter(K=>K.lane!==void 0&&w.has(K.lane)).map(K=>K.id)),L=S.children??[],D=L.filter(K=>!("waypoints"in K&&K.waypoints)&&K.type!=="bpmn:Lane"&&K.type!=="label"&&typeof K.y=="number"),H=[];for(const K of D){H.push([K.y,K.y+K.height]);const ue=K.label;ue&&H.push([ue.y,ue.y+ue.height])}for(const K of L){const ue="waypoints"in K&&K.waypoints?K.label:void 0;ue&&ue.y+ue.height>S.y&&ue.y<S.y+S.height&&H.push([ue.y,ue.y+ue.height])}for(const K of d().children){if(K.type!=="bpmn:TextAnnotation")continue;const ue=K;ue.x<S.x+S.width&&ue.x+ue.width>S.x&&ue.y<S.y+S.height&&ue.y+ue.height>S.y&&H.push([ue.y,ue.y+ue.height])}H.sort((K,ue)=>K[0]-ue[0]);const j=S.y,Q=S.y+S.height,ne=[];let de=j;for(const[K,ue]of H)K>de&&ne.push([de,K]),de=Math.max(de,ue);const oe=D.filter(K=>NF.test(K.type)&&!$.has(K.id)),ie=(K,ue)=>oe.some(Re=>Re.y+Re.height/2>=K&&Re.y+Re.height/2<=ue),ye=K=>H.some(([ue,Re])=>ue<K-.5&&K+.5<Re),me=[];let te=j;for(const K of O.slice(1).map(ue=>ue.y)){const ue=te+2*T,Re=!ye(K)&&K>=ue&&K<=Q-2*T?[K]:[];for(const[nt,Xe]of ne){const Ae=Math.max(nt+T,ue),Se=Math.min(Xe-T,Q-2*T);Ae<=Se&&Re.push(Math.min(Math.max(K,Ae),Se))}Re.push(Math.max(de+T,ue));let Ie;for(const nt of Re){const Xe=!ie(te,nt)&&nt-te<I?D.filter(Ce=>Ce.y>=nt).length:0,Ae=Math.abs(nt-K),Se=Ie?Math.abs(Ie.y-K):0;(!Ie||Xe<Ie.cost||Xe===Ie.cost&&(Ae<Se||Ae===Se&&nt>Ie.y))&&(Ie={y:nt,cost:Xe})}me.push(Ie.y),te=Ie.y}const le=me[me.length-1]+2*T-Q;le>0&&(n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+le}),Wt(Q,S.id,le));const ge=[j,...me,S.y+S.height];O.forEach((K,ue)=>{const Re=ge[ue],Ie=ge[ue+1]-Re;(K.y!==Re||K.height!==Ie)&&n.resizeShape(K,{x:K.x,y:Re,width:K.width,height:Ie})});for(const K of O){if(K.height>=I||ie(K.y,K.y+K.height))continue;const ue=I-K.height,Re=S.y+S.height,Ie=ns(K,I);Wt(Re,S.id,ue,Ie)}}const Ap=h.map((x,w)=>({op:x,declared:w}));Ap.sort((x,w)=>{const S=x.op.order??Number.POSITIVE_INFINITY,O=w.op.order??Number.POSITIVE_INFINITY;return S!==O?S-O:x.declared-w.declared});let Tc=80;for(const x of r.getAll())x.parent===d()&&"height"in x&&typeof x.y=="number"&&(Tc=Math.max(Tc,x.y+x.height+60));const Yg=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===d()),$F=(()=>{if(!Yg.length)return;const x=Yg.filter(I=>!wv(I)),w=x.length?x:Yg,S=Math.min(...w.map(I=>I.x)),O=Math.max(...w.map(I=>I.x+I.width));return O>S?{x:S,width:O-S}:void 0})();for(const{op:x}of Ap){const w=x.participant,S=v.filter(ie=>ie.node.participant===w.id).length,O=((tR=w.lanes)==null?void 0:tR.length)??0,I=Math.max(1200,S*160+300),T=(w.lanes??[]).map(ie=>ti(Bi.get(ie.id)??0)),$=T.reduce((ie,ye)=>ie+ye,0);O&&$<300&&(T[O-1]+=300-$);const L=Math.max(300,z*((Bi.get(`pool:${w.id}`)??0)+1)),D=w.blackBox||S+O===0?120:O?Math.max(300,$):L,H=w.blackBox?$F:void 0,j=(H==null?void 0:H.x)??100,Q=(H==null?void 0:H.width)??I,ne=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:w.id,name:w.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...w.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Q,height:D,isExpanded:!0}),de=n.createShape(ne,{x:j+Q/2,y:Tc+D/2},d()),oe=w.lanes??[];if(oe.length&&n.splitLane(de,oe.length),oe.length){const ie=r.filter(ye=>{var me;return ye.type==="bpmn:Lane"&&((me=g(ye))==null?void 0:me.id)===w.id}).sort((ye,me)=>ye.y-me.y);if(ie.forEach((ye,me)=>{const te=oe[me];te&&n.updateProperties(ye,{id:te.id,name:te.name})}),T.some(ye=>ye!==de.height/O)){let ye=de.y;ie.forEach((me,te)=>{const le=T[te];n.resizeShape(me,{x:me.x,y:ye,width:me.width,height:le}),ye+=le})}}Tc=de.y+de.height+60}const FF=x=>{var O;const w=N.get(x);if(w)return w.node.participant??"";const S=f(x);return S?S.type==="bpmn:Participant"?S.id:((O=g(S))==null?void 0:O.id)??"":""},Pc=new Map,xS=x=>{let w=Pc.get(x);return w||Pc.set(x,w={nodes:[],flows:[]}),w};for(const x of v)xS(x.node.participant??"").nodes.push(x);for(const x of Y)xS(FF(x.flow.source)).flows.push(x);const Tp=x=>{var w;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((w=x.condition)==null?void 0:w.label)})},Kg=(x,w,S)=>o.createShape({type:ul(x.type),...x.eventDefinition?{eventDefinitionType:Fc[x.eventDefinition]}:{},businessObject:i.create(ul(x.type),{id:x.id,name:x.name,...w!==void 0?{"bwl:band":w}:{},...S!==void 0?{"bwl:afterColumn":S}:{}})}),jF=[...Ap.map(({op:x})=>x.participant.id).filter(x=>Pc.has(x)),...[...Pc.keys()].filter(x=>!h.some(w=>w.participant.id===x))],Xg=x=>x.endsWith("Gateway");for(const x of jF){const w=Pc.get(x),S=x?m(x):void 0,O=S?S.x+150:250;let I=S?S.y+80:120;const T=(K,ue,Re)=>{if(K){const Ie=m(K);return Ie.y+Math.min(Ie.height/2,Z)+gi(K,ue??0)*z}return ue!==void 0&&S?S.y+V+gi(`pool:${x}`,ue)*z:Re},$=(K,ue,Re)=>{if(K){const Ie=m(K);return Ie.y+Math.min(Ie.height/2,Z)+ue*z}return S?S.y+V+ue*z:Re},L=K=>K.participant?m(K.participant):d(),D=(K,ue,Re,Ie,nt,Xe,Ae,Se)=>{const Ce=Re!==void 0||Ie!==void 0,ce=Oe=>{const Ye=()=>ni(Re,Oe,S);Se?Se(Ye):Ye()},_e=gi(Re??`pool:${x}`,Ie??0);if((Ie===void 0||Un(Re,x,Ie,Ae??Number.NaN))&&Ae!==void 0&&Cp(Re,ue,Ae)&&!U(K,ue,nt,Ae))return{x:nt,y:Ae};if(Ce)for(let Oe=0;Oe<4;Oe++){const Ye=$(Re,_e+Oe,Xe);if(!U(K,ue,nt,Ye,vS(Re,_e+Oe)))return ce(_e+Oe),{x:nt,y:Ye}}const He=T(Re,Ie,Xe);Ce?ce(_e):Se?Se(()=>Sr(K,ue,ue.y+ue.height/2)):Sr(K,ue,He);let st=nt;for(let Oe=0;Oe<64;Oe++){const Ye=U(K,ue,st,He);if(!Ye)break;st=Ye.x+Ye.width+se+ue.width/2}return{x:st,y:He}},H=(K,ue,Re)=>{const Ie=r.getAll().filter(Xe=>{var Ae;return/Association$/.test(Xe.type)&&(((Ae=Xe.waypoints)==null?void 0:Ae.length)??0)>=2});if(!Ie.length)return Re;const nt=Xe=>{const Ae={id:ue.id,type:ue.type,x:Xe-ue.width/2,y:Re.y-ue.height/2,width:ue.width,height:ue.height};return Ie.some(Se=>Se.waypoints.some((Ce,ce)=>!!Se.waypoints[ce+1]&&bo(Ce,Se.waypoints[ce+1],Ae)<=F))};if(!nt(Re.x))return Re;for(let Xe=R;Xe<=C;Xe+=R){const Ae=Re.x+Xe;if(!nt(Ae)&&!U(K,ue,Ae,Re.y))return{x:Ae,y:Re.y}}return Re},j=new Set(w.flows.map(K=>K.flow.target)),Q=new Map,ne=K=>{if(K===void 0)return;const ue=r.get(K);if(!(!ue||typeof ue.x!="number"||typeof ue.width!="number"))return ue.x+ue.width+se},de=K=>{if(X(K)>0)return;const ue=w.flows.filter(Ie=>Ie.flow.source===K);if(ue.length!==1)return;const Re=r.get(ue[0].flow.target);return Re&&typeof Re.y=="number"&&typeof Re.height=="number"?Re.y+Re.height/2:void 0};for(const K of w.nodes){if(j.has(K.node.id))continue;const ue=Kg(K.node,K.band,K.afterColumn),Re=ut(K),Ie=K.node.lane?`${K.node.lane}|${Re??""}`:Re!==void 0?`band:${Re}`:"",nt=L(K.node),Xe=Q.get(Ie)??O,Ae=ne(K.afterColumn),Se=Ae===void 0?Xe:Math.max(Xe,Ae);let Ce;const ce=D(nt,ue,K.node.lane,Re,Se,I,de(K.node.id),IF.has(K.node.id)&&K.node.participant!==void 0?_e=>Ce=_e:void 0);if(Ce?n.createShape(ue,ce,nt,{autoResize:!1}):n.createShape(ue,ce,nt),Ce){const _e=K.node.lane?m(K.node.lane):nt;qg.set(K.node.id,{container:_e,relCy:ce.y-_e.y,grow:Ce})}Q.set(Ie,ce.x+ue.width+se),!K.node.lane&&Re===void 0&&(I+=160)}const oe=new Set,ie=new Map,ye=new Map;if(x&&ee.has(`pool:${x}`)){const K=new Map;for(const Se of w.flows)K.set(Se.flow.target,(K.get(Se.flow.target)??0)+1);const ue=Se=>T(Se.node.lane,yt(Se),Number.NaN),Re=new Set,Ie=Se=>{var _e;const Ce=(_e=N.get(Se))==null?void 0:_e.node.participant;if(Ce)return f(Ce);const ce=f(Se);if(ce)return ce.type==="bpmn:Participant"?ce:g(ce)},nt=Se=>{const Ce=[],ce=new Set([Se]),_e=[Se];for(;_e.length;){const He=_e.shift(),st=N.get(He);st&&Ce.push(st);for(const Oe of w.flows)Oe.flow.source!==He||ce.has(Oe.flow.target)||(K.get(Oe.flow.target)??0)!==1||(ce.add(Oe.flow.target),_e.push(Oe.flow.target))}return Ce},Xe=Se=>{if(!S)return;const Ce=new Set(Se.map(He=>He.node.id));let ce=!1,_e=!1;for(const He of E){if(!Ce.has(He.flow.source))continue;const st=Ie(He.flow.target);!st||st.id===S.id||(st.y<S.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const Se of w.nodes){if(!Xg(Se.node.type))continue;const Ce=T(Se.node.lane,ut(Se),Number.NaN);if(Number.isNaN(Ce))continue;const ce=[];for(const Oe of w.flows){if(Oe.flow.source!==Se.node.id)continue;const Ye=N.get(Oe.flow.target);if(!Ye||Ye.node.lane!==Se.node.lane||(K.get(Ye.node.id)??0)!==1)continue;const Dt=ut(Ye);if(Dt===void 0)continue;const Pn=T(Ye.node.lane,Dt,Number.NaN);if(Number.isNaN(Pn))continue;const kn=nt(Ye.node.id),xt=Xe(kn);xt&&ce.push({subtree:kn,band:Dt,row:Pn,dir:xt})}if(!ce.some(Oe=>Oe.dir==="up")||!ce.some(Oe=>Oe.dir==="down")||!ce.some(Oe=>Oe.dir==="up"&&ce.some(Ye=>Ye.dir==="down"&&Ye.row<Oe.row)))continue;const He=[...ce].sort((Oe,Ye)=>Oe.row-Ye.row);[...ce.filter(Oe=>Oe.dir==="up"),...ce.filter(Oe=>Oe.dir==="down")].sort((Oe,Ye)=>Oe.dir===Ye.dir?Oe.row-Ye.row:Oe.dir==="up"?-1:1).forEach((Oe,Ye)=>{const Dt=He[Ye].band;if(Dt!==Oe.band){Re.add(Se.node.id);for(const Pn of Oe.subtree)ut(Pn)===Oe.band&&zt.set(Pn.node.id,Dt)}})}const Ae=Se=>{if(!S)return;const Ce=new Set(Se.map(He=>He.node.id));let ce=!1,_e=!1;for(const He of E){if(!Ce.has(He.flow.target))continue;const st=Ie(He.flow.source);!st||st.id===S.id||(st.y<S.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const Se of w.nodes){if(!Xg(Se.node.type))continue;const Ce=Se.node.lane??`pool:${x}`,ce=ke.get(Ce);if(!ce||ce.size<2)continue;const _e=ce.get(0);if(_e===void 0)continue;const He=Math.max(...ce.values()),st=_e===He&&_e!==0?"down":void 0;if(!st)continue;const Oe=[];for(const xt of w.flows){if(xt.flow.source!==Se.node.id)continue;const qi=N.get(xt.flow.target);if(!qi||qi.node.lane!==Se.node.lane||(K.get(qi.node.id)??0)!==1)continue;const ss=yt(qi);ss!==void 0&&Oe.push({t:qi,subtree:nt(qi.node.id),band:ss})}const Ye=Oe.find(xt=>(ce.get(xt.band)??xt.band)===_e);if(!Ye||Ae(Ye.subtree)===st||Xe(Ye.subtree)===st)continue;const Dt=Oe.find(xt=>xt!==Ye&&Ae(xt.subtree)===st);if(!Dt)continue;const Pn=Ye.band,kn=Dt.band;for(const xt of Ye.subtree)yt(xt)===Pn&&zt.set(xt.node.id,kn);for(const xt of Dt.subtree)yt(xt)===kn&&zt.set(xt.node.id,Pn);Re.add(Se.node.id)}for(const Se of w.nodes){if(!Xg(Se.node.type))continue;const Ce=ue(Se);if(Number.isNaN(Ce)||Tn(Se.node.id))continue;let ce,_e=!1,He;for(const st of w.flows){if(st.flow.source!==Se.node.id)continue;const Oe=N.get(st.flow.target);if(!Oe||!Oe.node.lane&&ut(Oe)===void 0)continue;const Ye=ue(Oe);Number.isNaN(Ye)||(Math.abs(Ye-Ce)<.5&&(_e=!0),Ye>Ce?!ce||Ye>ce.row?ce={id:Oe.node.id,row:Ye,count:1}:Ye===ce.row&&ce.count++:Ye<Ce&&Oe.node.lane===Se.node.lane&&!$t.has(Oe.node.id)&&(!He||Ye>He.row?He={op:Oe,row:Ye,count:1}:Ye===He.row&&He.count++))}ce&&ce.count===1&&(K.get(ce.id)??0)===1&&!Re.has(Se.node.id)&&oe.add(ce.id),!_e&&He&&He.count===1&&(K.get(He.op.node.id)??0)===1&&!on.has(Se.node.id)&&ie.set(He.op.node.id,{lane:Se.node.lane,band:yt(Se)})}for(const Se of gn){const Ce=(nR=w.flows.find(ce=>ce.flow.target===Se))==null?void 0:nR.flow.source;Ce&&!Re.has(Ce)&&oe.add(Se)}}const me=pT(w.flows.map(K=>K.flow),w.nodes.map(K=>K.node.id),K=>N.has(K));let te=!1;const le=new Set;let ge=0;for(;ge++<w.nodes.length+2;){for(let Re=0;Re<w.nodes.length+w.flows.length+2;Re++){let Ie=!1,nt=!1;for(const Xe of w.flows){const Ae=Xe.flow;if(le.has(Ae.id))continue;const Se=f(Ae.source);if(!Se)continue;const Ce=f(Ae.target),ce=N.get(Ae.target);if(!Ce&&ce&&!te&&me.has(Ae.id)){nt=!0;continue}if(!Ce&&ce){const _e=Kg(ce.node,ce.band),He=yt(ce);if(ce.node.lane||He!==void 0){const st=L(ce.node),Oe=Se,Ye=Oe.x+(ye.get(Ae.source)??0)+Oe.width+se,Dt=ie.get(Ae.target),Pn=D(st,_e,Dt?Dt.lane:ce.node.lane,Dt?Dt.band:He,oe.has(Ae.target)?Oe.x+Oe.width/2:Ye,Number.NaN,Dt||!At(Ae.target)?void 0:Oe.y+Oe.height/2),kn=N.has(Ae.source)?Pn:H(st,_e,Pn),xt=n.createShape(_e,kn,st);oe.has(Ae.target)&&ye.set(Ae.target,Ye-(xt.x+xt.width/2)),n.connect(Se,xt,{type:"bpmn:SequenceFlow",businessObject:Tp(Ae)})}else s.append(Se,_e,{connection:{type:"bpmn:SequenceFlow",businessObject:Tp(Ae)}})}else if(Ce)n.connect(Se,Ce,{type:"bpmn:SequenceFlow",businessObject:Tp(Ae)});else continue;le.add(Ae.id),Ie=!0}if(!Ie){if(nt&&!te){te=!0;continue}break}te=!1}const K=w.nodes.filter(Re=>!f(Re.node.id));if(!K.length)break;const ue=K[0];{const Re=Kg(ue.node,ue.band),Ie=L(ue.node),nt=ut(ue);n.createShape(Re,D(Ie,Re,ue.node.lane,nt,O,I),Ie),!ue.node.lane&&nt===void 0&&(I+=160)}}}const bS=new Map;for(const[x,w]of G){const S=f(x),O=f(w.flow.target);if(!(S!=null&&S.target)||!O)continue;const I=S.label&&{x:S.label.x,y:S.label.y,width:S.label.width,height:S.label.height};bS.set(x,{waypoints:S.waypoints.map(L=>({x:L.x,y:L.y})),label:I});const T=S.target,$=L=>({x:L.x+L.width/2,y:L.y+L.height/2});n.reconnect(S,O,T,[$(O),$(T)]),n.layoutConnection(S,{waypoints:[]})}const wS=new Set;{const x=T=>T.endsWith("Task")||T==="bpmn:CallActivity"||T==="bpmn:SubProcess",w=T=>x(T)||T==="bpmn:EndEvent"||T==="bpmn:IntermediateThrowEvent"||T==="bpmn:IntermediateCatchEvent",S=T=>(T??[]).filter($=>$.type==="bpmn:SequenceFlow"),O=Gt(e,"sequenceFlow.update"),I=(T,$)=>{var L;return(L=y(T,$))==null?void 0:L.id};for(const T of O){if(T.source===void 0&&T.target===void 0||G.has(T.id))continue;const $=f(T.id);if(!$)continue;const L=T.source!==void 0?f(T.source):$.source,D=T.target!==void 0?f(T.target):$.target;if(!L||!D||L.id===D.id||N.has(L.id)||N.has(D.id)||!x(L.type)||!w(D.type)||L.parent!==D.parent||S(D.incoming).some(te=>te.id!==$.id)||S(D.outgoing).some(te=>te.id!==$.id)||O.some(te=>te!==T&&(te.target===D.id||te.source===D.id))||D.x>=L.x+L.width)continue;const H=L.parent,j=g(L),Q=L.x+L.width+se,ne=L.y+L.height/2,de=D.y+D.height/2,oe=I(j,L)===I(j,D),ie=new Set([D.id]),ye=[oe?ne:de,de].find(te=>!U(H,D,Q,te,ie));if(ye===void 0)continue;if(n.moveElements([D],{x:Q-(D.x+D.width/2),y:ye-de}),j){const te=D.x+D.width+Nd-(j.x+j.width);te>0&&hl(n,j,j.width+te)}const me=te=>({x:te.x+te.width/2,y:te.y+te.height/2});n.reconnect($,L,D,[me(L),me(D)]),Math.abs(me(L).y-me(D).y)>1&&n.layoutConnection($,{waypoints:[]}),wS.add(T.id)}}const Rr=40,HF=10,Pp=x=>{const w=j=>j.kind==="label-over-line"||j.kind==="label-over-shape"||j.kind==="label-on-shared-segment"?j.edge===x.id:j.kind==="annotation-over-label"||j.kind==="pool-name-over-label"?j.label===x.id:!1,S=()=>new Map(ft(Ge(r)).filter(j=>!w(j)).map(j=>[ct(j),j])),O=S(),I=j=>[...j].filter(([Q])=>!O.has(Q)).map(([,Q])=>Q),T=j=>I(j).length<=[...O.keys()].filter(Q=>!j.has(Q)).length,$=x.waypoints.map(j=>({x:j.x,y:j.y})),L=x.label,D=L&&{x:L.x,y:L.y};n.layoutConnection(x,{waypoints:[]});const H=S();if(!T(H)){if(I(H).every(j=>j.kind==="edge-crosses-shape"&&j.edge===x.id)){const j=Ge(r),Q=j.edges.find(ie=>ie.id===x.id),ne=Dn(j),de=Q?Ot(Q,ne):[],oe=Q&&de.length&&!de.every(ie=>ie.type==="bpmn:TextAnnotation")?ol(Q,ne,xs(x),j.edges):null;if(oe&&(n.updateWaypoints(x,oe),T(S())))return}n.updateWaypoints(x,$),L&&D&&(L.x!==D.x||L.y!==D.y)&&n.moveElements([L],{x:D.x-L.x,y:D.y-L.y})}},Zg=5,Ni=10,_S=200,kc=new Set([...Y.map(x=>x.flow.id),...E.map(x=>x.flow.id),...Gt(e,"sequenceFlow.update").map(x=>x.id),...Gt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),zF=(x,w,S,O,I,T)=>{const $=new Set(x.map(te=>te.id)),L=Math.min(...x.map(te=>te.x))+w-Ni,D=Math.max(...x.map(te=>te.x+te.width))+w+_S+Ni,H=Math.min(...x.map(te=>te.y+Math.min(0,...S)))-Ni,j=Math.max(...x.map(te=>te.y+te.height+Math.max(0,...S)))+Ni,Q=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const le=te;return kc.has(le.id)||!le.waypoints||le.waypoints.length<2||[le.source,le.target].some(K=>!K||$.has(K.id)||K.x>=O)?!1:le.waypoints.some((K,ue)=>{const Re=le.waypoints[ue+1];return!!Re&&Math.max(K.x,Re.x)>=L&&Math.min(K.x,Re.x)<=D&&Math.max(K.y,Re.y)>=H&&Math.min(K.y,Re.y)<=j})});if(!Q.length)return 0;const ne=te=>{const le=new Map;for(const ge of x)for(const K of S){const ue={id:ge.id,type:ge.type,x:ge.x+w+te,y:ge.y+K,width:ge.width,height:ge.height};for(const Re of Q){let Ie=1/0;for(let Xe=0;Xe+1<Re.waypoints.length;Xe++)Ie=Math.min(Ie,bo(Re.waypoints[Xe],Re.waypoints[Xe+1],ue));const nt=`${Re.id}|${ge.id}`;le.set(nt,Math.min(le.get(nt)??1/0,Ie))}}return le},de=[...ne(0)].filter(([,te])=>te<=Zg).map(([te])=>te);if(!de.length)return 0;let oe=0;for(let te=1;te<=_S;te++){const le=ne(te);if([...le.values()].every(ge=>ge>Zg)&&de.every(ge=>(le.get(ge)??1/0)>=Ni)){oe=te;break}}if(!oe)return 0;const ie=Math.min(...x.map(te=>te.x))+w+oe,ye=new Set(de.map(te=>te.slice(0,te.indexOf("|"))));return Q.some(te=>te.type==="bpmn:SequenceFlow"&&ye.has(te.id)&&te.waypoints.some((le,ge)=>{const K=te.waypoints[ge+1];if(!K||Math.min(le.y,K.y)>T||Math.max(le.y,K.y)<T||le.y===K.y)return!1;const ue=le.x+(T-le.y)*(K.x-le.x)/(K.y-le.y);return ue>I&&ue<ie}))?0:oe},$o=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],I=new Set([x]);for(let T=0;T<O.length;T++){const $=O[T].id;for(const L of Y){const D=L.flow.target;if(L.flow.source!==$||I.has(D)||!N.has(D))continue;I.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},GF=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],I=new Set([x]);for(let T=0;T<O.length;T++){const $=O[T].id;for(const L of Y){const D=L.flow.source;if(L.flow.target!==$||I.has(D)||!N.has(D))continue;I.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},$i=30,bi=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",is=(x,w)=>hl(n,x,w),Fo=(x,w,S=!1)=>{const O=new Set(x.flatMap(D=>D.subtree.map(H=>H.id)));for(const D of x){const H=(D.pool.children??[]).filter(bi).filter(Q=>!O.has(Q.id));if(D.subtree.some(Q=>H.some(ne=>Q.x+w<ne.x+ne.width+$i&&Q.x+w+Q.width+$i>ne.x&&Q.y<ne.y+ne.height&&Q.y+Q.height>ne.y)))return null}const I=x.map(D=>D.pool.width),T=S?r.filter(D=>Array.isArray(D.waypoints)).map(D=>({c:D,wps:D.waypoints.map(H=>({x:H.x,y:H.y}))})):[],$=r.filter(D=>D.type==="label").map(D=>({label:D,x:D.x,y:D.y}));n.moveElements(x.flatMap(D=>D.subtree),{x:w,y:0});const L=x.map(D=>{const j=Math.max(...D.subtree.map(Q=>Q.x+Q.width))+Nd-(D.pool.x+D.pool.width);return j>0&&is(D.pool,D.pool.width+j),j});return()=>{n.moveElements(x.flatMap(D=>D.subtree),{x:-w,y:0}),x.forEach((D,H)=>{L[H]>0&&is(D.pool,I[H])});for(const{c:D,wps:H}of T){const j=D.waypoints??[];j.length===H.length&&j.every((ne,de)=>Math.abs(ne.x-H[de].x)<=.5&&Math.abs(ne.y-H[de].y)<=.5)||n.updateWaypoints(D,H.map(ne=>({x:ne.x,y:ne.y})))}for(let D=0;D<3;D++){let H=0;for(const j of $){const Q=j.x-j.label.x,ne=j.y-j.label.y;Math.abs(Q)<=.5&&Math.abs(ne)<=.5||(n.moveElements([j.label],{x:Q,y:ne}),H++)}if(!H)break}}},Jg=x=>{var I,T;const w=new Map,S=new Map;for(const $ of r.getAll()){if($.type!=="bpmn:Participant")continue;const L=$;(L.children??[]).length||(w.set(L.id,L),S.set(L.id,[]))}for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const L=$,D=(I=L.source)==null?void 0:I.id,H=(T=L.target)==null?void 0:T.id;D&&H&&S.has(D)&&S.get(D).push(H),D&&H&&S.has(H)&&S.get(H).push(D)}const O=[];for(const[$,L]of S)L.length&&L.every(D=>x.has(D))&&O.push(w.get($));return O},ES=(x,w)=>{if(!x.length)return null;const S=new Set(x.map(j=>j.id)),O=r.getAll().filter(j=>j.type==="bpmn:Participant"&&!S.has(j.id)),I=Math.min(...O.filter(j=>(j.children??[]).length>0).map(j=>j.x)),T=new Set(x.filter(j=>Math.abs(j.x-I)<=2).map(j=>j.id));if(x.some(j=>{const Q=T.has(j.id)?j.x:j.x+w,ne=T.has(j.id)?j.width+w:j.width;return O.some(de=>Q<de.x+de.width+$i&&Q+ne+$i>de.x&&j.y<de.y+de.height&&j.y+j.height>de.y)}))return null;const L=r.filter(j=>j.type==="label").map(j=>({label:j,x:j.x,y:j.y})),D=x.filter(j=>!T.has(j.id)),H=x.filter(j=>T.has(j.id)).map(j=>({pool:j,was:{x:j.x,y:j.y,width:j.width,height:j.height}}));D.length&&n.moveElements(D,{x:w,y:0});for(const{pool:j,was:Q}of H)n.resizeShape(j,{...Q,width:Q.width+w});return()=>{for(const{pool:j,was:Q}of H)n.resizeShape(j,Q);D.length&&n.moveElements(D,{x:-w,y:0});for(let j=0;j<3;j++){let Q=0;for(const ne of L){const de=ne.x-ne.label.x,oe=ne.y-ne.label.y;Math.abs(de)<=.5&&Math.abs(oe)<=.5||(n.moveElements([ne.label],{x:de,y:oe}),Q++)}if(!Q)break}}},SS=(x,w,S)=>{const O=S.x+S.width/2,I=w.y>S.y,T=I?S.y+S.height:S.y,$=I?w.y:w.y+w.height,L=x.source===w?[{x:O,y:$},{x:O,y:T}]:[{x:O,y:T},{x:O,y:$}],D=Ge(r),H={...D.edges.find(j=>j.id===x.id),waypoints:L};return Ot(H,Dn(D)).length?!1:(n.updateWaypoints(x,L),!0)},VF=()=>{const x=r.filter($=>$.type==="bpmn:Participant"),w=Math.min(...x.filter($=>($.children??[]).length>0).map($=>$.x)),S=$=>h.some(L=>L.participant.id===$.id),O=$=>!!$&&$.type==="bpmn:Participant"&&!($.children??[]).length&&Math.abs($.x-w)<=2&&!S($),I=$=>!!$&&$.type==="bpmn:Participant"&&($.children??[]).length>0&&!S($),T=new Set;for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const L=$;if((L.waypoints??[]).length!==2)continue;const D=[L.source,L.target].find(Q=>O(Q)||I(Q)),H=D===L.source?L.target:L.source;if(!D||!H||H.type==="bpmn:Participant")continue;const j=H.x+H.width/2;I(D)&&(j<D.x||j>D.x+D.width)||T.add(L.id)}return T},WF=x=>{var S;const w=new Map;for(const O of x){const I=r.get(O);if(!I||(I.waypoints??[]).length===2)continue;const T=((S=I.source)==null?void 0:S.type)==="bpmn:Participant"?I.source:I.target,$=T===I.source?I.target:I.source;if($.x+$.width/2<=T.x+T.width)continue;const L=w.get(T.id)??{pool:T,msgs:[]};L.msgs.push({conn:I,other:$}),w.set(T.id,L)}for(const{pool:O,msgs:I}of w.values()){const T=Math.max(...I.map(({other:oe})=>oe.x+oe.width/2))+Bd;if(r.getAll().some(oe=>{if(oe.type!=="bpmn:Participant"||oe.id===O.id)return!1;const ie=oe;return O.x<ie.x+ie.width+$i&&T+$i>ie.x&&O.y<ie.y+ie.height&&O.y+O.height>ie.y}))continue;const L={x:O.x,y:O.y,width:O.width,height:O.height},D=[...O.incoming??[],...O.outgoing??[]],H=D.map(oe=>({c:oe,wps:(oe.waypoints??[]).map(ie=>({x:ie.x,y:ie.y}))})),j=D.flatMap(oe=>{const ie=oe.label;return ie?[{label:ie,x:ie.x,y:ie.y}]:[]}),Q=Mr();is(O,T-O.x);const ne=I.filter(({conn:oe,other:ie})=>SS(oe,O,ie)).length,de=Mr();if(!(ne>0&&de.messages>Q.messages&&de.lines>=Q.lines)){is(O,L.width);for(const{c:oe,wps:ie}of H){const ye=oe.waypoints??[];ye.length===ie.length&&ye.every((te,le)=>Math.abs(te.x-ie[le].x)<=.5&&Math.abs(te.y-ie[le].y)<=.5)||n.updateWaypoints(oe,ie.map(te=>({x:te.x,y:te.y})))}for(let oe=0;oe<3;oe++){let ie=0;for(const ye of j){const me=ye.x-ye.label.x,te=ye.y-ye.label.y;Math.abs(me)<=.5&&Math.abs(te)<=.5||(n.moveElements([ye.label],{x:me,y:te}),ie++)}if(!ie)break}}}},RS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:DataInputAssociation"&&w.type!=="bpmn:DataOutputAssociation")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},MS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:Association")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},UF=x=>{const w=[];for(const S of r.getAll()){if(S.type!=="bpmn:TextAnnotation")continue;const O=S;if(x.has(O.id))continue;const T=[...O.incoming??[],...O.outgoing??[]].filter(D=>D.type==="bpmn:Association").map(D=>D.source===O?D.target:D.source);if(!T.length||T.some(D=>D===void 0))continue;const $=D=>{if(!("waypoints"in D&&D.waypoints))return[D.id];const H=D,j=[H.source,H.target];return j.some(Q=>!Q)?[]:j.map(Q=>Q.id)},L=T.flatMap(D=>$(D));L.length&&L.every(D=>x.has(D))&&w.push(O)}return w},CS=()=>ft(Ge(r)).filter(x=>x.kind==="edge-crosses-shape").length,AS=x=>{const w=(x.children??[]).filter(bi);let S=0;for(let O=0;O<w.length;O++)for(let I=O+1;I<w.length;I++){const T=w[O],$=w[I];T.x<$.x+$.width&&T.x+T.width>$.x&&T.y<$.y+$.height&&T.y+T.height>$.y&&S++}return S},Mr=()=>{const x=Ge(r),w=S=>S.length>=2&&(S.every(O=>Math.abs(O.x-S[0].x)<.01)||S.every(O=>Math.abs(O.y-S[0].y)<.01));return{messages:x.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length,lines:x.edges.filter(S=>w(S.waypoints)).length}},TS=x=>{const w=new Map;for(const O of r.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const I=O;if(!I.waypoints||I.waypoints.length!==2)continue;const T=I.source,$=I.target;if(!T||!$)continue;const L=x.has(T.id);if(L===x.has($.id))continue;const D=L?$:T,H=g(D);if(!H||x.has(D.id))continue;const j=w.get(H.id);j?D.x<j.minX&&(j.minX=D.x):w.set(H.id,{pool:H,minX:D.x})}const S=[];for(const{pool:O,minX:I}of w.values()){const T=(O.children??[]).filter($=>bi($)&&!x.has($.id)&&$.x>=I);T.length&&S.push({subtree:T,pool:O})}return S},qF=(x,w,S)=>{const O=new Map(w.map($=>[$.pool.id,{subtree:[...$.subtree],pool:$.pool}])),I=new Set(x);for(const $ of w)for(const L of $.subtree)I.add(L.id);let T=!1;for(;;){let $=0;for(const L of TS(I)){if(L.pool===S)continue;const D=O.get(L.pool.id);D?D.subtree.push(...L.subtree):O.set(L.pool.id,{subtree:[...L.subtree],pool:L.pool});for(const H of L.subtree)I.add(H.id);$+=L.subtree.length}if(!$)break;T=!0}return T?[...O.values()]:null},YF=(x,w)=>{const S=new Map;for(const I of r.getAll()){if(I.type!=="bpmn:DataInputAssociation"&&I.type!=="bpmn:DataOutputAssociation")continue;const T=I,$=T.waypoints;if(!$||$.length<2||!$.every(de=>Math.abs(de.x-$[0].x)<1))continue;const L=T.source,D=T.target;if(!L||!D)continue;const H=x.has(L.id);if(H===x.has(D.id))continue;const j=H?D:L,Q=g(j);if(!Q||Q===w||Q===g(H?L:D))continue;const ne=S.get(Q.id);ne?j.x<ne.minX&&(ne.minX=j.x):S.set(Q.id,{pool:Q,minX:j.x})}const O=[];for(const{pool:I,minX:T}of S.values()){const $=(I.children??[]).filter(L=>bi(L)&&!x.has(L.id)&&L.x>=T);$.length&&O.push({subtree:$,pool:I})}return O},PS=x=>{const w=Ge(r),S=w.shapes.filter(I=>x.has(I.id)),O=new Set;for(const I of w.edges)if(!(I.type!=="bpmn:SequenceFlow"&&I.type!=="bpmn:MessageFlow"))for(const T of Ot(I,S))O.add(`${I.id}|${T.id}`);return O},Qg=new Map,KF=Gt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const w=G.get(x.id);return w?[{id:x.id,target:w.flow.target,source:w.flow.source}]:[]});for(const x of KF){if(x.target===void 0)continue;const w=N.get(x.target);if(!w)continue;const S=f(x.target),O=f(x.id);if(!S||!O)continue;const I=x.source!==void 0?f(x.source):O.source,T=O.target;if(!I||!T||T.id===S.id)continue;const $=bS.get(O.id)??{waypoints:O.waypoints,label:O.label},L=$.waypoints&&$.waypoints.length>=3&&Math.abs($.waypoints[0].x-$.waypoints[1].x)<1&&Math.abs($.waypoints[0].y-$.waypoints[1].y)>1?{x:$.waypoints[0].x,y:$.waypoints[0].y}:void 0,D=L?$.waypoints[1].y:void 0,H=L&&$.label?{x:$.label.x,y:$.label.y}:void 0,j=H&&$.label&&Math.abs(H.y+$.label.height/2-D)<=z/5&&H.x+$.label.width>L.x?H.x+$.label.width+6:void 0,Q=(I.outgoing??[]).filter(De=>De.type==="bpmn:SequenceFlow"&&De.id!==O.id&&De.target&&!kc.has(De.id)),ne=new Set(Q.map(De=>De.target.id)),de=De=>{const Tt={type:"bpmn:Task",x:De.x+2,y:De.y+2,width:De.width-4,height:De.height-4};return Q.find(Et=>(Et.waypoints??[]).some((Jt,Fe)=>!!Et.waypoints[Fe+1]&&bo(Jt,Et.waypoints[Fe+1],Tt)===0))},oe=$o(x.target),ie=new Set(oe.map(De=>De.id)),ye=qg.has(x.target)?{autoResize:!1}:void 0,me=Math.min(...oe.map(De=>De.x)),te=Math.max(...oe.map(De=>De.x+De.width)),le=I.x+I.width,ge=T.x+T.width<=I.x,K=(()=>{if(!ge)return;const De=g(S),Tt=((De==null?void 0:De.children)??[]).filter(ze=>bi(ze)&&!ie.has(ze.id)&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:Participant"),Et=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Jt=r.getAll().filter(ze=>{if(!Et.includes(ze.type))return!1;const jt=ze;return jt.id===O.id||kc.has(jt.id)||!jt.waypoints||jt.waypoints.length<2?!1:![jt.source,jt.target].some(Lt=>!Lt||ie.has(Lt.id))}),Fe=(ze,jt)=>oe.every(Lt=>{var ca;const Rt={id:Lt.id,type:Lt.type,x:Lt.x+ze,y:Lt.y+jt,width:Lt.width,height:Lt.height};return De&&(Rt.x<De.x||Rt.x+Rt.width>De.x+De.width||Rt.y<De.y||Rt.y+Rt.height>De.y+De.height)||!Cp((ca=N.get(Lt.id))==null?void 0:ca.node.lane,Lt,Lt.y+jt+Lt.height/2)||Tt.some(Xn=>Rt.x<Xn.x+Xn.width+Ni&&Rt.x+Rt.width+Ni>Xn.x&&Rt.y<Xn.y+Xn.height+Ni&&Rt.y+Rt.height+Ni>Xn.y)?!1:Jt.every(Xn=>{for(let yo=0;yo+1<Xn.waypoints.length;yo++)if(bo(Xn.waypoints[yo],Xn.waypoints[yo+1],Rt)<Ni)return!1;return!0})}),Ke=I.x+I.width/2,bt=I.y+I.height/2,it=$.waypoints??[],kt=it.length>=2&&Math.abs(it[0].y-it[1].y)<1&&it[1].x<it[0].x;return[...D!==void 0?[{cx:Ke,cy:D}]:[],...kt?[{cx:I.x-Rr-S.width/2,cy:it[0].y}]:[],{cx:Ke,cy:bt+z},{cx:Ke,cy:bt-z}].find(ze=>Fe(ze.cx-(S.x+S.width/2),ze.cy-(S.y+S.height/2)))})(),ue=ge&&!K?le:T.x,Re=(()=>{var bt;if(L||ge)return 0;const De=$.label,Tt=((bt=O.businessObject)==null?void 0:bt.name)??"";if(!De||De.width==null||!Tt.trim())return 0;const Et=le+Rr,Jt=I.y+I.height/2-S.height/2;if(Math.min(De.y+De.height,Jt+S.height)-Math.max(De.y,Jt)<3||De.x+De.width-Et<3)return 0;const Ke=De.x+De.width+HF-Et;return Ke<=S.width?Ke:0})();Re>0&&u.add(O.id);const Ie=S.y+S.height/2,nt=zF(oe,le+Rr+Re-me,[0,I.y+I.height/2-Ie,T.y+T.height/2-Ie],ue,le,I.y+I.height/2),Xe=le+Rr+Re+nt,Ae=(()=>{if(j===void 0)return 0;const De=le+Rr,Tt=I.y+I.height/2-S.height/2,Et={x:De,y:Tt,width:te-me,height:S.height},Jt=g(I);return((Jt==null?void 0:Jt.children)??[]).some(Ke=>bi(Ke)&&!ie.has(Ke.id)&&Ke.id!==I.id&&Ke.id!==T.id&&Ke.type!=="bpmn:Group"&&Ke.type!=="bpmn:Participant"&&Ke.x<Et.x+Et.width&&Ke.x+Ke.width>Et.x&&Ke.y<Et.y+Et.height&&Ke.y+Ke.height>Et.y)||de(Et)?Math.max(0,j-De):0})(),Se=K?0:te-me+Rr*2+nt+Ae+Re-(ge?0:T.x-le);let Ce=[];if(Se>0){const De=g(S),Tt=(De==null?void 0:De.children)??[],Et=it=>it.type==="bpmn:Lane";Ce=(()=>{const it=new Set;for(const Ue of Tt)bi(Ue)&&!ie.has(Ue.id)&&Ue.id!==I.id&&Ue.x>=ue&&it.add(Ue.id);const kt=[];for(const Ue of Tt){if(Ue.type!=="bpmn:DataStoreReference"&&Ue.type!=="bpmn:DataObjectReference")continue;const ze=Ue,Lt=[...ze.incoming??[],...ze.outgoing??[]].filter(Rt=>Rt.type==="bpmn:DataInputAssociation"||Rt.type==="bpmn:DataOutputAssociation").map(Rt=>Rt.source===ze?Rt.target:Rt.source);Lt.length&&Lt.every(Rt=>Rt!==void 0&&it.has(Rt.id))&&kt.push(ze)}return kt})();const Fe=Tt.filter(it=>!("waypoints"in it&&it.waypoints)&&!Et(it)&&it.type!=="label"&&!ie.has(it.id)&&it.id!==I.id&&it.x>=ue),Ke=Fe.flatMap(it=>it.labels??[]),bt=De?[De,...Tt.filter(it=>Et(it))]:[];if(Fe.length){const it=new Set(Fe.map(rt=>rt.id)),kt=TS(it),Ue=kt.length?qF(it,kt,De):null,ze=rt=>{const Mt=new Set(it);for(const Ht of rt)for(const jo of Ht.subtree)Mt.add(jo.id);return UF(Mt)},jt=ze(kt),Lt=Ue?ze(Ue):jt,Rt=Jg(it),ca=new Set(it);for(const rt of kt)for(const Mt of rt.subtree)ca.add(Mt.id);const Xn=kt.length?Jg(ca):Rt,yo=(()=>{if(!Ue)return[];const rt=new Set(it);for(const Mt of Ue)for(const Ht of Mt.subtree)rt.add(Ht.id);return Jg(rt)})(),cs=Ue??kt,la=(()=>{const rt=new Set(it);for(const Mt of cs)for(const Ht of Mt.subtree)rt.add(Ht.id);return YF(rt,De)})(),lm=la.length?ze([...cs,...la]):jt,Ki=new Set([...Fe,...bt].map(rt=>rt.id)),St=Tt.filter(rt=>{const Mt=rt.labelTarget;return rt.type==="label"&&!!Mt&&"waypoints"in Mt&&!!Mt.source&&!!Mt.target&&Ki.has(Mt.source.id)&&Ki.has(Mt.target.id)}),Sn=VF();n.createSpace([...Fe,...Ke,...St],bt,{x:Se,y:0},"e",ue-1);const Qt=(rt,Mt,Ht)=>{const jo=Mr(),Lp=Ht?PS(Ht):null,Ip=Fo(rt,Se,!!Ht);if(!Ip)return!1;const Ic=Mt.length?ES(Mt,Se):null,Bp=Mr(),en=!!Ht&&!!Lp&&[...PS(Ht)].some(pa=>!Lp.has(pa));return Bp.messages>jo.messages&&Bp.lines>=jo.lines&&!en?!0:(Ic==null||Ic(),Ip(),!1)},mi=la.length>0&&Qt([...cs,...la],Ue?yo:Xn,new Set(la.flatMap(rt=>rt.subtree.map(Mt=>Mt.id)))),ua=!mi&&Ue?Qt(Ue,yo):!1;let vo=mi||ua;!vo&&kt.length&&(vo=Qt(kt,Xn));const ls=mi?lm:ua?Lt:jt;if(!vo){for(const rt of kt){const Mt=Mr(),Ht=Fo([rt],Se);if(!Ht)continue;const jo=Mr();(jo.messages<=Mt.messages||jo.lines<Mt.lines)&&Ht()}if(Rt.length){const rt=Mr(),Mt=ES(Rt,Se);if(Mt){const Ht=Mr();(Ht.messages<=rt.messages||Ht.lines<rt.lines)&&Mt()}}}if(WF(Sn),ls.length){const rt=()=>new Set(ft(Ge(r)).map(Ht=>ct(Ht))),Mt=Ht=>{const jo=MS(),Lp=rt(),Ip=Ht.map(en=>({a:en,x:en.x,y:en.y})),Ic=r.filter(en=>en.type==="label").map(en=>({label:en,x:en.x,y:en.y}));n.moveElements(Ht,{x:Se,y:0});const Bp=[...rt()].filter(en=>!Lp.has(en));if(MS()<jo&&Bp.length===0)return!0;for(const{a:en,x:pa,y:Bc}of Ip)(en.x!==pa||en.y!==Bc)&&n.moveElements([en],{x:pa-en.x,y:Bc-en.y});for(const en of Ic){const pa=en.x-en.label.x,Bc=en.y-en.label.y;(pa!==0||Bc!==0)&&n.moveElements([en.label],{x:pa,y:Bc})}return!1};if(!Mt(ls)&&ls.length>1)for(const Ht of ls)Mt([Ht])}}}const ce=w.node.lane!==void 0?f(w.node.lane):w.node.participant!==void 0?f(w.node.participant):void 0,_e=De=>{if(!ce)return!0;const Tt=De.y+De.height/2;return Tt>=ce.y&&Tt<=ce.y+ce.height},He=!_e(I)&&_e(T),st=De=>De.y+De.height/2,Oe=()=>{const De=I.x+I.width,Tt=T.x,Et=st(T)-S.height/2,Jt=st(T)+S.height/2;return!r.getAll().some(Fe=>bi(Fe)&&Fe.type!=="bpmn:Participant"&&Fe.type!=="bpmn:Group"&&Fe.type!=="bpmn:TextAnnotation"&&Fe.id!==I.id&&Fe.id!==T.id&&Fe.id!==S.id&&Fe.x<Tt&&Fe.x+Fe.width>De&&Fe.y<Jt&&Fe.y+Fe.height>Et)},Ye=!He&&w.band!==void 0&&_e(T)&&!Un(w.node.lane,w.node.participant,w.band,st(I))&&Un(w.node.lane,w.node.participant,w.band,st(T))&&T.x>=I.x+I.width&&Oe(),Dt=He||Ye?T:I,Pn=Dt.y+Dt.height/2,kn=Pn-(S.y+S.height/2),xt=w.band!==void 0,qi=xt?[S]:oe,ss=(w.band===void 0||Un(w.node.lane,w.node.participant,w.band,Pn))&&At(x.target)&&qi.every(De=>{var Tt;return Cp((Tt=N.get(De.id))==null?void 0:Tt.node.lane,De,De.y+De.height/2+kn)}),y6=De=>Math.abs(De.y+De.height/2-(S.y+S.height/2))<=z/2;if(ss&&xt){const De=Math.abs(kn)<=z/2?oe.filter(Fe=>Fe.id!==S.id&&y6(Fe)):[],Tt=S.y+S.height/2,Jt=w.band!==void 0&&!Un(w.node.lane,w.node.participant,w.band,Tt)?oe.filter(Fe=>{var Ke,bt;return Fe.id!==S.id&&!De.includes(Fe)&&((Ke=N.get(Fe.id))==null?void 0:Ke.band)===w.band&&((bt=N.get(Fe.id))==null?void 0:bt.node.lane)===w.node.lane&&(Math.abs(Fe.y+Fe.height/2-Tt)<=z/2||Un(w.node.lane,w.node.participant,w.band,Fe.y+Fe.height/2))}).map(Fe=>({t:Fe,dy:Pn-(Fe.y+Fe.height/2)})).filter(({dy:Fe})=>Fe!==0):[];if(n.moveElements(oe,{x:Xe-me,y:0},void 0,ye),n.moveElements([S],{x:0,y:kn},void 0,ye),De.length){const Fe=()=>new Set(ft(Ge(r)).map(ze=>ct(ze))),Ke=Fe(),bt=r.filter(ze=>ze.type==="label").map(ze=>({label:ze,x:ze.x,y:ze.y}));n.moveElements(De,{x:0,y:kn});const it=Fe(),kt=[...it].filter(ze=>!Ke.has(ze)).length,Ue=[...Ke].filter(ze=>!it.has(ze)).length;if(kt>Ue){n.moveElements(De,{x:0,y:-kn});for(const ze of bt){const jt=ze.x-ze.label.x,Lt=ze.y-ze.label.y;(jt!==0||Lt!==0)&&n.moveElements([ze.label],{x:jt,y:Lt})}}}if(Jt.length){const Fe=new Set(oe.map(Ke=>Ke.id));for(const{t:Ke,dy:bt}of Jt)U(Ke.parent,Ke,Ke.x+Ke.width/2,Ke.y+Ke.height/2+bt,Fe)||n.moveElements([Ke],{x:0,y:bt})}}else n.moveElements(oe,{x:Xe-me,y:ss?kn:0},void 0,ye);const Yi=g(S);if(!ss&&w.node.lane===void 0&&w.band!==void 0&&Yi){const De=Yi.y+V+gi(`pool:${w.node.participant??""}`,w.band)*z,Tt=De-(S.y+S.height/2);Tt!==0&&!U(Yi,S,S.x+S.width/2,De,ie)&&n.moveElements([S],{x:0,y:Tt},void 0,ye)}if(K)n.moveElements(oe,{x:K.cx-(S.x+S.width/2),y:K.cy-(S.y+S.height/2)},void 0,ye);else if(Yi){const De=(Yi.children??[]).filter(Fe=>bi(Fe)&&!ie.has(Fe.id)&&Fe.type!=="bpmn:Group"&&Fe.type!=="bpmn:Participant"),Tt=(Fe,Ke,bt,it,kt)=>Fe.x+Ke<kt.x+kt.width+it&&Fe.x+Ke+Fe.width+it>kt.x&&Fe.y+bt<kt.y+kt.height+it&&Fe.y+bt+Fe.height+it>kt.y,Et=De.find(Fe=>Tt(S,0,0,0,Fe)),Jt=Et?void 0:de(S);if(Et||Jt){const Fe=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Ke=r.getAll().filter(St=>{if(!Fe.includes(St.type))return!1;const Sn=St;return kc.has(Sn.id)||!Sn.waypoints||Sn.waypoints.length<2?!1:![Sn.source,Sn.target].some(Qt=>!Qt||ie.has(Qt.id))}),bt=(St,Sn,Qt)=>{var mi;return Cp((mi=N.get(St.id))==null?void 0:mi.node.lane,St,St.y+Qt+St.height/2)&&St.x+Sn>=Yi.x&&St.x+Sn+St.width<=Yi.x+Yi.width&&St.y+Qt>=Yi.y&&St.y+Qt+St.height<=Yi.y+Yi.height},it=(St,Sn)=>oe.every(Qt=>bt(Qt,St,Sn)&&!De.some(mi=>Tt(Qt,St,Sn,Ni,mi))&&Ke.every(mi=>{const ua={id:Qt.id,type:Qt.type,x:Qt.x+St,y:Qt.y+Sn,width:Qt.width,height:Qt.height};for(let vo=0;vo+1<mi.waypoints.length;vo++)if(bo(mi.waypoints[vo],mi.waypoints[vo+1],ua)<Ni)return!1;return!0})),kt=S.y+S.height/2,Ue=[D,T.y+T.height/2].filter(St=>St!==void 0&&Math.abs(St-kt)>=1),ze=Et&&ne.has(Et.id)?Et:Jt==null?void 0:Jt.target,jt=ze?ze.x-S.x:0,Lt=Math.max(...oe.map(St=>St.x+St.width)),Rt=[...jt!==0?[jt]:[],...nt!==0?[-nt]:[],0],ca=j===void 0?[]:Rt.map(St=>Math.max(St,j-S.x)),Xn=St=>Lt+St+Rr<=T.x,yo=[...new Set([...ca,...Rt])].filter(Xn),cs=Et&&ne.has(Et.id)?[Et.x+Et.width+Rr-S.x]:[],la=j===void 0?[]:cs.map(St=>Math.max(St,j-S.x)),lm=[...new Set([...la,...cs])].filter(St=>Xn(St)&&!yo.includes(St));let Ki;for(const St of[yo,lm]){for(const Sn of Ue){for(const Qt of St)if(it(Qt,Sn-kt)){Ki={dx:Qt,dy:Sn-kt};break}if(Ki)break}if(Ki)break}if(Ki){const St=rt=>{const Mt=rt;return[Mt.edge,Mt.other,...Array.isArray(Mt.edges)?Mt.edges:[]].some(Ht=>typeof Ht=="string"&&kc.has(Ht))},Sn=()=>new Set(ft(Ge(r)).filter(rt=>!St(rt)).map(rt=>ct(rt))),Qt=Sn(),mi=r.filter(rt=>rt.type==="label").map(rt=>({label:rt,x:rt.x,y:rt.y}));n.moveElements(oe,{x:Ki.dx,y:Ki.dy},void 0,ye);const ua=Sn(),vo=[...ua].filter(rt=>!Qt.has(rt)).length,ls=[...Qt].filter(rt=>!ua.has(rt)).length;if(vo>ls){n.moveElements(oe,{x:-Ki.dx,y:-Ki.dy},void 0,ye);for(const rt of mi){const Mt=rt.x-rt.label.x,Ht=rt.y-rt.label.y;(Mt!==0||Ht!==0)&&n.moveElements([rt.label],{x:Mt,y:Ht})}}else L&&Qg.set(O.id,{exit:L,channelY:D,label:H})}}}{const De=new Set(oe.map(Ke=>Ke.id)),Tt=new Set(Y.map(Ke=>Ke.flow.id)),Et=20,Jt=Ke=>{const bt=Ke.source,it=Ke.target,kt=Math.min(bt.x,it.x)-Et,Ue=Math.max(bt.x+bt.width,it.x+it.width)+Et,ze=Math.min(bt.y,it.y)-Et,jt=Math.max(bt.y+bt.height,it.y+it.height)+Et;return Ke.waypoints.some(Lt=>Lt.x<kt||Lt.x>Ue||Lt.y<ze||Lt.y>jt)},Fe=new Map;for(const Ke of oe)for(const bt of[...Ke.incoming??[],...Ke.outgoing??[]])(G.has(bt.id)||bt.id!==x.id&&Tt.has(bt.id))&&!(De.has(bt.source.id)&&De.has(bt.target.id))&&Fe.set(bt.id,bt);for(const Ke of Fe.values())Jt(Ke)&&Pp(Ke)}const mo=Ce.length?g(Ce[0]):void 0;if(mo){const De={assoc:RS(),overlaps:AS(mo),crosses:CS()},Tt=Ce.map(Ue=>({st:Ue,x:Ue.x})),Et=r.filter(Ue=>Ue.type==="label").map(Ue=>({label:Ue,x:Ue.x,y:Ue.y})),Jt=Math.min(...Ce.flatMap(Ue=>[...Ue.incoming??[],...Ue.outgoing??[]].filter(ze=>ze.type==="bpmn:DataInputAssociation"||ze.type==="bpmn:DataOutputAssociation").map(ze=>(ze.source===Ue?ze.target:ze.source).x))),Fe=new Set(Ce.map(Ue=>Ue.id)),Ke=(mo.children??[]).filter(bi).filter(Ue=>!Fe.has(Ue.id));let bt=Jt;for(const Ue of[...Ce].sort((ze,jt)=>ze.x-jt.x)){let ze=bt;for(let jt=0;jt<100;jt++){const Lt=Ke.find(Rt=>ze<Rt.x+Rt.width+$i&&ze+Ue.width+$i>Rt.x&&Ue.y<Rt.y+Rt.height&&Ue.y+Ue.height>Rt.y);if(!Lt)break;ze=Lt.x+Lt.width+$i}ze!==Ue.x&&n.moveElements([Ue],{x:ze-Ue.x,y:0}),bt=ze+Ue.width+$i}const it=bt+150-(mo.x+mo.width);it>0&&is(mo,mo.width+it);const kt={assoc:RS(),overlaps:AS(mo),crosses:CS()};if(kt.assoc>=De.assoc||kt.overlaps>De.overlaps||kt.crosses>De.crosses){for(const{st:Ue,x:ze}of Tt)Ue.x!==ze&&n.moveElements([Ue],{x:ze-Ue.x,y:0});it>0&&is(mo,mo.width-it);for(const Ue of Et){const ze=Ue.x-Ue.label.x,jt=Ue.y-Ue.label.y;(ze!==0||jt!==0)&&n.moveElements([Ue.label],{x:ze,y:jt})}}}}for(const[x,w]of qg){const S=f(x);if(!S)continue;const O=w.container,I=Math.abs(S.y+S.height/2-O.y-w.relCy)>=.5,T=S.label,$=Math.min(S.y,T&&!T.hidden?T.y:S.y),L=Math.max(S.y+S.height,T&&!T.hidden?T.y+T.height:0);if(I&&$>=O.y&&L<=O.y+O.height)continue;const D=S.y;w.grow(),S.y!==D&&n.moveElements([S],{x:0,y:D-S.y},void 0,{autoResize:!1})}const kS=(x,w)=>{const S=w.target===x,O=m(w.source),I=m(w.target),T=S?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,I,w.id?{type:T,businessObject:i.create(T,{id:w.id})}:{type:T})},OS=x=>{for(const w of h){if(!w.participant.blackBox)continue;const S=f(w.participant.id);if(!S)continue;const O=[];for(const T of E){const $=T.flow.source===w.participant.id?T.flow.target:T.flow.target===w.participant.id?T.flow.source:void 0,L=$?f($):void 0;L&&typeof L.x=="number"&&L.type!=="bpmn:Participant"&&O.push(L)}if(!O.length)continue;if(!x&&w.order===void 0){const T=(()=>{var L;const $=new Map;for(const D of O){const H=g(D);if(!H)continue;const j=$.get(H.id);j?j.n+=1:$.set(H.id,{shape:H,n:1})}return(L=[...$.values()].sort((D,H)=>H.n-D.n)[0])==null?void 0:L.shape})();if(T){const $=H=>H.reduce((j,Q)=>j+Q,0)/H.length,L=$(O.map(H=>H.y+H.height/2))<T.y+T.height/2,D=r.filter(H=>H.type==="bpmn:Participant"&&H.id!==w.participant.id&&H.id!==T.id).filter(H=>L?H.y+H.height<=T.y+5:H.y>=T.y+T.height-5);if(D.length){const H=[...D.reduce((ge,K)=>ge.set(K.y,(ge.get(K.y)??0)+1),new Map)].sort((ge,K)=>K[1]-ge[1]||(L?K[0]-ge[0]:ge[0]-K[0]))[0][0],j=Math.min(S.width,sT),Q=cT,ne=O.map(ge=>ge.x+ge.width/2),de=Math.round($(ne)-j/2),oe=Math.max(...ne)+Bd,ie=ge=>({x:ge,width:Math.max(j,oe-ge)}),ye=D.filter(ge=>Math.min(ge.y+ge.height,H+Q)-Math.max(ge.y,H)>0),me=ge=>{const K=ie(ge);return ye.some(ue=>ue.x<K.x+K.width&&K.x<ue.x+ue.width)},te=ge=>{const K=ie(ge);return ne.filter(ue=>ue>=K.x+10&&ue<=K.x+K.width-10).length},le=(()=>{if(!me(de))return de;const ge=te(de);return ye.flatMap(K=>[K.x+K.width+dv,K.x-dv-j]).map(K=>Math.round(K)).filter(K=>!me(K)&&te(K)>=ge).sort((K,ue)=>Math.abs(K-de)-Math.abs(ue-de))[0]??de})();if(le!==S.x||H!==S.y||j!==S.width||Q!==S.height){const ge=()=>new Set(ft(Ge(r)).map(Xe=>ct(Xe))),K=ge(),ue={x:S.x,y:S.y,width:S.width,height:S.height};n.resizeShape(S,{x:le,y:H,width:j,height:Q});const Re=ge(),Ie=[...Re].filter(Xe=>!K.has(Xe)).length,nt=[...K].filter(Xe=>!Re.has(Xe)).length;Ie>nt&&n.resizeShape(S,ue)}}}}const I=Math.max(...O.map(T=>T.x+T.width/2))+Bd;if(I>S.x+S.width&&n.resizeShape(S,{x:S.x,y:S.y,width:I-S.x,height:S.height}),!!x)for(const T of E){const $=f(T.flow.id),L=T.flow.source===w.participant.id?T.flow.target:T.flow.target===w.participant.id?T.flow.source:void 0,D=L?f(L):void 0;if(!$||!D||D.type==="bpmn:Participant")continue;const H=D.x+D.width/2;H<S.x+10||H>S.x+S.width-10||SS($,S,D)}}};OS(!1);for(const x of E){const w=x.flow;n.connect(m(w.source),m(w.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:w.id,name:w.name})})}{const S=new Set([...Y.map(D=>D.flow.id),...E.map(D=>D.flow.id)].filter(D=>!!D)),O=r.filter(D=>!!D.waypoints),I=(D,H)=>Math.abs(H.x-D.x)<2?"L":Math.abs(H.x-(D.x+D.width))<2?"R":Math.abs(H.y-D.y)<2?"T":Math.abs(H.y-(D.y+D.height))<2?"B":void 0,T=new Map,$=(D,H,j)=>{if(!D||!H||typeof D.x!="number")return;const Q=I(D,H);if(!Q)return;let ne=T.get(D.id);ne||T.set(D.id,ne=new Map),ne.set(Q,[...ne.get(Q)??[],j])};for(const D of O){const H=D.waypoints;!H||H.length<2||($(D.source,H[0],{id:D.id,dir:"out"}),$(D.target,H[H.length-1],{id:D.id,dir:"in"}))}const L=new Set;for(const[D,H]of T){const j=f(D);if(!j||typeof j.x!="number")continue;const Q=te=>{var ge;const le=(ge=f(te.id))==null?void 0:ge.source;return!!le&&typeof le.x=="number"&&le.x+le.width/2>j.x+j.width/2};if(![...H.values()].some(te=>te.length>=3&&te.some(le=>le.dir==="out")&&te.some(le=>le.dir==="in"&&S.has(le.id)&&Q(le))))continue;const de=g(j);if(!de||L.has(de.id)||(de.children??[]).some(te=>te.type==="bpmn:Lane"))continue;const oe=(iR=H.get("T"))!=null&&iR.length?(oR=H.get("B"))!=null&&oR.length?void 0:"B":"T";if(!oe||(oe==="T"?j.y-de.y:de.y+de.height-(j.y+j.height))>=z)continue;const ye=(de.children??[]).filter(te=>!("waypoints"in te&&te.waypoints)&&te.type!=="label"&&typeof te.x=="number"),me=de.y+de.height;n.resizeShape(de,{x:de.x,y:de.y,width:de.width,height:de.height+z}),Wt(me,de.id,z),oe==="T"&&ye.length&&n.moveElements(ye,{x:0,y:z}),L.add(de.id)}}const em=20,DS=4,XF=3,ZF=2,JF=2,QF=[10,30,80],Ui=()=>{const x=Ge(r);return{bad:ft(x).filter(w=>w.kind==="edge-crosses-shape"||w.kind==="edge-overlap-opposite"||w.kind==="edge-overlap-mixed").length,crossings:iy(x),straight:x.edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.waypoints.length===2).length}},Cr=x=>{const w=Ge(r),S=w.edges.find(O=>O.id===x);return S?Ot(S,Dn(w)).length:0},Oc=x=>Cr(x)>0,os=x=>Ge(r).edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.id!==x&&w.waypoints.length===2).length,LS=(x,w,S)=>Fo([{subtree:x,pool:w}],S),IS=(x,w)=>w.bad>x.bad||w.crossings>x.crossings&&w.straight<=x.straight&&w.bad>=x.bad,rs=(x,w)=>IS(x,w)||w.straight<x.straight,ra=(x,w,S=()=>!0,O=IS,I=!1)=>{const T=Ui(),$=Fo(x,w,I);if(!$)return!1;const L=Ui();return O(T,L)||!S()?($(),!1):!0},e6=(x,w,S,O=()=>!0)=>ra([{subtree:x,pool:w}],S,O),aa=x=>{var w;return!!((w=N.get(x))!=null&&w.node.participant)},as=new Map;for(const x of E){if(!aa(x.flow.target))continue;const w=as.get(x.flow.target)??[];w.push(x),as.set(x.flow.target,w)}const Dc=[...as.keys()],tm=new Set(Y.map(x=>x.flow.target)),BS=x=>Ap.findIndex(({op:w})=>w.participant.id===x);Dc.sort((x,w)=>{var I,T;const S=tm.has(x)?1:0,O=tm.has(w)?1:0;return S!==O?S-O:BS((I=N.get(x))==null?void 0:I.node.participant)-BS((T=N.get(w))==null?void 0:T.node.participant)});const Ar=x=>x.x+x.width/2,t6=x=>{const w=new Map;for(const I of r.getAll()){const T=I;if(!T.waypoints||!T.source||!T.target)continue;(w.get(T.source.id)??w.set(T.source.id,[]).get(T.source.id)).push(T.target.id)}const S=new Set([x]),O=[x];for(let I=0;I<O.length;I++)for(const T of w.get(O[I])??[])S.has(T)||(S.add(T),O.push(T));return S},n6=(x,w)=>{const S=t6(w);let O;for(const I of r.getAll()){const T=I;if(T.type!=="bpmn:MessageFlow"||!T.source||!T.target||T.target.id!==x||S.has(T.source.id))continue;const $=T.source;if(typeof $.x!="number"||$.type==="bpmn:Participant")continue;const L=Ar($);(O===void 0||L>O)&&(O=L)}return O},nm=(x,w)=>{const S=f(x.flow.source);if(S)return S.type==="bpmn:Participant"?n6(S.id,w):Ar(S)},NS=x=>{let w;for(const S of as.get(x)??[]){const O=nm(S,x);O!==void 0&&(!w||O>w.cx)&&(w={op:S,cx:O})}return w==null?void 0:w.op},i6=x=>{const w=NS(x),S=f(x),O=w?nm(w,x):void 0;return S&&O!==void 0?O-Ar(S):void 0},$S=x=>{const w=i6(x);return w!==void 0&&Math.abs(w)<em},kp=(x,w,S,O,I)=>{var T;for(let $=!0;$;){$=!1;for(const L of E){if(L.flow.id===S)continue;const D=w.has(L.flow.source),H=w.has(L.flow.target);if(D===H||O(D?L.flow.source:L.flow.target))continue;const j=D?L.flow.target:L.flow.source;if(I(j)||!aa(j))continue;const Q=f(L.flow.id);if(!(Q!=null&&Q.waypoints)||Q.waypoints.length!==2)continue;const ne=f(j),de=(T=N.get(j))==null?void 0:T.node.participant;if(!ne||!de)continue;const oe=$o(j,ie=>ie.x>=ne.x).filter(ie=>!w.has(ie.id));if(!(!oe.length||oe.some(ie=>I(ie.id)))){for(const ie of oe)w.add(ie.id);x.set(de,[...x.get(de)??[],...oe]),$=!0}}}return[...x].map(([$,L])=>({subtree:L,pool:m($)}))},im=(x,w,S,O,I)=>kp(new Map([[w,[...x]]]),new Set(x.map(T=>T.id)),O,T=>T===S,T=>T===I),om=x=>{const w=NS(x);if(!w)return null;const S=f(x),O=f(w.flow.source),I=nm(w,x);if(!S||!O||I===void 0)return null;const T=I-Ar(S);if(T>=em){const $=N.get(x).node.participant,L=$o(x,H=>H.x>=S.x),D=$o(x,H=>H.x>=S.x&&!$S(H.id));return{groups:im(L,$,x,w.flow.id,w.flow.source),dx:T,cut:D.length<L.length?im(D,$,x,w.flow.id,w.flow.source):void 0}}if(-T>=em&&aa(w.flow.source)){const $=N.get(w.flow.source).node.participant,L=$o(w.flow.source,D=>D.x>=O.x&&!$S(D.id));return{groups:im(L,$,w.flow.source,w.flow.id,x),dx:-T}}return null},FS=()=>Dc.map(x=>({id:x,plan:om(x)})).filter(x=>!!x.plan).sort((x,w)=>Math.min(...x.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))-Math.min(...w.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))).map(x=>x.id),jS=()=>{var O;const x=r.getAll().filter(bi).filter(I=>I.type!=="bpmn:Participant"&&I.type!=="bpmn:Group").map(I=>[I.x,I.x+I.width]).sort((I,T)=>I[0]-T[0]);let w=((O=x[0])==null?void 0:O[1])??0,S=0;for(const[I,T]of x.slice(1))I>w&&(S=Math.max(S,I-w)),w=Math.max(w,T);return S},HS=x=>{if(!x.cut)return Fo(x.groups,x.dx);const w=Fo(x.groups,x.dx,!0);if(!w)return null;const S=Ui(),O=jS();w();const I=Fo(x.cut,x.dx,!0);if(I){const T=Ui();if(T.bad<=S.bad&&T.crossings<=S.crossings&&T.straight>=S.straight&&jS()<O)return I;I()}return Fo(x.groups,x.dx)};for(let x=0;x<3;x++){const w=Ui(),S=[];for(const I of FS()){const T=om(I);if(!T)continue;const $=HS(T);$&&S.push($)}if(!S.length)break;if(!rs(w,Ui()))continue;for(const I of S.reverse())I();let O=!1;for(const I of FS()){const T=om(I);if(!T)continue;const $=Ui(),L=HS(T);L&&(rs($,Ui())?L():O=!0)}if(!O)break}for(const x of Dc){if(tm.has(x))continue;const w=N.get(x);if(!w||w.node.lane!==void 0)continue;const S=ut(w);if(S===void 0)continue;const O=f(x),I=O?g(O):void 0;if(!O||!I)continue;const T=I.y+V+gi(`pool:${w.node.participant??""}`,S)*z,$=T-(O.y+O.height/2);$!==0&&!U(I,O,O.x+O.width/2,T)&&n.moveElements([O],{x:0,y:$})}const Op=()=>{const x=r.filter(O=>O.type==="bpmn:Participant"),w=new Map(x.map(O=>[O.id,O]));let S=0;for(const{pools:[O,I]}of yd(x)){const T=w.get(O),$=w.get(I);S+=(Math.min(T.x+T.width,$.x+$.width)-Math.max(T.x,$.x))*(Math.min(T.y+T.height,$.y+$.height)-Math.max(T.y,$.y))}return S},rm=new Set,zS=new Set;for(let x=0,w=!0;w&&x<XF;x++){w=!1;for(const S of Dc.flatMap(O=>as.get(O)??[])){if(rm.has(S.flow.id)||!Oc(S.flow.id))continue;const O=f(S.flow.target);if(!O)continue;const I=m(N.get(S.flow.target).node.participant),T=$o(S.flow.target,j=>j.x>=O.x),$=O.width+se,L=Cr(S.flow.id),D=os(S.flow.id),H=Op();for(let j=1;j<=DS;j++){const Q=()=>Cr(S.flow.id)>=L||Op()>H?!1:os(S.flow.id)>=D?!0:(zS.add(S.flow.id),!1);if(e6(T,I,$*j,Q)){rm.add(S.flow.id),w=!0;break}}}}const GS=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const w=x.source,S=x.target;return!!w&&!!S&&S.x+S.width<w.x}).length;for(const x of Dc.flatMap(w=>as.get(w)??[])){if(rm.has(x.flow.id)||!zS.has(x.flow.id)||!Oc(x.flow.id))continue;const w=f(x.flow.target);if(!w)continue;const S=m(N.get(x.flow.target).node.participant),O=$o(x.flow.target,ne=>ne.x>=w.x),I=new Set(O.map(ne=>ne.id)),T=new Map;for(const ne of r.filter(de=>de.type==="bpmn:MessageFlow")){if(((rR=ne.waypoints)==null?void 0:rR.length)!==2||!ne.source||!ne.target)continue;const de=I.has(ne.source.id);if(de===I.has(ne.target.id))continue;const oe=de?ne.target:ne.source,ie=(aR=N.get(oe.id))==null?void 0:aR.node.participant;!ie||T.has(oe.id)||T.set(oe.id,{subtree:[oe],pool:m(ie)})}if(!T.size)continue;const $=w.width+se,L=Cr(x.flow.id),D=os(x.flow.id),H=Op(),j=GS(),Q=()=>Cr(x.flow.id)<L&&os(x.flow.id)>=D&&Op()<=H&&GS()<=j;for(let ne=1;ne<=ZF&&!ra([{subtree:O,pool:S},...T.values()],$*ne,Q);ne++);}const am=E.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),VS=new Set(am.map(x=>x.id));for(const x of r.filter(w=>w.type==="bpmn:MessageFlow"))VS.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&am.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of am){if(!Oc(x.id))continue;const w=f(x.source),S=f(x.target);if(!w||!S)continue;let O,I,T;if(x.preexisting){const[L,D]=w.type==="bpmn:Participant"?[S,w]:[w,S];if(O=Ar(L),O<D.x||O>D.x+D.width)continue;[I,T]=L.y<D.y?[L.y+L.height,D.y]:[D.y+D.height,L.y]}else{if(w.type==="bpmn:Participant"||S.type==="bpmn:Participant"||(O=w.x+w.width/2,Math.abs(O-(S.x+S.width/2))>15))continue;[I,T]=w.y<S.y?[w.y+w.height,S.y]:[S.y+S.height,w.y]}const $=[...N.values()].map(L=>f(L.node.id)).filter(L=>!!L&&L.id!==w.id&&L.id!==S.id).filter(L=>L.x<=O&&O<=L.x+L.width&&L.y+L.height>I&&L.y<T).sort((L,D)=>L.x-D.x);for(const L of $){const D=(sR=N.get(L.id))==null?void 0:sR.node.participant,H=D?f(D):void 0;if(!D||!H)continue;const j=[...N.values()].filter(le=>le.node.participant===D).map(le=>le.node.id),Q=le=>le.map(ge=>f(ge)).filter(ge=>!!ge),de=[GF(L.id,le=>{var ge;return((ge=N.get(le.id))==null?void 0:ge.node.participant)===D}),Q(j)].filter(le=>le.length).map(le=>[{subtree:le,pool:H}]);if(x.preexisting){const le=Q(j);le.length&&de.push(kp(new Map([[D,[...le]]]),new Set(le.map(ge=>ge.id)),x.id,()=>!1,ge=>ge===w.id||ge===S.id))}const oe=L.width+se,ie=Cr(x.id),ye=os(x.id),me=()=>Cr(x.id)<ie&&os(x.id)>=ye;let te=!1;for(const le of de){for(let ge=1;ge<=DS;ge++)if(ra(le,oe*ge,me)){te=!0;break}if(te)break}if(!Oc(x.id))break}}const Dp=()=>{var w;const x=new Set;for(const S of ft(Ge(r)))S.kind!=="edge-crosses-shape"||VS.has(S.edge)||((w=f(S.edge))==null?void 0:w.type)==="bpmn:MessageFlow"&&x.add(`${S.edge}>${S.shape}`);return x},o6=(x,w)=>Ui().bad>=x&&[...Dp()].some(S=>!w.has(S)),WS=x=>{var w,S;return Cr(x)===0&&((S=(w=f(x))==null?void 0:w.waypoints)==null?void 0:S.length)===2},r6=(x,w,S)=>{const O=new Set(x.flatMap(T=>T.subtree.map($=>$.id))),I=[...Dp()].filter(T=>!S.has(T)).map(T=>T.split(">")[1]);return[...new Set(I)].filter(T=>O.has(T)&&T!==w.source&&T!==w.target)},a6=(x,w,S,O,I)=>{const T=x.map(H=>({...H,subtree:H.subtree.filter(j=>!I.includes(j.id))})).filter(H=>H.subtree.length),$=new Set(T.flatMap(H=>H.subtree.map(j=>j.id))),L=()=>I.every(H=>{const j=f(H);return!!j&&Y.filter(Q=>Q.flow.target===H&&$.has(Q.flow.source)).every(Q=>{const ne=f(Q.flow.source);return!!ne&&ne.x+ne.width<=j.x})});return ra(T,w,()=>WS(S.id)&&[...Dp()].every(H=>O.has(H))&&L(),rs,!0)};for(const x of E){if(!Oc(x.flow.id))continue;const w=f(x.flow.id);if(((cR=w==null?void 0:w.waypoints)==null?void 0:cR.length)!==2)continue;const S=f(x.flow.source),O=f(x.flow.target);if(!S||!O||S.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!aa(x.flow.source)||!aa(x.flow.target)||Math.abs(Ar(S)-Ar(O))>JF)continue;const I=Ar(S),T=w.waypoints.map(ie=>ie.y),[$,L]=[Math.min(...T),Math.max(...T)],D=Dn(Ge(r)).filter(ie=>ie.id!==S.id&&ie.id!==O.id&&ie.x<I&&I<ie.x+ie.width&&$<ie.y+ie.height&&ie.y<L);if(!D.length)continue;const H=(lR=N.get(x.flow.source))==null?void 0:lR.node.participant,j=(uR=N.get(x.flow.target))==null?void 0:uR.node.participant;if(!H||!j)continue;const Q=new Map;for(const[ie,ye,me]of[[x.flow.source,S,H],[x.flow.target,O,j]]){const te=Q.get(me)??[],le=$o(ie,ge=>ge.x>=ye.x).filter(ge=>!te.some(K=>K.id===ge.id));Q.set(me,[...te,...le])}const ne=new Set([...Q.values()].flat().map(ie=>ie.id)),de=kp(Q,ne,x.flow.id,ie=>ie===x.flow.source||ie===x.flow.target,()=>!1),oe=Math.max(...D.map(ie=>ie.x+ie.width));for(const ie of QF){const ye=oe+ie-I;if(ye<=0)continue;const me=Ui().bad,te=Dp();let le=[],ge=!0;const K=()=>!WS(x.flow.id)||ge&&(le=r6(de,x.flow,te),le.length)?!1:!o6(me,te);if(ra(de,ye,K,rs))break;if(le.length&&(a6(de,ye,x.flow,te,le)||(ge=!1,ra(de,ye,K,rs))))break}}{const x=T=>T.y+T.height/2,w=/(Task|Event|Gateway|CallActivity|SubProcess)$/,S=()=>{const T=Ge(r),$=new Set(ft(T).flatMap(H=>H.kind==="edge-crosses-shape"?[`${H.edge}|${H.shape}`]:[])),L=T.shapes.filter(H=>!H.container&&w.test(H.type)),D=new Set;for(const H of T.edges){if(H.type!=="bpmn:SequenceFlow"&&H.type!=="bpmn:MessageFlow")continue;const j=new Set(H.endpoints);for(const Q of[H.waypoints[0],H.waypoints[H.waypoints.length-1]])for(const ne of L)ne.x-4<=Q.x&&Q.x<=ne.x+ne.width+4&&ne.y-4<=Q.y&&Q.y<=ne.y+ne.height+4&&j.add(ne.id);for(const Q of L)if(!(j.has(Q.id)||$.has(`${H.id}|${Q.id}`))){for(let ne=0;ne+1<H.waypoints.length;ne++)if(bo(H.waypoints[ne],H.waypoints[ne+1],Q)<=Zg){D.add(`${H.id}|${Q.id}`);break}}}return D},O=()=>({...Ui(),grazes:S()}),I=[];for(const T of N.keys()){if(!aa(T))continue;const $=Y.filter(H=>H.flow.target===T);if($.length!==1)continue;const L=f($[0].flow.source),D=f(T);!L||!D||!N.has(L.id)||Math.abs(x(L)-x(D))>1||D.x-(L.x+L.width)<=se+1||I.push({id:T,pred:L,node:D})}I.sort((T,$)=>T.node.x-$.node.x);for(const{id:T}of I){const $=N.get(T),L=f(T),D=f(Y.find(le=>le.flow.target===T).flow.source);if(!L||!D)continue;const H=L.x-(D.x+D.width);if(H<=se+1)continue;const j=m($.node.participant),Q=$o(T,le=>le.x>=L.x),ne=-(H-se),de=(le,ge)=>ge.bad>le.bad||ge.crossings>le.crossings||ge.crossings===le.crossings&&ge.bad===le.bad||ge.straight<le.straight||[...ge.grazes].some(K=>!le.grazes.has(K)),oe=kp(new Map([[$.node.participant,[...Q]]]),new Set(Q.map(le=>le.id)),"",()=>!1,()=>!1),ie=oe.some(le=>le.pool!==j)||oe.reduce((le,ge)=>le+ge.subtree.length,0)>Q.length,ye=O(),me=LS(Q,j,ne);if(!me)continue;const te=O();if(ie&&!de(ye,te)){me();const le=Fo(oe,ne);if(le){const ge=O();if(!de(ye,ge)&&ge.bad<=te.bad&&ge.crossings<=te.crossings)continue;le()}LS(Q,j,ne);continue}de(ye,te)&&me()}}OS(!0);const s6=10,c6=400,l6=x=>[...x.incoming??[],...x.outgoing??[]].filter(w=>w.type==="bpmn:DataInputAssociation"||w.type==="bpmn:DataOutputAssociation").map(w=>w.source===x?w.target:w.source).filter(w=>!!w&&typeof w.y=="number"),u6=r.filter(x=>x.type==="bpmn:DataStoreReference"&&_.has(x.id)),p6=(x,w)=>{const S=x.x+x.width/2,O=x.y+x.height/2;let I;for(const T of u6){if((g(T)??d())!==w||T.y<x.y+x.height)continue;const $=Math.abs(T.x+T.width/2-S);$>c6||$<T.width||!l6(T).some(D=>D.height===x.height&&Math.abs(D.y+D.height/2-O)<=s6&&T.y>=D.y+D.height)||(!I||$<I.dx||$===I.dx&&T.id<I.id)&&(I={dx:$,id:T.id,cy:T.y+T.height/2})}return I==null?void 0:I.cy},d6=50,f6=(x,w)=>{const S=g(w);if(!S||x.y<w.y+w.height)return;const O=y(S,w),I=O??S,T=x.label,$=Math.max(x.y+x.height,T?T.y+T.height:0),L=I.y+I.height;if($<=L)return;const D=Math.ceil($+d6-L),H=S.y+S.height;if(O){const j=ns(O,O.height+D,new Set([x.id]));Wt(H,S.id,D,j)}else n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+D}),Wt(H,S.id,D)};for(const x of M){const w=x.associations??[],S=w.map($=>$.source===x.dataStore.id?$.target:$.source).map(f).find(Boolean),O=S?g(S)??d():d(),I=S?{x:S.x+S.width/2,y:p6(S,O)??S.y+S.height+110}:{x:200,y:Tc+60},T=n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},I,O);S&&f6(T,S);for(const $ of w)kS(x.dataStore.id,$)}for(const x of B){const S=m(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;kS(S,x.association)}let US=0;const sa=10,qS=40,h6=(x,w)=>{const S=w.map(D=>g(D)).filter(D=>!!D);for(const D of S){const H=sa,j=D.y,Q=D.y+D.height,ne=D.x,de=D.x+D.width;if(Math.abs(x.y-j)<H){const oe=j+H-x.y;x.y+=oe,x.height-=oe}if(Math.abs(x.y+x.height-Q)<H&&(x.height=Q-H-x.y),Math.abs(x.x-ne)<H){const oe=ne+H-x.x;x.x+=oe,x.width-=oe}Math.abs(x.x+x.width-de)<H&&(x.width=de-H-x.x)}if(!S.length)return;const O=Math.min(...S.map(D=>D.y)),I=Math.max(...S.map(D=>D.y+D.height)),T=O-x.y,$=x.y+x.height-I,L=qS-sa;if(T>0!=$>0)if(T>0&&T<L){const D=T+sa;x.y+=D,x.height-=D}else $>0&&$<L&&(x.height-=$+sa)},g6=(x,w)=>{const S=sa,O=30,I=r.filter(T=>T.type==="bpmn:Group"&&T.id!==w);for(const T of I){const $=T.x,L=T.x+T.width,D=T.y,H=T.y+T.height,j=x.y<H&&D<x.y+x.height,Q=x.x<L&&$<x.x+x.width;if(j){if(Math.abs(x.x-L)<S){const ne=Math.min(L+S-x.x,O);ne>0&&x.width-ne>0&&(x.x+=ne,x.width-=ne)}if(Math.abs(x.x+x.width-$)<S){const ne=Math.min(x.x+x.width-($-S),O);ne>0&&x.width-ne>0&&(x.width-=ne)}}if(Q){if(Math.abs(x.y-H)<S){const ne=Math.min(H+S-x.y,O);ne>0&&x.height-ne>0&&(x.y+=ne,x.height-=ne)}if(Math.abs(x.y+x.height-D)<S){const ne=Math.min(x.y+x.height-(D-S),O);ne>0&&x.height-ne>0&&(x.height-=ne)}}}},sm=(x,w)=>{const S=qS,O=Math.min(...x.map(D=>D.x))-S,I=Math.min(...x.map(D=>D.y))-S,T=Math.max(...x.map(D=>D.x+D.width))+S,$=Math.max(...x.map(D=>D.y+D.height))+S,L={x:O,y:I,width:T-O,height:$-I};return h6(L,x),g6(L,w),L};for(const x of k){const w=(x.group.members??[]).map(f).filter(I=>!!I);let S;w.length?S=sm(w,x.group.id):(S={x:300+US*350,y:40,width:300,height:200},US++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:S.width,height:S.height},{x:S.x+S.width/2,y:S.y+S.height/2},d());x.group.name&&n.updateLabel(O,x.group.name),(pR=x.group.members)!=null&&pR.length&&Me(O,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(I=>!!I.waypoints),w=new Map,S=(I,T)=>{!I||!T||(w.has(I)||w.set(I,new Set),w.get(I).add(T))};for(const I of x){const T=(dR=I.source)==null?void 0:dR.id,$=(fR=I.target)==null?void 0:fR.id;S(T,$),((hR=I.type)!=null&&hR.includes("DataOutputAssociation")||(gR=I.type)!=null&&gR.includes("DataInputAssociation")||I.type==="bpmn:Association")&&S($,T)}const O=r.filter(I=>I.type==="bpmn:Group");for(const I of O){const $=(((mR=I.businessObject.extensionElements)==null?void 0:mR.values)??[]).find(me=>me.$type==="bwl:Members"),L=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean);if(!L.length)continue;const D=new Set(L),H=[...L];for(;H.length;){const me=H.shift();for(const te of w.get(me)??[])D.has(te)||(D.add(te),H.push(te))}const j=I.x,Q=I.x+I.width,ne=I.y,de=I.y+I.height,oe=me=>Y.filter(te=>te.flow.target===me).length,ie=me=>{var le;const te=((le=f(me))==null?void 0:le.type)??"";if(te==="bpmn:StartEvent"&&oe(me)===0)return!1;if(te.endsWith("Gateway")){const ge=Y.filter(K=>K.flow.target===me).map(K=>K.flow.source);if(ge.length&&ge.every(K=>{var ue;return((ue=f(K))==null?void 0:ue.type)==="bpmn:StartEvent"&&oe(K)===0}))return!1}return!0},ye=r.filter(me=>bi(me)).filter(me=>me.type!=="bpmn:Group"&&me.type!=="bpmn:Participant"&&me.type!=="bpmn:TextAnnotation"&&!D.has(me.id)&&aa(me.id)&&ie(me.id)&&me.x<Q&&me.x+me.width>j&&me.y<de&&me.y+me.height>ne);if(ye.length)for(const me of[-1,1]){const te=ye.filter(Ae=>(Ae.x+Ae.width-j<=Q-Ae.x?-1:1)===me);if(!te.length)continue;const le=[];for(const Ae of te){const Se=le.find(Ce=>Ce.some(ce=>Ae.y<ce.y+ce.height&&Ae.y+Ae.height>ce.y));Se?Se.push(Ae):le.push([Ae])}const ge=new Map;for(const Ae of le){let Se=me<0?j-sa:Q+sa;for(const Ce of[...Ae].sort((ce,_e)=>me<0?_e.x-ce.x:ce.x-_e.x)){const ce=me<0?Math.min(Ce.x,Se-Ce.width):Math.max(Ce.x,Se);Se=me<0?ce-$i:ce+Ce.width+$i,ce!==Ce.x&&Math.sign(ce-Ce.x)===me&&ge.set(Ce.id,ce-Ce.x)}}const K=new Map,ue=Ae=>K.get(Ae)===Ae||!K.get(Ae)?Ae:ue(K.get(Ae));for(const Ae of te)K.set(Ae.id,Ae.id);for(const Ae of E){const Se=ge.has(Ae.flow.source)?Ae.flow.source:void 0,Ce=ge.has(Ae.flow.target)?Ae.flow.target:void 0;if(!Se||!Ce)continue;const ce=f(Ae.flow.id);((yR=ce==null?void 0:ce.waypoints)==null?void 0:yR.length)===2&&K.set(ue(Se),ue(Ce))}const Re=new Map;for(const Ae of te){if(!ge.has(Ae.id))continue;const Se=ue(Ae.id);Re.set(Se,[...Re.get(Se)??[],Ae])}const Ie=[...Re.values()].sort((Ae,Se)=>me<0?Math.min(...Ae.map(Ce=>Ce.x))-Math.min(...Se.map(Ce=>Ce.x)):Math.max(...Se.map(Ce=>Ce.x))-Math.max(...Ae.map(Ce=>Ce.x))),nt=[];let Xe=!0;for(const Ae of Ie){const Se=Ae.map(_e=>ge.get(_e.id)??0).reduce((_e,He)=>Math.abs(He)>Math.abs(_e)?He:_e,0),Ce=new Map;let ce=!0;for(const _e of Ae){const He=g(_e);if(!He){ce=!1;break}Ce.has(He.id)||Ce.set(He.id,{subtree:[],pool:He}),Ce.get(He.id).subtree.push(_e)}ce&&ra([...Ce.values()],Se,()=>!0,rs)?nt.push({shapes:Ae,dx:Se}):Xe=!1}if(!Xe)for(const Ae of nt.reverse())n.moveElements(Ae.shapes,{x:-Ae.dx,y:0})}}}{const x=new Set([...k.map(w=>w.group.id),...Gt(e,"group.update").map(w=>w.id)]);for(const w of r.filter(S=>S.type==="bpmn:Group")){if(x.has(w.id))continue;const O=(((vR=w.businessObject.extensionElements)==null?void 0:vR.values)??[]).find(L=>L.$type==="bwl:Members"),I=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(L=>!!L);!I.length||!I.some(L=>{const D=_.get(L.id);return!D||D.x!==L.x||D.y!==L.y})||!I.some(L=>L.x<w.x||L.y<w.y||L.x+L.width>w.x+w.width||L.y+L.height>w.y+w.height)||n.resizeShape(w,sm(I,w.id))}}{const w=new Map(Yo(Ge(r)).map(L=>[L.owner,L.rect])),S=r.filter(L=>!!L.waypoints),O=new Map,I=(L,D)=>{!L||!D||(O.has(L)||O.set(L,new Set),O.get(L).add(D))};for(const L of S){const D=(xR=L.source)==null?void 0:xR.id,H=(bR=L.target)==null?void 0:bR.id;I(D,H),((wR=L.type)!=null&&wR.includes("DataOutputAssociation")||(_R=L.type)!=null&&_R.includes("DataInputAssociation")||L.type==="bpmn:Association")&&I(H,D)}const T=L=>Y.filter(D=>D.flow.target===L).length,$=L=>{var H;const D=((H=f(L))==null?void 0:H.type)??"";if(D==="bpmn:StartEvent"&&T(L)===0)return!1;if(D.endsWith("Gateway")){const j=Y.filter(Q=>Q.flow.target===L).map(Q=>Q.flow.source);if(j.length&&j.every(Q=>{var ne;return((ne=f(Q))==null?void 0:ne.type)==="bpmn:StartEvent"&&T(Q)===0}))return!1}return!0};for(const L of r.filter(D=>D.type==="bpmn:Group")){const H=(((ER=L.businessObject.extensionElements)==null?void 0:ER.values)??[]).find(ce=>ce.$type==="bwl:Members"),j=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const Q=j.map(f).filter(ce=>!!ce);if(!Q.length||!(k.some(ce=>ce.group.id===L.id)||Gt(e,"group.update").some(ce=>ce.id===L.id)||Q.some(ce=>{const _e=_.get(ce.id);return!_e||_e.x!==ce.x||_e.y!==ce.y})))continue;const de=new Set(j),oe=[...j];for(;oe.length;){const ce=oe.shift();for(const _e of O.get(ce)??[])de.has(_e)||(de.add(_e),oe.push(_e))}const ie=L.x,ye=L.x+L.width,me=L.y,te=L.y+L.height,le=ce=>{const _e=w.get(ce.id),He={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return _e?[He,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[He]},ge=Q.flatMap(le),K=Math.min(...ge.map(ce=>ce.x)),ue=Math.max(...ge.map(ce=>ce.x+ce.width)),Re=Math.min(...ge.map(ce=>ce.y)),Ie=Math.max(...ge.map(ce=>ce.y+ce.height)),nt={L:K-ie,R:ye-ue,T:Re-me,B:te-Ie},Xe=new Set(j),Ae=ce=>ce.x>=ie&&ce.x+ce.width<=ye&&ce.y>=me&&ce.y+ce.height<=te,Se=r.filter(ce=>bi(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!Xe.has(ce.id)&&(!de.has(ce.id)||!Ae(ce))&&$(ce.id)&&ce.x<ye&&ce.x+ce.width>ie&&ce.y<te&&ce.y+ce.height>me);if(!Se.length)continue;const Ce={L:0,R:0,T:0,B:0};for(const ce of Se){const _e=le(ce),He=Math.min(..._e.map(xt=>xt.x)),st=Math.max(..._e.map(xt=>xt.x+xt.width)),Oe=Math.min(..._e.map(xt=>xt.y)),Ye=Math.max(..._e.map(xt=>xt.y+xt.height)),Dt={L:st-ie,R:ye-He,T:Ye-me,B:te-Oe},Pn=["L","R","T","B"].filter(xt=>Dt[xt]<=nt[xt]+.001);if(!Pn.length)continue;const kn=Pn.reduce((xt,qi)=>Dt[qi]<Dt[xt]?qi:xt,Pn[0]);Ce[kn]=Math.max(Ce[kn],Math.min(Dt[kn]+10,nt[kn]))}!Ce.L&&!Ce.R&&!Ce.T&&!Ce.B||n.resizeShape(L,{x:L.x+Ce.L,y:L.y+Ce.T,width:L.width-Ce.L-Ce.R,height:L.height-Ce.T-Ce.B})}}const YS=x=>{const w=x.waypoints;if(w!=null&&w.length){const O=w[Math.floor((w.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const S=x;return{x:S.x,y:S.y,width:S.width,height:S.height}};let Lc=0;const cm=vv.get(t),KS=(x,w)=>{var O;const S=(O=cm==null?void 0:cm.get(x))==null?void 0:O.texts;return S?[...new Set([w,...Object.values(S)])]:[w]};for(const x of P){const w=x.association,S=((SR=x.placement)==null?void 0:SR.anchor)??(w?w.source===x.annotation.id?w.target:w.source:void 0),O=S?f(S):void 0,I=O?YS(O):void 0,T=sv(KS(x.annotation.id,x.annotation.text??""));let $;if(I&&x.placement){const[j,Q]=pl[x.placement.side],ne=x.placement.offset??50;$={x:I.x+I.width/2+j*(I.width/2+T.width/2+ne),y:I.y+I.height/2+Q*(I.height/2+T.height/2+ne)}}else I?($={x:I.x+I.width/2+180+Lc%3*260,y:I.y-110-Lc%2*95},Lc++):($={x:300+Lc*260,y:60},Lc++);const L=O?g(O)??d():d(),D=L;I&&typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant"&&($=fl(r,I,T,D,x.placement?{placement:x.placement}:{from:$}));const H=n.createShape({type:"bpmn:TextAnnotation",width:T.width,height:T.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},$,L);if(w){const j=Q=>Q===x.annotation.id?H:m(Q);n.connect(j(w.source),j(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}x.placement&&Me(H,"bwl:Placement",Te(x.placement))}for(const x of Gt(e,"association.add")){const w=x.association;n.connect(m(w.source),m(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}const m6=(x,w,S,O)=>{const I=x.parent;if(!I)return O;const T=x.x+x.width/2,$=new Set([x.id]);if(!U(I,x,T,O,$))return O;const L=w?w.y+Math.min(w.height/2,Z):S?S.y+V:void 0;if(L===void 0)return O;const D=Math.floor((O-L)/z+1e-6);for(let H=1;H<=3;H++){const j=D+H,Q=L+j*z,ne=vS(w==null?void 0:w.id,j);if(!U(I,x,T,Q,ne?new Set([...$,...ne]):$))return ni(w==null?void 0:w.id,j,S),Q}return O},XS=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of Gt(e,"node.update")){let w=m(x.id);if(x.type&&ul(x.type)!==w.type){const S=w.x+w.width/2,O=w.y+w.height/2,I=XS();w=c.replaceElement(w,{type:ul(x.type),...x.eventDefinition?{eventDefinitionType:Fc[x.eventDefinition]}:{}});const T=XS(),$=[...I].filter(H=>H!==x.id&&!T.has(H));if($.length)throw new mv({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:$});const L=Math.round(S-(w.x+w.width/2)),D=Math.round(O-(w.y+w.height/2));if(L!==0||D!==0){n.moveShape(w,{x:L,y:D});for(const H of[...w.incoming??[],...w.outgoing??[]])Pp(H)}}if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(w,{"bwl:band":x.band});const S=w.y+w.height/2,O=g(w),I=x.lane?m(x.lane):((O==null?void 0:O.children)??[]).find($=>$.type==="bpmn:Lane"&&S>=$.y&&S<=$.y+$.height);x.band!==void 0&&ni(I==null?void 0:I.id,x.band,O);const T=I?I.y+(x.band===void 0?I.height/2:Math.min(I.height/2,Z)+gi(I.id,x.band)*z):x.band!==void 0&&O?O.y+V+gi(`pool:${O.id}`,x.band)*z:void 0;if(T!==void 0){const $=m6(w,I,O,T),L=$===T?T-S:$-(w.y+w.height/2);L!==0&&(p.push({id:w.id,x:w.x,y:w.y,width:w.width,height:w.height}),n.moveElements([w],{x:0,y:L}))}}}for(const x of Gt(e,"sequenceFlow.update")){const w=m(x.id),S=G.get(x.id);if(S){const O=H=>({x:H.x+H.width/2,y:H.y+H.height/2}),I=m(S.flow.source),T=m(S.flow.target),$=n.connect(I,T,{type:"bpmn:SequenceFlow",businessObject:Tp(S.flow)}),L=Qg.get(x.id),D=T.y+T.height/2;L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1?n.updateWaypoints($,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]):(n.reconnect($,I,T,[O(I),O(T)]),Math.abs(D-(I.y+I.height/2))>1&&Pp($))}else if((x.source!==void 0||x.target!==void 0)&&!wS.has(x.id)){const O=w,I=x.source!==void 0?m(x.source):O.source,T=x.target!==void 0?m(x.target):O.target,$=H=>({x:H.x+H.width/2,y:H.y+H.height/2});n.reconnect(O,I,T,[$(I),$(T)]);const L=Qg.get(O.id),D=T.y+T.height/2;if(L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1){n.updateWaypoints(O,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]);const H=O.label;if(H&&L.label){const Q=Math.abs(L.label.y+H.height/2-L.channelY)<=z/5&&L.label.x+H.width>L.exit.x,ne=L.exit.x+6,de=T.x-6-H.width,oe=Q?de>=ne?{x:Math.max(ne,Math.min(L.label.x,de)),y:L.label.y+(D-L.channelY)}:void 0:L.label;oe&&(oe.x!==H.x||oe.y!==H.y)&&n.moveElements([H],{x:oe.x-H.x,y:oe.y-H.y})}}else Math.abs(D-(I.y+I.height/2))>1&&Pp(O)}x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(w,{name:((RR=x.condition)==null?void 0:RR.label)??void 0})}for(const x of Gt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Gt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Gt(e,"annotation.update")){const w=m(x.id);if(x.text!==void 0){n.updateProperties(w,{text:x.text});const S=sv(KS(x.id,x.text));if(S.width!==w.width||S.height!==w.height){const O={x:w.x,y:w.y,width:S.width,height:S.height};n.resizeShape(w,O,void 0,{[cv]:O})}}if(x.placement===null)Me(w,"bwl:Placement",null);else if(x.placement){const S=m(x.placement.anchor),O=YS(S),I=g(S)??d(),T=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[$,L]=pl[x.placement.side],D=x.placement.offset??50,H={x:O.x+O.width/2+$*(O.width/2+w.width/2+D),y:O.y+O.height/2+L*(O.height/2+w.height/2+D)},j=T?fl(r,O,{width:w.width,height:w.height},I,{placement:x.placement,selfId:x.id}):H;n.moveElements([w],{x:j.x-(w.x+w.width/2),y:j.y-(w.y+w.height/2)}),Me(w,"bwl:Placement",Te(x.placement))}}for(const x of Gt(e,"group.update")){const w=m(x.id);if(x.name!==void 0&&n.updateLabel(w,x.name??""),x.members){const S=x.members.map(f).filter(O=>!!O);S.length&&n.resizeShape(w,sm(S,x.id)),Me(w,"bwl:Members",{refs:x.members.join(" ")})}}}function _s(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 gT(e,t,n){const i=(r,a)=>{const s=r.shapes.find(l=>l.id===a);if(s)return{x:s.x+s.width/2,y:s.y+s.height/2};const c=r.edges.find(l=>l.id===a);return c!=null&&c.waypoints.length?c.waypoints[Math.floor((c.waypoints.length-1)/2)]:void 0},o=new Set;for(const r of e.shapes){if(r.type!=="bpmn:TextAnnotation")continue;const a=i(e,r.id),s=i(t,r.id);if(!a||!s)continue;const c=s.x-a.x,l=s.y-a.y;if(Math.abs(c)<=2&&Math.abs(l)<=2)continue;const u=n(r.id),p=u?i(e,u):void 0,d=u?i(t,u):void 0;p&&d&&Math.abs(d.x-p.x-c)<=2&&Math.abs(d.y-p.y-l)<=2||o.add(r.id)}return o}function mT(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(f=>f.type==="bpmn:Association");if(!a.length)return 0;const s=f=>f.map(m=>m.original?{x:m.x,y:m.y,original:{x:m.original.x,y:m.original.y}}:{x:m.x,y:m.y}),c=(f,m)=>f.length===m.length&&f.every((g,y)=>{var _,h,v,b;return g.x===m[y].x&&g.y===m[y].y&&((_=g.original)==null?void 0:_.x)===((h=m[y].original)==null?void 0:h.x)&&((v=g.original)==null?void 0:v.y)===((b=m[y].original)==null?void 0:b.y)}),l=a.map(f=>s(f.waypoints)),u=new Set(a.map(f=>f.id));r.moveElements([t],{x:n,y:i});const p=Ge(o),d=[...eo(p),..._i(p)].filter(([f,m])=>u.has(f)!==u.has(m)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,m)=>{c(f.waypoints,l[m])||r.updateWaypoints(f,l[m])}),d}function yT(e,t,n,i=new Set,o=new Set){var g,y;const{elementRegistry:r}=e,a=e.modeling,s=_=>ft(_).filter(h=>!t.has(ct(h))),c=_=>{var h;return((h=r.get(_))==null?void 0:h.type)==="bpmn:TextAnnotation"},l=Ge(r),u=s(l),p=_=>!n.has(_),d=_=>u.some(h=>h.kind==="edge-crosses-shape"&&h.shape===_&&i.has(h.edge)||h.kind==="shape-overlap"&&h.shapes.includes(_)&&h.shapes.every(c)),f=[...new Set(u.flatMap(_s))].filter(_=>c(_)&&(!p(_)||d(_))),m=[...f.filter(_=>!p(_)),...f.filter(p)];if(m.length)for(const _ of m){const h=r.get(_);if(!h||typeof h.x!="number"||typeof h.width!="number")continue;let v=h.parent,b;for(;v;){if(v.type==="bpmn:Participant"){b=v;break}v=v.parent}if(!b){const V=h.x+h.width/2,Z=h.y+h.height/2;b=r.getAll().find(pe=>{if(pe.type!=="bpmn:Participant")return!1;const ve=pe;return typeof ve.x=="number"&&typeof ve.width=="number"&&V>=ve.x&&V<=ve.x+ve.width&&Z>=ve.y&&Z<=ve.y+ve.height})}if(!b||typeof b.x!="number"||typeof b.width!="number")continue;const M=(((g=h.businessObject.extensionElements)==null?void 0:g.values)??[]).find(V=>V.$type==="bwl:Placement"),B=[...h.incoming??[],...h.outgoing??[]].find(V=>V.type==="bpmn:Association"),P=(M!=null&&M.anchor?r.get(M.anchor):void 0)??(B?((y=B.source)==null?void 0:y.id)===_?B.target:B.source:void 0);if(!P)continue;const k=P.waypoints,N=k!=null&&k.length?{x:k[Math.floor((k.length-1)/2)].x,y:k[Math.floor((k.length-1)/2)].y,width:0,height:0}:{x:P.x,y:P.y,width:P.width,height:P.height},G={width:h.width,height:h.height},q={x:h.x+h.width/2,y:h.y+h.height/2},Y=M==null?void 0:M.side,ae=hv(r,N,b),X=[];if(Y&&Y in pl&&X.push(fl(r,N,G,b,{placement:{side:Y,offset:(M==null?void 0:M.offset)??null},selfId:_})),ae&&!dl(q,G,ae))for(const V of uT)X.push(fl(r,N,G,b,{placement:{side:V,offset:null},selfId:_}));for(const[V,Z]of[[-1,0],[1,0],[0,-1],[0,1]])for(let pe=1;pe<=lT;pe++)X.push({x:q.x+V*fv*pe,y:q.y+Z*fv*pe});const Me=p(_)?Ge(r):l,Te={...Me,edges:Me.edges.filter(V=>V.id!==(B==null?void 0:B.id))},Pe=s(Te),fe=Pe.filter(V=>_s(V).includes(_)).length;if(!fe)continue;let z,se=!1;for(const V of X){const Z=V.x-q.x,pe=V.y-q.y;if(!Z&&!pe||V.x-G.width/2<b.x||V.x+G.width/2>b.x+b.width||V.y-G.height/2<b.y||V.y+G.height/2>b.y+b.height||ae&&!dl(V,G,ae))continue;const ve={...Te,shapes:Te.shapes.map(R=>R.id===_?{...R,x:R.x+Z,y:R.y+pe}:R)},$e=o.has(_)?s(ve):ft(ve).filter(R=>!t.has(ct(R))||_s(R).includes(_)),F=$e.filter(R=>_s(R).includes(_)).length;if(F>=fe||$e.length>Pe.length)continue;const C=Math.abs(Z)+Math.abs(pe);if(se||((!z||F<z.mine||F===z.mine&&($e.length<z.all||$e.length===z.all&&C<z.dist))&&(z={x:V.x,y:V.y,mine:F,all:$e.length,dist:C}),z.mine===0&&z.all<Pe.length&&(se=!0)),F===0&&$e.length<Pe.length&&mT(e,h,Z,pe)===0){z={x:V.x,y:V.y,mine:F,all:$e.length,dist:C};break}}z&&a.moveElements([h],{x:z.x-q.x,y:z.y-q.y})}}const vT=60;function hl(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 xT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=_=>ft(_).filter(h=>!t.has(ct(h))),a=_=>_.filter(h=>h.kind==="pool-overlap"),s=new Map(n.shapes.map(_=>[_.id,_])),c=(_,h)=>h.x>=_.x&&h.y>=_.y&&h.x+h.width<=_.x+_.width&&h.y+h.height<=_.y+_.height,l=_=>{if(!s.get(_))return[_];const v=new Set,b=new Set([_]);for(let M=0;M<4;M++){let B=!1;for(const P of n.shapes)P.type!=="bpmn:Group"||v.has(P.id)||[...b].some(k=>{const N=s.get(k);return N&&c(P,N)})&&(v.add(P.id),B=!0);for(const P of n.shapes)P.type!=="bpmn:Participant"||b.has(P.id)||[...v].some(k=>{const N=s.get(k);return N&&c(N,P)})&&(b.add(P.id),B=!0);if(!B)break}const E=n.shapes.filter(M=>!M.parent&&!b.has(M.id)&&!v.has(M.id)&&M.type!=="bpmn:Group"&&M.type!=="bpmn:Participant").filter(M=>[...v].some(B=>{const P=s.get(B);return P&&c(P,M)})).map(M=>M.id);return[...b,...v,...E]},u=r(Ge(i)),p=a(u).length;if(!p)return;const d=u.length,f=[];let m=0,g=p,y=d;for(let _=0;_<6;_++){const h=Ge(i),v=a(r(h));if(!v.length)break;const b=new Map(h.shapes.map(k=>[k.id,k]));let E=null;for(const k of v){if(k.kind!=="pool-overlap")continue;const[N,G]=k.pools,q=b.get(N),Y=b.get(G);if(!q||!Y)continue;const[ae,X]=q.x<=Y.x?[q,Y]:[Y,q];if(k.contained)continue;const Me=s.get(ae.id),Te=s.get(X.id),Pe=Me&&Te?Math.max(Te.x-(Me.x+Me.width),0):vT,fe=ae.x+ae.width+Pe-X.x;if(fe<=0)continue;const z=l(X.id).filter(se=>i.get(se));z.length&&(!E||fe>E.dx)&&(E={movers:z,dx:fe})}if(!E)break;const M=E.movers.map(k=>i.get(k)).filter(k=>!!k&&typeof k.x=="number");if(!M.length)break;o.moveElements(M,{x:E.dx,y:0}),f.push({els:M,dx:E.dx});const B=r(Ge(i)),P=a(B).length;P<p&&B.length<=d&&(P<g||P===g&&B.length<y||m===0)&&(m=f.length,g=P,y=B.length)}for(const{els:_,dx:h}of f.slice(m).reverse())o.moveElements(_,{x:-h,y:0})}const Es=.5,Nd=150;function bT(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of wT(n))i.length<n.length&&i.some(r=>wv(e.elementRegistry.get(r.id)))||_T(e,i)}function wT(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)<=Es?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function wv(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 _T(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(h=>h.x+h.width),r=Math.max(...o);if(r-Math.min(...o)>Es)return;const a=t.map(h=>n.get(h.id)).filter(h=>!!h&&typeof h.x=="number");if(a.length<2)return;const s=new Map(t.map(h=>[h.id,h.x]));if(a.some(h=>Math.abs(h.x-s.get(h.id))>Es))return;const c=a.map(h=>h.x+h.width);if(Math.max(...c)-Math.min(...c)<=Es)return;const l=h=>h.x+h.width,u=h=>!!h&&typeof h.width=="number",p=h=>{const v={shapes:[],edges:[],lanes:[]},b=E=>{for(const M of E.children??[]){if("waypoints"in M&&M.waypoints){v.edges.push(M);continue}M.type!=="label"&&(M.type==="bpmn:Lane"?v.lanes.push(M):v.shapes.push(M),b(M))}};return b(h),v},d=new Map(a.map(h=>[h.id,p(h)]));let f=r;for(const h of a){const{shapes:v}=d.get(h.id),b=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+Nd))}const m=a.filter(h=>Math.abs(l(h)-f)>Es);if(!m.length)return;for(const h of m){const v=l(h),{shapes:b,edges:E,lanes:M}=d.get(h.id);if([...b.flatMap(k=>[l(k),...u(k.label)?[l(k.label)]:[]]),...E.flatMap(k=>[...k.waypoints.map(N=>N.x),...u(k.label)?[l(k.label)]:[]])].some(k=>k>f)||[...(h.incoming??[]).map(k=>k.waypoints[k.waypoints.length-1]),...(h.outgoing??[]).map(k=>k.waypoints[0])].some(k=>!k||k.x>f||Math.abs(k.x-v)<1))return;if(f>v){const k={x:v,y:h.y,width:f-v,height:h.height},N=new Set([h.id,...b.map(q=>q.id),...E.map(q=>q.id),...M.map(q=>q.id)]);if(n.getAll().some(q=>{var X;if("waypoints"in q&&q.waypoints||q.type==="bpmn:Group"||!u(q))return!1;const Y=q.type==="label"?(X=q.labelTarget)==null?void 0:X.id:q.id;if(!Y||N.has(Y)||N.has(q.id))return!1;const ae=q;return ae.x<k.x+k.width&&ae.x+ae.width>k.x&&ae.y<k.y+k.height&&ae.y+ae.height>k.y}))return}}const g=()=>new Set(ft(Ge(n)).map(ct)),y=g(),_=m.map(h=>h.width);for(const h of m)hl(i,h,f-h.x,{layout:!1});[...g()].every(h=>y.has(h))||m.forEach((h,v)=>hl(i,h,_[v],{layout:!1}))}function ET(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ft(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(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!p.length)continue;const d=p.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(d.length!==p.length)continue;const f=s(p),m=s(d),g=m.l+(l.x-f.l),y=m.t+(l.y-f.t),_=m.r+(l.x+l.width-f.r),h=m.b+(l.y+l.height-f.b),v={x:g,y,width:_-g,height:h-y};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const b=r(Ge(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(Ge(i)).length>b&&o.resizeShape(u,E)}}const gl=20,ml=10;function ST(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(ft(f,{includeObservationOnly:!0}).filter(m=>m.kind==="edge-along-group-boundary").map(ct)),s=Ge(o),c=ft(s,{includeObservationOnly:!0}).filter(f=>f.kind==="edge-along-group-boundary"&&!t.has(ct(f)));if(!c.length)return;const l=new Map(n.shapes.map(f=>[f.id,f])),u=new Map;for(const f of c)u.set(f.group,[...u.get(f.group)??[],f]);for(const[f,m]of u){const g=s.shapes.find($e=>$e.id===f);if(!((p=g==null?void 0:g.members)!=null&&p.length))continue;const y=l.get(f);if(!(!y||Math.abs(y.x-g.x)>=.5||Math.abs(y.y-g.y)>=.5||Math.abs(y.width-g.width)>=.5||Math.abs(y.height-g.height)>=.5))continue;const h=g.members.map($e=>o.get($e)).filter($e=>!!$e&&typeof $e.x=="number");if(!h.length)continue;const v=Math.min(...h.map($e=>$e.x)),b=Math.min(...h.map($e=>$e.y)),E=Math.max(...h.map($e=>$e.x+$e.width)),M=Math.max(...h.map($e=>$e.y+$e.height)),B=g.x,P=g.y,k=g.x+g.width,N=g.y+g.height;let G=B,q=P,Y=k,ae=N;for(const $e of m){const F=s.edges.find(R=>R.id===$e.edge);if(!F)continue;const C=F.endpoints.some(R=>{const U=s.shapes.find(ke=>ke.id===R);if(!U||U.container)return!1;const ee=U.x+U.width/2,he=U.y+U.height/2;return B<ee&&ee<k&&P<he&&he<N});for(const R of sn(F)){const U=R.axis==="v"?[P,N]:[B,k];Math.min(R.hi,U[1])-Math.max(R.lo,U[0])<pd||(R.axis==="v"?B<R.at&&R.at<k:P<R.at&&R.at<N)&&C||(R.axis==="v"?(Math.abs(R.at-B)<=xa&&(G=Math.max(G,R.at+gl)),Math.abs(R.at-k)<=xa&&(Y=Math.min(Y,R.at-gl))):(Math.abs(R.at-P)<=xa&&(q=Math.max(q,R.at+gl)),Math.abs(R.at-N)<=xa&&(ae=Math.min(ae,R.at-gl))))}}if(G>v-ml&&(G=B),q>b-ml&&(q=P),Y<E+ml&&(Y=k),ae<M+ml&&(ae=N),G===B&&q===P&&Y===k&&ae===N)continue;const X=o.get(f),Me={x:X.x,y:X.y,width:X.width,height:X.height},Te=Ge(o),Pe=new Set(ft(Te).map(ct)),fe=a(Te);r.resizeShape(X,{x:G,y:q,width:Y-G,height:ae-q});let z=Ge(o),se=ft(z).filter($e=>!Pe.has(ct($e)));const V=[];if(se.length>0&&se.every($e=>$e.kind==="label-over-line"&&!i.has($e.edge)&&z.edges.some(F=>F.id===$e.edge))){for(const $e of se){if($e.kind!=="label-over-line")continue;const F=z.edges.find(he=>he.id===$e.edge),C=F&&Od(F,z),R=(d=o.get($e.edge))==null?void 0:d.label;if(!C||!R)continue;const U=C.x-R.x,ee=C.y-R.y;r.moveElements([R],{x:U,y:ee}),V.push({label:R,dx:U,dy:ee})}z=Ge(o),se=ft(z).filter($e=>!Pe.has(ct($e)))}const pe=a(z),ve=[...pe].some($e=>!fe.has($e));if(se.length||ve||pe.size>=fe.size){for(const $e of V.reverse())r.moveElements([$e.label],{x:-$e.dx,y:-$e.dy});r.resizeShape(X,Me)}}}function RT(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Vp((o==null?void 0:o.$parent)??o),a=ps(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:Wp(u,i,r),requests:Kp(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 $d(e,t,n={}){var Te,Pe;const{i18n:i,lower:o=bv}=n,r=pv(e),a=hy(r.elementRegistry),s=nv(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=YA(t,a,i),u=i&&l.writes.size?RT(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ge(r.elementRegistry),d=new Set(ft(p).map(ct)),f=new Set(ft(p,{includeObservationOnly:!0}).map(ct)),m=new Set(gv(l.ops,fe=>{var z,se;return(se=(z=r.elementRegistry.get(fe))==null?void 0:z.source)==null?void 0:se.id}).keys()),g=new Set(p.edges.map(fe=>fe.id).filter(fe=>!m.has(fe))),y=new Set(t.flatMap(fe=>fe.kind==="sequenceFlow.update"&&(fe.source!==void 0||fe.target!==void 0)?[fe.id]:[])),_=()=>new Set(p.edges.filter(fe=>{var se;const z=(se=r.elementRegistry.get(fe.id))==null?void 0:se.waypoints;return z?!(z.length===fe.waypoints.length&&fe.waypoints.every((V,Z)=>Math.round(V.x)===Math.round(z[Z].x)&&Math.round(V.y)===Math.round(z[Z].y))):!1}).map(fe=>fe.id)),h=(fe,z)=>new Set([...fe].filter(se=>!z.has(se))),v=new Set(p.shapes.map(fe=>fe.id)),b=new Set(t.flatMap(fe=>fe.kind==="annotation.update"&&fe.placement?[fe.id]:[])),E=eo(p),M=E.length,B=new Set(E.map(([fe,z])=>`${fe}|${z}`)),P=_i(p),k=new Set(P.map(([fe,z])=>`${fe}|${z}`)),N=new Map;for(const fe of r.elementRegistry.filter(z=>"waypoints"in z&&!!z.waypoints))fe.label&&N.set(fe.id,{wps:fe.waypoints.map(z=>({x:z.x,y:z.y})),label:{x:fe.label.x,y:fe.label.y},source:(Te=fe.source)==null?void 0:Te.id,target:(Pe=fe.target)==null?void 0:Pe.id});const G=e.get("commandStack");try{fT(r,l.writes),mm(G,()=>{o(l.ops,r);for(const Z of(u==null?void 0:u.contexts())??[])G.execute(qp,Z);xT(r,d,p),bT(r,p),ET(r,d,p),_A(r,p,y),xA(r,g,v),Ay(r,g);const fe=wd(r,d),z=lA(r,hT(r),g,y);_y(r,B,g);const se=_(),V=Gy(r,d,h(g,se),se);Dy(r,g),LA(r,g,y),Fy(r,d,g),zA(r,d,g),mA(r,k,g),AA(r,g,p),Ky(r,d,h(g,_())),Yy(r,g,new Set([...y,...V,...z])),Zy(r,v),yT(r,d,v,fe,b),wd(r,d,fe),ST(r,f,p,g),Jy(r,d),qy(r,N,dT(r))})}catch(fe){return{ok:!1,issues:[fe instanceof mv?fe.issue:{kind:"lower-failed",message:fe instanceof Error?fe.message:String(fe)}],findings:[],stats:c}}const q=Ge(r.elementRegistry),Y=gT(p,q,fe=>{var V,Z,pe;const z=r.elementRegistry.get(fe),se=[...(z==null?void 0:z.incoming)??[],...(z==null?void 0:z.outgoing)??[]].find(ve=>ve.type==="bpmn:Association");return se&&(((V=se.source)==null?void 0:V.id)===fe?(Z=se.target)==null?void 0:Z.id:(pe=se.source)==null?void 0:pe.id)}),ae=ft(q,{includeObservationOnly:!0}).filter(fe=>!f.has(ct(fe))||_s(fe).some(z=>Y.has(z))),X=oy(q),Me=_i(q);return{ok:!0,issues:[],findings:ae,stats:{edgeCrossings:{before:M,after:X.pairs.length,pairs:X.pairs,solidPairs:X.solidPairs,dashedPairs:X.dashedPairs,mixedPairs:X.mixedPairs,crossPoolMessages:X.crossPoolMessages},sharedEndpointCrossings:{before:P.length,after:Me.length,pairs:Me}}}}function MT(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function _v(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Ev(e,t){const n=_v(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Sv(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function CT(e){return typeof e=="string"&&Fp.includes(e)}function Gi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Rv(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:{}},d=[],f=[],m=[],g=[],y=[],_=[],h=[],v=new Map,b=new Set,E=new Set,M=z=>{z&&b.add(z)},B=z=>{b.add(z),E.add(z)},P=z=>{const se=Sv(z,"bwl:Placement");if(!se)return;const V=typeof se.anchor=="string"?se.anchor:void 0;if(!V||!CT(se.side))return;const Z=typeof se.offset=="number"?se.offset:void 0;y.push({owner:z.id,anchor:V,side:se.side,...Z!==void 0?{offset:Z}:{}})},k=z=>{const se=Sv(z,"bwl:Members"),V=typeof(se==null?void 0:se.refs)=="string"?se.refs.split(/\s+/).filter(Boolean):[];V.length&&h.push({owner:z.id,refs:V})},N=z=>{var se;for(const V of z)switch(M(V.id),V.$type){case"bpmn:TextAnnotation":B(V.id),v.set(V.id,V),c.push({id:V.id,text:typeof V.text=="string"?V.text:""}),P(V);break;case"bpmn:Association":m.push({id:V.id,type:V.$type,source:Gi(V.sourceRef),target:Gi(V.targetRef)});break;case"bpmn:Group":{B(V.id),v.set(V.id,V);const Z=(se=V.categoryValueRef)==null?void 0:se.value;l.push({id:V.id,...typeof Z=="string"&&Z?{name:Z}:{}}),k(V);break}default:u.push({id:V.id,type:V.$type,reason:"type-outside-mvp"})}},G=z=>{for(const se of z.flowElements??[])M(se.id),u.push({id:se.id,type:se.$type,reason:"inside-container"}),(se.flowElements??[]).length&&G(se);for(const se of z.artifacts??[])M(se.id),u.push({id:se.id,type:se.$type,reason:"inside-container"})},q=(z,se)=>{const V=z.flowElements??[],Z=(z.laneSets??[]).flatMap(ve=>ve.lanes??[]),pe=new Map;for(const ve of Z){M(ve.id),v.set(ve.id,ve);for(const $e of ve.flowNodeRef??[]){const F=Gi($e);F&&pe.set(F,ve.id)}}for(const ve of V){if(M(ve.id),v.set(ve.id,ve),ve.$type==="bpmn:SequenceFlow"){d.push({id:ve.id,source:Gi(ve.sourceRef),target:Gi(ve.targetRef),...typeof ve.name=="string"&&ve.name?{name:ve.name}:{}});continue}if(ve.$type==="bpmn:DataStoreReference"){B(ve.id),s.push({id:ve.id,...ve.name?{name:ve.name}:{}});continue}const $e=MT(ve.$type),F=$e==="intermediateCatchEvent"?Np((ve.eventDefinitions??[]).map(ee=>ee.$type)):void 0;if(!um($e)||$e==="intermediateCatchEvent"&&!F){u.push({id:ve.id,type:ve.$type,reason:"type-outside-mvp"});continue}B(ve.id);const C=$e==="boundaryEvent"?Gi(ve.attachedToRef):void 0;a.push({id:ve.id,type:$e,...ve.name?{name:ve.name}:{},...se?{participant:se}:{},...pe.has(ve.id)?{lane:pe.get(ve.id)}:{},...C?{attachedTo:C}:{},...F?{eventDefinition:F}:{}}),$e==="subProcess"&&G(ve);const R=Ev(ve,"bwl:band");R!==void 0&&(p.bands[ve.id]=R);const U=_v(ve,"bwl:afterColumn");typeof U=="string"&&U!==""&&_.push([ve.id,U]);for(const ee of ve.dataOutputAssociations??[])M(ee.id),g.push({id:ee.id,type:ee.$type,source:ve.id,target:Gi(ee.targetRef)});for(const ee of ve.dataInputAssociations??[])M(ee.id),g.push({id:ee.id,type:ee.$type,source:Gi((ee.sourceRef??[])[0]),target:ve.id})}N(z.artifacts??[])};if(i){const z=new Set;for(const se of i.participants??[]){B(se.id),v.set(se.id,se);const V=Gi(se.processRef);V&&z.add(V);const Z=V?o.get(V):void 0,pe=((Z==null?void 0:Z.laneSets)??[]).flatMap(C=>C.lanes??[]),ve=pe.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of ve)B(C.id);const $e=!Z||(Z.flowElements??[]).length===0&&pe.length===0&&(Z.artifacts??[]).length===0;r.push({id:se.id,...se.name?{name:se.name}:{},...$e?{blackBox:!0}:{},...ve.length?{lanes:ve}:{}});const F=Ev(se,"bwl:poolOrder");F!==void 0&&(p.poolOrders[se.id]=F),Z&&q(Z,se.id)}for(const se of i.messageFlows??[])M(se.id),v.set(se.id,se),f.push({id:se.id,source:Gi(se.sourceRef),target:Gi(se.targetRef),...typeof se.name=="string"&&se.name?{name:se.name}:{}});N(i.artifacts??[]);for(const[se,V]of o)!z.has(se)&&(V.flowElements??[]).length>0&&u.push({id:se,type:V.$type,reason:"unreachable-process"})}else for(const z of o.values())q(z);const Y=[],ae=[],X=[],Me=[],Te=(z,se)=>!!z&&!!se&&E.has(z)&&E.has(se);for(const z of d){if(!Te(z.source,z.target)){u.push({id:z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Y.push({id:z.id,source:z.source,target:z.target,...z.name?{name:z.name}:{}}),E.add(z.id)}for(const z of f){if(!Te(z.source,z.target)){u.push({id:z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}ae.push({id:z.id,source:z.source,target:z.target,...z.name?{name:z.name}:{}}),E.add(z.id)}for(const z of g){if(!Te(z.source,z.target)){u.push({id:z.id??"",type:z.type,reason:"endpoint-outside-mvp"});continue}Me.push({...z.id?{id:z.id}:{},source:z.source,target:z.target}),z.id&&E.add(z.id)}for(const z of m){if(!Te(z.source,z.target)){u.push({id:z.id??"",type:z.type,reason:"endpoint-outside-mvp"});continue}X.push({...z.id?{id:z.id}:{},source:z.source,target:z.target})}const Pe=new Map(l.map(z=>[z.id,z]));for(const{owner:z,refs:se}of h){const V=se.filter(pe=>b.has(pe)),Z=Pe.get(z);Z&&V.length&&(Z.members=V)}for(const z of y)b.has(z.anchor)&&(p.placements[z.owner]={anchor:z.anchor,side:z.side,...z.offset!==void 0?{offset:z.offset}:{}});for(const[z,se]of _)b.has(se)&&(p.afterColumns[z]=se);const fe={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Y,...ae.length?{messageFlows:ae}:{},...s.length?{dataStores:s}:{},...Me.length?{dataAssociations:Me}:{},...c.length?{annotations:c}:{},...X.length?{associations:X}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:fe,hints:p,omitted:u,i18n:AT(fe,v,e,t.i18n)}:{definition:fe,hints:p,omitted:u}}function AT(e,t,n,i){const o=Vp(n),r=ps(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Wp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of Kp(u))r.includes(d.locale)&&a.push({id:c.id,...d})};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 TT(e,t={}){const{definitions:n,warnings:i}=await va(e);return{...Rv(n,t),warnings:i}}const PT=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Fd(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function kT(e){return Fd(e.processRef)!==void 0}function OT(e){const t=new Set,n=o=>{const r=Fd(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 DT(e){const t=[],n=i=>{for(const o of i.flowElements??[])PT.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 LT(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 jd(e){const t=[],n=e.rootElements??[],i=OT(e);for(const r of DT(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??[])kT(s)&&LT(r.get(Fd(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 IT(e){const{definitions:t,warnings:n}=await va(e);return{issues:jd(t),warnings:n}}const BT=.5,NT=8,$T=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Ea=e=>typeof e=="number"?e:Number(e??NaN),yl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function FT(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}=${yl(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=>`${yl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(yl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function jT(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?[Ea(s.x),Ea(s.y),Ea(s.width),Ea(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=yl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(d=>[Ea(d.x),Ea(d.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 Mv(e){const t=jT(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:")&&!$T.has(s)&&n.set(c,{type:s,props:FT(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 Cv(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 Av(e,t,n={}){const i=n.moveTolerance??BT,o=Mv(e),r=Mv(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||Cv(p.geometry,u.geometry,i)||Cv(p.label,u.label,n.labelTolerance??NT))&&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 HT(e,t,n={}){const[i,o]=await Promise.all([va(e),va(t)]);return{...Av(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function zT(e){return new Set([...e.added,...e.modified])}function Tv(e){return e.get("moddle").ids}function Pv(e,t,n){const i=Object.prototype.hasOwnProperty.call(e,"nextPrefixed"),o=e.nextPrefixed;e.nextPrefixed=t;try{return n()}finally{i?e.nextPrefixed=o:delete e.nextPrefixed}}function kv(e,t){const n=Tv(e),i=n.nextPrefixed,o=[];return{value:Pv(n,function(a,s){const c=i.call(this,a,s);return o.push(c),c},t),generatedIds:o}}function Ov(e,t,n){const i=Tv(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:Pv(i,function(l,u){const p=t[r++];return p!==void 0&&p.startsWith(l)&&!this.assigned(p)?(this.claim(p,u),a++,p):(s++,o.call(this,l,u))},n),fed:a,missed:s,remaining:Math.max(0,t.length-r)}}function GT(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Dv(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>$d(e,t.ops,{i18n:i}),{value:a,generatedIds:s}=o?kv(e,r):{value:r(),generatedIds:void 0};if(!a.ok)return{status:"rejected",issues:a.issues};const{xml:c}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:c??"",findings:a.findings,stats:a.stats,...s?{generatedIds:s}:{}}}const Ss=()=>typeof performance>"u"?Date.now():performance.now();function VT(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class Hd extends Error{constructor(t,n){super(n),this.reason=t}}async function Lv(e,t,{expectedXml:n,i18n:i}){const o=Ss(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(Ss()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(Ss()-o)};const a=e.get("commandStack"),s=ym(a),c=t.flatMap(p=>p.generatedIds);let l;try{r.run(()=>{const p=Ov(e,c,()=>{t.forEach((d,f)=>{f>0&&r.atBatchBoundary();const m=$d(e,d.ops,{...i?{i18n:i}:{}});if(!m.ok)throw new Hd("rejected",`배치 ${f+1}/${t.length} — ${VT(m.issues)}`)})});if(p.missed||p.remaining)throw new Hd("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof Hd?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=vm(a,s);if(!l)try{const{xml:p}=await e.saveXML({format:!0});p!==n&&(l={reason:"xml"})}catch(p){l={reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}return l?(u&&a.undo(),{status:"diverged",...l,ms:Math.round(Ss()-o)}):{status:"replayed",ms:Math.round(Ss()-o)}}const WT=new Set(["lasso","lasso.selection","hand","hand.move"]),Iv=1e4,UT="bwl-edit-locked",Bv=new WeakMap;function qT(e){const t=Bv.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",Iv,()=>{var s;if(o)return WT.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"],Iv,()=>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(UT,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 Bv.set(e,a),a}const YT=Symbol("bpmn-editor"),zd={geometry:[],semantic:[]};function KT(){const e=Ee.ref(!1),t=Ee.ref(!0),n=Ee.ref(!1),i=Ee.shallowRef(zd),o=Ee.shallowRef(void 0),r=Ee.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=zd;return}const h=ft(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:h,semantic:v?jd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const h=p();if(!h||!a){r.value=void 0;return}const v=h.locales(),b={};for(const E of v)b[E]={untranslated:h.untranslatedCount(E),reviewRequested:h.reviewRequestedCount(E)};r.value={designLocale:a.designLocale,locales:v,displayLocale:h.getDisplayLocale()??a.designLocale,counts:b}}function f(){const h=p();h&&(h.configure(a),a&&s&&(s=h.setDisplayLocale(s)))}const m=()=>{l||(e.value=!0,u())};function g(h,v){qT(h).set(!v)}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function _(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:o,i18n:r,configureI18n(h){a=h,f(),d()},setDisplayLocale(h){var b;s=h;const v=(b=p())==null?void 0:b.setDisplayLocale(h);v&&(s=v),d()},setChangeScope(h){o.value=h===void 0?void 0:new Set(h)},requestFocus(h){if(!c)return;const v=c.get("elementRegistry").get(h);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(h){const v=c==null?void 0:c.get("elementRegistry").get(h),b=v==null?void 0:v.businessObject;if(!b)return;const E=typeof b.name=="string"&&b.name.trim()!==""?b.name:b.text;return{name:typeof E=="string"&&E.trim()!==""?E.trim():void 0,type:typeof b.$type=="string"?b.$type:""}},attach(h){c&&this.detach(),c=h,c.get("eventBus").on("commandStack.changed",m),t.value||g(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",m),c&&!t.value&&g(c,!0),c=void 0,i.value=zd,o.value=void 0,r.value=void 0},setEditable(h){t.value=h,c&&g(c,h)},async applyAgentBatch(h,v){const b=y();n.value=!0;try{const E=await Dv(b,h,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return E.status==="applied"&&(e.value=!1),E}finally{n.value=!1}},async replayAgentTurn(h,v){const b=y(),E=e.value;n.value=!0,l=!0;try{const M=await Lv(b,h,{expectedXml:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return e.value=M.status==="replayed"?!1:E,M}finally{l=!1,n.value=!1,u()}},async importXml(h){const{warnings:v}=await y().importXML(h);return e.value=!1,o.value=void 0,u(),{warnings:ud(v)}},async saveXml(){const{xml:h}=await y().saveXML({format:!0});return e.value=!1,h??""},undo:()=>{var h;return(h=_())==null?void 0:h.undo()},redo:()=>{var h;return(h=_())==null?void 0:h.redo()},canUndo:()=>{var h;return((h=_())==null?void 0:h.canUndo())??!1},canRedo:()=>{var h;return((h=_())==null?void 0:h.canRedo())??!1}}}const XT=new RegExp("\\p{Script=Hangul}","u"),ZT=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,JT=new RegExp("\\p{Script=Han}","u");function vl(e){const t=XT.test(e),n=ZT.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:JT.test(e)?"han":"other"}}function Nv(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 $v(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=Or(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Go(a).filter(l=>Rn(l))})}return n}const Rs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function QT(e,t={}){const n=Nv(e),i=$v(e);let o;const r={},a=[],s=[],c=[];for(const g of i){const y=g.trs.filter(_=>(_.body??"")===g.name).map(Rn);if(y.length){const _=[...y].sort().join("+");r[_]=(r[_]??0)+1,o=o?new Set([...o].filter(h=>y.includes(h))):new Set(y)}else g.trs.some(_=>_.body)?a.push(Rs(g)):c.push({e:g,inference:vl(g.name)});for(const _ of g.trs){const h=Rn(_),v=_.body??"",b=vl(v);b.locale&&b.locale!==h?s.push({...Rs(g),locale:h,script:b.script}):h==="ko"&&b.script==="han"&&g.trs.some(E=>E!==_&&E.body===v)&&s.push({...Rs(g),locale:h,script:"han"})}}const l=new Set(c.map(g=>g.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const g=l.size===1?[...l][0]:void 0;g&&o.has(g)?[u,p]=[g,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const d=n??u,f=[],m=[];for(const{e:g,inference:y}of c)y.locale?y.locale!==d&&f.push({...Rs(g),locale:y.locale}):m.push({...Rs(g),script:y.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:m,drift:a,matchedBy:r,scriptMismatch:s}}function eP(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Nv(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map($v(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(d=>d.body))continue;const l=c.trs.find(d=>Rn(d)===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(kr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Fv(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;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const Gd=e=>Rn(e)||void 0,jv=e=>e.body??"";function Hv(e){const t=new Map;for(const n of Fv(e)){const i=Go(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Gd(o),body:jv(o)}))})}return t}const zv=e=>JSON.stringify(e.map(t=>t.body).sort());class tP{constructor(){an(this,"byId",new Map);an(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};Gv(this.byId,o,a),Gv(this.byBodies,zv(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(zv(t))??[]}}function Gv(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function nP(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function Vd(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function iP(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const oP=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function rP(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Hv(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=nP(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(y=>y.doc===t.doc&&Vd(y.state,c)).sort((y,_)=>_.version-y.version).slice(0,1).map(y=>y.state)],["lineage",t.index.sameId(a).filter(y=>y.doc!==t.doc&&Vd(y.state,c)).map(y=>y.state)],["bodies",t.index.sameBodies(s.cells).filter(y=>!(y.doc===t.doc&&y.id===a)&&Vd(y.state,c)).map(y=>y.state)]].find(([,y])=>y.length);if(!p){if(!r(s))continue;for(const[y,_]of c)for(let h=0;h<_;h++)n.unresolved.push({...l,body:y,script:vl(y).script});continue}const[d,f]=p,m=f.map(y=>iP(s,y,c));if(m.some(y=>y.overflow)||new Set(m.map(oP)).size>1){n.ambiguous.push({...l,source:d});continue}const[g]=m;for(const y of g.stale)n.stale.push({...l,...y});g.cells.length&&n.restores.push({...l,source:d,cells:g.cells})}return n}function aP(e,t){if(!t.restores.length)return 0;const n=new Map(Fv(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=Go(r),s=new Set(a.map(Gd).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Gd(p)&&jv(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Ne(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function sP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wd={exports:{}},Vv;function cP(){if(Vv)return Wd.exports;Vv=1;var e=Wd.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},Wd.exports}var lP=cP(),uP=sP(lP);function to(e){if(!(this instanceof to))return new to(e);e=e||[128,36,1],this._seed=e.length?uP.rack(e[0],e[1],e[2]):e}to.prototype.next=function(e){return this._seed(e||!0)},to.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},to.prototype.claim=function(e,t){this._seed.set(e,t||!0)},to.prototype.assigned=function(e){return this._seed.get(e)||!1},to.prototype.unclaim=function(e){delete this._seed.hats[e]},to.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const vn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};vn.td=vn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],vn.option=vn.optgroup=[1,'<select multiple="multiple">',"</select>"],vn.thead=vn.tbody=vn.colgroup=vn.caption=vn.tfoot=[1,"<table>","</table>"],vn.polyline=vn.ellipse=vn.polygon=vn.circle=vn.text=vn.line=vn.path=vn.rect=vn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Vt(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(vn,i)?vn[i]:vn._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 pP(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 Yn(e,...t){const n=e.style;return W(t,function(i){i&&W(i,function(o,r){n[r]=o})}),e}function Mn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const dP=Object.prototype.toString;function Pt(e){return new Ko(e)}function Ko(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ko.prototype.add=function(e){return this.list.add(e),this},Ko.prototype.remove=function(e){return dP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ko.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},Ko.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ko.prototype.array=function(){return Array.from(this.list)},Ko.prototype.has=Ko.prototype.contains=function(e){return this.list.contains(e)};function xl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function jr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function fP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bl={},Wv;function hP(){if(Wv)return bl;Wv=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return bl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},bl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},bl}var Uv=hP(),gP=fP(Uv),We=pP({__proto__:null,default:gP},[Uv]),qv=["focus","blur"];function mP(e,t,n,i,o){return qv.indexOf(n)!==-1&&(o=!0),We.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=jr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function yP(e,t,n,i){return qv.indexOf(t)!==-1&&(i=!0),We.unbind(e,t,n,i)}var ai={bind:mP,unbind:yP};function Ud(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Ct(e,t){return t=t||document,t.querySelector(e)}function Ms(e,t){return t=t||document,t.querySelectorAll(e)}function no(e){e.parentNode&&e.parentNode.removeChild(e)}function vP(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function xP(e,t){return t.appendChild(vP(e,t))}function tt(e,t){return xP(t,e),e}var qd=2,Yv={"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":qd,"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":qd,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function bP(e,t){return Yv[t]?e.style[t]:e.getAttributeNS(null,t)}function Kv(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Yv[i];o?(o===qd&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function wP(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Kv(e,o,t[o])}function Le(e,t,n){if(typeof t=="string")if(n!==void 0)Kv(e,t,n);else return bP(e,t);else wP(e,t);return e}const _P=Object.prototype.toString;function gt(e){return new Xo(e)}function Xo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xo.prototype.add=function(e){return this.list.add(e),this},Xo.prototype.remove=function(e){return _P.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xo.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},Xo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xo.prototype.array=function(){return Array.from(this.list)},Xo.prototype.has=Xo.prototype.contains=function(e){return this.list.contains(e)};function Cs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Yd(e){return e.cloneNode(!0)}var Kd={svg:"http://www.w3.org/2000/svg"},Xv='<svg xmlns="'+Kd.svg+'"';function EP(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Kd.svg)===-1&&(e=Xv+e.substring(4)):(e=Xv+">"+e+"</svg>",t=!0);var n=SP(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function SP(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function je(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=EP(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Kd.svg,e),t&&Le(n,t),n}var Xd=null;function Zv(){return Xd===null&&(Xd=je("svg")),Xd}function Jv(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function RP(e,t,n,i,o,r){var a=Zv().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Jv(a,e);case 6:return Jv(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function As(e){return Zv().createSVGTransform()}var Qv=/([&<>]{1})/g,MP=/([&<>\n\r"]{1})/g,CP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Zd(e,t){function n(i,o){return CP[o]||o}return e.replace(t,n)}function ex(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Zd(e.textContent,Qv));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,'="',Zd(r.value,MP),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ex(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Zd(e.nodeValue,Qv),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function AP(e){for(var t=e.firstChild,n=[];t;)ex(t,n),t=t.nextSibling;return n.join("")}function tx(e,t){return AP(e)}function cn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function TP(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function PP(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(TP(e,i))}function Ts(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),PP(n,t)),n.consolidate()}const kP=/^class[ {]/;function OP(e){return kP.test(e.toString())}function Jd(e){return Array.isArray(e)}function Qd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function wl(...e){e.length===1&&Jd(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const DP=/constructor\s*[^(]*\(\s*([^)]*)\)/m,LP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,IP=/\/\*([^*]*)\*\//m;function BP(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(OP(e)?DP:LP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(IP);return(o&&o[1]||i).trim()})||[]}function nx(e,t){const n=t||{get:function(v,b){if(i.push(v),b===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const b=i.join(" -> ");return i.length=0,new Error(b?`${v} (Resolving: ${b})`:v)};function c(v,b){if(!o[v]&&v.includes(".")){const E=v.split(".");let M=c(E.shift());for(;E.length;)M=M[E.shift()];return M}if(Qd(r,v))return r[v];if(Qd(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,b)}function l(v,b){if(typeof b>"u"&&(b={}),typeof v!="function")if(Jd(v))v=wl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const M=(v.$inject||BP(v)).map(B=>Qd(b,B)?b[B]:c(B));return{fn:v,dependencies:M}}function u(v){const{fn:b,dependencies:E}=l(v),M=Function.prototype.bind.call(b,null,...E);return new M}function p(v,b,E){const{fn:M,dependencies:B}=l(v,E);return M.apply(b,B)}function d(v){return wl(b=>v.get(b))}function f(v,b){if(b&&b.length){const E=Object.create(null),M=Object.create(null),B=[],P=[],k=[];let N,G,q,Y;for(let ae in o)N=o[ae],b.indexOf(ae)!==-1&&(N[2]==="private"?(G=B.indexOf(N[3]),G===-1?(q=N[3].createChild([],b),Y=d(q),B.push(N[3]),P.push(q),k.push(Y),E[ae]=[Y,ae,"private",q]):E[ae]=[k[G],ae,"private",P[G]]):E[ae]=[N[2],N[1]],M[ae]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&b.forEach(X=>{N[1].$scope.indexOf(X)!==-1&&(E[ae]=[N[2],N[1]],M[X]=!0)});b.forEach(ae=>{if(!M[ae])throw new Error('No provider for "'+ae+'". Cannot use provider from the parent!')}),v.unshift(E)}return new nx(v,a)}const m={factory:p,type:u,value:function(v){return v}};function g(v,b){const E=v.__init__||[];return function(){E.forEach(M=>{typeof M=="string"?b.get(M):b.invoke(M)})}}function y(v){const b=v.__exports__;if(b){const E=v.__modules__,M=Object.keys(v).reduce((G,q)=>(q!=="__exports__"&&q!=="__modules__"&&q!=="__init__"&&q!=="__depends__"&&(G[q]=v[q]),G),Object.create(null)),B=(E||[]).concat(M),P=f(B),k=wl(function(G){return P.get(G)});b.forEach(function(G){o[G]=[k,G,"private",P]});const N=(v.__init__||[]).slice();return N.unshift(function(){P.init()}),v=Object.assign({},v,{__init__:N}),g(v,P)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const M=v[E];if(M[2]==="private"){o[E]=M;return}const B=M[0],P=M[1];o[E]=[m[B],NP(B,P),B]}),g(v,a)}function _(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(_,v),v.indexOf(b)!==-1)?v:v.concat(b)}function h(v){const b=v.reduce(_,[]).map(y);let E=!1;return function(){E||(E=!0,b.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=f,this.init=h(e)}function NP(e,t){return e!=="value"&&Jd(t)&&(t=wl(t.slice())),t}var $P=1e3;function _o(e,t){var n=this;t=t||$P,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)})}_o.prototype.canRender=function(e){},_o.prototype.drawShape=function(e,t){},_o.prototype.drawConnection=function(e,t){},_o.prototype.getShapePath=function(e){},_o.prototype.getConnectionPath=function(e){};function Hr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function FP(e){return["M",e.x,e.y]}function ef(e){return["L",e.x,e.y]}function jP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function HP(e,t){const n=e.length,i=[FP(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(ef(a));continue}const c=Math.min(t,tf(a.x-r.x,a.y-r.y),tf(s.x-a.x,s.y-a.y));if(!c){i.push(ef(a));continue}const l=_l(a,r,c),u=_l(a,r,c*.5),p=_l(a,s,c),d=_l(a,s,c*.5);i.push(ef(l)),i.push(jP(u,d,p))}return i}function _l(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=tf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function tf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ps(e,t,n){Je(t)&&(n=t,t=null),t||(t={});const i=je("path",t);return Je(n)&&(i.dataset.cornerRadius=String(n)),nf(i,e)}function nf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Le(e,{d:Hr(HP(t,n))}),e}function El(e){var t=new Set(e);return dt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function zr(e,t,n){n=n||0,Ze(e)||(e=[e]),W(e,function(i,o){var r=t(i,o,n);Ze(r)&&r.length&&zr(r,t,n+1)})}function of(e,t,n){var i=new Set,o=new Set;return zr(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 ks(e,t){return of(e)}function zP(e,t,n){Pr(t)&&(t=!0),yn(t)&&(n=t,t=!0),n=n||{};var i=Os(n.allShapes),o=Os(n.allConnections),r=Os(n.enclosedElements),a=Os(n.enclosedConnections),s=Os(n.topLevel,t&&ha(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,W(u.incoming,c),W(u.outgoing,c),u.children}return zr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function ln(e,t){t=!!t,Ze(e)||(e=[e]);var n,i,o,r;return W(e,function(a){var s=a;a.waypoints&&!t&&(s=ln(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 Sa(e,t){var n={};return W(e,function(i){var o=i;o.waypoints&&(o=ln(o)),!Je(t.y)&&o.x>t.x&&(n[i.id]=i),!Je(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Je(t.width)&&Je(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Je(t.width)||!Je(t.height))&&(n[i.id]=i)}),n}function ix(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ox(e){return!!(e&&e.isFrame)}function Os(e,t){return J({},e||{},t||{})}var GP=1;function Zo(e,t){_o.call(this,e,GP),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})}Ne(Zo,_o),Zo.prototype.canRender=function(){return!0},Zo.prototype.drawShape=function(t,n,i){var o=je("rect");return Le(o,{x:0,y:0,width:n.width||0,height:n.height||0}),ox(n)?Le(o,J({},this.FRAME_STYLE,i||{})):Le(o,J({},this.SHAPE_STYLE,i||{})),tt(t,o),o},Zo.prototype.drawConnection=function(t,n,i){var o=Ps(n.waypoints,J({},this.CONNECTION_STYLE,i||{}));return tt(t,o),o},Zo.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 Hr(a)},Zo.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 Hr(r)},Zo.$inject=["eventBus","styles"];function VP(){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 J(r,{class:n})},this.style=function(n,i){!Ze(n)&&!i&&(i=n,n=[]);var o=ri(n,function(r,a){return J(r,e[a]||{})},{});return i?J(o,i):o},this.computeStyle=function(n,i,o){return Ze(i)||(o=i,i=[]),t.style(i||[],J({},o,n||{}))}}const WP={__init__:["defaultRenderer"],defaultRenderer:["type",Zo],styles:["type",VP]};function nn(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function rn(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 rf(e,t){return!e||!t?-1:e.indexOf(t)}function Ds(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function af(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=Ds(e,t);return Math.abs(o/r)<=i}var UP=2;function Eo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(qP(o,n))return r;return!1}function qP(e,t){const n=t[0];return Ho(t,function(i){return Math.abs(n[e]-i[e])<=UP})}function rx(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 sf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var YP=/,?([a-z]),?/gi,ax=parseFloat,un=Math,Jo=un.PI,io=un.min,oo=un.max,sx=un.pow,Qo=un.abs,KP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,XP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,cx=Array.isArray||function(e){return e instanceof Array};function ZP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function JP(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 QP(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 ZP(o,i)?(JP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function e2(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(KP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(XP,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=lf,n}function t2(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 n2(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 lf(){return this.join(",").replace(YP,"$1")}function i2(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=lf,t}function lx(e,t,n,i,o,r,a,s,c){var l=1-c,u=sx(l,3),p=sx(l,2),d=c*c,f=d*c,m=u*e+p*3*c*n+l*3*c*c*o+f*a,g=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:Sl(m),y:Sl(g)}}function ux(e){var t=l2(...e);return cf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function o2(e,t){return e=cf(e),t=cf(t),er(t,e.x,e.y)||er(t,e.x2,e.y)||er(t,e.x,e.y2)||er(t,e.x2,e.y2)||er(e,t.x,t.y)||er(e,t.x2,t.y)||er(e,t.x,t.y2)||er(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 px(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 dx(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],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,m=0;m<u;m++){var g=l*p[m]+l,y=px(g,e,n,o,a),_=px(g,t,i,r,s),h=y*y+_*_;f+=d[m]*un.sqrt(h)}return l*f}function r2(e,t,n,i,o,r,a,s){if(!(oo(e,n)<io(o,a)||io(e,n)>oo(o,a)||oo(t,i)<io(r,s)||io(t,i)>oo(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=Sl(c/u),d=Sl(l/u),f=+p.toFixed(2),m=+d.toFixed(2);if(!(f<+io(e,n).toFixed(2)||f>+oo(e,n).toFixed(2)||f<+io(o,a).toFixed(2)||f>+oo(o,a).toFixed(2)||m<+io(t,i).toFixed(2)||m>+oo(t,i).toFixed(2)||m<+io(r,s).toFixed(2)||m>+oo(r,s).toFixed(2)))return{x:p,y:d}}}}function Sl(e){return Math.round(e*1e11)/1e11}function a2(e,t,n){var i=ux(e),o=ux(t);if(!o2(i,o))return[];var r=dx(...e),a=dx(...t),s=hx(e)?1:~~(r/5)||1,c=hx(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,m;for(f=0;f<s+1;f++){var g=lx(...e,f/s);l[f]={x:g.x,y:g.y,t:f/s}}for(f=0;f<c+1;f++)g=lx(...t,f/c),u[f]={x:g.x,y:g.y,t:f/c};for(f=0;f<s;f++)for(m=0;m<c;m++){var y=l[f],_=l[f+1],h=u[m],v=u[m+1],b=Qo(_.x-y.x)<.01?"y":"x",E=Qo(v.x-h.x)<.01?"y":"x",M=r2(y.x,y.y,_.x,_.y,h.x,h.y,v.x,v.y),B;if(M){if(B=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[B])continue;p[B]=!0;var P=y.t+Qo((M[b]-y[b])/(_[b]-y[b]))*(_.t-y.t),k=h.t+Qo((M[E]-h[E])/(v[E]-h[E]))*(v.t-h.t);P>=0&&P<=1&&k>=0&&k<=1&&d.push({x:M.x,y:M.y,t1:P,t2:k})}}return d}function fx(e,t,n){e=yx(e),t=yx(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],m=0,g=e.length;m<g;m++){var y=e[m];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,h=t.length;_<h;_++){var v=t[_];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(d=[r,a,...v.slice(1)],r=d[6],a=d[7]):(d=[r,a,r,a,l,u,l,u],r=l,a=u);var b=a2(p,d);{for(var E=0,M=b.length;E<M;E++)b[E].segment1=m,b[E].segment2=_,b[E].bez1=p,b[E].bez2=d;f=f.concat(b)}}}}}return f}function s2(e){return cx(e)&&cx(e[0])}function c2(e){if(t2(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 d=1,f=l.length;d<f;d++)c[d]=+l[d]+(d%2?n:i)}else for(var m=0,g=l.length;m<g;m++)c[m]=l[m];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=lf,t}function hx(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Rl(e,t,n,i){return[e,t,n,i,n,i]}function gx(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 mx(e,t,n,i,o,r,a,s,c,l){var u=Jo*120/180,p=Jo/180*(+o||0),d=[],f,m=QP(function(F,C,R){var U=F*un.cos(R)-C*un.sin(R),ee=F*un.sin(R)+C*un.cos(R);return{x:U,y:ee}});if(l)B=l[0],P=l[1],E=l[2],M=l[3];else{f=m(e,t,-p),e=f.x,t=f.y,f=m(s,c,-p),s=f.x,c=f.y;var g=(e-s)/2,y=(t-c)/2,_=g*g/(n*n)+y*y/(i*i);_>1&&(_=un.sqrt(_),n=_*n,i=_*i);var h=n*n,v=i*i,b=(r==a?-1:1)*un.sqrt(Qo((h*v-h*y*y-v*g*g)/(h*y*y+v*g*g))),E=b*n*y/i+(e+s)/2,M=b*-i*g/n+(t+c)/2,B=un.asin(((t-M)/i).toFixed(9)),P=un.asin(((c-M)/i).toFixed(9));B=e<E?Jo-B:B,P=s<E?Jo-P:P,B<0&&(B=Jo*2+B),P<0&&(P=Jo*2+P),a&&B>P&&(B=B-Jo*2),!a&&P>B&&(P=P-Jo*2)}var k=P-B;if(Qo(k)>u){var N=P,G=s,q=c;P=B+u*(a&&P>B?1:-1),s=E+n*un.cos(P),c=M+i*un.sin(P),d=mx(s,c,n,i,o,0,a,G,q,[P,N,E,M])}k=P-B;var Y=un.cos(B),ae=un.sin(B),X=un.cos(P),Me=un.sin(P),Te=un.tan(k/4),Pe=4/3*n*Te,fe=4/3*i*Te,z=[e,t],se=[e+Pe*ae,t-fe*Y],V=[s+Pe*Me,c-fe*X],Z=[s,c];if(se[0]=2*z[0]-se[0],se[1]=2*z[1]-se[1],l)return[se,V,Z].concat(d);d=[se,V,Z].concat(d).join().split(",");for(var pe=[],ve=0,$e=d.length;ve<$e;ve++)pe[ve]=ve%2?m(d[ve-1],d[ve],p).y:m(d[ve],d[ve+1],p).x;return pe}function l2(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,m,g,y,_,h=0;h<2;++h){if(h==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,d=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,d=3*i-3*t),Qo(u)<1e-12){if(Qo(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}y=p*p-4*d*u,_=un.sqrt(y),!(y<0)&&(m=(-p+_)/(2*u),0<m&&m<1&&c.push(m),g=(-p-_)/(2*u),0<g&&g<1&&c.push(g))}for(var v=c.length,b=v,E;v--;)f=c[v],E=1-f,l[0][v]=E*E*E*e+3*E*E*f*n+3*E*f*f*o+f*f*f*a,l[1][v]=E*E*E*t+3*E*E*f*i+3*E*f*f*r+f*f*f*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:io(...l[0]),y0:io(...l[1]),x1:oo(...l[0]),y1:oo(...l[1])}}function yx(e){if(s2(e)||(e=e2(e)),n2(e))return e;for(var t=i2(c2(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,m){var g,y;if(!d)return["C",f.x,f.y,f.x,f.y,f.x,f.y];switch(!(d[0]in{T:1,Q:1})&&(f.qx=f.qy=null),d[0]){case"M":f.X=d[1],f.Y=d[2];break;case"A":d=["C",...mx(f.x,f.y,...d.slice(1))];break;case"S":m=="C"||m=="S"?(g=f.x*2-f.bx,y=f.y*2-f.by):(g=f.x,y=f.y),d=["C",g,y,...d.slice(1)];break;case"T":m=="Q"||m=="T"?(f.qx=f.x*2-f.qx,f.qy=f.y*2-f.qy):(f.qx=f.x,f.qy=f.y),d=["C",...gx(f.x,f.y,f.qx,f.qy,d[1],d[2])];break;case"Q":f.qx=d[1],f.qy=d[2],d=["C",...gx(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",...Rl(f.x,f.y,d[1],d[2])];break;case"H":d=["C",...Rl(f.x,f.y,d[1],f.y)];break;case"V":d=["C",...Rl(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",...Rl(f.x,f.y,f.X,f.Y)];break}return d},o=function(d,f){if(d[f].length>7){d[f].shift();for(var m=d[f];m.length;)r[f]="A",d.splice(f++,0,["C",...m.splice(0,6)]);d.splice(f,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=ax(u[p-4])||n.x,n.by=ax(u[p-3])||n.y}return t}function It(e){return yn(e)&&oi(e,"waypoints")}function lt(e){return yn(e)&&oi(e,"labelTarget")}function u2(e){return yn(e)&&da(e.parent)}function vx(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function So(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function qe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ml(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function p2(e){return So({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function d2(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var d=t[p-1];if(d){var f=l[l.length-1],m=f&&f.endLength||0,g=g2(d,u);l.push({start:d,end:u,startLength:m,endLength:m+g,length:g})}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 Qe(e){return It(e)?d2(e):p2(e)}function Bn(e,t,n){n=n||0,yn(n)||(n={x:n,y:n});var i=qe(e),o=qe(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 Ls(e,t,n){var i=f2(e,t);return i.length===1||i.length===2&&Ds(i[0],i[1])<1?So(i[0]):i.length>1?(i=Xi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),So(i[n?0:i.length-1])):null}function f2(e,t){return fx(e,t)}function h2(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Ds(n,o)===0||af(i,o,n)?e.splice(t,1):t++;return e}function g2(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cl(e,t){return Math.round(e*t)/t}function xx(e){return Je(e)?e+"px":e}function m2(e){for(;e.parent;)e=e.parent;return e}function y2(e){e=J({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Yn(n,{position:"relative",overflow:"hidden",width:xx(e.width),height:xx(e.height)}),t.appendChild(n),n}function bx(e,t,n){const i=je("g");gt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const v2="base",wx=0,x2=1,b2={shape:["x","y","width","height"],connection:["waypoints"]};function et(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||{})}et.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],et.prototype._init=function(e){const t=this._eventBus,n=this._container=y2(e),i=this._svg=je("svg");Le(i,{width:"100%",height:"100%"}),Mn(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")}),tt(n,i);const o=this._viewport=bx(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Gp(this._viewboxChanged,300)),this._restoreFocus=Gp(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)},et.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},et.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},et.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=ix(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},et.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},et.prototype.restoreFocus=function(){this._restoreFocus()},et.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},et.prototype.isFocused=function(){return this._focused},et.prototype.getDefaultLayer=function(){return this.getLayer(v2,wx)},et.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},et.prototype._getChildIndex=function(e){return ri(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},et.prototype._createLayer=function(e,t){typeof t>"u"&&(t=x2);const n=this._getChildIndex(t);return{group:bx(this._viewport,"layer-"+e,n),index:t,visible:!0}},et.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},et.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&&(cn(n),t.visible=!1),n},et.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],cn(t.group))},et.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},et.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(m2(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},et.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},et.prototype._findPlaneForRoot=function(e){return Ft(this._planes,function(t){return t.rootElement===e})},et.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},et.prototype._resolveElements=function(e){return Ze(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},et.prototype.getContainer=function(){return this._container},et.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&&(W([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),gt(o).add(t)):(e.markers.delete(t),gt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},et.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},et.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},et.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},et.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},et.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},et.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,wx);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},et.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},et.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},et.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)},et.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})},et.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})},et.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=b2[e];if(!Ho(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},et.prototype._setParent=function(e,t,n){rn(t.children,e,n),e.parent=t},et.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},et.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},et.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},et.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),nn(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},et.prototype.removeShape=function(e){return this._removeElement(e,"shape")},et.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},et.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},et.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},et.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},et.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);Ts(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Ts(t),o=a?a.matrix:RP(),s=Cl(o.a,1e3),c=Cl(-o.e||0,1e3),l=Cl(-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},et.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=J({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),_x(t,n)}),{x:n.e,y:n.f}},et.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(m=>m!=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=ln(r),s=qe(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 d=qe(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const m=Math.max(0,s.right-d.right),g=Math.min(0,s.left-d.left),y=Math.max(0,s.bottom-d.bottom),_=Math.min(0,s.top-d.top);u=m||g,p=y||_}this.scroll({dx:-u*l,dy:-p*l})},et.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)}),Cl(i.a,1e3)};function _x(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}et.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},et.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=J(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),_x(this._viewport,u),u},et.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},et.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}},et.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ra="data-element-id";function vi(e){this._elements={},this._eventBus=e}vi.$inject=["eventBus"],vi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Le(t,Ra,i),n&&Le(n,Ra,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},vi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Le(i.gfx,Ra,""),i.secondaryGfx&&Le(i.secondaryGfx,Ra,""),delete t[n])},vi.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)},vi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Le(t,Ra,i),t},vi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Le(e,Ra);var n=this._elements[t];return n&&n.element},vi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},vi.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}},vi.prototype.getAll=function(){return this.filter(function(e){return e})},vi.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)})},vi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},vi.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 w2(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 _2(e){return e.__refs_collection===!0}function E2(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Ex(e,t,n){var i=w2(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 S2(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 Si(e,t){if(!(this instanceof Si))return new Si(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Si.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?Ex(this,t,e):S2(this,t,e)},Si.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return _2(n)||Ex(this,t,e),n},Si.prototype.ensureBound=function(e,t){E2(e,t)||this.bind(e,t)},Si.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Si.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var uf=new Si({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Sx=new Si({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Rx=new Si({name:"attachers",collection:!0},{name:"host"}),Mx=new Si({name:"outgoing",collection:!0},{name:"source"}),Cx=new Si({name:"incoming",collection:!0},{name:"target"});function Ma(){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)}}),uf.bind(this,"parent"),Sx.bind(this,"labels"),Mx.bind(this,"outgoing"),Cx.bind(this,"incoming")}function Is(){Ma.call(this),uf.bind(this,"children"),Rx.bind(this,"host"),Rx.bind(this,"attachers")}Ne(Is,Ma);function Ax(){Ma.call(this),uf.bind(this,"children")}Ne(Ax,Is);function Tx(){Is.call(this),Sx.bind(this,"labelTarget")}Ne(Tx,Is);function Px(){Ma.call(this),Mx.bind(this,"source"),Cx.bind(this,"target")}Ne(Px,Ma);var R2={connection:Px,shape:Is,label:Tx,root:Ax};function M2(e,t){var n=R2[e];if(!n)throw new Error("unknown type: <"+e+">");return J(new n,t)}function C2(e){return e instanceof Ma}function Ro(){this._uid=12}Ro.prototype.createRoot=function(e){return this.create("root",e)},Ro.prototype.createLabel=function(e){return this.create("label",e)},Ro.prototype.createShape=function(e){return this.create("shape",e)},Ro.prototype.createConnection=function(e){return this.create("connection",e)},Ro.prototype.create=function(e,t){return t=J({},t||{}),t.id||(t.id=e+"_"+this._uid++),M2(e,t)};var Al="__fn",kx=1e3,A2=Array.prototype.slice;function si(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}si.prototype.on=function(e,t,n,i){if(e=Ze(e)?e:[e],wn(t)&&(i=n,n=t,t=kx),!Je(t))throw new Error("priority must be a number");var o=n;i&&(o=Zn(n,i),o[Al]=n[Al]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},si.prototype.once=function(e,t,n,i){var o=this;if(wn(t)&&(i=n,n=t,t=kx),!Je(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[Al]=n,this.on(e,t,r)},si.prototype.off=function(e,t){e=Ze(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},si.prototype.createEvent=function(e){var t=new Bs;return t.init(e),t},si.prototype.fire=function(e,t){var n,i,o,r;if(r=A2.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}},si.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},si.prototype._destroy=function(){this._listeners={}},si.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},si.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=T2(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},si.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},si.prototype._getListeners=function(e){return this._listeners[e]},si.prototype._setListeners=function(e,t){this._listeners[e]=t},si.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[Al]===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){J(this,e||{})};function T2(e,t){return e.apply(null,t)}function tr(e){return e.childNodes[0]}function P2(e){return e.parentNode.childNodes[1]}function Tl(e,t,n,i,o){var r=As();r.setTranslate(t,n);var a=As();a.setRotate(i||0,0,0);var s=As();s.setScale(1,1),Ts(e,[r,a,s])}function Nn(e,t,n){var i=As();i.setTranslate(t,n),Ts(e,i)}function Ox(e,t){var n=As();n.setRotate(t,0,0),Ts(e,n)}function xi(e,t){this._eventBus=e,this._elementRegistry=t}xi.$inject=["eventBus","elementRegistry"],xi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=P2(t),n||(n=je("g"),gt(n).add("djs-children"),tt(t.parentNode,n))):n=t,n},xi.prototype._clear=function(e){var t=tr(e);return xl(t),t},xi.prototype._createContainer=function(e,t,n,i){var o=je("g");gt(o).add("djs-group"),typeof n<"u"?k2(o,t,t.childNodes[n]):tt(t,o);var r=je("g");gt(r).add("djs-element"),gt(r).add("djs-"+e),i&&gt(r).add("djs-frame"),tt(o,r);var a=je("g");return gt(a).add("djs-visual"),tt(r,a),r},xi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,ox(t))},xi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ri(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),W(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;W(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},xi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},xi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},xi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},xi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},xi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Nn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Le(n,"display","none"):Le(n,"display","block")}},xi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);cn(t.parentNode)};function k2(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const O2={__depends__:[WP],__init__:["canvas"],canvas:["type",et],elementRegistry:["type",vi],elementFactory:["type",Ro],eventBus:["type",si],graphicsFactory:["type",xi]};function D2(e){var t=new nx(e);return t.init(),t}function L2(e){e=e||{};var t={config:["value",e]},n=[t,O2].concat(e.modules||[]);return D2(n)}function nr(e,t){this._injector=t||L2(e),this.get("eventBus").fire("diagram.init")}nr.prototype.get=function(e,t){return this._injector.get(e,t)},nr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},nr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Vn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Qn(e,t){return e.$instanceOf(t)}function I2(e){return Ft(e.rootElements,function(t){return Qn(t,"bpmn:Process")||Qn(t,"bpmn:Collaboration")})}function B2(e){var t={},n=[],i={};function o(V,Z){return function(pe){V(pe,Z)}}function r(V){t[V.id]=V}function a(V){return t[V.id]}function s(V,Z){var pe=V.gfx;if(pe)throw new Error(`already rendered ${Vn(V)}`);return e.element(V,i[V.id],Z)}function c(V,Z){return e.root(V,i[V.id],Z)}function l(V,Z){try{var pe=i[V.id]&&s(V,Z);return r(V),pe}catch(ve){u(ve.message,{element:V,error:ve}),console.error(`failed to import ${Vn(V)}`,ve)}}function u(V,Z){e.error(V,Z)}var p=this.registerDi=function(Z){var pe=Z.bpmnElement;pe?i[pe.id]?u(`multiple DI elements defined for ${Vn(pe)}`,{element:pe}):i[pe.id]=Z:u(`no bpmnElement referenced in ${Vn(Z)}`,{element:Z})};function d(V){f(V.plane)}function f(V){p(V),W(V.planeElement,m)}function m(V){p(V)}this.handleDefinitions=function(Z,pe){var ve=Z.diagrams;if(pe&&ve.indexOf(pe)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!pe&&ve&&ve.length&&(pe=ve[0]),!pe)throw new Error("no diagram to display");i={},d(pe);var $e=pe.plane;if(!$e)throw new Error(`no plane for ${Vn(pe)}`);var F=$e.bpmnElement;if(!F)if(F=I2(Z),F)u(`correcting missing bpmnElement on ${Vn($e)} to ${Vn(F)}`),$e.bpmnElement=F,p($e);else throw new Error("no process or collaboration to display");var C=c(F,$e);if(Qn(F,"bpmn:Process")||Qn(F,"bpmn:SubProcess"))y(F,C);else if(Qn(F,"bpmn:Collaboration"))z(F,C),_(Z.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Vn($e)}: ${Vn(F)}`);g(n)};var g=this.handleDeferred=function(){for(var Z;n.length;)Z=n.shift(),Z()};function y(V,Z){Te(V,Z),k(V.ioSpecification,Z),P(V.artifacts,Z),r(V)}function _(V,Z){var pe=dt(V,function(ve){return!a(ve)&&Qn(ve,"bpmn:Process")&&ve.laneSets});pe.forEach(o(y,Z))}function h(V,Z){l(V,Z)}function v(V,Z){W(V,o(h,Z))}function b(V,Z){l(V,Z)}function E(V,Z){l(V,Z)}function M(V,Z){l(V,Z)}function B(V,Z){l(V,Z)}function P(V,Z){W(V,function(pe){Qn(pe,"bpmn:Association")?n.push(function(){B(pe,Z)}):B(pe,Z)})}function k(V,Z){V&&(W(V.dataInputs,o(E,Z)),W(V.dataOutputs,o(M,Z)))}var N=this.handleSubProcess=function(Z,pe){Te(Z,pe),P(Z.artifacts,pe)};function G(V,Z){var pe=l(V,Z);Qn(V,"bpmn:SubProcess")&&N(V,pe||Z),Qn(V,"bpmn:Activity")&&k(V.ioSpecification,Z),n.push(function(){W(V.dataInputAssociations,o(b,Z)),W(V.dataOutputAssociations,o(b,Z))})}function q(V,Z){l(V,Z)}function Y(V,Z){l(V,Z)}function ae(V,Z){n.push(function(){var pe=l(V,Z);V.childLaneSet&&X(V.childLaneSet,pe||Z),se(V)})}function X(V,Z){W(V.lanes,o(ae,Z))}function Me(V,Z){W(V,o(X,Z))}function Te(V,Z){Pe(V.flowElements,Z),V.laneSets&&Me(V.laneSets,Z)}function Pe(V,Z){W(V,function(pe){Qn(pe,"bpmn:SequenceFlow")?n.push(function(){q(pe,Z)}):Qn(pe,"bpmn:BoundaryEvent")?n.unshift(function(){G(pe,Z)}):Qn(pe,"bpmn:FlowNode")?G(pe,Z):Qn(pe,"bpmn:DataObject")||(Qn(pe,"bpmn:DataStoreReference")||Qn(pe,"bpmn:DataObjectReference")?Y(pe,Z):u(`unrecognized flowElement ${Vn(pe)} in context ${Vn(Z&&Z.businessObject)}`,{element:pe,context:Z}))})}function fe(V,Z){var pe=l(V,Z),ve=V.processRef;ve&&y(ve,pe||Z)}function z(V,Z){W(V.participants,o(fe,Z)),n.push(function(){v(V.messageFlows,Z)}),P(V.artifacts,Z)}function se(V){W(V.flowNodeRef,function(Z){var pe=Z.get("lanes");pe&&pe.push(V)})}}function Dx(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(g,y){return i.add(g,y)},element:function(g,y,_){return i.add(g,y,_)},error:function(g,y){s.push({message:g,context:y})}},d=new B2(p);u=u||l.diagrams&&l.diagrams[0];var f=N2(l,u);if(!f)throw new Error("no diagram to display");W(f,function(g){d.handleDefinitions(l,g)});var m=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(m+"_plane")||r.findRoot(m))}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 N2(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=$2(n));var o;A(i,"bpmn:Collaboration")?o=i:o=Ft(e.rootElements,function(l){if(A(l,"bpmn:Collaboration"))return Ft(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Hn(o.participants,function(l){return l.processRef}),r.push(o));var a=Lx(r),s=[t],c=[n];return W(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 Lx(e){var t=[];return W(e,function(n){n&&(t.push(n),t=t.concat(Lx(n.flowElements)))}),t}function $2(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var F2='<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>',Ix=F2,Bx={verticalAlign:"middle"},Nx={color:"#404040"},j2={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},H2={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},z2={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"},G2='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Ix+'</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>',ro;function V2(){ro=Vt(G2),Yn(ro,j2),Yn(Ct("svg",ro),Bx),Yn(Ct(".backdrop",ro),H2),Yn(Ct(".notice",ro),z2),Yn(Ct(".link",ro),Nx,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function W2(){ro||(V2(),ai.bind(ro,".backdrop","click",function(e){document.body.removeChild(ro)})),document.body.appendChild(ro)}const Pl=5,$x="djs-outline-hidden";function Yt(e){e=J({},q2,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),K2(this._container)}Ne(Yt,nr),Yt.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(d){throw this._emit("import.parse.complete",{error:d}),d}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||[]),kl(s,r),s=U2(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw kl(r,[]),r}if(typeof t=="string"&&(i=Y2(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw kl(r,[]),r}try{this.clear()}catch(r){throw kl(r,[]),r}const{warnings:o}=await Dx(this,n,i);return{warnings:o}},Yt.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},Yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Ct(":scope > defs",i._svg),a=tx(o),s=r?"<defs>"+tx(r)+"</defs>":"",c=i.getContainer();Pt(c).add($x);let l;try{l=o.getBBox()}finally{Pt(c).remove($x)}const u=l.x-Pl,p=l.y-Pl,d=l.width+Pl*2,f=l.height+Pl*2;t=`<?xml version="1.0" encoding="utf-8"?>
7
7
  <!-- created with bpmn-js / http://bpmn.io -->
8
8
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
9
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+d+'" height="'+f+'" viewBox="'+u+" "+p+" "+d+" "+f+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Yt.prototype._setDefinitions=function(e){this._definitions=e},Yt.prototype.getModules=function(){return this._modules},Yt.prototype.clear=function(){this.getDefinitions()&&nr.prototype.clear.call(this)},Yt.prototype.destroy=function(){nr.prototype.destroy.call(this),no(this._container)},Yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Yt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Ct(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Yt.prototype.getDefinitions=function(){return this._definitions},Yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Yt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=J(Zi(n,["additionalModules"]),{canvas:J({},n.canvas,{container:e}),modules:a});nr.call(this,s),n&&n.container&&this.attachTo(n.container)},Yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Yt.prototype._createContainer=function(e){const t=Vt('<div class="bjs-container"></div>');return Yn(t,{width:$x(e.width),height:$x(e.height),position:e.position}),t},Yt.prototype._createModdle=function(e){const t=J({},this._moddleExtensions,e.moddleExtensions);return new Hm(t)},Yt.prototype._modules=[];function kl(e,t){return e.warnings=t,e}function U2(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 q2={width:"100%",height:"100%",position:"relative"};function $x(e){return e+(Je(e)?"px":"")}function Y2(e,t){return t&&Ft(e.diagrams,function(n){return n.id===t})||null}function K2(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Lx+"</a>",i=Vt(n);Yn(Ct("svg",i),Ix),Yn(i,Bx,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),We.bind(i,"click",function(o){W2(),o.preventDefault()})}function Gr(e){Yt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ne(Gr,Yt),Gr.prototype._createModdle=function(e){var t=Yt.prototype._createModdle.call(this,e);return t.ids=new to([32,36,1]),t},Gr.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 mt(e,t){return A(e,"bpmn:CallActivity")?!1:A(e,"bpmn:SubProcess")?(t=t||vt(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!we(e).processRef:!0}function _n(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=vt(e).isHorizontal;return t===void 0?!0:t}}function X2(e){return e&&we(e).isInterrupting!==!1}function Wn(e){return e&&!!we(e).triggeredByEvent}function Ca(e,t){var n=we(e).eventDefinitions;return zo(n,function(i){return A(i,t)})}function Z2(e){return Ca(e,"bpmn:ErrorEventDefinition")}function J2(e){return Ca(e,"bpmn:EscalationEventDefinition")}function Q2(e){return Ca(e,"bpmn:CompensateEventDefinition")}var Vr={width:90,height:20},Fx=15;function ir(e){return A(e,"bpmn:Event")||A(e,"bpmn:Gateway")||A(e,"bpmn:DataStoreReference")||A(e,"bpmn:DataObjectReference")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:Group")}function Ol(e){return lt(e.label)}function ek(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=tk(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-=Fx:a+=Fx,{x:a,y:s}}function tk(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?ek(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Vr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Vr.height/2}}function jx(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Vr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=pf(t),i=Vr),J({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Hx(e){if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return"name";if(A(e,"bpmn:TextAnnotation"))return"text";if(A(e,"bpmn:Group"))return"categoryValueRef"}function nk(e){var t=e.categoryValueRef;return t&&t.value||""}function ci(e){var t=e.businessObject,n=Hx(t);if(n)return n==="categoryValueRef"?nk(t):t[n]||""}function ik(e,t){var n=e.businessObject,i=Hx(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function ok(e){return lt(e)&&ir(e.labelTarget)}var Aa=7;function zx(e){let t=[];return W(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),W(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ns(e){const t=new Map;return W(of(e),n=>{W(zx(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 df="hsl(225, 10%, 15%)",rk="white";function ao(e,t){return zo(e.eventDefinitions,function(n){return n.$type===t})}function ak(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function sk(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ht(e,t,n){var i=vt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||rk}function Be(e,t,n){var i=vt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||df}function $s(e,t,n,i){var o=vt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Be(e,n)}function Gx(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 Hr(o)}function ff(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 Hr(a)}function ck(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 Hr(s)}function lk(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 Hr(r)}function Fs(e,t={}){return{width:Ri(e,t),height:li(e,t)}}function Ri(e,t={}){return oi(t,"width")?t.width:e.width}function li(e,t={}){return oi(t,"height")?t.height:e.height}var uk=new to,pk=10,Dl=3,dk=1.5,Ll=10,fk=4,Ta=.95,hk=1,gk=.25;function Wr(e,t,n,i,o,r,a){_o.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(F){return n.computeStyle(F,{strokeLinecap:"round",strokeLinejoin:"round",stroke:df,strokeWidth:2,fill:"white"})}function p(F){return n.computeStyle(F,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:df,strokeWidth:2})}function d(F,C){var{ref:R={x:0,y:0},scale:U=1,element:ee,parentGfx:he=o._svg}=C,ke=je("marker",{id:F,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*U,markerHeight:20*U,orient:"auto"});tt(ke,ee);var at=Ct(":scope > defs",he);at||(at=je("defs"),tt(he,at)),tt(at,ke)}function f(F,C,R,U){var ee=uk.nextPrefixed("marker-");return m(F,ee,C,R,U),"url(#"+ee+")"}function m(F,C,R,U,ee){if(R==="sequenceflow-end"){var he=je("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:ee,stroke:ee,strokeWidth:1})});d(C,{element:he,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="messageflow-start"){var ke=je("circle",{cx:6,cy:6,r:3.5,...u({fill:U,stroke:ee,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:ke,ref:{x:6,y:6},parentGfx:F})}if(R==="messageflow-end"){var at=je("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:U,stroke:ee,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:at,ref:{x:8.5,y:5},parentGfx:F})}if(R==="association-start"){var ut=je("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:ee,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:ut,ref:{x:1,y:10},scale:.5,parentGfx:F})}if(R==="association-end"){var zt=je("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:ee,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:zt,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="conditional-flow-marker"){var yt=je("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:U,stroke:ee})});d(C,{element:yt,ref:{x:-1,y:10},scale:.5,parentGfx:F})}if(R==="conditional-default-flow-marker"){var on=je("path",{d:"M 6 4 L 10 16",...u({stroke:ee,fill:"none"})});d(C,{element:on,ref:{x:0,y:10},scale:.5,parentGfx:F})}}function g(F,C,R,U,ee={}){yn(U)&&(ee=U,U=0),U=U||0,ee=u(ee);var he=C/2,ke=R/2,at=je("circle",{cx:he,cy:ke,r:Math.round((C+R)/4-U),...ee});return tt(F,at),at}function y(F,C,R,U,ee,he){yn(ee)&&(he=ee,ee=0),ee=ee||0,he=u(he);var ke=je("rect",{x:ee,y:ee,width:C-ee*2,height:R-ee*2,rx:U,ry:U,...he});return tt(F,ke),ke}function _(F,C,R,U){var ee=C/2,he=R/2,ke=[{x:ee,y:0},{x:C,y:he},{x:ee,y:R},{x:0,y:he}],at=ke.map(function(zt){return zt.x+","+zt.y}).join(" ");U=u(U);var ut=je("polygon",{...U,points:at});return tt(F,ut),ut}function h(F,C,R,U){R=p(R);var ee=Ps(C,R,U);return tt(F,ee),ee}function v(F,C,R){return h(F,C,R,5)}function b(F,C,R){R=p(R);var U=je("path",{...R,d:C});return tt(F,U),U}function E(F,C,R,U){return b(C,R,J({"data-marker":F},U))}function M(F){return $e[F]}function B(F){return function(C,R,U){return M(F)(C,R,U)}}var P={"bpmn:MessageEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill),ke=U?ht(C,s,R.fill):Be(C,c,R.stroke),at=b(F,ee,{fill:he,stroke:ke,strokeWidth:1});return at},"bpmn:TimerEventDefinition":function(F,C,R={}){var U=R.width||C.width,ee=R.height||C.height,he=R.width?1:2,ke=g(F,U,ee,.2*ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:he}),at=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:U,containerHeight:ee,position:{mx:.5,my:.5}});b(F,at,{stroke:Be(C,c,R.stroke),strokeWidth:he});for(var ut=0;ut<12;ut++){var zt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:U,containerHeight:ee,position:{mx:.5,my:.5}}),yt=U/2,on=ee/2;b(F,zt,{strokeWidth:1,stroke:Be(C,c,R.stroke),transform:"rotate("+ut*30+","+on+","+yt+")"})}return ke},"bpmn:EscalationEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(F,C,R={}){var U=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return b(F,U,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),he=U?Be(C,c,R.stroke):"none",ke=b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1});return kx(ke,45),ke},"bpmn:CompensateEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{strokeWidth:1,fill:he,stroke:Be(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(F,C,R={}){var U=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return b(F,U,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(F,C,R={}){var U=g(F,C.width,C.height,8,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:4});return U}};function k(F,C,R={},U){var ee=we(F),he=ak(ee),ke=U||F;return ee.get("eventDefinitions")&&ee.get("eventDefinitions").length>1?ee.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,ke,R,he):P["bpmn:MultipleEventDefinition"](C,ke,R,he):ao(ee,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,ke,R,he):ao(ee,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,ke,R,he):ao(ee,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,ke,R,he):ao(ee,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,ke,R,he):ao(ee,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,ke,R,he):ao(ee,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,ke,R,he):ao(ee,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,ke,R,he):ao(ee,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,ke,R,he):ao(ee,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,ke,R,he):ao(ee,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,ke,R,he):null}var N={ParticipantMultiplicityMarker:function(F,C,R={}){var U=Ri(C,R),ee=li(C,R),he=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:(U/2-6)/U,my:(ee-15)/ee}});E("participant-multiplicity",F,he,{strokeWidth:2,fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},SubProcessMarker:function(F,C,R={}){var U=y(F,14,14,0,{strokeWidth:1,fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)});Nn(U,C.width/2-7.5,C.height-20);var ee=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",F,ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},ParallelMarker:function(F,C,R){var U=Ri(C,R),ee=li(C,R),he=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:(U/2+R.parallel)/U,my:(ee-20)/ee}});E("parallel",F,he,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},SequentialMarker:function(F,C,R){var U=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",F,U,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},CompensationMarker:function(F,C,R){var U=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",F,U,{strokeWidth:1,fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},LoopMarker:function(F,C,R){var U=Ri(C,R),ee=li(C,R),he=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:(U/2+R.loop)/U,my:(ee-7)/ee}});E("loop",F,he,{strokeWidth:1.5,fill:"none",stroke:Be(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(F,C,R){var U=Ri(C,R),ee=li(C,R),he=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:(U/2+R.adhoc)/U,my:(ee-15)/ee}});E("adhoc",F,he,{strokeWidth:1,fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke)})}};function G(F,C,R,U){N[F](C,R,U)}function q(F,C,R=[],U={}){U={fill:U.fill,stroke:U.stroke,width:Ri(C,U),height:li(C,U)};var ee=we(C),he=R.includes("SubProcessMarker");he?U={...U,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:U={...U,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},ee.get("isForCompensation")&&R.push("CompensationMarker"),A(ee,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),he||J(U,{compensation:U.compensation-18}));var ke=ee.get("loopCharacteristics"),at=ke&&ke.get("isSequential");ke&&(J(U,{compensation:U.compensation-18}),R.includes("AdhocMarker")&&J(U,{seq:-23,loop:-18,parallel:-24}),at===void 0&&R.push("LoopMarker"),at===!1&&R.push("ParallelMarker"),at===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&J(U,{compensation:-8}),W(R,function(ut){G(ut,F,C,U)})}function Y(F,C,R={}){R=J({size:{width:100}},R);var U=r.createText(C||"",R);return gt(U).add("djs-label"),tt(F,U),U}function ae(F,C,R,U={}){var ee=we(C),he=Fs({x:C.x,y:C.y,width:C.width,height:C.height},U);return Y(F,ee.name,{align:R,box:he,padding:7,style:{fill:$s(C,l,c,U.stroke)}})}function X(F,C,R={}){var U={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Y(F,ci(C),{box:U,style:J({},r.getExternalStyle(),{fill:$s(C,l,c,R.stroke)})})}function Me(F,C,R,U={}){var ee=_n(R),he=Y(F,C,{box:{height:30,width:ee?li(R,U):Ri(R,U)},align:"center-middle",style:{fill:$s(R,l,c,U.stroke)}});if(ee){var ke=-1*li(R,U);Tl(he,0,-ke,270)}}function Te(F,C,R={}){var{width:U,height:ee}=Fs(C,R);return y(F,U,ee,Ll,{...R,fill:ht(C,s,R.fill),fillOpacity:Ta,stroke:Be(C,c,R.stroke)})}function Pe(F,C,R={}){var U=we(C),ee=ht(C,s,R.fill),he=Be(C,c,R.stroke);return(U.get("associationDirection")==="One"||U.get("associationDirection")==="Both")&&(R.markerEnd=f(F,"association-end",ee,he)),U.get("associationDirection")==="Both"&&(R.markerStart=f(F,"association-start",ee,he)),R=wt(R,["markerStart","markerEnd"]),v(F,C.waypoints,{...R,stroke:he,strokeDasharray:"0, 5"})}function fe(F,C,R={}){var U=ht(C,s,R.fill),ee=Be(C,c,R.stroke),he=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),ke=b(F,he,{fill:U,fillOpacity:Ta,stroke:ee}),at=we(C);if(sk(at)){var ut=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}});b(F,ut,{strokeWidth:2,fill:U,stroke:ee})}return ke}function z(F,C,R={}){return g(F,C.width,C.height,{fillOpacity:Ta,...R,fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})}function se(F,C,R={}){return _(F,C.width,C.height,{fill:ht(C,s,R.fill),fillOpacity:Ta,stroke:Be(C,c,R.stroke)})}function V(F,C,R={}){var U=y(F,Ri(C,R),li(C,R),0,{fill:ht(C,s,R.fill),fillOpacity:R.fillOpacity||Ta,stroke:Be(C,c,R.stroke),strokeWidth:1.5}),ee=we(C);if(A(ee,"bpmn:Lane")){var he=ee.get("name");Me(F,he,C,R)}return U}function Z(F,C,R={}){var U=Te(F,C,R),ee=mt(C);if(Wn(C)&&(Le(U,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!ee)){var he=we(C).flowElements||[],ke=he.filter(at=>A(at,"bpmn:StartEvent"));ke.length===1&&pe(ke[0],F,R,C)}return ae(F,C,ee?"center-top":"center-middle",R),ee?q(F,C,void 0,R):q(F,C,["SubProcessMarker"],R),U}function pe(F,C,R,U){var ee=22,he={fill:ht(U,s,R.fill),stroke:Be(U,c,R.stroke),width:ee,height:ee},ke=we(F).isInterrupting,at=ke?0:3,ut=ke?1:1.2,zt=20,yt=(ee-zt)/2,on="translate("+yt+","+yt+")";g(C,zt,zt,{fill:he.fill,stroke:he.stroke,strokeWidth:ut,strokeDasharray:at,transform:on}),k(F,C,he,U)}function ve(F,C,R={}){var U=Te(F,C,R);return ae(F,C,"center-middle",R),q(F,C,void 0,R),U}var $e=this.handlers={"bpmn:AdHocSubProcess":function(F,C,R={}){return mt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]),Z(F,C,R)},"bpmn:Association":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Pe(F,C,R)},"bpmn:BoundaryEvent":function(F,C,R={}){var{renderIcon:U=!0}=R;R=wt(R,["fill","stroke"]);var ee=we(C),he=ee.get("cancelActivity");R={strokeWidth:1.5,fill:ht(C,s,R.fill),fillOpacity:hk,stroke:Be(C,c,R.stroke)},he||(R.strokeDasharray="6");var ke=z(F,C,R);return g(F,C.width,C.height,Dl,{...R,fill:"none"}),U&&k(C,F,R),ke},"bpmn:BusinessRuleTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),he=b(F,ee);Le(he,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1});var ke=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),at=b(F,ke);return Le(at,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:CallActivity":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Z(F,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=se(F,C,R),ee=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(F,ee,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:DataInput":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=i.getRawPath("DATA_ARROW"),ee=fe(F,C,R);return b(F,U,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:1}),ee},"bpmn:DataInputAssociation":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Pe(F,C,{...R,markerEnd:f(F,"association-end",ht(C,s,R.fill),Be(C,c,R.stroke))})},"bpmn:DataObject":function(F,C,R={}){return R=wt(R,["fill","stroke"]),fe(F,C,R)},"bpmn:DataObjectReference":B("bpmn:DataObject"),"bpmn:DataOutput":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=i.getRawPath("DATA_ARROW"),ee=fe(F,C,R);return b(F,U,{strokeWidth:1,fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke)}),ee},"bpmn:DataOutputAssociation":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Pe(F,C,{...R,markerEnd:f(F,"association-end",ht(C,s,R.fill),Be(C,c,R.stroke))})},"bpmn:DataStoreReference":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(F,U,{fill:ht(C,s,R.fill),fillOpacity:Ta,stroke:Be(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(F,C,R={}){var{renderIcon:U=!0}=R;R=wt(R,["fill","stroke"]);var ee=z(F,C,{...R,strokeWidth:4});return U&&k(C,F,R),ee},"bpmn:EventBasedGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=we(C),ee=se(F,C,R);g(F,C.width,C.height,C.height*.2,{fill:ht(C,"none",R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1});var he=U.get("eventGatewayType"),ke=!!U.get("instantiate");function at(){var zt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(F,zt,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:2})}if(he==="Parallel"){var ut=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(F,ut,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:1})}else he==="Exclusive"&&(ke||g(F,C.width,C.height,C.height*.26,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:1}),at());return ee},"bpmn:ExclusiveGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=se(F,C,R),ee=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),he=vt(C);return he.get("isMarkerVisible")&&b(F,ee,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:Gateway":function(F,C,R={}){return R=wt(R,["fill","stroke"]),se(F,C,R)},"bpmn:Group":function(F,C,R={}){return R=wt(R,["fill","stroke","width","height"]),y(F,C.width,C.height,Ll,{stroke:Be(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ri(C,R),height:li(C,R)})},"bpmn:InclusiveGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=se(F,C,R);return g(F,C.width,C.height,C.height*.24,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:2.5}),U},"bpmn:IntermediateEvent":function(F,C,R={}){var{renderIcon:U=!0}=R;R=wt(R,["fill","stroke"]);var ee=z(F,C,{...R,strokeWidth:1.5});return g(F,C.width,C.height,Dl,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:1.5}),U&&k(C,F,R),ee},"bpmn:IntermediateCatchEvent":B("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":B("bpmn:IntermediateEvent"),"bpmn:Lane":function(F,C,R={}){return R=wt(R,["fill","stroke","width","height"]),V(F,C,{...R,fillOpacity:gk})},"bpmn:ManualTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(F,ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:.5}),U},"bpmn:MessageFlow":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=we(C),ee=vt(C),he=ht(C,s,R.fill),ke=Be(C,c,R.stroke),at=v(F,C.waypoints,{markerEnd:f(F,"messageflow-end",he,ke),markerStart:f(F,"messageflow-start",he,ke),stroke:ke,strokeDasharray:"10, 11",strokeWidth:1.5});if(U.get("messageRef")){var ut=at.getPointAtLength(at.getTotalLength()/2),zt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ut.x,y:ut.y}}),yt={strokeWidth:1};ee.get("messageVisibleKind")==="initiating"?(yt.fill=he,yt.stroke=ke):(yt.fill=ke,yt.stroke=he);var on=b(F,zt,yt),En=U.get("messageRef"),An=En.get("name"),$t=Y(F,An,{align:"center-top",fitBox:!0,style:{fill:ke}}),gn=on.getBBox(),Tn=$t.getBBox(),gi=ut.x-Tn.width/2,Un=ut.y+gn.height/2+pk;Tl($t,gi,Un,0)}return at},"bpmn:ParallelGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=se(F,C,R),ee=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(F,ee,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:Participant":function(F,C,R={}){R=wt(R,["fill","stroke","width","height"]);var U=V(F,C,R),ee=mt(C),he=_n(C),ke=we(C),at=ke.get("name");if(ee){var ut=he?[{x:30,y:0},{x:30,y:li(C,R)}]:[{x:0,y:30},{x:Ri(C,R),y:30}];h(F,ut,{stroke:Be(C,c,R.stroke),strokeWidth:dk}),Me(F,at,C,R)}else{var zt=Fs(C,R);he||(zt.height=Ri(C,R),zt.width=li(C,R));var yt=Y(F,at,{box:zt,align:"center-middle",style:{fill:$s(C,l,c,R.stroke)}});if(!he){var on=-1*li(C,R);Tl(yt,0,-on,270)}}return ke.get("participantMultiplicity")&&G("ParticipantMultiplicityMarker",F,C,R),U},"bpmn:ReceiveTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=we(C),ee=ve(F,C,R),he;return U.get("instantiate")?(g(F,28,28,20*.22,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),he=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):he=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(F,he,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),ee},"bpmn:ScriptTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(F,ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:SendTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(F,ee,{fill:Be(C,c,R.stroke),stroke:ht(C,s,R.fill),strokeWidth:1}),U},"bpmn:SequenceFlow":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ht(C,s,R.fill),ee=Be(C,c,R.stroke),he=v(F,C.waypoints,{markerEnd:f(F,"sequenceflow-end",U,ee),stroke:ee}),ke=we(C),{source:at}=C;if(at){var ut=we(at);ke.get("conditionExpression")&&A(ut,"bpmn:Activity")&&Le(he,{markerStart:f(F,"conditional-flow-marker",U,ee)}),ut.get("default")&&(A(ut,"bpmn:Gateway")||A(ut,"bpmn:Activity"))&&ut.get("default")===ke&&Le(he,{markerStart:f(F,"conditional-default-flow-marker",U,ee)})}return he},"bpmn:ServiceTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R);g(F,10,10,{fill:ht(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var ee=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(F,ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),g(F,10,10,{fill:ht(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var he=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(F,he,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:StartEvent":function(F,C,R={}){var{renderIcon:U=!0}=R;R=wt(R,["fill","stroke"]);var ee=we(C);ee.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var he=z(F,C,R);return U&&k(C,F,R),he},"bpmn:SubProcess":function(F,C,R={}){return mt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]),Z(F,C,R)},"bpmn:Task":function(F,C,R={}){return R=wt(R,["fill","stroke"]),ve(F,C,R)},"bpmn:TextAnnotation":function(F,C,R={}){R=wt(R,["fill","stroke"]);var{width:U,height:ee}=Fs(C,R),he=y(F,U,ee,0,0,{fill:"none",stroke:"none"}),ke=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:0,my:0}});b(F,ke,{stroke:Be(C,c,R.stroke)});var at=we(C),ut=at.get("text")||"";return Y(F,ut,{align:"left-top",box:Fs(C,R),padding:Aa,style:{fill:$s(C,l,c,R.stroke)}}),he},"bpmn:Transaction":function(F,C,R={}){mt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]);var U=Z(F,C,{strokeWidth:1.5,...R}),ee=n.style(["no-fill","no-events"],{stroke:Be(C,c,R.stroke),strokeWidth:1.5}),he=mt(C);return he||(R={}),y(F,Ri(C,R),li(C,R),Ll-Dl,Dl,ee),U},"bpmn:UserTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=15,he=12,ke=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:ee,y:he}});b(F,ke,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:.5});var at=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:ee,y:he}});b(F,at,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:.5});var ut=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:ee,y:he}});return b(F,ut,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:.5}),U},label:function(F,C,R={}){return X(F,C,R)}};this._drawPath=b,this._renderer=M}Ne(Wr,_o),Wr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Wr.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},Wr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Wr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Wr.prototype.getShapePath=function(e){return lt(e)?ff(e,fk):A(e,"bpmn:Event")?Gx(e):A(e,"bpmn:Activity")?ff(e,Ll):A(e,"bpmn:Gateway")?ck(e):lk(e)};function wt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var mk=0,yk={width:150,height:50};function vk(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function xk(e){return yn(e)?J({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var hf=null;function bk(){return hf||(hf=document.createElement("canvas").getContext("2d")),hf}function wk(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(Vx(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Vx(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function _k(e,t){var n=bk();if(!n)return{width:0,height:0};n.font=wk(t),"letterSpacing"in n&&(n.letterSpacing=Vx(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 Ek(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=_k(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return Sk(e,o,i,r);o=Mk(o,r.width,t)}}function Sk(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 Wx="­";function Rk(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===Wx)&&o.pop();break}var a=o[o.length-1];return a&&a===Wx&&(o[o.length-1]="-"),o.join("")}function Mk(e,t,n){var i=Math.max(e.length*(n/t),1),o=Rk(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Il(e){this._config=J({},{size:yk,padding:mk,style:{},align:"center-top"},e||{})}Il.prototype.createText=function(e,t){return this.layoutText(e,t).element},Il.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Il.prototype.layoutText=function(e,t){for(var n=J({},this._config.size,t.box),i=J({},this._config.style,t.style),o=vk(t.align||this._config.align),r=xk(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Ck(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(Ek(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ri(l,function(y,_,h){return y+(s||_.height)},0)+r.top+r.bottom,d=ri(l,function(y,_,h){return _.width>y?_.width:y},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var m=je("text");Le(m,i),W(l,function(y){var _;switch(f+=s||y.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?d:u)-r.right-y.width;break;default:_=Math.max(((a?d:u)-y.width)/2+r.left,0)}var h=je("tspan");Le(h,{x:_,y:f}),h.textContent=y.text,tt(m,h)});var g={width:d,height:p};return{dimensions:g,element:m}};function Ck(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Ak=12,Tk=1.2,Pk=40;function Ux(e){var t=J({fontFamily:"Arial, sans-serif",fontSize:Ak,fontWeight:"normal",lineHeight:Tk},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=J({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Il({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Vr.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:Aa});return{x:a.x,y:a.y,width:a.width,height:Math.max(Pk,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,J({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Ux.$inject=["config.textRenderer"];function kk(){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=Ik(i.d,{mx:o,my:r,e:a});return p}}var Ok=/\{([^{}]+)\}/g,Dk=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Lk(e,t,n){var i=n;return t.replace(Dk,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 Ik(e,t){return String(e).replace(Ok,function(n,i){return Lk(n,i,t)})}const Bk={__init__:["bpmnRenderer"],bpmnRenderer:["type",Wr],textRenderer:["type",Ux],pathMap:["type",kk]};function Nk(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const js={translate:["value",Nk]};function Bl(e,t,n){return J({id:e.id,type:e.$type,businessObject:e,di:t},n)}function $k(e,t,n){var i=e.waypoint;return!i||i.length<2?[Qe(t),Qe(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function qx(e,t,n){return new Error(`element ${Vn(t)} referenced by ${Vn(e)}#${n} not yet drawn`)}function Mo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Mo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Mo.prototype.add=function(e,t,n){var i,o,r;if(A(t,"bpmndi:BPMNPlane")){var a=A(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Bl(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!mt(e,t),c=jk(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Bl(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})),A(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),A(e,"bpmn:Lane")&&(r=0),A(e,"bpmn:DataStoreReference")&&(Fk(n,Qe(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(A(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Bl(e,t,{hidden:o,source:u,target:p,waypoints:$k(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Vn(t)} for element ${Vn(e)}`);return ir(e)&&ci(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Mo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Vn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw qx(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Mo.prototype.addLabel=function(e,t,n){var i,o,r;return i=jx(t,n),o=ci(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Bl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ci(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)},Mo.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?qx(e,i,t+"Ref"):new Error(`${Vn(e)}#${t} Ref not specified`)},Mo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Mo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Mo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function Fk(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 jk(e){return A(e,"bpmn:Group")}const Yx={__depends__:[Bk,{__depends__:[js],bpmnImporter:["type",Mo]}]};function Hs(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Vi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function gf(e){return Math.log(e)/Math.log(10)}var Hk=1e3;function be(e){this._eventBus=e}be.$inject=["eventBus"];function zk(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}be.prototype.on=function(e,t,n,i,o,r){if((wn(t)||Je(t))&&(r=o,o=i,i=n,n=t,t=null),wn(n)&&(r=o,o=i,i=n,n=Hk),yn(o)&&(r=o,o=!1),!wn(i))throw new Error("handlerFn must be a function");Ze(e)||(e=[e]);var a=this._eventBus;W(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?zk(i,r):i,r)})},be.prototype.canExecute=Co("canExecute"),be.prototype.preExecute=Co("preExecute"),be.prototype.preExecuted=Co("preExecuted"),be.prototype.execute=Co("execute"),be.prototype.executed=Co("executed"),be.prototype.postExecute=Co("postExecute"),be.prototype.postExecuted=Co("postExecuted"),be.prototype.revert=Co("revert"),be.prototype.reverted=Co("reverted");function Co(e){return function(n,i,o,r,a){(wn(n)||Je(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var mf=["top","bottom","left","right"],Nl=10;function yf(e,t){be.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(Ol(o)&&!It(o)){var r=Wk(o);r&&i(o,r)}}function i(o,r){var a=Qe(o),s=o.label,c=Qe(s);if(s.parent){var l=qe(o),u;switch(r){case"top":u={x:a.x,y:l.top-Nl-s.height/2};break;case"left":u={x:l.left-Nl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Nl+s.height/2};break;case"right":u={x:l.right+Nl+s.width/2,y:a.y};break}var p=Vi(u,c);t.moveShape(s,p)}}}Ne(yf,be),yf.$inject=["eventBus","modeling"];function Gk(e){var t=e.host,n=Qe(e),i=Bn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=mf.filter(function(a){return o.indexOf(a)===-1});return r}function Vk(e){var t=Qe(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 Kx(t,i)});return n}function Wk(e){var t=Qe(e.label),n=Qe(e),i=Kx(n,t);if(Uk(i)){var o=Vk(e);if(e.host){var r=Gk(e);o=o.concat(r)}var a=mf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?Bn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Kx(e,t){return Bn(t,e,5)}function Uk(e){return mf.indexOf(e)!==-1}function vf(e){be.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(A(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)}Ne(vf,be),vf.$inject=["eventBus"];var qk=1500;function xf(e,t,n){e.invoke(be,this),this.preExecute("elements.delete",qk,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=dt(o,l=>A(l,"bpmn:Participant")||A(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>A(l,"bpmn:Artifact"))),c=new Set;return W(r,l=>{const u=new Set(fa(Sa(Array.from(s),ln(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ne(xf,be),xf.$inject=["injector","eventBus","canvas"];function bf(e,t){e.invoke(be,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=dt(o.incoming.concat(o.outgoing),function(a){return A(a,"bpmn:Association")});W(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ne(bf,be),bf.$inject=["injector","modeling"];function Pa(e,t){for(ii(t)&&(t=[t]);e=e.parent;)if(pt(e,t))return e;return null}function Xx(e,t){var n=Pa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Pa(e,i),n)return _n(n);if(pt(e,i))return _n(e);var o;for(o=we(e);o&&!A(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=we(a);return s&&s.get("processRef")===o});return r?_n(r):!0}var Zx=500;function $l(e,t){t.invoke(be,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Zx,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Jx(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",Zx,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Jx(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}$l.$inject=["bpmnReplace","injector"],Ne($l,be),$l.prototype._replaceShape=function(e,t){var n=Yk(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Yk(e){var t=we(e),n=t.eventDefinitions;return n&&n[0]}function Jx(e,t){return!lt(e)&&pt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function wf(e,t){be.call(this,e);function n(i){return dt(i.attachers,function(o){return A(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);A(o,"bpmn:EventBasedGateway")&&A(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;A(o,"bpmn:Gateway")&&A(r,"bpmn:EventBasedGateway")&&W(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}wf.$inject=["eventBus","modeling"],Ne(wf,be);function Qx(e){return e.create("bpmn:Category")}function Kk(e){return e.create("bpmn:CategoryValue")}function eb(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Kk(e)),n.$parent||(n.$parent=Qx(e)),n}function Xk(e,t,n){return rn(t.get("categoryValue"),e),e.$parent=t,rn(n.get("rootElements"),t),t.$parent=n,e}function Zk(e){var t=e.$parent;return t&&(nn(t.get("categoryValue"),e),e.$parent=null),e}function Jk(e){var t=e.$parent;return t&&(nn(t.get("rootElements"),e),e.$parent=null),e}var Qk=500;function _f(e,t,n){n.invoke(be,this);function i(c){return t.filter(function(l){return A(l,"bpmn:Group")&&!l.labelTarget}).map(we).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&&Xk(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&Jk(l),c&&!o(c,u)&&Zk(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(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;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,we(l))},!0),this.executed(["shape.move","shape.resize"],Qk,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,we(l))},!0),this.executed("group.updateRefs",function(c){tb(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){tb(c).forEach(function(l){s(l.categoryValue,l.category,we(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,we(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}_f.$inject=["bpmnjs","elementRegistry","injector"],Ne(_f,be);function tb(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Ef(e,t,n){be.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,h=y.target;ka(_)&&zs(h)&&u(h)}function o(y){const _=y.connection,h=y.source,v=y.target;ka(h)&&Fl(v)&&(l(v),d(h,[_]))}function r(y){const _=y.newTarget,h=y.oldSource,v=y.oldTarget;if(v!==_){const b=h;zs(v)&&u(v),ka(b)&&Fl(_)&&l(_)}}function a(y){const{element:_}=y;zs(_)?(p(_),f(_)):Fl(_)&&m(_)}function s(y){const{newData:_,oldShape:h}=y;if(ka(y.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const v=h.outgoing.find(({target:b})=>zs(b));v&&v.target&&(y._connectionTarget=v.target)}else if(!ka(y.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const v=h.outgoing.find(({target:b})=>Fl(b));v&&v.target&&(y._connectionTarget=v.target),g(h)}}function c(y){const{_connectionTarget:_,newShape:h}=y;_&&t.connect(h,_)}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 d(y,_){y.outgoing.filter(b=>A(b,"bpmn:Association")).filter(b=>zs(b.target)&&!_.includes(b)).forEach(b=>t.removeConnection(b))}function f(y){const _=y.attachers.slice();_.length&&t.removeElements(_)}function m(y){const _=y.incoming.filter(h=>ka(h.source));t.removeElements(_)}function g(y){const _=y.outgoing.filter(h=>A(h,"bpmn:SequenceFlow"));t.removeElements(_)}}Ne(Ef,be),Ef.$inject=["eventBus","modeling","bpmnRules"];function zs(e){const t=we(e);return t&&t.get("isForCompensation")}function ka(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ca(e,"bpmn:CompensateEventDefinition")}function Fl(e){return e&&A(e,"bpmn:Activity")&&!Wn(e)}function Sf(e){e.invoke(be,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;A(i,"bpmn:Lane")&&!A(o,"bpmn:Lane")&&(n.parent=Pa(i,"bpmn:Participant"))})}Sf.$inject=["injector"],Ne(Sf,be);function Rf(e,t){be.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(A(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}})}Rf.$inject=["eventBus","bpmnFactory"],Ne(Rf,be);var Mf=20,Cf=20,nb=30,jl=2e3;function Af(e,t,n){be.call(this,t),t.on(["create.start","shape.move.start"],jl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!A(a,"bpmn:Participant")||!A(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!A(p,"bpmn:Group")&&!lt(p)&&!It(p)});if(c.length){var l=ln(c),u=eO(a,l);J(a,u),r.createConstraints=tO(a,l)}}}),t.on("create.start",jl,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}A(a,"bpmn:Participant")&&A(s,"bpmn:Process")&&(t.on("element.hover",jl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return A(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",jl,function(o){var r=o.elements,a=o.parent,s=nO(r),c;s&&A(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=we(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;A(a,"bpmn:Participant")&&A(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=we(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)&&we(s).set("processRef",we(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)&&we(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)}Af.$inject=["canvas","eventBus","modeling"],Ne(Af,be);function eO(e,t){t={width:t.width+Mf*2+nb,height:t.height+Cf*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 tO(e,t){return t=qe(t),{bottom:t.top+e.height/2-Cf,left:t.right-e.width/2+Mf,top:t.bottom-e.height/2+Cf,right:t.left+e.width/2-Mf-nb}}function nO(e){return Ft(e,function(t){return A(t,"bpmn:Participant")})}var ib="__targetRef_placeholder";function Tf(e,t){be.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],ob(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],ob(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Ft(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Ft(c,function(u){return u.name===ib});return!l&&s&&(l=t.create("bpmn:Property",{name:ib}),rn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||nn(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,d=s.newTarget,f=d&&d.businessObject,m=s.oldTarget||s.target,g=m&&m.businessObject,y=c.businessObject,_;g&&g!==p&&o(g,l),f&&f!==p&&o(f,l),p?(_=i(p,!0),y.targetRef=_):y.targetRef=null}}Tf.$inject=["eventBus","bpmnFactory"],Ne(Tf,be);function ob(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function Hl(e){this._bpmnUpdater=e}Hl.$inject=["bpmnUpdater"],Hl.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),[]},Hl.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 Pf(e,t,n,i){be.call(this,i),t.registerHandler("dataStore.updateContainment",Hl);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&we(s).processRef})[0]}function r(s){return s.children.filter(function(c){return A(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:vt(s),newSemanticParent:u.processRef||u,newDiParent:vt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;A(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 A(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!A(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(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(!A(u,"bpmn:Collaboration")&&A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(p,"bpmn:Collaboration")){var d=A(u,"bpmn:Participant")?u:oO(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();pt(l,["bpmn:Participant","bpmn:SubProcess"])&&A(u,"bpmn:Collaboration")&&r(u).filter(function(p){return iO(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(d){A(u,"bpmn:Process")&&a(d,u)})})}Pf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ne(Pf,be);function iO(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 oO(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var zl=Math.max,Gl=Math.min,rO=20;function rb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function aO(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 sO(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],o=n.min&&n.min[e],r=n.max&&n.max[e];return Je(o)&&(i=(/top|left/.test(e)?Gl:zl)(i,o)),Je(r)&&(i=(/top|left/.test(e)?zl:Gl)(i,r)),i}function cO(e,t){if(!t)return e;var n=qe(e);return Ml({top:Vl("top",n,t),right:Vl("right",n,t),bottom:Vl("bottom",n,t),left:Vl("left",n,t)})}function lO(e,t,n,i){var o=qe(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?qe(i):r,s={top:Gl(r.top,a.top),left:Gl(r.left,a.left),bottom:zl(r.bottom,a.bottom),right:zl(r.right,a.right)};return Ml(s)}function Gs(e,t){return typeof e<"u"?e:rO}function uO(e,t){var n,i,o,r;return typeof t=="object"?(n=Gs(t.left),i=Gs(t.right),o=Gs(t.top),r=Gs(t.bottom)):n=i=o=r=Gs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function pO(e){return!(e.waypoints||e.type==="label")}function ab(e,t){var n;if(e.length===void 0?n=dt(e.children,pO):n=e,n.length)return uO(ln(n),t)}var or=Math.abs;function dO(e,t){return rb(qe(t),qe(e))}var fO=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Mi=30;function Wl(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(Wl(n,t),t.push(n))}),t}function rr(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Ci(e){return Pa(e,fO)||e}function hO(e,t){var n=Ci(e),i=A(n,"bpmn:Process")?[]:[n],o=Wl(n,i),r=qe(e),a=qe(t),s=dO(e,t),c=[],l=_n(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,d=l?s.right:0,f=l?0:s.bottom,m=l?s.left:0,g=qe(u);s.top&&(or(g.bottom-r.top)<10&&(f=a.top-g.bottom),or(g.top-r.top)<5&&(p=a.top-g.top)),s.left&&(or(g.right-r.left)<10&&(d=a.left-g.right),or(g.left-r.left)<5&&(m=a.left-g.left)),s.bottom&&(or(g.top-r.bottom)<10&&(p=a.bottom-g.top),or(g.bottom-r.bottom)<5&&(f=a.bottom-g.bottom)),s.right&&(or(g.left-r.right)<10&&(m=a.right-g.left),or(g.right-r.right)<5&&(d=a.right-g.right)),(p||d||f||m)&&c.push({shape:u,newBounds:sO(u,{top:p,right:d,bottom:f,left:m})})}}),c}var gO=500;function kf(e,t){be.call(this,e);function n(i,o){var r=_n(i),a=rr(o),s=[],c=[],l=[],u=[];if(zr(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 d,f,m,g;s.length&&(d=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},"s")),c.length&&(f=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:-p},"n")),l.length&&(m=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:p,y:0},"e")),u.length&&(g=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",gO,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;A(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}kf.$inject=["eventBus","spaceTool"],Ne(kf,be);var sb=500;function Ul(e,t){t.invoke(be,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",sb,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return cb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",sb,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;cb(a,yO(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Ul.$inject=["bpmnReplace","injector"],Ne(Ul,be),Ul.prototype._replaceShape=function(e){var t=mO(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function mO(e){var t=we(e),n=t.eventDefinitions;return n&&n[0]}function cb(e,t){return!lt(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function yO(e,t){return e.indexOf(t)!==-1}var ql=Math.round,vO=Math.max;function xO(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 bO(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var lb=10;function wO(e,t){var n,i;for(n=0;i=e[n];n++)if(Ds(i,t)<=lb)return{point:e[n],bendpoint:!0,index:n};return null}function _O(e,t){var n=dx(xO(t,lb),bO(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=vO(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:ql(i.x+o.x)/2,y:ql(i.y+o.y)/2},index:i.segment2}:{point:{x:ql(i.x),y:ql(i.y)},index:i.segment2}:null}function Of(e,t){return wO(e,t)||_O(e,t)}function Df(e,t,n){be.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,m,g=o.outgoing.slice(),y=o.incoming.slice(),_;Je(a.width)?_=Qe(a):_=a;var h=Of(s,_);if(h){if(c=s.slice(0,h.index),l=s.slice(h.index+(h.bendpoint?1:0)),!c.length||!l.length)return;u=h.bendpoint?s[h.index]:_,(c.length===1||!ub(o,c[c.length-1]))&&c.push(pb(u)),(l.length===1||!ub(o,l[0]))&&l.unshift(pb(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),f=r),t.canConnect(o,d,r)&&(f?m=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),m=r));var v=[].concat(f&&dt(y,function(b){return b.source===f.source})||[],m&&dt(g,function(b){return b.target===m.target})||[]);v.length&&n.removeElements(v)}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=Qe(c),u={x:l.x+s.x,y:l.y+s.y},p=Ft(r.children,function(d){var f=t.canInsert(a,d);return f&&Of(d.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)}Ne(Df,be),Df.$inject=["eventBus","bpmnRules","modeling"];function ub(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 pb(e){return J({},e)}function Lf(e,t){be.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)&&Oa(o)){var c=[];A(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Oa(l)):c=a.incoming.filter(l=>l!==o&&Oa(l)&&A(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(A(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Oa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Oa).forEach(function(s){const c=a.incoming.filter(Oa).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}Lf.$inject=["eventBus","modeling"],Ne(Lf,be);function Oa(e){return A(e,"bpmn:SequenceFlow")}var Yl=1500,db=2e3;function fb(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"],Yl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;A(a,"bpmn:Lane")&&!pt(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ci(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||pt(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"],Yl,function(i){var o=i.hover;A(o,"bpmn:Lane")&&(i.hover=Ci(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Yl,function(i){var o=i.context,r=i.hover,a=o.type;A(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ci(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Yl,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Ci(r)||r)}),t.on("shape.move.start",db,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Ci(o)||o)}),t.on("spaceTool.move",db,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Ci(o))})}fb.$inject=["elementRegistry","eventBus","canvas"];var hb=770;function If(e,t,n,i){n.invoke(be,this);function o(s,c){var l=we(s),u=c.categoryValue||l.categoryValueRef;u||(u=eb(e,l));var p=c.category||u.$parent||Qx(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=we(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;A(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=we(l);if(!(!A(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(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=we(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!we(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!we(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||we(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(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",hb,function(s){var c=s.descriptor,l=s.element;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=we(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",hb,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})}If.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ne(If,be);function Bf(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 gb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=Bf(i,o,r,a),l=Bf(i,o,r,s),u;c&&l?mb(c,r)>mb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],Qe(i.source)),t(o[o.length-1],o[o.length-2],Qe(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}gb.$inject=["eventBus"];function mb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Nf(e){be.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=we(i),r=vt(i);if(pt(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}Nf.$inject=["eventBus"],Ne(Nf,be);function yb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function vb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function EO(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 SO(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 $f(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=SO([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 xb(e,t){var n=$f(e,t),i={x:n.x-e.x,y:n.y-e.y};return yb(i)}function Vs(e,t){return yb({x:e.x-t.x,y:e.y-t.y})}var bb=Math.sqrt,wb=Math.min,RO=Math.max,_b=Math.abs;function Eb(e){return Math.pow(e,2)}function Ws(e,t){return bb(Eb(e.x-t.x)+Eb(e.y-t.y))}function MO(e,t){var n=0,i,o,r,a,s,c,l,u,p,d,f;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],Rb(i,o)?l=[i]:(r=Ws(e,i),a=Ws(e,o),c=wb(r,a),l=CO(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:Rb(i,l[0])?n:n+1}),l.length===2&&(s=TO(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ws(i,s)/Ws(i,o)}),p=Ws(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function CO(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,d=u/c,f=p*p-d;if(f<0&&f>-1e-6&&(f=0),f<0)return[];var m=bb(f),g=-p+m,y=-p-m,_={x:e.x-o*g,y:e.y-r*g};if(f===0)return[_];var h={x:e.x-o*y,y:e.y-r*y};return[_,h].filter(function(v){return AO(v,e,t)})}function AO(e,t,n){return Sb(e.x,t.x,n.x)&&Sb(e.y,t.y,n.y)}function Sb(e,t,n){return e>=wb(t,n)-Kl&&e<=RO(t,n)+Kl}function TO(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Kl=.1;function Rb(e,t){return _b(e.x-t.x)<=Kl&&_b(e.y-t.y)<=Kl}function PO(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=Cb(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 Mb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=MO(e,n),c=s.segmentIndex,l=PO(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Ab(n,c),p=Ab(t,l),d=s.position,f=OO(u,d),m=kO(u,p);if(s.type==="bendpoint"){var g=t.length-n.length,y=s.bendpointIndex,_=n[y];if(t.indexOf(_)!==-1)return a;if(g===0){var h=t[y];return o=h.x-s.position.x,r=h.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}g<0&&y!==0&&y<n.length-1&&(f=Cb(n,y))}var v={x:(p[1].x-p[0].x)*f+p[0].x,y:(p[1].y-p[0].y)*f+p[0].y},b=EO({x:e.x-d.x,y:e.y-d.y},m);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:So(v),delta:So({x:o,y:r})}}function Cb(e,t){var n=Vs(e[t-1],e[t]),i=Vs(e[t],e[t+1]),o=n/(n+i);return o}function kO(e,t){var n=vb(e),i=vb(t);return i-n}function Ab(e,t){return[e[t],e[t+1]]}function OO(e,t){var n=Vs(e[0],e[1]),i=Vs(e[0],t);return n===0?0:i/n}function DO(e,t,n,i){var o=Qe(e);return Mb(o,t,n,i).delta}function Us(e,t,n){var i=Hs(t),o=Hs(n),r=Vi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return So({x:o.x+a.x,y:o.y+a.y})}function Tb(e,t,n){var i=Hs(e),o=Hs(t),r=Hs(n),a=Vi(e,i),s=Vi(i,o),c=LO(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 So({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function LO(e,t,n){var i=qe(t),o=qe(n);if(IO(i,o))return null;var r=Bn(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=Bn(n,s),c!==r?null:a}function IO(e,t){return BO(e,t)||NO(e,t)}function BO(e,t){return e.right!==t.right&&e.left!==t.left}function NO(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Pb="name",kb="text";function Ff(e,t,n,i){be.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{we(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Pb in l&&t.updateLabel(c,l[Pb]),kb in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[kb]||"");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;lt(l)||!ir(l)||ci(l)&&t.updateLabel(l,ci(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=J({},s.hints),p=s.newWaypoints||c.waypoints,d=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),DO(l,p,d,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=we(c);u&&ir(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(!(!lt(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(ci(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?m-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Ol(c)){var p=c.label,d=Qe(p),f=jO(u),m=FO(d,f),g=$O(m,u,l);t.moveShape(p,g)}})}Ne(Ff,be),Ff.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function $O(e,t,n){var i=Us(e,t,n);return So(Vi(i,e))}function FO(e,t){if(t.length){var n=HO(e,t);return $f(e,n)}}function jO(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 HO(e,t){var n=t.map(function(o){return{line:o,distance:xb(e,o)}}),i=Xi(n,"distance");return i[0].line}function zO(e,t,n,i){return Mb(e,t,n,i).point}function jf(e,t){be.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=J({},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),zO(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},d=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,d)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},d=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,d)})})}Ne(jf,be),jf.$inject=["eventBus","modeling"];function Xl(e,t,n){var i=Jl(e),o=Db(i,t),r=i[0];return o.length?o[o.length-1]:Us(r.original||r,n,t)}function Zl(e,t,n){var i=Jl(e),o=Db(i,t),r=i[i.length-1];return o.length?o[0]:Us(r.original||r,n,t)}function Hf(e,t,n){var i=Jl(e),o=Ob(t,n),r=i[0];return Us(r.original||r,o,t)}function zf(e,t,n){var i=Jl(e),o=Ob(t,n),r=i[i.length-1];return Us(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 Jl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Db(e,t){var n=Hn(e,VO);return dt(n,function(i){return GO(i,t)})}function GO(e,t){return Bn(t,e,1)==="intersect"}function VO(e){return e.original||e}function Gf(e,t){be.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(WO(i,o)){var r=UO(i);r.incoming.forEach(function(a){var s=Zl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Xl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Gf.$inject=["eventBus","modeling"],Ne(Gf,be);function WO(e,t){return A(e,"bpmn:Participant")&&mt(e)&&A(t,"bpmn:Participant")&&!mt(t)}function UO(e){var t=ks([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){A(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){A(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const qO=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Lb(e){const t=we(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&Wn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:qO.some(i=>A(n[0],i))}function Ib(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Vf(e,t){e.invoke(be,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Lb(o))return;const a=Ib(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=we(i).get(a),l=we(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Vf.$inject=["injector","modeling"],Ne(Vf,be);function Wf(e,t){be.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=vt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ne(Wf,be),Wf.$inject=["eventBus","modeling"];function Uf(e,t,n){be.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(!(!A(r,"bpmn:SequenceFlow")||!A(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=YO(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ne(Uf,be),Uf.$inject=["eventBus","bpmnRules","modeling"];function Da(e){return e.original||e}function YO(e,t){var n=Bf(Da(e[e.length-2]),Da(e[e.length-1]),Da(t[1]),Da(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Da(e[0]),Da(t[t.length-1])]}function qf(e,t){be.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;A(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)}qf.$inject=["eventBus","modeling"],Ne(qf,be);function Yf(e,t,n,i){be.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 d,f;A(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),A(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(f=!0),n.canConnectSequenceFlow(l,u)&&(d="bpmn:SequenceFlow")),f&&t.removeConnection(c),d&&t.connect(l,u,{type:d,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,d=l.newTarget||u.target,f,m;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(m=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,o&&s(u,m))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,d;!p||!p.length||(d=p.indexOf(c),d!==-1&&p.splice(d,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;W(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,d=p.businessObject,f;u.default&&(f=Ft(p.outgoing,ga({id:p.businessObject.default.id})),f&&t.updateProperties(f,{conditionExpression:void 0})),u.conditionExpression&&d.sourceRef.default===d&&t.updateProperties(p.source,{default:void 0})})}Ne(Yf,be),Yf.$inject=["eventBus","modeling","bpmnRules","injector"];function Ql(e,t,n,i,o,r){i.invoke(be,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=ri(l,function(p,d){var f=t.canReplace([d],d.host||d.parent||c);return f?p.concat(f.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=[];W(s.closure.topLevel,function(d){Wn(d)?u=u.concat(d.children):u=u.concat(d)}),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})})}Ne(Ql,be),Ql.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;W(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)},Ql.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var KO=1500,XO={width:140,height:120},Kf={width:300,height:60},Xf={width:60,height:300},eu={width:300,height:150},tu={width:150,height:300},Bb={width:140,height:120},Nb={width:100,height:40};function $b(e){e.on("resize.start",KO,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(A(i,"bpmn:Lane")||A(i,"bpmn:Participant"))&&(n.resizeConstraints=tD(i,o,r)),A(i,"bpmn:SubProcess")&&mt(i)&&(n.minDimensions=Bb),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=Nb)})}$b.$inject=["eventBus"];var ar=Math.abs,ZO=Math.min,JO=Math.max;function Fb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function La(e,t,n){return Fb(e,t,n,ZO)}function Ia(e,t,n){return Fb(e,t,n,JO)}var QO={top:20,left:50,right:20,bottom:20},eD={top:50,left:20,right:20,bottom:20};function tD(e,t,n){var i=Ci(e),o=!0,r=!0,a=Wl(i,[i]),s=qe(e),c={},l={},u=_n(e),p=u?Kf:Xf;/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(m){var g=qe(m);u?(g.top<s.top-10&&(o=!1),g.bottom>s.bottom+10&&(r=!1)):(g.left<s.left-10&&(o=!1),g.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&ar(s.top-g.bottom)<10&&Ia(c,"top",g.top+p.height),ar(s.top-g.top)<5&&La(l,"top",g.bottom-p.height)),/e/.test(t)&&(n&&ar(s.right-g.left)<10&&La(c,"right",g.right-p.width),ar(s.right-g.right)<5&&Ia(l,"right",g.left+p.width)),/s/.test(t)&&(n&&ar(s.bottom-g.top)<10&&La(c,"bottom",g.bottom-p.height),ar(s.bottom-g.bottom)<5&&Ia(l,"bottom",g.top+p.height)),/w/.test(t)&&(n&&ar(s.left-g.right)<10&&Ia(c,"left",g.left+p.width),ar(s.left-g.left)<5&&La(l,"left",g.right-p.width))});var d=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(A(m,"bpmn:FlowElement")||A(m,"bpmn:Artifact"))}),f=u?QO:eD;return d.forEach(function(m){var g=qe(m);/n/.test(t)&&(!u||o)&&La(l,"top",g.top-f.top),/e/.test(t)&&(u||r)&&Ia(l,"right",g.right+f.right),/s/.test(t)&&(!u||r)&&Ia(l,"bottom",g.bottom+f.bottom),/w/.test(t)&&(u||o)&&La(l,"left",g.left-f.left)}),{min:l,max:c}}function jb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ba(e){return e.originalEvent||e.srcEvent}function Zf(e){jb(e),jb(Ba(e))}function Ur(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 Hb(){return/mac/i.test(navigator.platform)}function zb(e,t){return(Ba(e)||e).button===t}function sr(e){return zb(e,0)}function nD(e){return zb(e,1)}function qs(e){var t=Ba(e)||e;return sr(e)?Hb()?t.metaKey:t.ctrlKey:!1}function nu(e){var t=Ba(e)||e;return sr(e)&&t.shiftKey}var Gb=1001;function Vb(e,t){e.on("resize.start",Gb+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!qs(n))}),e.on("resize.end",Gb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))return r&&(a=yx(a),t.resizeLane(o,a,i.balanced)),!1})}Vb.$inject=["eventBus","modeling"];var iD=500;function Jf(e,t,n,i,o){n.invoke(be,this);function r(u){return pt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||oD(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!Ft(d,ga({id:u.id}))}function s(u){if(A(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(A(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(A(u,"bpmn:MessageEventDefinition"))return"messageRef";if(A(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(pt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),d=p[0];return d.get(s(d))}function l(u,p){if(pt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var d=u.get("eventDefinitions"),f=d[0];return f.set(s(f),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var d=we(p),f=c(d),m;f&&!a(f)&&(m=e.getDefinitions().get("rootElements"),rn(m,f),u.addedRootElement=f)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var d=e.getDefinitions().get("rootElements");nn(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=we(d),m=c(f);m&&(p.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",iD,function(u){var p=u.descriptor,d=p.businessObject,f=p.referencedRootElement;f&&(a(f)||(f=i.copyElement(f,o.create(f.$type))),l(d,f),delete p.referencedRootElement)})}Jf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ne(Jf,be);function oD(e,t){return Ze(t)||(t=[t]),zo(t,function(n){return Ca(e,n)})}var Wb=Math.max;function Ub(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return W(n,function(a){var s=a.id;A(a,"bpmn:Participant")&&(r[s]=aD(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=_n(a)?Kf:Xf),A(a,"bpmn:SubProcess")&&mt(a)&&(r[s]=Bb),A(a,"bpmn:TextAnnotation")&&(r[s]=Nb),A(a,"bpmn:Group")&&(r[s]=XO)}),r})}Ub.$inject=["eventBus"];function rD(e){return e==="x"}function aD(e,t,n){var i=_n(e);if(!lD(e))return i?eu:tu;var o=rD(t),r={};return o?i?r=eu:r={width:cD(e,n,o),height:tu.height}:i?r={width:eu.width,height:sD(e,n,o)}:r=tu,r}function sD(e,t,n){var i;return i=uD(e,t,n),Wb(eu.height,i)}function cD(e,t,n){var i;return i=pD(e,t,n),Wb(tu.width,i)}function lD(e){return!!rr(e).length}function uD(e,t,n){var i=rr(e),o;return o=Qf(i,t,n),e.height-o.height+Kf.height}function pD(e,t,n){var i=rr(e),o;return o=Qf(i,t,n),e.width-o.width+Xf.width}function Qf(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=rr(o),r.length?Qf(r,t,n):o}var qb="_plane";function Yb(e){var t=e.id;return dD(t)}function so(e){var t=e.id;return A(e,"bpmn:SubProcess")?Kb(t):t}function qr(e){return Kb(e)}function iu(e){var t=vt(e);return A(t,"bpmndi:BPMNPlane")}function Kb(e){return e+qb}function dD(e){return e.replace(new RegExp(qb+"$"),"")}var Xb=400,fD=600,Zb={x:180,y:160};function Ao(e,t,n,i,o,r,a){be.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 A(p,"bpmn:SubProcess")&&!mt(p)}function l(p){var d=p.shape,f=p.newRootElement,m=we(d);f=s._addDiagram(f||m),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=we(d);s._removeDiagram(f);var m=p.newRootElement=a.get(so(f));e.removeRootElement(m)}this.executed("shape.create",function(p){var d=p.shape;c(d)&&l(p)},!0),this.postExecuted("elements.create",function(p){var d=p.elements;W(d,function(f){if(c(f)){var m=a.get(so(f));if(!(!m||!f.children||!f.children.length)){var g=Jb(f);s._showRecursively(g),s._moveChildrenToShape(g,m)}}})},!0),this.reverted("shape.create",function(p){var d=p.shape;c(d)&&u(p)},!0),this.preExecute("shape.delete",function(p){var d=p.shape;!A(d,"bpmn:SubProcess")||!mt(d)||W(Ns([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(so(d));f&&n.removeElements(f.children.slice())}},!0),this.executed("shape.delete",function(p){var d=p.shape;c(d)&&u(p)},!0),this.reverted("shape.delete",function(p){var d=p.shape;c(d)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var d=p.oldShape,f=p.newShape;!c(d)||!c(f)||(p.oldRoot=e.removeRootElement(so(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,m=e.findRoot(so(d));if(!(!f||!m)){var g=f.children;n.moveElements(g,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,g=m.id,y=f.id;if(g!==y){if(iu(d)){a.updateId(d,qr(y)),a.updateId(g,y);return}var _=a.get(qr(g));_&&a.updateId(qr(g),qr(y))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,g=m.id,y=f.id;if(g!==y){if(iu(d)){a.updateId(d,qr(g)),a.updateId(y,g);return}var _=a.get(qr(y));_&&a.updateId(_,qr(g))}}},!0),t.on("element.changed",function(p){var d=p.element;if(iu(d)){var f=d,m=a.get(Yb(f));!m||m===f||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",Xb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(mt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",Xb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(mt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",fD,function(p){var d=p.shape;if(A(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(mt(d))s._moveChildrenToShape(f.children.slice(),d),W(Ns(d.children),g=>{n.moveShape(g.annotation,{x:0,y:0},d.parent),W(g.associations,y=>{n.moveConnection(y,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var m=Jb(d);s._moveChildrenToShape(m,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var m=so(d),g=a.get(m);g&&f.push.apply(f,g.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,m=p.elements,g=f.parent,y=A(vt(g),"bpmndi:BPMNPlane");if(y){var _=Yb(g),h=Ft(m,function(v){return v.id===_});h&&(d.parent=h.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}Ne(Ao,be),Ao.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=ln(i),r;if(!t.x)r={x:Zb.x-o.x,y:Zb.y-o.y};else{var a=Qe(t),s=Qe(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},Ao.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(zx(e).map(i=>i.annotation));n.size&&W(Ns(e.children),i=>{n.has(i.annotation)&&W(i.associations,o=>{t.removeConnection(o)})})},Ao.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},Ao.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},Ao.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:so(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},Ao.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ft(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ao.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function hD(e){var t=[];return W(Ns(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Jb(e){return e.children.slice().concat(hD(e.children)).concat(gD(e))}function gD(e){return of(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function eh(e,t){e.invoke(be,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!A(o,"bpmn:SubProcess")||A(o,"bpmn:AdHocSubProcess")||!(A(i,"bpmn:Task")||A(i,"bpmn:CallActivity"))||!mt(o))){var r=mD(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}eh.$inject=["injector","modeling"],Ne(eh,be);function mD(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function th(e,t){be.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;A(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&&A(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(!(!A(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,ci(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}}})}Ne(th,be),th.$inject=["eventBus","textRenderer"];function nh(e,t){be.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(mt(i))return;var o=ks(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();W(s,function(l){r(l,!0)}),W(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||A(a,"bpmn:Association")&&(A(a.source,"bpmn:TextAnnotation")||A(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Qe(i)):t.reconnectStart(a,i,Qe(i)))}},!0)}Ne(nh,be),nh.$inject=["eventBus","modeling"];var ih=500;function oh(e,t,n){be.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=yD(c).concat([a]),p=ab(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"],ih,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?vt(c).isExpanded=!1:(i(c.children),vt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ih,function(a){var s=a.context,c=s.shape;c.collapsed?vt(c).isExpanded=!1:vt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ih,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"})})}Ne(oh,be),oh.$inject=["eventBus","elementFactory","modeling"];function yD(e){return e.filter(function(t){return!t.hidden})}function rh(e,t,n,i){t.invoke(be,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;lt(a)||(A(a,"bpmn:Participant")&&mt(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;A(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ne(rh,be),rh.$inject=["canvas","injector","moddle","modeling"];function ah(e,t){be.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;vD(o,r)&&t.updateProperties(r,{default:null})})}Ne(ah,be),ah.$inject=["eventBus","modeling"];function vD(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=we(t),i=we(e);return n.get("default")===i}var xD=500,bD=5e3,Qb=["shape.create","shape.delete","shape.move","shape.resize"],ew=[...Qb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function sh(e,t){be.call(this,e);var n;function i(){return n=n||new wD,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(ew,bD,function(){i()}),this.postExecuted(ew,xD,function(){r()}),this.preExecute(Qb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(A(c,"bpmn:Lane")&&l.addLane(c),A(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}sh.$inject=["eventBus","modeling"],Ne(sh,be);function wD(){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 _D=500,ED=5e3,tw=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],nw=[...tw,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function ch(e,t){be.call(this,e);var n;function i(){return n=n||new SD,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(nw,ED,function(){i()}),this.postExecuted(nw,_D,function(){r()}),this.preExecute(tw,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(A(s,"bpmn:FlowElement")&&c.addFlowElement(s),A(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;A(s,"bpmn:Group")&&o().addGroup(s)})}ch.$inject=["eventBus","modeling"],Ne(ch,be);function SD(){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 lh(e,t){be.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)RD(r)&&!CD(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ne(lh,be),lh.$inject=["eventBus","modeling"];function RD(e){const t=we(e);return t&&t.isForCompensation}function MD(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ca(e,"bpmn:CompensateEventDefinition")}function CD(e){return e.incoming.filter(n=>MD(n.source)).length>0}const AD={__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",yf],appendBehavior:["type",vf],associationBehavior:["type",bf],attachEventBehavior:["type",$l],artifactBehavior:["type",xf],boundaryEventBehavior:["type",wf],categoryRootElementReferenceBehavior:["type",_f],compensateBoundaryEventBehaviour:["type",Ef],createBehavior:["type",Sf],createDataObjectBehavior:["type",Rf],createParticipantBehavior:["type",Af],dataInputAssociationBehavior:["type",Tf],dataStoreBehavior:["type",Pf],deleteLaneBehavior:["type",kf],detachEventBehavior:["type",Ul],dropOnFlowBehavior:["type",Df],eventBasedGatewayBehavior:["type",Lf],fixHoverBehavior:["type",fb],groupBehavior:["type",If],importDockingFix:["type",gb],isHorizontalFix:["type",Nf],labelBehavior:["type",Ff],layoutConnectionBehavior:["type",jf],messageFlowBehavior:["type",Gf],nonInterruptingBehavior:["type",Vf],removeElementBehavior:["type",Uf],removeEmbeddedLabelBoundsBehavior:["type",Wf],removeParticipantBehavior:["type",qf],replaceConnectionBehavior:["type",Yf],replaceElementBehaviour:["type",Ql],resizeBehavior:["type",$b],resizeLaneBehavior:["type",Vb],rootElementReferenceBehavior:["type",Jf],spaceToolBehavior:["type",Ub],subProcessPlaneBehavior:["type",Ao],subProcessStartEventBehavior:["type",eh],textAnnotationBehavior:["type",th],toggleCollapseConnectionBehaviour:["type",nh],toggleElementCollapseBehaviour:["type",oh],unclaimIdBehavior:["type",rh],unsetDefaultFlowBehavior:["type",ah],updateFlowNodeRefsBehavior:["type",sh],updateCategoryValueRefsBehavior:["type",ch],setCompensationActivityAfterPasteBehavior:["type",lh]};function uh(e){this._commandStack=e.get("commandStack",!1)}uh.$inject=["injector"],uh.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const co={__init__:["rules"],rules:["type",uh]};function Ai(e){be.call(this,e),this.init()}Ai.$inject=["eventBus"],Ne(Ai,be),Ai.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)})},Ai.prototype.init=function(){};function iw(e,t){var n=Bn(e,t,-15);return n!=="intersect"?n:null}function $n(e){Ai.call(this,e)}Ne($n,Ai),$n.$inject=["eventBus"],$n.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return TD(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 ru(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ru(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 mw(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return It(i)&&!au(t,i)?!1:Ho(t,function(o){return It(o)?ru(o.source,o.target,o):o.host?Ys(o,o.host,null,n):hh(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 uw(a)&&!n.includes(a.host)})?!1:Ys(n,t,null,i)||hw(n,t,i)||gw(n,t)||au(n,t)}),this.addRule("shape.create",function(e){return hh(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ys(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return ww(n,t)})},$n.prototype.canConnectMessageFlow=xw,$n.prototype.canConnectSequenceFlow=bw,$n.prototype.canConnectDataAssociation=gh,$n.prototype.canConnectAssociation=yw,$n.prototype.canConnectCompensationAssociation=vw,$n.prototype.canMove=gw,$n.prototype.canAttach=Ys,$n.prototype.canReplace=hw,$n.prototype.canDrop=Na,$n.prototype.canInsert=au,$n.prototype.canCreate=hh,$n.prototype.canConnect=ru,$n.prototype.canResize=mw,$n.prototype.canCopy=ww;function TD(e){return ph(e)?null:pt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function ph(e){return!e||lt(e)}function ow(e){do{if(A(e,"bpmn:Process"))return we(e);if(A(e,"bpmn:Participant"))return we(e).processRef||we(e)}while(e=e.parent)}function dh(e){return A(e,"bpmn:TextAnnotation")}function fh(e){return A(e,"bpmn:Group")&&!e.labelTarget}function rw(e){return A(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function ou(e){return we(e).isForCompensation}function PD(e,t){var n=ow(e),i=ow(t);return n===i}function kD(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&cw(e,"bpmn:MessageEventDefinition"))}function OD(e){return A(e,"bpmn:InteractionNode")&&!ou(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&cw(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!lo(e,"bpmn:MessageEventDefinition"))}function aw(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return we(t);if(A(t,"bpmn:Participant"))return we(t).processRef}return null}function sw(e,t){var n=aw(e),i=aw(t);return n===i}function lo(e,t){var n=we(e);return!!Ft(n.eventDefinitions||[],function(i){return A(i,t)})}function cw(e,t){var n=we(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function DD(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!Wn(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&lo(e,"bpmn:LinkEventDefinition"))&&!rw(e)&&!ou(e)}function LD(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!Wn(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&lo(e,"bpmn:LinkEventDefinition"))&&!ou(e)}function ID(e){return A(e,"bpmn:ReceiveTask")||A(e,"bpmn:IntermediateCatchEvent")&&(lo(e,"bpmn:MessageEventDefinition")||lo(e,"bpmn:TimerEventDefinition")||lo(e,"bpmn:ConditionalEventDefinition")||lo(e,"bpmn:SignalEventDefinition"))}function BD(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function lw(e,t){var n=BD(t);return n.indexOf(e)!==-1}function ru(e,t,n){if(ph(e)||ph(t))return null;if(!A(n,"bpmn:DataAssociation")){if(xw(e,t))return{type:"bpmn:MessageFlow"};if(bw(e,t))return{type:"bpmn:SequenceFlow"}}var i=gh(e,t);return i||(vw(e,t)?{type:"bpmn:Association",associationDirection:"One"}:yw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Na(e,t){return lt(e)||fh(e)?!0:A(t,"bpmn:Participant")&&!mt(t)?!1:A(e,"bpmn:Participant")?A(t,"bpmn:Process")||A(t,"bpmn:Collaboration"):pt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:A(e,"bpmn:Lane")?A(t,"bpmn:Participant")||A(t,"bpmn:Lane"):A(e,"bpmn:BoundaryEvent")&&!ND(e)?!1:A(e,"bpmn:FlowElement")&&!A(e,"bpmn:DataStoreReference")?A(t,"bpmn:FlowElementsContainer")?mt(t):pt(t,["bpmn:Participant","bpmn:Lane"]):A(e,"bpmn:DataStoreReference")&&A(t,"bpmn:Collaboration")?zo(we(t).get("participants"),function(n){return!!n.get("processRef")}):pt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?pt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):A(e,"bpmn:MessageFlow")?A(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function ND(e){return we(e).cancelActivity&&(pw(e)||dw(e))}function uw(e){return!lt(e)&&A(e,"bpmn:BoundaryEvent")}function $D(e){return A(e,"bpmn:Lane")}function FD(e){return uw(e)||A(e,"bpmn:IntermediateThrowEvent")&&pw(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&dw(e)}function pw(e){var t=we(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function dw(e){return fw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function fw(e,t){return t.some(function(n){return lo(e,n)})}function jD(e){return A(e,"bpmn:ReceiveTask")&&Ft(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function Ys(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return lt(o)||!FD(o)||Wn(t)||!A(t,"bpmn:Activity")||ou(t)||i&&!iw(i,t)||jD(t)?!1:"attach"}function hw(e,t,n){if(!t)return!1;var i={replacements:[]};return W(e,function(o){Wn(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&Na(o,t)&&(X2(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(Z2(o)||J2(o)||Q2(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),fw(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&A(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),A(t,"bpmn:Transaction")||lo(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(A(o,"bpmn:EndEvent")&&Na(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),A(o,"bpmn:BoundaryEvent")&&Ys(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function gw(e,t){return zo(e,$D)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Na(n,t)})}function hh(e,t,n,i){return t?lt(e)||fh(e)?!0:Na(e,t)||au(e,t):!1}function mw(e,t,n){return A(e,"bpmn:SubProcess")?mt(e)&&(!t||t.width>=100&&t.height>=80):A(e,"bpmn:Lane")||A(e,"bpmn:Participant")?!0:dh(e)?n?n==="e"||n==="w":!0:fh(e)?!0:lt(e)?n?n==="e"||n==="w":!0:!1}function HD(e,t){var n=dh(e),i=dh(t);return(n||i)&&n!==i}function yw(e,t){return lw(t,e)||lw(e,t)?!1:HD(e,t)?!0:!!gh(e,t)}function vw(e,t){return sw(e,t)&&rw(e)&&A(t,"bpmn:Activity")&&!GD(t,e)&&!Wn(t)}function xw(e,t){return Ew(e)&&!Ew(t)?!1:kD(e)&&OD(t)&&!PD(e,t)}function bw(e,t){return DD(e)&&LD(t)&&sw(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!ID(t))}function gh(e,t){return pt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&pt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:pt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&pt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function au(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:pt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!lt(t)&&A(e,"bpmn:FlowNode")&&!A(e,"bpmn:BoundaryEvent")&&Na(e,t.parent)}function mh(e,t){return e&&t&&e.indexOf(t)!==-1}function ww(e,t){return lt(t)?!0:!(A(t,"bpmn:Lane")&&!mh(e,t.parent)||A(t,"bpmn:MessageFlow")&&!zD(e,t))}function zD(e,t){var n=_w(t.source),i=_w(t.target);return mh(e,n)&&mh(e,i)}function _w(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function Ew(e){return Pa(e,"bpmn:Process")||Pa(e,"bpmn:Collaboration")}function GD(e,t){return e.attachers.includes(t)}const VD={__depends__:[co],__init__:["bpmnRules"],bpmnRules:["type",$n]};var WD=2e3;function Sw(e,t){e.on("saveXML.start",WD,n);function n(){var i=t.getRootElements();W(i,function(o){var r=vt(o),a,s;a=ks([o]),a=dt(a,function(c){return c!==o&&!c.labelTarget}),s=Hn(a,vt),r.set("planeElement",s)})}}Sw.$inject=["eventBus","canvas"];const UD={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Sw]};function su(e){be.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)})}su.prototype.getOrdering=function(e,t){return null},Ne(su,be);function yh(e,t){su.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=Ft(n,function(c){return pt(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&&!pt(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||A(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=xm(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}}}yh.$inject=["eventBus","canvas"],Ne(yh,su);const qD={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",yh]};function Ks(){}Ks.prototype.get=function(){return this._data},Ks.prototype.set=function(e){this._data=e},Ks.prototype.clear=function(){var e=this._data;return delete this._data,e},Ks.prototype.isEmpty=function(){return!this._data};const YD={clipboard:["type",Ks]};var Rw=1500;function Mw(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",Rw,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Rw,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=Ur(a),c=document.elementFromPoint(s.x,s.y),KD(c)}}Mw.$inject=["elementRegistry","eventBus","injector"];function KD(e){return jr(e,"svg, .djs-element",!0)}const XD={__init__:["hoverFix"],hoverFix:["type",Mw]};function ZD(e){return!0}function cu(e){return sr(e)||nD(e)}var Cw=500;function Aw(e,t,n){var i=this;function o(P,k,N){if(!s(P,k)){var G,q,Y;N?q=t.getGraphics(N):(G=k.delegateTarget||k.target,G&&(q=G,N=t.get(q))),!(!q||!N)&&(Y=e.fire(P,{element:N,gfx:q,originalEvent:k}),Y===!1&&(k.stopPropagation(),k.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,k){var N=l[P]||sr;return!N(k)}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":ZD,"element.mousedown":cu,"element.mouseup":cu,"element.click":cu,"element.dblclick":cu};function u(P,k,N){var G=c[P];if(!G)throw new Error("unmapped DOM event name <"+P+">");return o(G,k,N)}var p="svg, .djs-element";function d(P,k,N,G){var q=r[N]=function(Y){o(N,Y)};G&&(l[N]=G),q.$delegate=ai.bind(P,p,k,q)}function f(P,k,N){var G=a(N);G&&ai.unbind(P,k,G.$delegate)}function m(P){W(c,function(k,N){d(P,N,k)})}function g(P){W(c,function(k,N){f(P,N,k)})}e.on("canvas.destroy",function(P){g(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var k=P.element,N=P.gfx;e.fire("interactionEvents.createHit",{element:k,gfx:N})}),e.on(["shape.changed","connection.changed"],Cw,function(P){var k=P.element,N=P.gfx;e.fire("interactionEvents.updateHit",{element:k,gfx:N})}),e.on("interactionEvents.createHit",Cw,function(P){var k=P.element,N=P.gfx;i.createDefaultHit(k,N)}),e.on("interactionEvents.updateHit",function(P){var k=P.element,N=P.gfx;i.updateDefaultHit(k,N)});var y=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),h=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),b={all:h,"click-stroke":_,stroke:y,"no-move":v};function E(P,k){return k=J({stroke:"white",strokeWidth:15},k||{}),n.cls(P,["no-fill","no-border"],k)}function M(P,k){var N=b[k];if(!N)throw new Error("invalid hit type <"+k+">");return Le(P,N),P}function B(P,k){tt(P,k)}this.removeHits=function(P){var k=Ms(".djs-hit",P);W(k,cn)},this.createDefaultHit=function(P,k){var N=P.waypoints,G=P.isFrame,q;return N?this.createWaypointsHit(k,N):(q=G?"stroke":"all",this.createBoxHit(k,q,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,k){var N=Ps(k);return M(N,"stroke"),B(P,N),N},this.createBoxHit=function(P,k,N){N=J({x:0,y:0},N);var G=je("rect");return M(G,k),Le(G,N),B(P,G),G},this.updateDefaultHit=function(P,k){var N=Ct(".djs-hit",k);if(N)return P.waypoints?nf(N,P.waypoints):Le(N,{width:P.width,height:P.height}),N},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}Aw.$inject=["eventBus","elementRegistry","styles"];const lu={__init__:["interactionEvents"],interactionEvents:["type",Aw]};function $a(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)})}$a.$inject=["eventBus","canvas"],$a.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()})}},$a.prototype.get=function(){return Array.from(this._selectedElements)},$a.prototype.isSelected=function(e){return this._selectedElements.has(e)},$a.prototype.select=function(e,t){var n=this.get();Ze(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?W(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Tw="hover",Pw="selected";function kw(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,Tw)}),t.on("element.out",function(o){i(o.element,Tw)}),t.on("selection.changed",function(o){function r(l){i(l,Pw)}function a(l){n(l,Pw)}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)})}kw.$inject=["canvas","eventBus"];function Ow(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;Ze(l)?t.select(l):t.select(s.filter(JD))}}),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=Ft(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(sr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=nu(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Ow.$inject=["eventBus","selection","canvas","elementRegistry"];function JD(e){return!e.hidden}const Ti={__init__:["selectionVisuals","selectionBehavior"],__depends__:[lu],selection:["type",$a],selectionVisuals:["type",kw],selectionBehavior:["type",Ow]};var QD=/^djs-cursor-.*$/;function uu(e){var t=Pt(document.body);t.removeMatching(QD),e&&t.add("djs-cursor-"+e)}function Dw(){uu(null)}var eL=5e3;function Lw(e,t){t=t||"element.click";function n(){return!1}return e.once(t,eL,n),function(){e.off(t,n)}}var tL=["c","C"],nL=["v","V"],iL=["d","D"],oL=["x","X"],rL=["y","Y"],Iw=["z","Z"];function aL(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ui(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function xn(e,t){return e=Ze(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function vh(e){return e.shiftKey}function sL(e){return ui(e)&&xn(tL,e)}function cL(e){return ui(e)&&xn(nL,e)}function lL(e){return ui(e)&&xn(iL,e)}function uL(e){return ui(e)&&xn(oL,e)}function pL(e){return ui(e)&&!vh(e)&&xn(Iw,e)}function dL(e){return ui(e)&&(xn(rL,e)||xn(Iw,e)&&vh(e))}var Fa=Math.round,Bw="djs-drag-active";function Yr(e){e.preventDefault()}function fL(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function hL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Nw(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(v.x-E.left)/b.scale,y:b.y+(v.y-E.top)/b.scale}}function s(v,b){b=b||r;var E=e.createEvent(J({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(b.prefix+"."+v,E)}function c(v){var b=v.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function l(v,b){var E=r.payload,M=r.displacement,B=r.globalStart,P=Ur(v),k=Vi(P,B),N=r.localStart,G=a(P),q=Vi(G,N);if(!r.active&&(b||hL(k)>r.threshold)){if(J(E,{x:Fa(N.x+M.x),y:Fa(N.y+M.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&uu(r.cursor),t.addMarker(t.getRootElement(),Bw)}Zf(v),r.active&&(J(E,{x:Fa(G.x+M.x),y:Fa(G.y+M.y),dx:Fa(q.x),dy:Fa(q.y)},{originalEvent:v}),s("move"))}function u(v){var b,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Zf(v)),E=s("end")),E===!1&&s("rejected"),b=_(E!==!0),s("ended",b)}function p(v){xn("Escape",v)&&(Yr(v),y())}function d(v){var b;r.active&&(b=Lw(e),setTimeout(b,400),Yr(v)),u(v)}function f(v){l(v)}function m(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function g(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function y(v){var b;if(r){var E=r.active;E&&s("cancel"),b=_(v),E&&s("canceled",b)}}function _(v){var b,E;s("cleanup"),Dw(),r.trapClick?E=d:E=u,We.unbind(document,"mousemove",l),We.unbind(document,"dragstart",Yr),We.unbind(document,"selectstart",Yr),We.unbind(document,"mousedown",E,!0),We.unbind(document,"mouseup",E,!0),We.unbind(document,"keyup",p),We.unbind(document,"touchstart",f,!0),We.unbind(document,"touchcancel",y,!0),We.unbind(document,"touchmove",l,!0),We.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",g),t.removeMarker(t.getRootElement(),Bw);var M=r.payload.previousSelection;return v!==!1&&M&&!n.get().length&&c(M),b=r,r=null,b}function h(v,b,E,M){r&&y(!1),typeof b=="string"&&(M=E,E=b,b=null),M=J({},o,M||{});var B=M.data||{},P,k,N,G,q;if(M.trapClick?G=d:G=u,v?(P=Ba(v)||v,k=Ur(v),Zf(v),P.type==="dragstart"&&Yr(P)):(P=null,k={x:0,y:0}),N=a(k),b||(b=N),q=fL(P),r=J({prefix:E,data:B,payload:{},globalStart:k,displacement:Vi(b,N),localStart:N,isTouch:q},M),M.manual||(q?(We.bind(document,"touchstart",f,!0),We.bind(document,"touchcancel",y,!0),We.bind(document,"touchmove",l,!0),We.bind(document,"touchend",u,!0)):(We.bind(document,"mousemove",l),We.bind(document,"dragstart",Yr),We.bind(document,"selectstart",Yr),We.bind(document,"mousedown",G,!0),We.bind(document,"mouseup",G,!0)),We.bind(document,"keyup",p),e.on("element.hover",m),e.on("element.out",g)),s("init")===!1)return y(),!1;M.autoActivate&&l(v,!0)}e.on("diagram.destroy",y),this.init=h,this.move=l,this.hover=m,this.out=g,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){J(o,v)}}Nw.$inject=["eventBus","canvas","selection","elementRegistry"];const To={__depends__:[XD,Ti],dragging:["type",Nw]};function Kr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Kr.prototype.next=function(){return this._prefix+ ++this._counter};const gL=new Kr("ps");var mL=["marker-start","marker-mid","marker-end"],yL=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}cr.$inject=["elementRegistry","eventBus","canvas","styles"],cr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},cr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Yd(n);return this._cloneMarkers(tr(o),i),Le(o,this._styles.cls(i,[])),tt(t,o),Le(o,"data-preview-support-element-id",e.id),o},cr.prototype.addFrame=function(e,t){var n=je("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return tt(t,n),Le(n,"data-preview-support-element-id",e.id),n},cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),wL(e)&&mL.forEach(function(o){if(Le(e,o)){var r=vL(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},cr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,gL.next()].join("-"),a=Ct("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Yd(n);s.id=r,gt(s).add(o);var c=Ct(":scope > defs",e);c||(c=je("defs"),tt(e,c)),tt(c,s);var l=bL(s.id);Le(t,i,l)};function vL(e,t,n){var i=xL(Le(e,t));return Ct("marker#"+i,n||document)}function xL(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function bL(e){return"url(#"+e+")"}function wL(e){return yL.indexOf(e.nodeName)!==-1}const ja={__init__:["previewSupport"],previewSupport:["type",cr]};var _L="drop-ok",$w="drop-not-ok",Fw="attach-ok",jw="new-parent",Hw="create",EL=2e3;function zw(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=dt(c,function(h){var v=h.labelTarget;return!h.parent&&!(lt(h)&&c.indexOf(v)!==-1)});var f=Ft(c,function(h){return!It(h)}),m=!1,g=!1,y=!1;Vw(c)&&(m=o.allowed("shape.attach",{position:u,shape:f,target:l})),m||(Vw(c)?y=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):y=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=d.connectionTarget;return y||m?(f&&p&&(g=o.allowed("connection.create",{source:_===p?f:p,target:_===p?p:f,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:g}):y===null||m===null?null:!1}function a(c,l){[Fw,_L,$w,jw].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,d=l.source,f=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Gw(c);var m={x:c.x,y:c.y},g=l.canExecute=p&&r(u,p,m,d,f);p&&g!==null&&(l.target=p,g&&g.attach?a(p,Fw):a(p,g?jw:$w))}),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,d=l.elements,f=l.target,m=l.canExecute,g=m&&m.attach,y=m&&m.connect,_=l.hints||{};if(m===!1||!f)return!1;Gw(c);var h={x:c.x,y:c.y};y?p=i.appendShape(u,p,h,f,{attach:g,connection:y===!0?{}:y,connectionTarget:_.connectionTarget}):(d=i.createElements(d,h,f,J({},_,{attach:g})),p=Ft(d,function(v){return!It(v)})),J(l,{elements:d,shape:p}),J(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===Hw&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],EL,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ze(l)||(l=[l]);var p=Ft(l,function(m){return!It(m)});if(p){u=J({elements:l,hints:{},shape:p},u||{}),W(l,function(m){Je(m.x)||(m.x=0),Je(m.y)||(m.y=0)});var d=dt(l,function(m){return!m.hidden}),f=ln(d);W(l,function(m){It(m)&&(m.waypoints=Hn(m.waypoints,function(g){return{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2}})),J(m,{x:m.x-f.x-f.width/2,y:m.y-f.y-f.height/2})}),t.init(c,Hw,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}zw.$inject=["canvas","dragging","eventBus","modeling","rules"];function Gw(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 Vw(e){return e&&e.length===1&&!It(e[0])}var SL=750;function Ww(e,t,n,i,o){function r(a){var s=je("g");Le(s,o.cls("djs-drag-group",["no-events"]));var c=je("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(tr(u),l)):(u=n._createContainer("shape",c),n.drawShape(tr(u),l),Nn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",SL,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(),tt(p,u)),Nn(u,a.x,a.y)):cn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&cn(c)})}Ww.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const pu={__depends__:[To,ja,co,Ti],__init__:["create","createPreview"],create:["type",zw],createPreview:["type",Ww]};function xh(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)})}xh.$inject=["eventBus"],xh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||RL(0,0)};function RL(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 Xs={__init__:["mouse"],mouse:["type",xh]};var Uw=2e3;function pi(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),ML(u)&&(l.priority=2,l.host=u.host.id),It(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=CL(u)),lt(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),W(["x","y","width","height"],function(d){Je(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Uw,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Uw,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;J(l,{createElementsBehavior:!1})})}pi.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],pi.prototype.copy=function(e,t={}){var n,i;return Ze(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ze(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},pi.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})}}},pi.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},pi.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},pi.prototype._getElementIdsFromTree=function(e){var t={};return W(e,function(n){W(n,function(i){i.id&&(t[i.id]=!0)})}),t},pi.prototype._paste=function(e,t,n,i){W(e,function(r){Je(r.x)||(r.x=0),Je(r.y)||(r.y=0)});var o=ln(e);return W(e,function(r){It(r)&&(r.waypoints=Hn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),J(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,J({},i))},pi.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return W(e,function(r,a){r=Xi(r,"priority"),W(r,function(s){var c=J({},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(It(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(lt(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},pi.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Zi(e,["id"]));return t},pi.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Zi(e,["id"]));return t},pi.prototype.createShape=function(e){var t=this._elementFactory.createShape(Zi(e,["id"]));return t},pi.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(It(e)&&(!n.has(e.source)||!n.has(e.target))||lt(e)&&!n.has(e.labelTarget))},pi.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=El(e);function s(p,d){return t.allowed("element.copy",{element:p,elements:d})}function c(p,d){var f=r.get(p);if(!f){var m={element:p,depth:d};o.push(m),r.set(p,m);return}if(f.depth<d){o=l(f,o);var g={element:f.element,depth:d};o.push(g),r.set(p,g)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}zr(a,function(p,d,f){if(lt(p))return;W(p.labels,function(y){c(y,f)});function m(y){y&&y.length&&W(y,function(_){W(_.labels,function(h){c(h,f)}),c(_,f)})}W([p.attachers,p.incoming,p.outgoing],m),c(p,f);var g=[];return p.children&&(g=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:g}),g}),e=Hn(o,function(p){return p.element});var u=new Set(e);return o=Hn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Xi(o,function(p){return p.descriptor.priority}),e=Hn(o,function(p){return p.element}),W(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){Yw(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Yw(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function ML(e){return!!e.host}function CL(e){return Hn(e.waypoints,function(t){return t=qw(t),t.original&&(t.original=qw(t.original)),t})}function qw(e){return J({},e)}function Yw(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const AL={__depends__:[YD,pu,Xs,co],__init__:["copyPaste"],copyPaste:["type",pi]};function bh(e,t,n){Ze(n)||(n=[n]),W(n,function(i){Pr(e[i])||(t[i]=e[i])})}var wh=750;function Kw(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",wh,function(c){var l=c.descriptor,u=c.element,p=we(u);if(lt(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(vt(u),!0);f.bpmnElement=d,bh(d,l,"name"),bh(f,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=we(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(we(c).attachedToRef=we(l[c.host])),Zi(u,ri(u,function(d,f,m){var g=f.element,y=f.property;return m===c.id&&(g.set(y,p),d.push(c.id)),d},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,d=u.di;if(lt(u)){u.businessObject=we(l[u.labelTarget]),u.di=vt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,bh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",wh,function(c){var l=c.descriptor,u=c.element;if(A(u,"bpmn:Participant")){var p=we(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;A(l,"bpmn:SubProcess")&&W(Ns(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",wh,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Kw.$inject=["bpmnFactory","eventBus","moddleCopy"];const TL=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],PL=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Zs(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 Xi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=yn(o)&&o.$descriptor;if(a&&PL.includes(a))return r;if(a&&TL.includes(a)||a&&s&&!Ft(s.properties,ga({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(A(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Zs.$inject=["eventBus","bpmnFactory","moddle"],Zs.prototype.copyElement=function(e,t,n,i=!1){n&&!Ze(n)&&(n=[n]),n=n||_h(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Ze(o)&&(n=o),W(n,r=>{let a;oi(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!mn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Zs.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 yn(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):Ze(e)?ri(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):yn(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},Zs.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 _h(e,t){return ri(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Xw={__depends__:[AL],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Kw],moddleCopy:["type",Zs]};var Zw=Math.round;function Eh(e,t){this._modeling=e,this._eventBus=t}Eh.$inject=["modeling","eventBus"],Eh.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=Zw(s+r/2),u=Zw(c+a/2),p=i.replaceShape(e,J({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Jw(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Jw.$inject=["selection","eventBus"];const kL={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Jw],replace:["type",Eh]};function OL(e,t,n){Ze(n)||(n=[n]),W(n,function(i){Pr(e[i])||(t[i]=e[i])})}var DL=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function LL(e,t){var n=e&&oi(e,"collapsed")?e.collapsed:!mt(e),i;return t&&(oi(t,"collapsed")||oi(t,"isExpanded"))?i=oi(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Qw(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(du(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&LL(s,c))return i.toggleCollapse(s),s;var d=e.create(u),f={type:u,businessObject:d};f.di={},u==="bpmn:ExclusiveGateway"&&(f.di.isMarkerVisible=!0),OL(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var m=_h(p.$descriptor),g=_h(d.$descriptor,!0),y=IL(m,g);J(d,Fi(c,DL));var _=dt(y,function(b){return b==="eventDefinitions"?e_(s,c.eventDefinitionType):b==="loopCharacteristics"?!Wn(d):oi(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Wn(d):!0});if(d=n.copyElement(p,d,_),c.eventDefinitionType&&(e_(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(du(p))f.isExpanded=mt(s);else if(c&&oi(c,"isExpanded")){f.isExpanded=c.isExpanded;var h=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=h.width,f.height=h.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}mt(s)&&!A(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(du(p)&&!du(d)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=_n(s);vt(s).isHorizontal||(vt(f).isHorizontal=v),f.width=v?s.width:t.getDefaultSize(f).width,f.height=v?t.getDefaultSize(f).height:s.height}return r.allowed("shape.resize",{shape:d})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),d.name=p.name,pt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&pt(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!A(p,"bpmn:BoundaryEvent")&&A(d,"bpmn:BoundaryEvent")&&(f.host=c.host),(f.type==="bpmn:DataStoreReference"||f.type==="bpmn:DataObjectReference")&&(f.x=s.x+(s.width-f.width)/2),o.replaceElement(s,f,{...l,targetElement:c})}this.replaceElement=a}Qw.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function du(e){return A(e,"bpmn:SubProcess")}function e_(e,t){var n=we(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function IL(e,t){return e.filter(function(n){return t.includes(n)})}const t_={__depends__:[Xw,kL,Ti],bpmnReplace:["type",Qw]};var BL=250;function Xr(e){this._eventBus=e,this._tools=[],this._active=null}Xr.$inject=["eventBus"],Xr.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)},Xr.prototype.isActive=function(e){return e&&this._active===e},Xr.prototype.length=function(e){return this._tools.length},Xr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Xr.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),W(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,BL,function(o){this._active&&(NL(o)||this.setActive(null))},this)};function NL(e){var t=e.originalEvent&&e.originalEvent.target;return t&&jr(t,'.group[data-group="tools"]')}const fu={__depends__:[To],__init__:["toolManager"],toolManager:["type",Xr]};function $L(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 FL(e,t){var n=[],i=new Set(e);W(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;W(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 jL(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 Sh=Math.abs,HL=Math.round,Po={x:"width",y:"height"},n_="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},zL=1500,hu={n:"s",w:"e",s:"n",e:"w"},gu=20;function Pi(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",zL,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&o_(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,m=l.start;if(l.initialized){o_(c);var g={x:0,y:0};g[u]=HL(c["d"+u]),s.makeSpace(d,f,g,p,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Pi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Pi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:n_,data:{context:{reactivate:n}},trapClick:!1})},Pi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:n_,data:{context:{}}})},Pi.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Pi.prototype.init=function(e,t){var n=Sh(e.dx)>Sh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Sh(i)<5)return!1;i<0&&(i*=-1),qs(e)&&(i*=-1);var r=$L(n,i),a=this._canvas.getRootElement();!nu(e)&&e.hover&&(a=e.hover);var s=[...ks(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=GL(c,n,r,o,l);return J(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),uu("resize-"+(n==="x"?"ew":"ns")),!0},Pi.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(f){s.has(f)||(s.add(f),r.push(f));var m=f.label;m&&!s.has(m)&&(s.add(m),r.push(m))}function d(f){c.has(f)||(c.add(f),a.push(f))}return W(e,function(f){if(!(!f.parent||lt(f))){if(It(f)){u.push(f);return}var m=f[t],g=m+f[Po[t]];if(VL(f)&&(n>0&&Qe(f)[t]>i||n<0&&Qe(f)[t]<i)){l.push(f);return}if(n>0&&m>i||n<0&&g<i){p(f);return}if(m<i&&g>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),W(r,function(f){var m=f.attachers;m&&W(m,function(g){p(g)})}),W(l,function(f){var m=f.host;(s.has(m)||c.has(m))&&p(f)}),W(u,function(f){var m=f.source,g=f.target,y=f.label;(s.has(m)||c.has(m))&&(s.has(g)||c.has(g))&&y&&p(y)}),{movingShapes:r,resizingShapes:a}},Pi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Pi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function i_(e){return{top:e.top-gu,right:e.right+gu,bottom:e.bottom+gu,left:e.left-gu}}function o_(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Je(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Je(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Je(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Je(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function GL(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 W(a,function(d){var f=d.attachers,m=d.children,g=qe(d),y=dt(m,function(q){return!It(q)&&!lt(q)&&!u.has(q)&&!p.has(q)}),_=dt(m,function(q){return!It(q)&&!lt(q)&&u.has(q)}),h,v,b,E=[],M=[],B,P,k,N;y.length&&(v=i_(qe(ln(y))),h=i-g[lr[n]]+v[lr[n]],n==="n"?s.bottom=l=Je(l)?Math.min(l,h):h:n==="w"?s.right=l=Je(l)?Math.min(l,h):h:n==="s"?s.top=c=Je(c)?Math.max(c,h):h:n==="e"&&(s.left=c=Je(c)?Math.max(c,h):h)),_.length&&(b=i_(qe(ln(_))),h=i-b[lr[hu[n]]]+g[lr[hu[n]]],n==="n"?s.bottom=l=Je(l)?Math.min(l,h):h:n==="w"?s.right=l=Je(l)?Math.min(l,h):h:n==="s"?s.top=c=Je(c)?Math.max(c,h):h:n==="e"&&(s.left=c=Je(c)?Math.max(c,h):h)),f&&f.length&&(f.forEach(function(q){u.has(q)?E.push(q):M.push(q)}),E.length&&(B=qe(ln(E.map(Qe))),P=g[lr[hu[n]]]-(B[lr[hu[n]]]-i)),M.length&&(k=qe(ln(M.map(Qe))),N=k[lr[n]]-(g[lr[n]]-i)),n==="n"?(h=Math.min(P||1/0,N||1/0),s.bottom=l=Je(l)?Math.min(l,h):h):n==="w"?(h=Math.min(P||1/0,N||1/0),s.right=l=Je(l)?Math.min(l,h):h):n==="s"?(h=Math.max(P||-1/0,N||-1/0),s.top=c=Je(c)?Math.max(c,h):h):n==="e"&&(h=Math.max(P||-1/0,N||-1/0),s.left=c=Je(c)?Math.max(c,h):h));var G=o&&o[d.id];G&&(n==="n"?(h=i+d[Po[t]]-G[Po[t]],s.bottom=l=Je(l)?Math.min(l,h):h):n==="w"?(h=i+d[Po[t]]-G[Po[t]],s.right=l=Je(l)?Math.min(l,h):h):n==="s"?(h=i-d[Po[t]]+G[Po[t]],s.top=c=Je(c)?Math.max(c,h):h):n==="e"&&(h=i-d[Po[t]]+G[Po[t]],s.left=c=Je(c)?Math.max(c,h):h))}),s}}function VL(e){return!!e.host}var Rh="djs-dragging",r_="djs-resizing",WL=250,mu=Math.max;function a_(e,t,n,i,o){function r(a,s){W(a,function(c){o.addDragger(c,s),n.addMarker(c,Rh)})}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=je("g");Le(u,i.cls("djs-crosshair-group",["no-events"])),tt(s,u);var p=je("path");Le(p,"d",l.x),gt(p).add("djs-crosshair"),tt(u,p);var d=je("path");Le(d,"d",l.y),gt(d).add("djs-crosshair"),tt(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Nn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&cn(c)}),e.on("spaceTool.move",WL,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 d=n.getLayer("space");c=je("path"),Le(c,"d","M0,0 L0,0"),gt(c).add("djs-crosshair"),tt(d,c),s.line=c;var f=je("g");Le(f,i.cls("djs-drag-group",["no-events"])),tt(n.getActiveLayer(),f),r(u,f);var m=new Set(u);W(p,function(M){m.add(M)});var g=new Set,y=s.movingConnections=[];m.forEach(function(M){W(M.outgoing,function(B){g.has(B)||!It(B)||!m.has(B.target)||(g.add(B),y.push(B))})}),r(y,f),s.dragGroup=f}if(!s.frameGroup){var _=je("g");Le(_,i.cls("djs-frame-group",["no-events"])),tt(n.getActiveLayer(),_);var h=[];W(p,function(M){var B=o.addFrame(M,_),P=B.getBBox();h.push({element:B,initialBounds:P}),n.addMarker(M,r_)}),s.frameGroup=_,s.frames=h}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Le(c,{d:v[l]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[s.axis]]=0,Nn(s.dragGroup,E.x,E.y),W(s.frames,function(M){var B=M.element,P=M.initialBounds,k,N;s.direction==="e"?Le(B,{width:mu(P.width+E.x,5)}):(k=mu(P.width-E.x,5),Le(B,{width:k,x:P.x+P.width-k})),s.direction==="s"?Le(B,{height:mu(P.height+E.y,5)}):(N=mu(P.height-E.y,5),Le(B,{height:N,y:P.y+P.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,d=s.dragGroup,f=s.frameGroup;W(c,function(m){n.removeMarker(m,Rh)}),W(l,function(m){n.removeMarker(m,Rh)}),d&&(cn(p),cn(d)),W(u,function(m){n.removeMarker(m,r_)}),f&&cn(f)})}a_.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const UL={__init__:["spaceToolPreview"],__depends__:[To,co,fu,ja,Xs],spaceTool:["type",Pi],spaceToolPreview:["type",a_]};function yu(e,t){e.invoke(Pi,this),this._canvas=t}yu.$inject=["injector","canvas"],Ne(yu,Pi),yu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=fa(Sa(o.children.filter(l=>A(l,"bpmn:Artifact")),ln(r))));const s=[...e,...a];var c=Pi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(A(l,"bpmn:TextAnnotation")||qL(l)&&(t==="y"&&_n(l)||t==="x"&&!_n(l)))}),c};function qL(e){return A(e,"bpmn:Participant")&&!we(e).processRef}const s_={__depends__:[UL],spaceTool:["type",yu]};function Kt(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)}Kt.$inject=["eventBus","injector"],Kt.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()},Kt.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},Kt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Kt.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()}},Kt.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()}},Kt.prototype.register=function(e,t){this._setHandler(e,t)},Kt.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)},Kt.prototype.canUndo=function(){return!!this._getUndoAction()},Kt.prototype.canRedo=function(){return!!this._getRedoAction()},Kt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Kt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Kt.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)})},Kt.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},Kt.prototype._createId=function(){return this._uid++},Kt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Kt.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()},Kt.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)},Kt.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)},Kt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ze(e)?e:[e],t.dirty=t.dirty.concat(e))},Kt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Kt.prototype._revertedAction=function(e){this._stackIdx--},Kt.prototype._getHandler=function(e){return this._handlerMap[e]},Kt.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 YL={commandStack:["type",Kt]};function ur(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 KL=250,c_=1400;function Mh(e,t,n){be.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",c_,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=l_(a),r.validatedShapes=l_(s)}),i&&t.on("shape.move.start",KL,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",c_,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];W(s,function(l){W(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;ur(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=rf(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&&(rn(s.labels,a,c),a.labelTarget=s)})}Ne(Mh,be),Mh.$inject=["injector","eventBus","modeling"];function l_(e){var t=new Set(e);return dt(e,function(n){return!t.has(n.labelTarget)})}const XL={__init__:["labelSupport"],labelSupport:["type",Mh]};var ZL=251,u_=1401,p_="attach-ok";function Ch(e,t,n,i,o){be.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",u_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=JL(c),s.validatedShapes=QL(l)}),r&&t.on("shape.move.start",ZL,function(a){var s=a.context,c=s.shapes,l=Ah(c);W(l,function(u){r.makeDraggable(s,u,!0),W(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,p_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,p_)}))}}),this.preExecuted("elements.move",u_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Ah(l);W(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=dt(c,function(p){var d=p.host;return eI(p)&&!tI(c,d)}),W(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;W(s,function(c){W(c.attachers,function(l){W(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),W(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;ur(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&&W(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,d=s.hints||{};d.attachSupport!==!1&&W(p,function(f){var m=Tb(f,l,u);o.moveShape(f,m,f.parent),W(f.labels,function(g){o.moveShape(g,m,g.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ur(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ne(Ch,be),Ch.$inject=["injector","eventBus","canvas","rules","modeling"];function Ah(e){return Hp(Hn(e,function(t){return t.attachers||[]}))}function JL(e){var t=Ah(e);return kR("id",e,t)}function QL(e){var t=ha(e,"id");return dt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function eI(e){return!!e.host}function tI(e,t){return e.indexOf(t)!==-1}const nI={__depends__:[co],__init__:["attachSupport"],attachSupport:["type",Ch]};function d_(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(nx(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)})}d_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Th={__init__:["changeSupport"],changeSupport:["type",d_]};function ki(e){this._model=e}ki.$inject=["moddle"],ki.prototype._needsId=function(e){return pt(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"])},ki.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;A(e,"bpmn:Activity")?t="Activity":A(e,"bpmn:Event")?t="Event":A(e,"bpmn:Gateway")?t="Gateway":pt(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))},ki.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ki.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ki.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",J({bpmnElement:e,bounds:this.createDiBounds()},t))},ki.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ki.prototype.createDiWaypoints=function(e){var t=this;return Hn(e,function(n){return t.createDiWaypoint(n)})},ki.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Fi(e,["x","y"]))},ki.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",J({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ki.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",J({bpmnElement:e},t))};function di(e,t,n){be.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var m=f.context,g=m.hints||{},y;!m.cropped&&g.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var m=f.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(f){var m=f.context,g=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(g,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fi(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fi(a));function s(f){var m=f.context,g=m.oldRoot,y=g.children;W(y,function(_){A(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var m=f.context.shape;A(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],fi(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],fi(function(f){f.context.shape.type!=="label"&&c(f)})),e.on("shape.changed",function(f){f.element.type==="label"&&c({context:{shape:f.element}})});function l(f){i.updateConnection(f.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],fi(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],fi(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],fi(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],fi(u)),this.executed("connection.reconnect",fi(function(f){var m=f.context,g=m.connection,y=m.oldSource,_=m.newSource,h=we(g),v=we(y),b=we(_);h.conditionExpression&&!pt(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=h.conditionExpression,delete h.conditionExpression),y!==_&&v.default===h&&(m.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",fi(function(f){var m=f.context,g=m.connection,y=m.oldSource,_=m.newSource,h=we(g),v=we(y),b=we(_);m.oldConditionExpression&&(h.conditionExpression=m.oldConditionExpression),m.oldDefault&&(v.default=m.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],fi(p)),this.reverted(["element.updateAttachment"],fi(p)),this.executed("element.updateLabel",fi(d)),this.reverted("element.updateLabel",fi(d));function d(f){const{element:m}=f.context,g=ci(m),y=vt(m),_=y&&y.get("label");ir(m)||iu(m)||(g&&!_?y.set("label",t.create("bpmndi:BPMNLabel")):!g&&_&&y.set("label",void 0))}}Ne(di,be),di.$inject=["eventBus","bpmnFactory","connectionDocking"],di.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},di.prototype.updateParent=function(e,t){if(!lt(e)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=vt(e),r=n&&n.businessObject,a=vt(n);A(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),A(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),A(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),A(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},di.prototype.updateBounds=function(e){var t=vt(e),n=oI(e);if(n){var i=Vi(n,t.get("bounds"));J(n,{x:e.x+i.x,y:e.y+i.y})}var o=lt(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),J(r,{x:e.x,y:e.y,width:e.width,height:e.height})},di.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),nn(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),rn(o,e))}},di.prototype.updateDiConnection=function(e,t,n){var i=vt(e),o=vt(t),r=vt(n);i.sourceElement&&i.sourceElement.bpmnElement!==we(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==we(n)&&(i.targetElement=n&&r)},di.prototype.updateDiParent=function(e,t){if(t&&!A(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(nn(n,e),e.$parent=null)}};function iI(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}di.prototype.getLaneSet=function(e){var t,n;return A(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(A(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)},di.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))&&(A(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(A(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(A(e,"bpmn:FlowElement")){if(t){if(A(t,"bpmn:Participant"))t=t.processRef;else if(A(t,"bpmn:Lane"))do t=t.$parent.$parent;while(A(t,"bpmn:Lane"))}i="flowElements"}else if(A(e,"bpmn:Artifact")){for(;t&&!A(t,"bpmn:Process")&&!A(t,"bpmn:SubProcess")&&!A(t,"bpmn:Collaboration");)if(A(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(A(e,"bpmn:MessageFlow"))i="messageFlows";else if(A(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=iI(e.$parent||t),e.$parent&&(nn(r.get("rootElements"),o),o.$parent=null),t&&(rn(r.get("rootElements"),o),o.$parent=r))}else A(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":A(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),nn(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);nn(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},di.prototype.updateConnectionWaypoints=function(e){var t=vt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},di.prototype.updateConnection=function(e){var t=e.connection,n=we(t),i=t.source,o=we(i),r=t.target,a=we(t.target),s;if(A(n,"bpmn:DataAssociation"))A(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):A(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=A(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(nn(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(nn(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)},di.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function fi(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;A(i,"bpmn:BaseElement")&&e(t)}}function oI(e){if(A(e,"bpmn:Activity")){var t=vt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function pr(e,t){Ro.call(this),this._bpmnFactory=e,this._moddle=t}Ne(pr,Ro),pr.$inject=["bpmnFactory","moddle"],pr.prototype._baseCreate=Ro.prototype.create,pr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,J({type:"label",di:n},Vr,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=J({},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(!aI(o)){var r=J({},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)}A(i,"bpmn:Group")&&(t=J({isFrame:!0},t)),t=rI(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ph(o,t,"isExpanded")),pt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ph(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!mt(i,o)),A(i,"bpmn:ExclusiveGateway")&&(oi(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),mn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),mn(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=J({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},pr.prototype.getDefaultSize=function(e,t){var n=we(e);if(t=t||vt(e),A(n,"bpmn:SubProcess"))return mt(n,t)?{width:350,height:200}:{width:100,height:80};if(A(n,"bpmn:Task"))return{width:100,height:80};if(A(n,"bpmn:Gateway"))return{width:50,height:50};if(A(n,"bpmn:Event"))return{width:36,height:36};if(A(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return mt(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return A(n,"bpmn:Lane")?{width:400,height:100}:A(n,"bpmn:DataObjectReference")?{width:36,height:50}:A(n,"bpmn:DataStoreReference")?{width:50,height:50}:A(n,"bpmn:TextAnnotation")?{width:100,height:40}:A(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},pr.prototype.createParticipantShape=function(e){return yn(e)||(e={isExpanded:e}),e=J({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function rI(e,t,n){return W(n,function(i){t=Ph(e,t,i)}),t}function Ph(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Zi(t,[n]))}function aI(e){return pt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function vu(e,t){this._modeling=e,this._canvas=t}vu.$inject=["modeling","canvas"],vu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;W(n,function(o){var r={x:0,y:0};mn(i.left)?r.x=i.left-o.x:mn(i.right)?r.x=i.right-o.width-o.x:mn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:mn(i.top)?r.y=i.top-o.y:mn(i.bottom)?r.y=i.bottom-o.height-o.y:mn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},vu.prototype.postExecute=function(e){};function xu(e){this._modeling=e}xu.$inject=["modeling"],xu.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},xu.prototype.postExecute=function(e){var t=e.hints||{};sI(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 sI(e,t){return zo(e.outgoing,function(n){return n.target===t})}function bu(e,t){this._canvas=e,this._layouter=t}bu.$inject=["canvas","layouter"],bu.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},bu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var wu=Math.round;function kh(e){this._modeling=e}kh.$inject=["modeling"],kh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;W(t,function(p){Je(p.x)||(p.x=0),Je(p.y)||(p.y=0)});var s=dt(t,function(p){return!p.hidden}),c=ln(s);W(t,function(p){It(p)&&(p.waypoints=Hn(p.waypoints,function(d){return{x:wu(d.x-c.x-c.width/2+o.x),y:wu(d.y-c.y-c.height/2+o.y)}})),J(p,{x:wu(p.x-c.x-c.width/2+o.x),y:wu(p.y-c.y-c.height/2+o.y)})});var l=new Set(El(t)),u={};W(t,function(p){if(It(p)){u[p.id]=Je(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 d=J({},r);l.has(p)||(d.autoResize=!1),lt(p)&&(d=Zi(d,["attach"])),u[p.id]=Je(i)?a.createShape(p,Fi(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,Fi(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=fa(u)};var f_=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?J(t,n):J(t,{x:n.x-f_(t.width/2),y:n.y-f_(t.height/2)}),this._canvas.addShape(t,i,o),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Js(e){dr.call(this,e)}Ne(Js,dr),Js.$inject=["canvas"];var cI=dr.prototype.execute;Js.prototype.execute=function(e){var t=e.shape;return uI(t),t.labelTarget=e.labelTarget,cI.call(this,e)};var lI=dr.prototype.revert;Js.prototype.revert=function(e){return e.shape.labelTarget=null,lI.call(this,e)};function uI(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Qs(e,t){this._canvas=e,this._modeling=t}Qs.$inject=["canvas","modeling"],Qs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Qs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=rf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Qs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,rn(n.children,t,i),this._canvas.addConnection(t,n),t};function Oh(e,t){this._modeling=e,this._elementRegistry=t}Oh.$inject=["modeling","elementRegistry"],Oh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;W(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function ec(e,t){this._canvas=e,this._modeling=t}ec.$inject=["canvas","modeling"],ec.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ur(n.children,function(i){It(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ec.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=rf(i.children,n),t.removeShape(n),n},ec.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return rn(i.children,n,o),t.addShape(n,i),n};function _u(e){this._modeling=e}_u.$inject=["modeling"];var h_={x:"y",y:"x"};_u.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 h={y:0};h[i]=y-a(_),h[i]&&(h[h_[i]]=0,t.moveElements([_],h,_.parent))}var u=n[0],p=s(n),d=n[p],f,m,g=0;W(n,function(y,_){var h,v,b;if(y.elements.length<2){_&&_!==n.length-1&&(r(y,y.elements[0]),g+=c(y.range));return}h=Xi(y.elements,i),v=h[0],_===p&&(v=h[s(h)]),b=a(v),y.range=null,W(h,function(E){if(l(b,E),y.range===null){y.range={min:E[i],max:E[i]+E[o]};return}r(y,E)}),_&&_!==n.length-1&&(g+=c(y.range))}),m=Math.abs(d.range.min-u.range.max),f=Math.round((m-g)/(n.length-1)),!(f<n.length-1)&&W(n,function(y,_){var h={},v;y===u||y===d||(v=n[_-1],y.range.max=0,W(y.elements,function(b,E){h[h_[i]]=0,h[i]=v.range.max-b[i]+f,y.range.min!==b[i]&&(h[i]+=b[i]-y.range.min),h[i]&&t.moveElements([b],h,b.parent),y.range.max=Math.max(b[i]+b[o],E?y.range.max:0)}))})},_u.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 J(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 Dh(){}Dh.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=nn(r.children,t),rn(i.children,t,o),t.parent=i,W(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},Dh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return nn(n.children,t),rn(i.children,t,o),t.parent=i,W(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 Lh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Lh.prototype.add=function(e,t){return this.addAll([e],t)},Lh.prototype.addAll=function(e,t){var n=zP(e,!!t,this);return J(this,n),this};function tc(e){this._modeling=e}tc.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},tc.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),W(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),W(s,function(p){var d=!!a[p.source.id],f=!!a[p.target.id];c[p.id]&&d&&f?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:d&&Hf(p,p.source,t),connectionEnd:f&&zf(p,p.target,t)})})},tc.prototype.getClosure=function(e){return new Lh().addAll(e,!0)};function Su(e){this._helper=new tc(e)}Su.$inject=["modeling"],Su.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Su.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Zr(e){this._modeling=e,this._helper=new tc(e)}Zr.$inject=["modeling"],Zr.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=Fi(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=nn(r.children,t),rn(i.children,t,o),J(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(W(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:zf(r,t,n)})}),W(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Hf(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return rn(n.children,t,i),J(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function nc(e){this._modeling=e}nc.$inject=["modeling"],nc.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 Ze(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},nc.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||g_(Ze(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||g_(Ze(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},nc.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 g_(e){return e.original||e}function ko(e,t){this._modeling=e,this._rules=t}ko.$inject=["modeling","rules"],ko.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(m,g,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:g})}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 d=o.incoming.slice(),f=o.outgoing.slice();W(d,function(m){var g=m.source,y=c(g,s,m);y&&t.reconnectEnd(m,s,Zl(m,s,u),a)}),W(f,function(m){var g=m.target,y=c(s,g,m);y&&t.reconnectStart(m,s,Xl(m,s,u),a)})},ko.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ko.prototype.execute=function(e){},ko.prototype.revert=function(e){},ko.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ko.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ko.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ic(e){this._modeling=e}ic.$inject=["modeling"],ic.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},J(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ic.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(W(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Zl(r,n,i)})}),W(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Xl(r,n,i)})}))},ic.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return J(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function fr(e){this._modeling=e}fr.$inject=["modeling"],fr.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),W(o,function(s){a[s.id]=dI(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(FL(i,o),t,n,r,i,o,a)},fr.prototype.execute=function(){},fr.prototype.revert=function(){},fr.prototype.moveShapes=function(e,t){var n=this;W(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},fr.prototype.resizeShapes=function(e,t,n){var i=this;W(e,function(o){var r=jL(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},fr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);W(e,function(u){var p=u.source,d=u.target,f=pI(u),m=y_(n),g={},y=c.has(p)||l.has(p),_=c.has(d)||l.has(d);y&&_?(f=Hn(f,function(h){return v_(h,i,n)&&(h[m]=h[m]+t[m]),h.original&&v_(h.original,i,n)&&(h.original[m]=h.original[m]+t[m]),h}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(y||_)&&(c.has(p)?g.connectionStart=Hf(u,p,t):c.has(d)?g.connectionEnd=zf(u,d,t):l.has(p)?g.connectionStart=Xl(u,p,a[p.id]):l.has(d)&&(g.connectionEnd=Zl(u,d,a[d.id])),s._modeling.layoutConnection(u,g))})};function m_(e){return J({},e)}function pI(e){return Hn(e.waypoints,function(t){return t=m_(t),t.original&&(t.original=m_(t.original)),t})}function y_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function v_(e,t,n){var i=y_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function dI(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ru(e){this._modeling=e}Ru.$inject=["modeling"],Ru.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=x_(n),t.collapsed=!t.collapsed;var i=b_(n,t.collapsed);return[t].concat(i)},Ru.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=w_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function x_(e){var t={};return W(e,function(n){t[n.id]=n.hidden,n.children&&(t=J({},t,x_(n.children)))}),t}function b_(e,t){var n=[];return W(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(b_(i.children,i.collapsed||t)))}),n}function w_(e,t){var n=[];return W(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(w_(i.children,t)))}),n}function Mu(e){this._modeling=e}Mu.$inject=["modeling"],Mu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=__(i,t),E_(n,t),t.host=n,t},Mu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,__(n,t),E_(i,t,o),t};function __(e,t){return nn(e&&e.attachers,t)}function E_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),rn(i,t,n)}}function Ih(){}Ih.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Ih.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Bt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Bt.$inject=["eventBus","elementFactory","commandStack"],Bt.prototype.getHandlers=function(){return{"shape.append":xu,"shape.create":dr,"shape.delete":ec,"shape.move":Zr,"shape.resize":ic,"shape.replace":ko,"shape.toggleCollapse":Ru,spaceTool:fr,"label.create":Js,"connection.create":bu,"connection.delete":Qs,"connection.move":Dh,"connection.layout":Eu,"connection.updateWaypoints":Ih,"connection.reconnect":nc,"elements.create":kh,"elements.move":Su,"elements.delete":Oh,"elements.distribute":_u,"elements.align":vu,"element.updateAttachment":Mu}},Bt.prototype.registerHandlers=function(e){W(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Bt.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)},Bt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Bt.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)},Bt.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)},Bt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Bt.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},Bt.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},Bt.prototype.createElements=function(e,t,n,i,o){Ze(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},Bt.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},Bt.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},Bt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Bt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Bt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Bt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Bt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Bt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Bt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Bt.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)},Bt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Bt.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)},Bt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,J(i,{docking:"source"}))},Bt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,J(i,{docking:"target"}))},Bt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Bt.prototype._create=function(e,t){return C2(t)?t:this._elementFactory.create(e,t)},Bt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function oc(e){this._elementRegistry=e}oc.$inject=["elementRegistry"],oc.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||fI(n,zc(i));return S_(n,i),e.oldProperties=r,e.changed=o,o},oc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return S_(n,t),i},oc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?hI(e,t):[]};function fI(e,t){return ri(t,function(n,i){return n[i]=e.get(i),n},{})}function S_(e,t){W(t,function(n,i){e.set(i,n)})}function hI(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&we(n).dataObjectRef===e})}var rc="default",Oo="id",R_="di",gI={width:0,height:0};function ac(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ac.$inject=["elementRegistry","moddle","modeling","textRenderer"],ac.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=bI(e.properties),s=e.oldProperties||mI(t,a);return M_(a,r)&&(o.unclaim(r[Oo]),i.updateId(t,a[Oo]),o.claim(a[Oo],r)),rc in a&&(a[rc]&&n.push(i.get(a[rc].id)),r[rc]&&n.push(i.get(r[rc].id))),C_(t,a),e.oldProperties=s,e.changed=n,n},ac.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&we(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,gI)}},ac.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 C_(t,i),M_(n,o)&&(a.unclaim(n[Oo]),r.updateId(t,i[Oo]),a.claim(i[Oo],o)),e.changed};function M_(e,t){return Oo in e&&e[Oo]!==t[Oo]}function mI(e,t){var n=zc(t),i=e.businessObject,o=vt(e);return ri(n,function(r,a){return a!==R_?r[a]=i.get(a):r[a]=yI(o,zc(t.di)),r},{})}function yI(e,t){return ri(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function C_(e,t){var n=e.businessObject,i=vt(e);W(t,function(o,r){r!==R_?n.set(r,o):i&&vI(i,o)})}function vI(e,t){W(t,function(n,i){e.set(i,n)})}var xI=["default"];function bI(e){var t=J({},e);return xI.forEach(function(n){n in e&&(t[n]=we(t[n]))}),t}function Cu(e,t){this._canvas=e,this._modeling=t}Cu.$inject=["canvas","modeling"],Cu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=vt(o);return t.setRootElement(n),t.removeRootElement(o),rn(a.rootElements,i),i.$parent=a,nn(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},Cu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=vt(n);return t.setRootElement(o),t.removeRootElement(n),nn(a.rootElements,i),i.$parent=null,rn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function Bh(e,t){this._modeling=e,this._spaceTool=t}Bh.$inject=["modeling","spaceTool"],Bh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ci(i),a=r===i,s=a?i:i.parent,c=rr(s),l=_n(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+Mi,y:i.y,width:i.width-Mi,height:i.height}:{x:i.x,y:i.y+Mi,width:i.width,height:i.height-Mi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];zr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:dt(b.children,function(E){return E!==i})});var d,f,m,g,y;o==="top"?(d=-120,f=i.y,m=f+10,g="n",y="y"):o==="left"?(d=-120,f=i.x,m=f+10,g="w",y="x"):o==="bottom"?(d=120,f=i.y+i.height,m=f-10,g="s",y="y"):o==="right"&&(d=120,f=i.x+i.width,m=f-10,g="e",y="x");var _=t.calculateAdjustments(p,y,d,m),h=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,h,g,m);var v=l?{x:i.x+(a?Mi:0),y:f-(o==="top"?120:0),width:i.width-(a?Mi:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Mi:0),width:120,height:i.height-(a?Mi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function Nh(e){this._modeling=e}Nh.$inject=["modeling"],Nh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=rr(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=_n(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,d;for(d=0;d<i;d++)d===i-1?l=s-c*d:l=c,u=a?{x:n.x+Mi,y:n.y+d*c,width:n.width-Mi,height:l}:{x:n.x+d*c,y:n.y+Mi,width:l,height:n.height-Mi},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function sc(e,t){this._modeling=e,this._spaceTool=t}sc.$inject=["modeling","spaceTool"],sc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},sc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=hO(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},sc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=qe(e),o=qe(t),r=rb(o,i),a=Ci(e),s=[],c=[];zr(a,function(m){return s.push(m),(A(m,"bpmn:Lane")||A(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,p,d,f;(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",d=r.top>0||r.bottom<0?-l:l,f=n.calculateAdjustments(s,"y",d,u),n.makeSpace(f.movingShapes,f.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",d=r.left>0||r.right<0?-l:l,f=n.calculateAdjustments(c,"x",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},p))};var cc="flowNodeRef",$h="lanes";function Au(){}Au.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=qe(p),f={x:u.x+u.width/2,y:u.y+u.height/2};return f.x>d.left&&f.x<d.right&&f.y>d.top&&f.y<d.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ci(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(d){return a(u,d)}).map(function(d){return d.businessObject})}return t.forEach(function(u){var p=Ci(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return A(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get($h),f=d.slice(),m=l(u);i.push({flowNode:p,remove:f,add:m})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(cc).forEach(function(d){i.push({flowNode:d,remove:[p],add:[]})})}),i},Au.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($h);n.remove.forEach(function(r){nn(o,r),nn(r.get(cc),i)}),n.add.forEach(function(r){rn(o,r),rn(r.get(cc),i)})}),[]},Au.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get($h);n.add.forEach(function(r){nn(o,r),nn(r.get(cc),i)}),n.remove.forEach(function(r){rn(o,r),rn(r.get(cc),i)})}),[]};var Fh="categoryValueRef";function lc(e,t){this._bpmnFactory=e,this._elementRegistry=t}lc.$inject=["bpmnFactory","elementRegistry"],lc.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(h,v,b){if(v){var E=a.get(h);E||(E={},a.set(h,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:v,root:jh(h)}:E.past={categoryValue:v}))}}function c(h){o.set(h,we(h))}function l(){n.filter(function(h){return A(h,"bpmn:FlowElement")&&!lt(h)&&h.parent}).forEach(c)}function u(h){var v=we(h),b=v.get("categoryValueRef");return b||(b=eb(i,v),r.push(wI(h,b))),b}function p(h){return h.reduce(function(v,b){var E=jh(b),M=v.get(E);return M||(M=[],v.set(E,M)),M.push(b),v},new Map)}e=Array.from(e||[]);var d=p(e);t.length&&l(),e.forEach(c),n.filter(function(h){return A(h,"bpmn:Group")&&!lt(h)&&h.parent}).forEach(function(h){var v=we(h).get("categoryValueRef");if(!v){var b=jh(h),E=d.get(b)||[],M=Sa(E,h),B=Object.keys(M).length>0;B&&(v=u(h))}s(h,v,!0)}),t.forEach(function(h){s(h.groupShape,h.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),m=Array.from(a.values()).reduce(function(h,v){return v.present&&h.add(v.present.categoryValue),v.past&&h.add(v.past.categoryValue),h},new Set),g=new Map,y=p(f);a.forEach(function(h,v){var b=h.present;if(b){var E=y.get(b.root)||[],M=Sa(E,v);E.forEach(function(B){if(M[B.id]){var P=g.get(B);P||(P=new Set,g.set(B,P)),P.add(b.categoryValue)}})}});var _=f.reduce(function(h,v){var b=o.get(v),E=b.get(Fh),M=new Set(E),B=g.get(v)||new Set,P=Array.from(B).filter(function(N){return!M.has(N)}),k=E.filter(function(N){return m.has(N)&&!B.has(N)});return(P.length||k.length)&&h.push({businessObject:b,categoryValuesToAdd:P,categoryValuesToRemove:k}),h},[]);return{flowElements:_,groups:r}},lc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),_I(t.groups),SI(t.flowElements),[]},lc.prototype.revert=function(e){var t=e.updates;return RI(t.flowElements),EI(t.groups),[]};function wI(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function _I(e){e.forEach(function(t){we(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function EI(e){e.forEach(function(t){we(t.groupShape).categoryValueRef=null})}function SI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Fh);t.categoryValuesToRemove.forEach(function(o){nn(i,o)}),t.categoryValuesToAdd.forEach(function(o){rn(i,o,!0)})})}function RI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Fh);t.categoryValuesToAdd.forEach(function(o){nn(i,o)}),t.categoryValuesToRemove.forEach(function(o){rn(i,o,!0)})})}function jh(e){for(;e.parent;)e=e.parent;return e}function Tu(e){this._moddle=e}Tu.$inject=["moddle"],Tu.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),[]},Tu.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 MI={fill:void 0,stroke:void 0};function Hh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ii(t)){var n=CI(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Hh.$inject=["commandStack"],Hh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||MI,i=this,o={};"fill"in n&&J(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&J(o,{"border-color":this._normalizeColor(n.stroke)}),W(t,function(r){var a=It(r)?Fi(o,["border-color"]):o,s=vt(r);if(AI(a),lt(r)){if(!s||!A(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!pt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function CI(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 AI(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var TI={width:0,height:0};function A_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return ik(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!lt(l)&&ir(l)&&!Ol(l)&&!T_(p)){var d=7,f=pf(l);f={x:f.x,y:f.y+d},e.createLabel(l,f,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=ci(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,d=c.newBounds,f=c.hints||{};if(!(!lt(u)&&!A(u,"bpmn:TextAnnotation"))){if(lt(u)&&T_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=ci(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,m)),d&&e.resizeShape(u,d,TI)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}A_.$inject=["modeling","textRenderer","bpmnFactory"];function T_(e){return!e||!e.trim()}function Fn(e,t,n,i){Bt.call(this,e,t,n),this._bpmnRules=i}Ne(Fn,Bt),Fn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Fn.prototype.getHandlers=function(){var e=Bt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=oc,e["element.updateProperties"]=ac,e["canvas.updateRoot"]=Cu,e["lane.add"]=Bh,e["lane.resize"]=sc,e["lane.split"]=Nh,e["lane.updateRefs"]=Au,e["group.updateRefs"]=lc,e["id.updateClaim"]=Tu,e["element.setColor"]=Hh,e["element.updateLabel"]=A_,e},Fn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Fn.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)},Fn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Fn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Fn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Fn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Fn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Fn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Fn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Fn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Fn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Fn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Fn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Fn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function P_(){}P_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Qe(t.source||e.source),t.connectionEnd||Qe(t.target||e.target)]};var Pu=20,PI=5,ku=Math.round,k_=20,kI={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function OI(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function DI(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=Bn(t,e,PI),o=n.split(":")[0],r=ku((t.x-e.x)/2+e.x),a=ku((t.y-e.y)/2+e.y),s,c,l=DI(o,i),u=/h|r|l/.test(o),p=!1,d=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=OI(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+Pu*(/l/.test(o)?-1:1),y:d?a+Pu:a}):(d=r===e.x,s={x:d?r+Pu:r,y:e.y+Pu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:zh(e,s,c).concat(s),directions:c,turnNextDirections:d}}function LI(e,t,n){return O_(e,t,n)}function II(e,t,n){var i=O_(t,e,D_(n));return{waypoints:i.waypoints.slice().reverse(),directions:D_(i.directions),turnNextDirections:i.turnNextDirections}}function BI(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=zh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function D_(e){return e.split(":").reverse().join(":")}function NI(e,t,n){var i=ku((t.x-e.x)/2+e.x),o=ku((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 zh(e,t,n){if(n=n||"h:h",!UI(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(I_(n)){var i=LI(e,t,n),o=II(e,t,n),r=BI(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return NI(e,t,n)}function $I(e,t,n){var i=zh(e,t,n);return i.unshift(e),i.push(t),N_(i)}function FI(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=TR(r,"straight")[0]||"h:h",s=kI[a]||0,c=Bn(e,t,s),l=WI(c,a);n=n||Qe(e),i=i||Qe(t);var u=l.split(":"),p=B_(n,e,u[0],qI(c)),d=B_(i,t,u[1],c);return $I(p,d,l)}function jI(e,t,n,i,o,r){Ze(n)&&(o=n,r=i,n=Qe(e),i=Qe(t)),r=J({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&zI(e,t,n,i,r),c||(c=r.connectionEnd&&VI(t,e,i,o),c)||(c=r.connectionStart&&GI(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:FI(e,t,n,i,r)}function HI(e,t,n){return e>=t&&e<=n}function L_(e,t,n){var i={x:"width",y:"height"};return HI(t[e],n[e],n[e]+n[i[e]])}function zI(e,t,n,i,o){var r={},a,s;return s=Bn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?L_(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:L_(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 GI(e,t,n,i){return Gh(e,t,n,i)}function VI(e,t,n,i){var o=i.slice().reverse();return o=Gh(e,t,n,o),o?o.reverse():null}function Gh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Ft(u,function(p,d){var f=u[d-1];return f&&Ds(p,f)<3})}function r(u,p,d){var f=Eo(p,u);switch(f){case"v":return{x:d.x,y:u.y};case"h":return{x:u.x,y:d.y}}return{x:u.x,y:u.y}}function a(u,p,d){var f;for(f=u.length-2;f!==0;f--)if(ox(u[f],p,k_)||ox(u[f],d,k_))return u.slice(f);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=Gh(e,t,n,l)),c&&Eo(c)?null:c}function WI(e,t){if(I_(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 UI(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function I_(e){return e&&/t|r|b|l/.test(e)}function qI(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 B_(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 N_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return af(o,r,n,0)||t.push(n),t},[])}var YI=-10,KI=40,XI={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},ZI={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},Vh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},uc={top:"t",right:"r",bottom:"b",left:"l"};function Ou(e){this._elementRegistry=e}Ne(Ou,P_),Ou.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=$_(o&&o[0],n)),a||(a=$_(o&&o[o.length-1],i)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!F_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Xx(n,s)?XI:ZI;return A(e,"bpmn:MessageFlow")?c=QI(n,i,u):(A(e,"bpmn:SequenceFlow")||F_(n,i))&&(n===i?c={preferredLayouts:rB(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:aB(n,i,a,u)}:pc(n)||pc(i)?c={preferredLayouts:u.subProcess,preserveDocking:tB(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=J(c,t),l=N_(jI(n,i,r,a,o,c))),l||[r,a]};function JI(e){var t=e.host;return Bn(Qe(e),t,YI)}function QI(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:eB(e,t)}}function eB(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":pc(t)?"source":pc(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function tB(e){return pc(e)?"target":"source"}function $_(e,t){return e?e.original||e:Qe(t)}function F_(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function pc(e){return A(e,"bpmn:SubProcess")&&mt(e)}function Jr(e,t){return e===t}function nB(e,t){return t.indexOf(e)!==-1}function Ha(e){var t=/right|left/.exec(e);return t&&t[0]}function za(e){var t=/top|bottom/.exec(e);return t&&t[0]}function j_(e,t){return Vh[e]===t}function iB(e,t){var n=Ha(e),i=Vh[n];return t.indexOf(i)!==-1}function oB(e,t){var n=za(e),i=Vh[n];return t.indexOf(i)!==-1}function H_(e){return e==="right"||e==="left"}function rB(e,t,n){var i=t.waypoints,o=i&&i.length&&Bn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function aB(e,t,n,i){var o=Qe(e),r=Qe(t),a=JI(e),s,c,l=Jr(e.host,t),u=nB(a,["top","right","bottom","left"]),p=Bn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?sB(a,u,e,t,n,i):(s=cB(a,p,u,i.isHorizontal),c=lB(a,p,u,i.isHorizontal),[s+":"+c])}function sB(e,t,n,i,o,r){var a=t?e:r.isHorizontal?za(e):Ha(e),s=uc[a],c;return t?H_(e)?c=z_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=z_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function z_(e,t,n,i){var o=KI;return!(Wh(e,i,n,o)||Wh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Wh(e,i,Qe(t),o))}function Wh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function cB(e,t,n,i){if(n)return uc[e];var o=za(e),r=Ha(e),a=za(t),s=Ha(t);if(i){if(Jr(o,a)||j_(r,s))return uc[o]}else if(Jr(r,s)||j_(o,a))return uc[r];return uc[i?r:o]}function lB(e,t,n,i){if(n)return H_(e)?iB(e,t)||Jr(e,t)?"h":"v":oB(e,t)||Jr(e,t)?"v":"h";var o=za(e),r=Ha(e),a=za(t),s=Ha(t);return a&&!s?"v":s&&!a?"h":i?Jr(o,a)?"h":"v":Jr(r,s)?"v":"h"}Ou.$inject=["elementRegistry"];function G_(e){return J({original:e.point.original||e.point},e.actual)}function hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}hr.$inject=["elementRegistry","graphicsFactory"],hr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(G_(i)),r.push(G_(o)),r},hr.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}},hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Ls(i,o,n)},hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Uh={__init__:["modeling","bpmnUpdater"],__depends__:[AD,VD,UD,qD,t_,YL,XL,nI,Ti,Th,s_],bpmnFactory:["type",ki],bpmnUpdater:["type",di],elementFactory:["type",pr],modeling:["type",Fn],layouter:["type",Ou],connectionDocking:["type",hr]};var uB=10,V_=50,pB=250;function qh(e,t,n,i){for(var o;o=dB(e,n,t);)n=i(t,n,o);return n}function Yh(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 dB(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=hB(e);return Ft(o,function(r){if(r===n)return!1;var a=Bn(r,i,uB);return a==="intersect"})}function fB(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||V_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||pB,c=t.reference||"start";r||(r=yB);function l(m,g){return o==="n"?c==="start"?qe(m).top-qe(g).bottom:c==="center"?qe(m).top-Qe(g).y:qe(m).top-qe(g).top:o==="w"?c==="start"?qe(m).left-qe(g).right:c==="center"?qe(m).left-Qe(g).x:qe(m).left-qe(g).left:o==="s"?c==="start"?qe(g).top-qe(m).bottom:c==="center"?Qe(g).y-qe(m).bottom:qe(g).bottom-qe(m).bottom:c==="start"?qe(g).left-qe(m).right:c==="center"?Qe(g).x-qe(m).right:qe(g).right-qe(m).right}var u=e.incoming.filter(r).map(function(m){var g=a(m),y=g<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:g}}),p=e.outgoing.filter(r).map(function(m){var g=a(m),y=g>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:g}}),d=u.concat(p).reduce(function(m,g){return m[g.id+"__weight_"+g.weight]=g,m},{}),f=ri(d,function(m,g){var y=g.distance,_=g.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*_,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return f.distance||i}function hB(e){var t=Kh(e);return e.host&&(t=t.concat(Kh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Kh(i))},[]))),t}function Kh(e){return mB(e).concat(gB(e))}function gB(e){return e.incoming.map(function(t){return t.source})}function mB(e){return e.outgoing.map(function(t){return t.target})}function yB(){return!0}var vB=100;function W_(e,t,n){e.on("autoPlace",vB,function(i){var o=i.shape,r=i.source;return xB(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}}W_.$inject=["eventBus","modeling","canvas"];function xB(e,t,n){n||(n={});var i=n.defaultDistance||V_,o=Qe(e),r=qe(e);return{x:r.right+i+t.width/2,y:o.y}}function U_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}U_.$inject=["eventBus","selection"];const bB={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",W_],autoPlaceSelectionBehavior:["type",U_]};function q_(e,t,n){var i=Xx(e,n);if(A(t,"bpmn:TextAnnotation"))return _B(e,t,i);if(pt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return EB(e,t,i);if(A(t,"bpmn:FlowNode"))return wB(e,t,i)}function wB(e,t,n){var i=qe(e),o=Qe(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=fB(e,{filter:function(f){return A(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;A(e,"bpmn:BoundaryEvent")&&(l=Bn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+Y_(l,c,r)}:{x:o.x+Y_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return qh(e,t,u,Yh(d))}function Y_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function _B(e,t,n){var i=qe(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};It(e)&&(o=Qe(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 qh(e,t,o,Yh(a))}function EB(e,t,n){var i=qe(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 qh(e,t,o,Yh(a))}function K_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return q_(o,i,t)})}K_.$inject=["eventBus","elementRegistry"];const Du={__depends__:[bB],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",K_]};function Do(e,t,n,i){be.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=Hp(fa(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ha(s,function(p){return p.parent.id});W(u,function(p,d){Ze(l)&&(p=p.filter(function(f){return Ft(l,ga({id:f.id}))})),o._expand(p,d)})}}),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)})}Do.$inject=["eventBus","elementRegistry","modeling","rules"],Ne(Do,be),Do.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=qe(ln(e)),r=qe(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),Ml(J({},r,a))},Do.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(SB(i,t)){var o=RB(Fi(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Do.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Do.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Do.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function SB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function RB(e,t){var n="";return e=qe(e),t=qe(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(Do,this)}Lu.$inject=["injector"],Ne(Lu,Do),Lu.prototype.resize=function(e,t,n){A(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function dc(e){Ai.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}dc.$inject=["eventBus"],Ne(dc,Ai),dc.prototype.canResize=function(e,t){return!1};function Iu(e,t){dc.call(this,e),this._modeling=t}Ne(Iu,dc),Iu.$inject=["eventBus","modeling"],Iu.prototype.canResize=function(e,t){if(A(t.di,"bpmndi:BPMNPlane")||!A(t,"bpmn:Participant")&&!A(t,"bpmn:Lane")&&!A(t,"bpmn:SubProcess"))return!1;var n=!0;return W(e,function(i){if(A(i,"bpmn:Lane")||lt(i)){n=!1;return}}),n};const X_={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Lu],bpmnAutoResizeProvider:["type",Iu]},MB=1500;class Z_{constructor(t){t.on("moddleCopy.canCopyProperties",MB,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,kr)))return;const o=Rn(n);o!==void 0&&i.set("xml:lang",o)})}}an(Z_,"$inject",["eventBus"]);const J_={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",Z_]},CB=500,Bu=1,Q_=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Bu||n>e.x+e.width+Bu||i<e.y-Bu||i>e.y+e.height+Bu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class e0{constructor(t){t.on("bpmnElement.added",CB,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(Q_(n.source,i[0]),Q_(n.target,i[i.length-1]))})}}an(e0,"$inject",["eventBus"]);const t0={__init__:["annotationImportDocking"],annotationImportDocking:["type",e0]},Xh=[Yx,js,Uh,Du,X_,Zp,J_,t0,lv];function AB(e={}){Wm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Gr({container:t,moddleExtensions:e.moddleExtensions??gs,additionalModules:[...Xh,...e.additionalModules??[]]})}const n0={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","merge-before-predecessor":"연결","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":"풀"},TB={이:["이","가"],을:["을","를"],와:["과","와"]};function PB(e,t){const[n,i]=TB[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 kB={"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":"연관선"},OB="요소";function Zh(e){return(e&&kB[e.type])??OB}const i0=20;function DB(e){const t=e.replace(/\s+/g," ").trim();return t.length>i0?`${t.slice(0,i0)}…`:t}function Nu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:DB(o.name),a=r===void 0?i+Zh(o):r,s=r===void 0?a:`「${r}」`;return n?s+PB(a,n).slice(a.length):s}function LB(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&&Zh(r)===Zh(a);return[Nu(e,t,i),Nu(e,n,o,s?"다른 ":"")]}function IB(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 BB(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];case"merge-before-predecessor":return[e.merge,e.edge]}}const $u={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function NB(e,t){const n=(o,r)=>Nu(t,o,r),i=(o,r,a,s)=>LB(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)}의 ${$u[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)}의 ${$u[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${$u[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${$u[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} 겹칩니다.`}case"merge-before-predecessor":return`합류 ${n(e.merge,"이")} 앞 단계보다 앞에 놓여 ${n(e.edge,"이")} 거꾸로 들어갑니다.`}}function $B(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Nu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const o0="기타",Jh={error:0,warning:1,info:2};function r0(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:IB(i),targetRefs:BB(i),category:n0[i.kind]??o0,message:NB(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:n0[i.ruleId]??o0,message:$B(i,t)});return n}function a0(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ga(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Qh(e,t){if(t===void 0||e.length===0)return!1;const n=Ga(e[0],t);return e.some(i=>Ga(i,t)!==n)}function s0(e,t){const n=Qh(e,t);return e.slice().sort((i,o)=>(n?Number(Ga(o,t))-Number(Ga(i,t)):0)||Jh[i.severity]-Jh[o.severity])}const c0="i18n-untranslated",l0="i18n-review-requested",fc="i18nDisplay.redrawn",u0=[["untranslated",c0],["reviewRequested",l0]];class eg{constructor(t,n,i,o,r,a,s,c){an(this,"config");an(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=(d,f,m)=>this.withDisplayText(f,()=>l(d,f,m),d);const u=r.activate.bind(r);r.activate=d=>this.withDisplayText(d,()=>u(d));const p=r.update.bind(r);r.update=(d,f,m,g)=>{const y=this.resolve(d);if(!y||y.native)return p(d,f,m,g);(f??"").trim()!==(m??"").trim()&&i.execute(Vc,{element:d.labelTarget??d,locale:this.displayLocale,text:f,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",d=>{if(!this.config)return;const{element:f,newLabel:m,oldLabel:g}=d.context;(m??"")!==(g??"")&&i.execute(Vc,{element:f.labelTarget??f,locale:this.displayLocale,text:m??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:g??""})})}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=Or(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Go(n).filter(d=>Rn(d)),s=d=>d.body??"",c=a.find(d=>Rn(d)===o&&s(d)),l=Vo(n).some(d=>d.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(d=>s(d)===r).map(Rn);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 d;if(!this.config)return n();const o=this.resolve(t),r=(d=i==null?void 0:i.parentNode)==null?void 0:d.classList;if(r)for(const[f,m]of u0)r.toggle(m,(o==null?void 0:o.status)===f);if(!o||o.native)return n();const{target:a,key:s}=Or((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 f=n();return p&&(f!=null&&f.setAttribute)&&f.setAttribute("transform",`translate(${p.dx}, 0)`),f}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 u0)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(fc)}}an(eg,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const p0={__depends__:[Zp],__init__:["i18nDisplay"],i18nDisplay:["type",eg]};var FB=2e3;function tg(e,t,n){e.on("autoPlace",FB,function(i){var o=i.source,r=Qe(o),a=i.shape,s=q_(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],A(a,"bpmn:TextAnnotation")&&(jB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}tg.$inject=["eventBus","gridSnapping","elementRegistry"];function jB(e){return e==="x"}var HB=3e3;function Va(e,t,n){be.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],HB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||zB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Va.$inject=["eventBus","gridSnapping","modeling"],Ne(Va,be),Va.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=WB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function zB(e){return e.length>3}function GB(e){return e==="h"}function VB(e){return e==="v"}function WB(e,t,n){var i=Eo(t,n),o={};return GB(i)&&(o.y=e.snapValue(t.y)),VB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=J({},t,o),n=J({},n,o)),[t,n]}function UB(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Br(e,t),fontBoundingBoxAscent:t*Qi.ascentEm,fontBoundingBoxDescent:t*Qi.descentEm,actualBoundingBoxAscent:t*Qi.ascentEm,actualBoundingBoxDescent:t*Qi.descentEm}}class ng{constructor(t,n,i,o,r,a){an(this,"active",!1);an(this,"shadow");an(this,"shadowContainer");this.eventBus=t,this.elementRegistry=n,this.textRenderer=i,this.graphicsFactory=o,this.canvas=r,this.bpmnjs=a,t.on("diagram.destroy",()=>this.disposeShadow());let s=[];t.on("elements.changed",c=>{this.active||(s=c.elements??[])}),t.on("commandStack.changed",c=>{const l=s;s=[],!(this.active||(c==null?void 0:c.trigger)!=="undo"&&(c==null?void 0:c.trigger)!=="redo")&&this.remeasureLabelsOf(l)})}isActive(){return this.active}run(t){if(this.active)throw new Error("headlessReplay.run: 이미 창 안이다(중첩 금지)");const n=typeof CanvasRenderingContext2D>"u"?void 0:CanvasRenderingContext2D.prototype,i=n==null?void 0:n.measureText;n&&(n.measureText=UB),this.active=!0;try{return this.reproject(),t()}finally{this.active=!1,n&&i&&(n.measureText=i),this.relabel(),this.syncGraphicsOrder(),this.redrawAll()}}atBatchBoundary(){if(!this.active)throw new Error("headlessReplay.atBatchBoundary: 창 밖이다");this.eventBus.fire("saveXML.start",{definitions:this.bpmnjs.getDefinitions()}),this.reproject()}reproject(){const t=this.ensureShadow();t.get("eventBus").fire("diagram.clear");let n=!1;t.get("eventBus").once("import.render.complete",()=>n=!0);let i;if(Ox(t,this.bpmnjs.getDefinitions()).catch(u=>i=u),!n)throw new Error(`headlessReplay: 그림자 import 가 동기로 끝나지 않았다${i?` — ${String(i)}`:""}`);const o=t.get("elementRegistry"),r=this.elementRegistry,a=u=>u?r.get(u.id):void 0,s=o.getAll();for(const u of s){const p=r.get(u.id);if(!p)continue;u.waypoints?p.waypoints=u.waypoints.map(f=>({x:f.x,y:f.y,...f.original?{original:{x:f.original.x,y:f.original.y}}:{}})):u.parent&&(p.x=u.x,p.y=u.y,p.width=u.width,p.height=u.height),p.collapsed=u.collapsed,p.hidden=u.hidden,p.isFrame=u.isFrame;const d=a(u.parent);d&&p.parent!==d&&(p.parent=d);for(const f of["incoming","outgoing"]){const m=(u[f]??[]).map(a).filter(Boolean),g=p[f];g&&m.length===g.length&&m.every(y=>g.includes(y))&&m.forEach((y,_)=>g[_]=y)}}for(const u of s){const p=r.get(u.id);if(!(p!=null&&p.children)||!u.children)continue;const d=u.children.map(a).filter(Boolean),f=p.children.filter(m=>!d.includes(m)&&m.parent===p);p.children.length=0,p.children.push(...d,...f)}const c=r._elements,l={};for(const u of s)u.id in c&&(l[u.id]=c[u.id]);for(const u of Object.keys(c))u in l||(l[u]=c[u]);r._elements=l}relabel(){for(const t of this.elementRegistry.filter(n=>n.type==="label"))this.remeasure(t)}remeasure(t){const n=t.labelTarget,i=n&&ci(n);if(!i)return!1;const o=this.textRenderer.getExternalLabelBounds(jx(vt(n),n),i),r={x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)};return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height?!1:(Object.assign(t,r),!0)}remeasureLabelsOf(t){const n=new Set;for(const o of t){(o==null?void 0:o.type)==="label"&&n.add(o);for(const r of(o==null?void 0:o.labels)??[])n.add(r)}let i=0;for(const o of n){if(!this.elementRegistry.get(o.id)||!this.remeasure(o))continue;const r=this.elementRegistry.getGraphics(o);r&&this.graphicsFactory.update("shape",o,r),i++}i&&this.eventBus.fire(fc)}syncGraphicsOrder(){var t,n;for(const i of this.elementRegistry.getAll()){if(!((t=i.children)!=null&&t.length))continue;const o=this.graphicsFactory._getChildrenContainer(i);for(const r of i.children){const a=(n=this.elementRegistry.getGraphics(r))==null?void 0:n.parentNode;a&&o.appendChild(a)}}}redrawAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);i&&this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}this.eventBus.fire(fc)}ensureShadow(){if(this.shadow)return this.shadow;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-10000px;top:0;width:800px;height:600px;visibility:hidden",document.body.appendChild(t),this.shadowContainer=t,this.shadow=new Gr({container:t,moddleExtensions:gs,additionalModules:[...Xh]}),this.shadow}disposeShadow(){var t,n;(t=this.shadow)==null||t.destroy(),this.shadow=void 0,(n=this.shadowContainer)==null||n.remove(),this.shadowContainer=void 0}}an(ng,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function d0(e,t){const n=Object.create(e);return n.on=(i,o,r,a)=>{typeof o=="function"&&(a=r,r=o,o=1e3);const s=function(...c){return t.isActive()?void 0:r.apply(this,c)};return e.on(i,o,s,a)},n}function ig(e,t,n,i){tg.call(this,d0(e,i),t,n)}ig.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function Fu(e,t,n,i){Va.call(this,d0(e,i),t,n)}Fu.prototype=Object.create(Va.prototype),Fu.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function qB(e){return e instanceof ig||e instanceof Fu}const f0={__init__:["headlessReplay"],headlessReplay:["type",ng],gridSnappingAutoPlaceBehavior:["type",ig],gridSnappingLayoutConnectionBehavior:["type",Fu]};function Qr(e){return CSS.escape(e)}var YB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function h0(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return YB[t]})}var ju=50,KB=new Kr,g0={min:.2,max:4},XB=10,ZB=.1,JB=250,QB=100,eN=2e3;function jn(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=KB.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=Hu({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);og(p,r._canvas),r._update()}function s(u){return function(d){var f=rg(d);(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var m=Hu({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),g=i.viewbox(),y=nN(m,g),_=r._viewportDom.getBoundingClientRect(),h={x:f.x-_.left+1,y:f.y-_.top+1};J(r._state,{cachedViewbox:g,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:y,offsetViewportDom:h,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),We.bind(document,"mousemove",c),We.bind(document,"mouseup",l)}}function c(u){var p=rg(u);if(r._state.isDragging){(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,m=r._state.parentClientRect;J(r._viewportDom.style,{top:p.y-d.y-m.top+"px",left:p.x-d.x-m.left+"px"});var g=y0(m,{top:p.y-d.y-m.top,left:p.x-d.x-m.left,width:f.width,height:f.height});J(r._overlay.style,{clipPath:g});var y=Hu({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);og({x:y.x-r._state.offsetViewport.x,y:y.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=rg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),J(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),We.unbind(document,"mousemove",c),We.unbind(document,"mouseup",l))}We.bind(this._viewportDom,"mousedown",s(!1)),We.bind(this._svg,"mousedown",s(!0)),We.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!sN(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*cN(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>ZB){var f=d>0?1:-1,m=Math.log(i.zoom())/Math.log(10),g=lN(g0,XB*2),y=Math.round(m/g)*g;y+=g*f;var _=Math.pow(10,y);i.zoom(uN(g0,_),h),r._state.zoomDelta=0;var h=Hu({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);og(h,r._canvas),r._update()}}}),We.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",JB,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,d=u.newId;r._updateElementId(p,d)}),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(d){r._addElement(d)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}jn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],jn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Pt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Pt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Pt(o).add("map"),n.appendChild(o);var r=this._svg=je("svg");Le(r,{width:"100%",height:"100%"}),tt(o,r);var a=this._elementsGroup=je("g");tt(r,a);var s=this._viewportGroup=je("g");tt(r,s);var c=this._viewport=je("rect");gt(c).add("viewport"),tt(s,c),We.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Pt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Pt(u).add("overlay"),this._parent.appendChild(u)},jn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Je(this._config.debounceDelay)?this._config.debounceDelay:QB,n=Je(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:eN,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)}},jn.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)})}},jn.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(v0(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-ju,o=o-ju,r=r+ju*2,a=a+ju*2,this._lastViewbox={x:i,y:o,width:r,height:a},Le(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Le(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};J(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=y0(l,p);J(this._overlay.style,{clipPath:d})}}},jn.prototype.open=function(){J(this._state,{isOpen:!0}),Pt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Mn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},jn.prototype.close=function(){J(this._state,{isOpen:!1}),Pt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Mn(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},jn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},jn.prototype.isOpen=function(){return this._state.isOpen},jn.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)}},jn.prototype._updateElementId=function(e,t){try{var n=Ct("#"+Qr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},jn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},jn.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=Ct("#"+Qr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=oN(e);return s!==-1?a?rN(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),tN(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Le(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Le(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},jn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&cn(t)},jn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=tr(t),n)){var i=pN(Yd(n));return Le(i,{id:this._prefixId(e.id)}),i}},jn.prototype._clear=function(){Cs(this._elementsGroup)},jn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function tN(e){return e.waypoints}function nN(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 Hu(e,t,n){var i=t.getBoundingClientRect(),o=iN(n,i.width/i.height),r=m0(e.x,0,i.width,o.x,o.x+o.width),a=m0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function og(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 iN(e,t){var n=e.width/e.height,i=J({},{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;J(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;J(i,{x:s,width:a})}return i}function m0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function oN(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function rN(e,t,n){var i=aN(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function aN(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function zu(e){return e.width===0&&e.height===0}function sN(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var cN=Math.sign||function(e){return e>=0?1:-1};function lN(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 uN(e,t){return Math.max(e.min,Math.min(e.max,t))}function y0(e,t){var n=[uo(t.left,t.top),uo(t.left+t.width,t.top),uo(t.left+t.width,t.top+t.height),uo(t.left,t.top+t.height),uo(t.left,e.height),uo(e.width,e.height),uo(e.width,0),uo(0,0),uo(0,e.height),uo(t.left,e.height)].join(", ");return"polygon("+n+")"}function uo(e,t){return e+"px "+t+"px"}function v0(e){return Ho(e,function(t){return yn(t)?v0(t):Je(t)&&isFinite(t)})}function rg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function pN(e){return Ms("[id]",e).forEach(function(t){t.remove()}),e}var dN={__init__:["minimap"],minimap:["type",jn]};const x0={closed:"미니맵",open:"접기"};class b0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(fc,()=>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?x0.open:x0.closed)}}an(b0,"$inject",["eventBus","minimap","canvas"]);const w0=[p0,{__depends__:[dN],__init__:["minimapI18n"],minimapI18n:["type",b0]},J_,t0,lv,f0];var fN=new Kr("ov"),hN=500;function Cn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=fN,this._overlayDefaults=J({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=gN(n.getContainer()),this._init()}Cn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Cn.prototype.get=function(e){if(ii(e)&&(e={id:e}),ii(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?dt(t.overlays,ga({type:e.type})):t.overlays.slice():[]}else return e.type?dt(this._overlays,ga({type:e.type})):e.id?this._overlays[e.id]:null},Cn.prototype.add=function(e,t,n){if(yn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=J({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Cn.prototype.remove=function(e){var t=this.get(e)||[];Ze(t)||(t=[t]);var n=this;W(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(no(i.html),no(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)}})},Cn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Cn.prototype.show=function(){Gu(this._overlayRoot)},Cn.prototype.hide=function(){Gu(this._overlayRoot,!1)},Cn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],xl(this._overlayRoot)},Cn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=ln(t);i=r.x,o=r.y}_0(n,i,o),Mn(e.html,"data-container-id",t.id)},Cn.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=ln(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=ln(i).height:s=i.height,r=t.bottom*-1+s}_0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Cn.prototype._createOverlayContainer=function(e){var t=Vt('<div class="djs-overlays" />');Yn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Cn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";E0(this._overlayRoot,n)},Cn.prototype._getOverlayContainer=function(e,t){var n=Ft(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Cn.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)),ii(i)&&(i=Vt(i)),r=this._getOverlayContainer(n),o=Vt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Yn(o,{position:"absolute"}),o.appendChild(i),e.type&&Pt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Gu(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())},Cn.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&&(mn(o)&&o>t.scale||mn(r)&&r<t.scale))&&(c=!1),Gu(a,c),this._updateOverlayScale(e,t)},Cn.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),mn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),mn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),mn(a)&&(s="scale("+a+","+a+")"),E0(r,s)},Cn.prototype._updateOverlaysVisibilty=function(e){var t=this;W(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Cn.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});W(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){no(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",hN,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(W(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&&Pt(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 gN(e){var t=Vt('<div class="djs-overlay-container" />');return Yn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function _0(e,t,n){Yn(e,{left:t+"px",top:n+"px"})}function Gu(e,t){e.style.display=t===!1?"none":""}function E0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Vu={__init__:["overlays"],overlays:["type",Cn]};function ag(e,t){t.invoke(be,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)})}Ne(ag,be),ag.$inject=["canvas","injector"];const mN={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ag]};var yN="bjs-breadcrumbs-shown";function S0(e,t,n){var i=Vt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Pt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=we(l),p=Ft(a,function(d){return d===u});p&&s()});function s(c){c&&(a=vN(c));var l=a.flatMap(function(p){var d=n.findRoot(so(p))||n.findRoot(p.id);if(!d&&A(p,"bpmn:Process")){var f=t.find(function(y){var _=we(y);return _&&_.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var m=h0(p.name||p.id),g=Vt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return g.addEventListener("click",function(){n.setRootElement(d)}),g});i.innerHTML="";var u=l.length>1;r.toggle(yN,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}S0.$inject=["eventBus","elementRegistry","canvas"];function vN(e){for(var t=we(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function R0(e,t){var n=null,i=new xN;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,!(!A(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})}R0.$inject=["eventBus","canvas"];function xN(){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 M0={x:180,y:160};function ea(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}ea.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)})}},ea.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;A(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),wN(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},ea.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=bN(e),i={x:n.x-M0.x,y:n.y-M0.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)})},ea.prototype._moveToDiPlane=function(e,t){var n=C0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},ea.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},ea.$inject=["eventBus","moddle"];function C0(e){return A(e,"bpmndi:BPMNDiagram")?e:C0(e.$parent)}function bN(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=qe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ml(t)}function wN(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||pt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Wu=250,_N='<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>',EN="bjs-drilldown-empty";function gr(e,t,n,i,o){be.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",Wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Wu,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"],Wu,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)})})}Ne(gr,be),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(so(e))},gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=we(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Pt(i.html).toggle(EN,!o)}},gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=we(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Vt('<button type="button" class="bjs-drilldown">'+_N+"</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(so(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const SN={__depends__:[Vu,Th,mN],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",S0],drilldownCentering:["type",R0],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",ea]};function mr(e){Yt.call(this,e)}Ne(mr,Yt),mr.prototype._modules=[Yx,SN,Vu,Ti,js],mr.prototype._moddleExtensions={};var Uu="keyboard.keydown",RN="keyboard.keyup",MN=1e3,A0="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 Kn(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(A0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Kn.$inject=["config.keyboard","eventBus"],Kn.prototype._keydownHandler=function(e){this._keyHandler(e,Uu)},Kn.prototype._keyupHandler=function(e){this._keyHandler(e,RN)},Kn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Uu,i),n&&e.preventDefault()}},Kn.prototype._isEventIgnored=function(e){return!1},Kn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(A0)),this.unbind(),e=this._node=this._target,We.bind(e,"keydown",this._keydownHandler),We.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Kn.prototype.getBinding=function(){return this._node},Kn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),We.unbind(e,"keydown",this._keydownHandler),We.unbind(e,"keyup",this._keyupHandler)),this._node=null},Kn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Kn.prototype.addListener=function(e,t,n){wn(e)&&(n=t,t=e,e=MN),this._eventBus.on(n||Uu,e,t)},Kn.prototype.removeListener=function(e,t){this._eventBus.off(t||Uu,e)},Kn.prototype.hasModifier=aL,Kn.prototype.isCmd=ui,Kn.prototype.isShift=vh,Kn.prototype.isKey=xn;var CN=500;function Wa(e,t){var n=this;e.on("editorActions.init",CN,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Wa.$inject=["eventBus","keyboard"],Wa.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(pL(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(dL(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(sL(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(cL(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(lL(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(uL(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(xn(["+","Add","="],o)&&ui(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(xn(["-","Subtract"],o)&&ui(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(xn("0",o)&&ui(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(xn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const sg={__init__:["keyboard","keyboardBindings"],keyboard:["type",Kn],keyboardBindings:["type",Wa]};var AN={moveSpeed:50,moveSpeedAccelerated:200};function T0(e,t,n){var i=this;this._config=J({},AN,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})}}T0.$inject=["config.keyboardMove","keyboard","canvas"];const P0={__depends__:[sg],__init__:["keyboardMove"],keyboardMove:["type",T0]};var TN=15;function k0(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=Ur(s),p=Vi(u,c);if(!n.dragging&&PN(p)>TN&&(n.dragging=!0,l===0&&Lw(e),uu("grab")),n.dragging){var d=n.last||n.start;p=Vi(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){We.unbind(document,"mousemove",o),We.unbind(document,"mouseup",r),n=null,Dw()}function a(s){if(!jr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Ur(s)},We.bind(document,"mousemove",o),We.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}k0.$inject=["eventBus","canvas"];function PN(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const O0={__init__:["moveCanvas"],moveCanvas:["type",k0]};function D0(e,t){var n=gf(e.min),i=gf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function kN(e,t){return Math.max(e.min,Math.min(e.max,t))}var ON=Math.sign||function(e){return e>=0?1:-1},cg={min:.2,max:4},L0=10,DN=.1,LN=.75;function po(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Zn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||LN;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}po.$inject=["config.zoomScroll","eventBus","canvas"],po.prototype.scroll=function(t){this._canvas.scroll(t)},po.prototype.reset=function(){this._canvas.zoom("fit-viewport")},po.prototype.zoom=function(t,n){var i=D0(cg,L0*2);this._totalDelta+=t,Math.abs(this._totalDelta)>DN&&(this._zoom(t,n,i),this._totalDelta=0)},po.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Hb()&&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))*ON(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)}},po.prototype.stepZoom=function(t,n){var i=D0(cg,L0);this._zoom(t,n,i)},po.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=gf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(kN(cg,s),t)},po.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&We[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},po.prototype._init=function(e){this.toggle(e)};const I0={__init__:["zoomScroll"],zoomScroll:["type",po]};function hc(e){mr.call(this,e)}Ne(hc,mr),hc.prototype._navigationModules=[P0,O0,I0],hc.prototype._modules=[].concat(mr.prototype._modules,hc.prototype._navigationModules);function lg(e){return e&&e[e.length-1]}function B0(e){return e.y}function N0(e){return e.x}var IN={left:N0,center:N0,right:function(e){return e.x+e.width},top:B0,middle:B0,bottom:function(e){return e.y+e.height}};function Ua(e,t){this._modeling=e,this._rules=t}Ua.$inject=["modeling","rules"],Ua.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}},Ua.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ua.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(d,f){return Math.round((d[i]+f[i]+f[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=lg(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(W(t,function(d){var f=d[i]+Math.round(d[o]/2);a[f]?a[f].elements.push(d):a[f]={elements:[d],center:f}}),c=Xi(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=lg(c).center,r;l=t[0],t=Xi(t,function(d){return d[i]+d[o]}),u=lg(t),r[e]=p(l,u)}return r},Ua.prototype.trigger=function(e,t){var n=this._modeling,i,o=dt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),Ze(i)&&(o=i),!(o.length<2||!i)){var r=IN[t],a=Xi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const BN={__init__:["alignElements"],alignElements:["type",Ua]},NN=new Kr;function qa(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}qa.$inject=["eventBus"],qa.prototype.schedule=function(e,t=NN.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},qa.prototype._schedule=function(e,t){const n=$N();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}},qa.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},qa.prototype._cancel=function(e){clearTimeout(e.executionId)};function $N(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const FN={scheduler:["type",qa]};var jN="djs-element-hidden",qu=".entry",HN=1e3,$0=8,zN=300;function pn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}pn.$inject=["canvas","elementRegistry","eventBus","scheduler"],pn.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=Ze(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=Ze(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},pn.prototype._createContainer=function(){var e=Vt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},pn.prototype.registerProvider=function(e,t){t||(t=e,e=HN),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},pn.prototype.getEntries=function(e){var t=this._getProviders(),n=Ze(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return W(t,function(o){if(wn(o[n])){var r=o[n](e);wn(r)?i=r(i):W(r,function(a,s){i[s]=a})}}),i},pn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Mn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},zN);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},pn.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(wn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},pn.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))}},pn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},pn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;W(t,function(o,r){var a=o.group||"default",s=Vt(o.html||'<div class="entry" draggable="true"></div>'),c;Mn(s,"data-action",r),c=Ct("[data-group="+Qr(a)+"]",n),c||(c=Vt('<div class="group"></div>'),Mn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&GN(s,o.className),o.title&&Mn(s,"title",o.title),o.imageUrl&&(i=Vt("<img>"),Mn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Pt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},pn.prototype._createHtml=function(e){var t=this,n=Vt('<div class="djs-context-pad"></div>');return ai.bind(n,qu,"click",function(i){t.trigger("click",i)}),ai.bind(n,qu,"dragstart",function(i){t.trigger("dragstart",i)}),ai.bind(n,qu,"mouseover",function(i){t.trigger("mouseover",i)}),ai.bind(n,qu,"mouseout",function(i){t.trigger("mouseout",i)}),We.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},pn.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()&&WN(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},pn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},pn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ze(e)!==Ze(n)?!1:Ze(e)?e.length===n.length&&Ho(e,function(i){return n.includes(i)}):n===e},pn.prototype.isShown=function(){return this.isOpen()&&Pt(this._current.html).has("open")},pn.prototype.show=function(){this.isOpen()&&(Pt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},pn.prototype.hide=function(){this.isOpen()&&(Pt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},pn.prototype._getPosition=function(e){if(!Ze(e)&&It(e)){var t=this._canvas.viewbox(),n=VN(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+$0*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+$0*this._canvas.zoom(),top:s.top-a.top}},pn.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")},pn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ze(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,jN)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},pn.prototype._getTargetBounds=function(e){var t=this,n=Ze(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 GN(e,t){var n=Pt(e);t=Ze(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function VN(e){return e.waypoints[e.waypoints.length-1]}function WN(e,t){return e=Ze(e)?e:[e],t=Ze(t)?t:[t],e.length===t.length&&Ho(e,function(n){return t.includes(n)})}const F0={__depends__:[lu,FN,Vu],contextPad:["type",pn]};var Yu,Xt,j0,yr,H0,z0,G0,ug,Ku,gc,V0,pg,dg,fg,Xu={},Zu=[],UN=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ju=Array.isArray;function Lo(e,t){for(var n in t)e[n]=t[n];return e}function hg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function W0(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?Yu.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 Qu(e,a,i,o,null)}function Qu(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??++j0,__i:-1,__u:0};return o==null&&Xt.vnode!=null&&Xt.vnode(r),r}function ep(e){return e.children}function tp(e,t){this.props=e,this.context=t}function ta(e,t){if(t==null)return e.__?ta(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"?ta(e):null}function qN(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Lo({},t);r.__v=t.__v+1,Xt.vnode&&Xt.vnode(r),gg(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??ta(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,Q0(i,r,o),t.__e=t.__=null,r.__e!=n&&U0(r)}}function U0(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}),U0(e)}function q0(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!np.__r++||H0!=Xt.debounceRendering)&&((H0=Xt.debounceRendering)||z0)(np)}function np(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(G0),e=yr.shift(),t=yr.length,qN(e)}finally{yr.length=np.__r=0}}function Y0(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,m,g,y,_=i&&i.__k||Zu,h=t.length;for(c=YN(n,t,_,c,h),p=0;p<h;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&_[f.__i]||Xu,f.__i=p,y=gg(e,f,d,o,r,a,s,c,l,u),m=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&mg(d.ref,null,f),u.push(f.ref,f.__c||m,f)),g==null&&m!=null&&(g=m),4&f.__u?(c=K0(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=g,c}function YN(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,d=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]=Qu(null,a,null,null,null):Ju(a)?a=e.__k[r]=Qu(ep,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Qu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+d,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=KN(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?d--:o<u&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,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=ta(s)),tE(s,s));return i}function K0(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=K0(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=ta(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function KN(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 X0(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||UN.test(t)?n:n+"px"}function ip(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||X0(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||X0(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(V0,"$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[gc]=i[gc]:(n[gc]=pg,e.addEventListener(t,r?fg:dg,r)):e.removeEventListener(t,r?fg:dg,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 Z0(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ku]==null)t[Ku]=pg++;else if(t[Ku]<n[gc])return;return n(Xt.event?Xt.event(t):t)}}}function gg(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,m,g,y,_,h,v,b,E,M,B,P,k,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Xt.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(h=t.props,v=N.prototype&&N.prototype.render,b=(u=N.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?_=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new N(h,E):(t.__c=d=new tp(h,E),d.constructor=N,d.render=ZN),b&&b.sub(d),d.state||(d.state={}),d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),v&&d.__s==null&&(d.__s=d.state),v&&N.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Lo({},d.__s)),Lo(d.__s,N.getDerivedStateFromProps(h,d.__s))),m=d.props,g=d.state,d.__v=t,f)v&&N.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&N.getDerivedStateFromProps==null&&h!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(h,E),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(h,d.__s,E)===!1){t.__v!=n.__v&&(d.props=h,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(G){G&&(G.__=t)}),Zu.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=ta(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(h,d.__s,E),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,y)})}if(d.context=E,d.props=h,d.__P=e,d.__e=!1,M=Xt.__r,B=0,v)d.state=d.__s,d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),Zu.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++B<25);d.state=d.__s,d.getChildContext!=null&&(i=Lo(Lo({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(m,g)),P=u!=null&&u.type===ep&&u.key==null?eE(u.props.children):u,s=Y0(e,Ju(P)?P:[P],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(G){if(a.length=p,t.__v=null,c||r!=null){if(G.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(k=r.length;k--;)hg(r[k])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),G.then||J0(t),Xt.__e(G,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=XN(n.__e,t,n,i,o,r,a,c,l);return(u=Xt.diffed)&&u(t),128&t.__u?void 0:s}function J0(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(J0))}function Q0(e,t,n){for(var i=0;i<n.length;i++)mg(n[i],n[++i],n[++i]);Xt.__c&&Xt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Xt.__e(r,o.__v)}})}function eE(e){return typeof e!="object"||e==null||e.__b>0?e:Ju(e)?e.map(eE):e.constructor!==void 0?null:Lo({},e)}function XN(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,m,g,y=n.props||Xu,_=t.props,h=t.type;if(h=="svg"?o="http://www.w3.org/2000/svg":h=="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((f=r[l])&&"setAttribute"in f==!!h&&(h?f.localName==h:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(h==null)return document.createTextNode(_);e=document.createElementNS(o,h,_.is&&_),s&&(Xt.__m&&Xt.__m(t,r),s=!1),r=null}if(h==null)y===_||s&&e.data==_||(e.data=_);else{if(r=h=="textarea"&&_.defaultValue!=null?null:r&&Yu.call(e.childNodes),!s&&r!=null)for(y={},l=0;l<e.attributes.length;l++)y[(f=e.attributes[l]).name]=f.value;for(l in y)f=y[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||ip(e,l,null,f,o);for(l in _)f=_[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?m=f:l=="checked"?g=f:s&&typeof f!="function"||y[l]===f||ip(e,l,f,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=""),Y0(t.type=="template"?e.content:e,Ju(d)?d:[d],t,n,i,h=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&ta(n,0),s,c),r!=null)for(l=r.length;l--;)hg(r[l]);s&&h!="textarea"||(l="value",h=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||h=="progress"&&!m||h=="option"&&m!=y[l])&&ip(e,l,m,y[l],o),l="checked",g!=null&&g!=e[l]&&ip(e,l,g,y[l],o))}return e}function mg(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){Xt.__e(o,n)}}function tE(e,t,n){var i,o;if(Xt.unmount&&Xt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||mg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Xt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&tE(i[o],t,n||typeof e.type!="function");n||hg(e.__e),e.__c=e.__=e.__e=void 0}function ZN(e,t,n){return this.constructor(e,n)}function nE(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Xt.__&&Xt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],gg(t,e=t.__k=W0(ep,null,[e]),o||Xu,Xu,t.namespaceURI,o?null:t.firstChild?Yu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),Q0(r,e,a),e.props.children=null}Yu=Zu.slice,Xt={__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}},j0=0,tp.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Lo({},this.state),typeof e=="function"&&(e=e(Lo({},n),this.props)),e&&Lo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),q0(this))},tp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),q0(this))},tp.prototype.render=ep,yr=[],z0=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,G0=function(e,t){return e.__v.__b-t.__v.__b},np.__r=0,ug=Math.random().toString(8),Ku="__d"+ug,gc="__a"+ug,V0=/(PointerCapture)$|Capture$/i,pg=0,dg=Z0(!1),fg=Z0(!0);var iE=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,iE(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},oE=new Map;function JN(e){var t=oE.get(this);return t||(t=new Map,oE.set(this,t)),(t=iE(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(d){r===1&&(d||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,d,a):r===3&&(d||a)?(c.push(3,d,a),r=2):r===2&&a==="..."&&d?c.push(4,d,0):r===2&&a&&!d?c.push(5,0,!0,a):r>=5&&((a||!d&&r===5)&&(c.push(r,0,a,o),r=6),d&&(c.push(r,d,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===`
10
- `||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 Nt=JN.bind(W0),Ya,dn,yg,rE,mc=0,aE=[],bn=Xt,sE=bn.__b,cE=bn.__r,lE=bn.diffed,uE=bn.__c,pE=bn.unmount,dE=bn.__;function op(e,t){bn.__h&&bn.__h(dn,e,mc||t),mc=0;var n=dn.__H||(dn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function vg(e){return mc=1,QN(hE,e)}function QN(e,t,n){var i=op(Ya++,2);if(i.t=e,!i.__c&&(i.__=[hE(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=dn,!dn.__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(f){if(f.__N){u=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),r){var d=r.call(this,s,c,l);return u?d||p:d}return!u||p};dn.__f=!0;var r=dn.shouldComponentUpdate,a=dn.componentWillUpdate;dn.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)},dn.shouldComponentUpdate=o}return i.__N||i.__}function rp(e,t){var n=op(Ya++,3);!bn.__s&&wg(n.__H,t)&&(n.__=e,n.u=t,dn.__H.__h.push(n))}function xg(e,t){var n=op(Ya++,4);!bn.__s&&wg(n.__H,t)&&(n.__=e,n.u=t,dn.__h.push(n))}function ap(e){return mc=5,Io(function(){return{current:e}},[])}function Io(e,t){var n=op(Ya++,7);return wg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function yc(e,t){return mc=8,Io(function(){return e},t)}function e$(){for(var e;e=aE.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(sp),t.__h.some(bg),t.__h=[]}catch(n){t.__h=[],bn.__e(n,e.__v)}}}bn.__b=function(e){dn=null,sE&&sE(e)},bn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),dE&&dE(e,t)},bn.__r=function(e){cE&&cE(e),Ya=0;var t=(dn=e.__c).__H;t&&(yg===dn?(t.__h=[],dn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(sp),t.__h.some(bg),t.__h=[],Ya=0)),yg=dn},bn.diffed=function(e){lE&&lE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(aE.push(t)!==1&&rE===bn.requestAnimationFrame||((rE=bn.requestAnimationFrame)||t$)(e$)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),yg=dn=null},bn.__c=function(e,t){t.some(function(n){try{n.__h.some(sp),n.__h=n.__h.filter(function(i){return!i.__||bg(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],bn.__e(i,n.__v)}}),uE&&uE(e,t)},bn.unmount=function(e){pE&&pE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{sp(i)}catch(o){t=o}}),n.__H=void 0,t&&bn.__e(t,n.__v))};var fE=typeof requestAnimationFrame=="function";function t$(e){var t,n=function(){clearTimeout(i),fE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);fE&&(t=requestAnimationFrame(n))}function sp(e){var t=dn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),dn=t}function bg(e){var t=dn;e.__c=e.__(),dn=t}function wg(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function hE(e,t){return typeof t=="function"?t(e):t}function n$(e){const{navigationStack:t,setNavigationStack:n}=e,i=Io(()=>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 Nt`
9
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+d+'" height="'+f+'" viewBox="'+u+" "+p+" "+d+" "+f+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Yt.prototype._setDefinitions=function(e){this._definitions=e},Yt.prototype.getModules=function(){return this._modules},Yt.prototype.clear=function(){this.getDefinitions()&&nr.prototype.clear.call(this)},Yt.prototype.destroy=function(){nr.prototype.destroy.call(this),no(this._container)},Yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Yt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Ct(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Yt.prototype.getDefinitions=function(){return this._definitions},Yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Yt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=J(Zi(n,["additionalModules"]),{canvas:J({},n.canvas,{container:e}),modules:a});nr.call(this,s),n&&n.container&&this.attachTo(n.container)},Yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Yt.prototype._createContainer=function(e){const t=Vt('<div class="bjs-container"></div>');return Yn(t,{width:Fx(e.width),height:Fx(e.height),position:e.position}),t},Yt.prototype._createModdle=function(e){const t=J({},this._moddleExtensions,e.moddleExtensions);return new Hm(t)},Yt.prototype._modules=[];function kl(e,t){return e.warnings=t,e}function U2(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 q2={width:"100%",height:"100%",position:"relative"};function Fx(e){return e+(Je(e)?"px":"")}function Y2(e,t){return t&&Ft(e.diagrams,function(n){return n.id===t})||null}function K2(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ix+"</a>",i=Vt(n);Yn(Ct("svg",i),Bx),Yn(i,Nx,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),We.bind(i,"click",function(o){W2(),o.preventDefault()})}function Gr(e){Yt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ne(Gr,Yt),Gr.prototype._createModdle=function(e){var t=Yt.prototype._createModdle.call(this,e);return t.ids=new to([32,36,1]),t},Gr.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 mt(e,t){return A(e,"bpmn:CallActivity")?!1:A(e,"bpmn:SubProcess")?(t=t||vt(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!we(e).processRef:!0}function _n(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=vt(e).isHorizontal;return t===void 0?!0:t}}function X2(e){return e&&we(e).isInterrupting!==!1}function Wn(e){return e&&!!we(e).triggeredByEvent}function Ca(e,t){var n=we(e).eventDefinitions;return zo(n,function(i){return A(i,t)})}function Z2(e){return Ca(e,"bpmn:ErrorEventDefinition")}function J2(e){return Ca(e,"bpmn:EscalationEventDefinition")}function Q2(e){return Ca(e,"bpmn:CompensateEventDefinition")}var Vr={width:90,height:20},jx=15;function ir(e){return A(e,"bpmn:Event")||A(e,"bpmn:Gateway")||A(e,"bpmn:DataStoreReference")||A(e,"bpmn:DataObjectReference")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:Group")}function Ol(e){return lt(e.label)}function ek(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=tk(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-=jx:a+=jx,{x:a,y:s}}function tk(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?ek(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Vr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Vr.height/2}}function Hx(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Vr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=pf(t),i=Vr),J({x:n.x-i.width/2,y:n.y-i.height/2},i)}function zx(e){if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return"name";if(A(e,"bpmn:TextAnnotation"))return"text";if(A(e,"bpmn:Group"))return"categoryValueRef"}function nk(e){var t=e.categoryValueRef;return t&&t.value||""}function ci(e){var t=e.businessObject,n=zx(t);if(n)return n==="categoryValueRef"?nk(t):t[n]||""}function ik(e,t){var n=e.businessObject,i=zx(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function ok(e){return lt(e)&&ir(e.labelTarget)}var Aa=7;function Gx(e){let t=[];return W(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),W(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ns(e){const t=new Map;return W(of(e),n=>{W(Gx(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 df="hsl(225, 10%, 15%)",rk="white";function ao(e,t){return zo(e.eventDefinitions,function(n){return n.$type===t})}function ak(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function sk(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ht(e,t,n){var i=vt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||rk}function Be(e,t,n){var i=vt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||df}function $s(e,t,n,i){var o=vt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Be(e,n)}function Vx(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 Hr(o)}function ff(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 Hr(a)}function ck(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 Hr(s)}function lk(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 Hr(r)}function Fs(e,t={}){return{width:Ri(e,t),height:li(e,t)}}function Ri(e,t={}){return oi(t,"width")?t.width:e.width}function li(e,t={}){return oi(t,"height")?t.height:e.height}var uk=new to,pk=10,Dl=3,dk=1.5,Ll=10,fk=4,Ta=.95,hk=1,gk=.25;function Wr(e,t,n,i,o,r,a){_o.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(F){return n.computeStyle(F,{strokeLinecap:"round",strokeLinejoin:"round",stroke:df,strokeWidth:2,fill:"white"})}function p(F){return n.computeStyle(F,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:df,strokeWidth:2})}function d(F,C){var{ref:R={x:0,y:0},scale:U=1,element:ee,parentGfx:he=o._svg}=C,ke=je("marker",{id:F,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*U,markerHeight:20*U,orient:"auto"});tt(ke,ee);var at=Ct(":scope > defs",he);at||(at=je("defs"),tt(he,at)),tt(at,ke)}function f(F,C,R,U){var ee=uk.nextPrefixed("marker-");return m(F,ee,C,R,U),"url(#"+ee+")"}function m(F,C,R,U,ee){if(R==="sequenceflow-end"){var he=je("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:ee,stroke:ee,strokeWidth:1})});d(C,{element:he,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="messageflow-start"){var ke=je("circle",{cx:6,cy:6,r:3.5,...u({fill:U,stroke:ee,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:ke,ref:{x:6,y:6},parentGfx:F})}if(R==="messageflow-end"){var at=je("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:U,stroke:ee,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:at,ref:{x:8.5,y:5},parentGfx:F})}if(R==="association-start"){var ut=je("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:ee,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:ut,ref:{x:1,y:10},scale:.5,parentGfx:F})}if(R==="association-end"){var zt=je("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:ee,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:zt,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="conditional-flow-marker"){var yt=je("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:U,stroke:ee})});d(C,{element:yt,ref:{x:-1,y:10},scale:.5,parentGfx:F})}if(R==="conditional-default-flow-marker"){var on=je("path",{d:"M 6 4 L 10 16",...u({stroke:ee,fill:"none"})});d(C,{element:on,ref:{x:0,y:10},scale:.5,parentGfx:F})}}function g(F,C,R,U,ee={}){yn(U)&&(ee=U,U=0),U=U||0,ee=u(ee);var he=C/2,ke=R/2,at=je("circle",{cx:he,cy:ke,r:Math.round((C+R)/4-U),...ee});return tt(F,at),at}function y(F,C,R,U,ee,he){yn(ee)&&(he=ee,ee=0),ee=ee||0,he=u(he);var ke=je("rect",{x:ee,y:ee,width:C-ee*2,height:R-ee*2,rx:U,ry:U,...he});return tt(F,ke),ke}function _(F,C,R,U){var ee=C/2,he=R/2,ke=[{x:ee,y:0},{x:C,y:he},{x:ee,y:R},{x:0,y:he}],at=ke.map(function(zt){return zt.x+","+zt.y}).join(" ");U=u(U);var ut=je("polygon",{...U,points:at});return tt(F,ut),ut}function h(F,C,R,U){R=p(R);var ee=Ps(C,R,U);return tt(F,ee),ee}function v(F,C,R){return h(F,C,R,5)}function b(F,C,R){R=p(R);var U=je("path",{...R,d:C});return tt(F,U),U}function E(F,C,R,U){return b(C,R,J({"data-marker":F},U))}function M(F){return $e[F]}function B(F){return function(C,R,U){return M(F)(C,R,U)}}var P={"bpmn:MessageEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill),ke=U?ht(C,s,R.fill):Be(C,c,R.stroke),at=b(F,ee,{fill:he,stroke:ke,strokeWidth:1});return at},"bpmn:TimerEventDefinition":function(F,C,R={}){var U=R.width||C.width,ee=R.height||C.height,he=R.width?1:2,ke=g(F,U,ee,.2*ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:he}),at=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:U,containerHeight:ee,position:{mx:.5,my:.5}});b(F,at,{stroke:Be(C,c,R.stroke),strokeWidth:he});for(var ut=0;ut<12;ut++){var zt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:U,containerHeight:ee,position:{mx:.5,my:.5}}),yt=U/2,on=ee/2;b(F,zt,{strokeWidth:1,stroke:Be(C,c,R.stroke),transform:"rotate("+ut*30+","+on+","+yt+")"})}return ke},"bpmn:EscalationEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(F,C,R={}){var U=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return b(F,U,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),he=U?Be(C,c,R.stroke):"none",ke=b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1});return Ox(ke,45),ke},"bpmn:CompensateEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{strokeWidth:1,fill:he,stroke:Be(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(F,C,R={},U){var ee=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),he=U?Be(C,c,R.stroke):ht(C,s,R.fill);return b(F,ee,{fill:he,stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(F,C,R={}){var U=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return b(F,U,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(F,C,R={}){var U=g(F,C.width,C.height,8,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:4});return U}};function k(F,C,R={},U){var ee=we(F),he=ak(ee),ke=U||F;return ee.get("eventDefinitions")&&ee.get("eventDefinitions").length>1?ee.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,ke,R,he):P["bpmn:MultipleEventDefinition"](C,ke,R,he):ao(ee,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,ke,R,he):ao(ee,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,ke,R,he):ao(ee,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,ke,R,he):ao(ee,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,ke,R,he):ao(ee,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,ke,R,he):ao(ee,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,ke,R,he):ao(ee,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,ke,R,he):ao(ee,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,ke,R,he):ao(ee,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,ke,R,he):ao(ee,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,ke,R,he):null}var N={ParticipantMultiplicityMarker:function(F,C,R={}){var U=Ri(C,R),ee=li(C,R),he=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:(U/2-6)/U,my:(ee-15)/ee}});E("participant-multiplicity",F,he,{strokeWidth:2,fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},SubProcessMarker:function(F,C,R={}){var U=y(F,14,14,0,{strokeWidth:1,fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)});Nn(U,C.width/2-7.5,C.height-20);var ee=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",F,ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},ParallelMarker:function(F,C,R){var U=Ri(C,R),ee=li(C,R),he=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:(U/2+R.parallel)/U,my:(ee-20)/ee}});E("parallel",F,he,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},SequentialMarker:function(F,C,R){var U=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",F,U,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},CompensationMarker:function(F,C,R){var U=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",F,U,{strokeWidth:1,fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})},LoopMarker:function(F,C,R){var U=Ri(C,R),ee=li(C,R),he=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:(U/2+R.loop)/U,my:(ee-7)/ee}});E("loop",F,he,{strokeWidth:1.5,fill:"none",stroke:Be(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(F,C,R){var U=Ri(C,R),ee=li(C,R),he=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:(U/2+R.adhoc)/U,my:(ee-15)/ee}});E("adhoc",F,he,{strokeWidth:1,fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke)})}};function G(F,C,R,U){N[F](C,R,U)}function q(F,C,R=[],U={}){U={fill:U.fill,stroke:U.stroke,width:Ri(C,U),height:li(C,U)};var ee=we(C),he=R.includes("SubProcessMarker");he?U={...U,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:U={...U,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},ee.get("isForCompensation")&&R.push("CompensationMarker"),A(ee,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),he||J(U,{compensation:U.compensation-18}));var ke=ee.get("loopCharacteristics"),at=ke&&ke.get("isSequential");ke&&(J(U,{compensation:U.compensation-18}),R.includes("AdhocMarker")&&J(U,{seq:-23,loop:-18,parallel:-24}),at===void 0&&R.push("LoopMarker"),at===!1&&R.push("ParallelMarker"),at===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&J(U,{compensation:-8}),W(R,function(ut){G(ut,F,C,U)})}function Y(F,C,R={}){R=J({size:{width:100}},R);var U=r.createText(C||"",R);return gt(U).add("djs-label"),tt(F,U),U}function ae(F,C,R,U={}){var ee=we(C),he=Fs({x:C.x,y:C.y,width:C.width,height:C.height},U);return Y(F,ee.name,{align:R,box:he,padding:7,style:{fill:$s(C,l,c,U.stroke)}})}function X(F,C,R={}){var U={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Y(F,ci(C),{box:U,style:J({},r.getExternalStyle(),{fill:$s(C,l,c,R.stroke)})})}function Me(F,C,R,U={}){var ee=_n(R),he=Y(F,C,{box:{height:30,width:ee?li(R,U):Ri(R,U)},align:"center-middle",style:{fill:$s(R,l,c,U.stroke)}});if(ee){var ke=-1*li(R,U);Tl(he,0,-ke,270)}}function Te(F,C,R={}){var{width:U,height:ee}=Fs(C,R);return y(F,U,ee,Ll,{...R,fill:ht(C,s,R.fill),fillOpacity:Ta,stroke:Be(C,c,R.stroke)})}function Pe(F,C,R={}){var U=we(C),ee=ht(C,s,R.fill),he=Be(C,c,R.stroke);return(U.get("associationDirection")==="One"||U.get("associationDirection")==="Both")&&(R.markerEnd=f(F,"association-end",ee,he)),U.get("associationDirection")==="Both"&&(R.markerStart=f(F,"association-start",ee,he)),R=wt(R,["markerStart","markerEnd"]),v(F,C.waypoints,{...R,stroke:he,strokeDasharray:"0, 5"})}function fe(F,C,R={}){var U=ht(C,s,R.fill),ee=Be(C,c,R.stroke),he=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),ke=b(F,he,{fill:U,fillOpacity:Ta,stroke:ee}),at=we(C);if(sk(at)){var ut=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}});b(F,ut,{strokeWidth:2,fill:U,stroke:ee})}return ke}function z(F,C,R={}){return g(F,C.width,C.height,{fillOpacity:Ta,...R,fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke)})}function se(F,C,R={}){return _(F,C.width,C.height,{fill:ht(C,s,R.fill),fillOpacity:Ta,stroke:Be(C,c,R.stroke)})}function V(F,C,R={}){var U=y(F,Ri(C,R),li(C,R),0,{fill:ht(C,s,R.fill),fillOpacity:R.fillOpacity||Ta,stroke:Be(C,c,R.stroke),strokeWidth:1.5}),ee=we(C);if(A(ee,"bpmn:Lane")){var he=ee.get("name");Me(F,he,C,R)}return U}function Z(F,C,R={}){var U=Te(F,C,R),ee=mt(C);if(Wn(C)&&(Le(U,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!ee)){var he=we(C).flowElements||[],ke=he.filter(at=>A(at,"bpmn:StartEvent"));ke.length===1&&pe(ke[0],F,R,C)}return ae(F,C,ee?"center-top":"center-middle",R),ee?q(F,C,void 0,R):q(F,C,["SubProcessMarker"],R),U}function pe(F,C,R,U){var ee=22,he={fill:ht(U,s,R.fill),stroke:Be(U,c,R.stroke),width:ee,height:ee},ke=we(F).isInterrupting,at=ke?0:3,ut=ke?1:1.2,zt=20,yt=(ee-zt)/2,on="translate("+yt+","+yt+")";g(C,zt,zt,{fill:he.fill,stroke:he.stroke,strokeWidth:ut,strokeDasharray:at,transform:on}),k(F,C,he,U)}function ve(F,C,R={}){var U=Te(F,C,R);return ae(F,C,"center-middle",R),q(F,C,void 0,R),U}var $e=this.handlers={"bpmn:AdHocSubProcess":function(F,C,R={}){return mt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]),Z(F,C,R)},"bpmn:Association":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Pe(F,C,R)},"bpmn:BoundaryEvent":function(F,C,R={}){var{renderIcon:U=!0}=R;R=wt(R,["fill","stroke"]);var ee=we(C),he=ee.get("cancelActivity");R={strokeWidth:1.5,fill:ht(C,s,R.fill),fillOpacity:hk,stroke:Be(C,c,R.stroke)},he||(R.strokeDasharray="6");var ke=z(F,C,R);return g(F,C.width,C.height,Dl,{...R,fill:"none"}),U&&k(C,F,R),ke},"bpmn:BusinessRuleTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),he=b(F,ee);Le(he,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1});var ke=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),at=b(F,ke);return Le(at,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:CallActivity":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Z(F,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=se(F,C,R),ee=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(F,ee,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:DataInput":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=i.getRawPath("DATA_ARROW"),ee=fe(F,C,R);return b(F,U,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:1}),ee},"bpmn:DataInputAssociation":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Pe(F,C,{...R,markerEnd:f(F,"association-end",ht(C,s,R.fill),Be(C,c,R.stroke))})},"bpmn:DataObject":function(F,C,R={}){return R=wt(R,["fill","stroke"]),fe(F,C,R)},"bpmn:DataObjectReference":B("bpmn:DataObject"),"bpmn:DataOutput":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=i.getRawPath("DATA_ARROW"),ee=fe(F,C,R);return b(F,U,{strokeWidth:1,fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke)}),ee},"bpmn:DataOutputAssociation":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Pe(F,C,{...R,markerEnd:f(F,"association-end",ht(C,s,R.fill),Be(C,c,R.stroke))})},"bpmn:DataStoreReference":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(F,U,{fill:ht(C,s,R.fill),fillOpacity:Ta,stroke:Be(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(F,C,R={}){var{renderIcon:U=!0}=R;R=wt(R,["fill","stroke"]);var ee=z(F,C,{...R,strokeWidth:4});return U&&k(C,F,R),ee},"bpmn:EventBasedGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=we(C),ee=se(F,C,R);g(F,C.width,C.height,C.height*.2,{fill:ht(C,"none",R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1});var he=U.get("eventGatewayType"),ke=!!U.get("instantiate");function at(){var zt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(F,zt,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:2})}if(he==="Parallel"){var ut=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(F,ut,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:1})}else he==="Exclusive"&&(ke||g(F,C.width,C.height,C.height*.26,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:1}),at());return ee},"bpmn:ExclusiveGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=se(F,C,R),ee=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),he=vt(C);return he.get("isMarkerVisible")&&b(F,ee,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:Gateway":function(F,C,R={}){return R=wt(R,["fill","stroke"]),se(F,C,R)},"bpmn:Group":function(F,C,R={}){return R=wt(R,["fill","stroke","width","height"]),y(F,C.width,C.height,Ll,{stroke:Be(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ri(C,R),height:li(C,R)})},"bpmn:InclusiveGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=se(F,C,R);return g(F,C.width,C.height,C.height*.24,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:2.5}),U},"bpmn:IntermediateEvent":function(F,C,R={}){var{renderIcon:U=!0}=R;R=wt(R,["fill","stroke"]);var ee=z(F,C,{...R,strokeWidth:1.5});return g(F,C.width,C.height,Dl,{fill:"none",stroke:Be(C,c,R.stroke),strokeWidth:1.5}),U&&k(C,F,R),ee},"bpmn:IntermediateCatchEvent":B("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":B("bpmn:IntermediateEvent"),"bpmn:Lane":function(F,C,R={}){return R=wt(R,["fill","stroke","width","height"]),V(F,C,{...R,fillOpacity:gk})},"bpmn:ManualTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(F,ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:.5}),U},"bpmn:MessageFlow":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=we(C),ee=vt(C),he=ht(C,s,R.fill),ke=Be(C,c,R.stroke),at=v(F,C.waypoints,{markerEnd:f(F,"messageflow-end",he,ke),markerStart:f(F,"messageflow-start",he,ke),stroke:ke,strokeDasharray:"10, 11",strokeWidth:1.5});if(U.get("messageRef")){var ut=at.getPointAtLength(at.getTotalLength()/2),zt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ut.x,y:ut.y}}),yt={strokeWidth:1};ee.get("messageVisibleKind")==="initiating"?(yt.fill=he,yt.stroke=ke):(yt.fill=ke,yt.stroke=he);var on=b(F,zt,yt),En=U.get("messageRef"),An=En.get("name"),$t=Y(F,An,{align:"center-top",fitBox:!0,style:{fill:ke}}),gn=on.getBBox(),Tn=$t.getBBox(),gi=ut.x-Tn.width/2,Un=ut.y+gn.height/2+pk;Tl($t,gi,Un,0)}return at},"bpmn:ParallelGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=se(F,C,R),ee=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(F,ee,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:Participant":function(F,C,R={}){R=wt(R,["fill","stroke","width","height"]);var U=V(F,C,R),ee=mt(C),he=_n(C),ke=we(C),at=ke.get("name");if(ee){var ut=he?[{x:30,y:0},{x:30,y:li(C,R)}]:[{x:0,y:30},{x:Ri(C,R),y:30}];h(F,ut,{stroke:Be(C,c,R.stroke),strokeWidth:dk}),Me(F,at,C,R)}else{var zt=Fs(C,R);he||(zt.height=Ri(C,R),zt.width=li(C,R));var yt=Y(F,at,{box:zt,align:"center-middle",style:{fill:$s(C,l,c,R.stroke)}});if(!he){var on=-1*li(C,R);Tl(yt,0,-on,270)}}return ke.get("participantMultiplicity")&&G("ParticipantMultiplicityMarker",F,C,R),U},"bpmn:ReceiveTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=we(C),ee=ve(F,C,R),he;return U.get("instantiate")?(g(F,28,28,20*.22,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),he=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):he=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(F,he,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),ee},"bpmn:ScriptTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(F,ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:SendTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(F,ee,{fill:Be(C,c,R.stroke),stroke:ht(C,s,R.fill),strokeWidth:1}),U},"bpmn:SequenceFlow":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ht(C,s,R.fill),ee=Be(C,c,R.stroke),he=v(F,C.waypoints,{markerEnd:f(F,"sequenceflow-end",U,ee),stroke:ee}),ke=we(C),{source:at}=C;if(at){var ut=we(at);ke.get("conditionExpression")&&A(ut,"bpmn:Activity")&&Le(he,{markerStart:f(F,"conditional-flow-marker",U,ee)}),ut.get("default")&&(A(ut,"bpmn:Gateway")||A(ut,"bpmn:Activity"))&&ut.get("default")===ke&&Le(he,{markerStart:f(F,"conditional-default-flow-marker",U,ee)})}return he},"bpmn:ServiceTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R);g(F,10,10,{fill:ht(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var ee=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(F,ee,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),g(F,10,10,{fill:ht(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var he=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(F,he,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:1}),U},"bpmn:StartEvent":function(F,C,R={}){var{renderIcon:U=!0}=R;R=wt(R,["fill","stroke"]);var ee=we(C);ee.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var he=z(F,C,R);return U&&k(C,F,R),he},"bpmn:SubProcess":function(F,C,R={}){return mt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]),Z(F,C,R)},"bpmn:Task":function(F,C,R={}){return R=wt(R,["fill","stroke"]),ve(F,C,R)},"bpmn:TextAnnotation":function(F,C,R={}){R=wt(R,["fill","stroke"]);var{width:U,height:ee}=Fs(C,R),he=y(F,U,ee,0,0,{fill:"none",stroke:"none"}),ke=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:ee,position:{mx:0,my:0}});b(F,ke,{stroke:Be(C,c,R.stroke)});var at=we(C),ut=at.get("text")||"";return Y(F,ut,{align:"left-top",box:Fs(C,R),padding:Aa,style:{fill:$s(C,l,c,R.stroke)}}),he},"bpmn:Transaction":function(F,C,R={}){mt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]);var U=Z(F,C,{strokeWidth:1.5,...R}),ee=n.style(["no-fill","no-events"],{stroke:Be(C,c,R.stroke),strokeWidth:1.5}),he=mt(C);return he||(R={}),y(F,Ri(C,R),li(C,R),Ll-Dl,Dl,ee),U},"bpmn:UserTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var U=ve(F,C,R),ee=15,he=12,ke=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:ee,y:he}});b(F,ke,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:.5});var at=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:ee,y:he}});b(F,at,{fill:ht(C,s,R.fill),stroke:Be(C,c,R.stroke),strokeWidth:.5});var ut=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:ee,y:he}});return b(F,ut,{fill:Be(C,c,R.stroke),stroke:Be(C,c,R.stroke),strokeWidth:.5}),U},label:function(F,C,R={}){return X(F,C,R)}};this._drawPath=b,this._renderer=M}Ne(Wr,_o),Wr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Wr.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},Wr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Wr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Wr.prototype.getShapePath=function(e){return lt(e)?ff(e,fk):A(e,"bpmn:Event")?Vx(e):A(e,"bpmn:Activity")?ff(e,Ll):A(e,"bpmn:Gateway")?ck(e):lk(e)};function wt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var mk=0,yk={width:150,height:50};function vk(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function xk(e){return yn(e)?J({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var hf=null;function bk(){return hf||(hf=document.createElement("canvas").getContext("2d")),hf}function wk(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(Wx(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Wx(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function _k(e,t){var n=bk();if(!n)return{width:0,height:0};n.font=wk(t),"letterSpacing"in n&&(n.letterSpacing=Wx(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 Ek(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=_k(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return Sk(e,o,i,r);o=Mk(o,r.width,t)}}function Sk(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 Ux="­";function Rk(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===Ux)&&o.pop();break}var a=o[o.length-1];return a&&a===Ux&&(o[o.length-1]="-"),o.join("")}function Mk(e,t,n){var i=Math.max(e.length*(n/t),1),o=Rk(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Il(e){this._config=J({},{size:yk,padding:mk,style:{},align:"center-top"},e||{})}Il.prototype.createText=function(e,t){return this.layoutText(e,t).element},Il.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Il.prototype.layoutText=function(e,t){for(var n=J({},this._config.size,t.box),i=J({},this._config.style,t.style),o=vk(t.align||this._config.align),r=xk(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Ck(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(Ek(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ri(l,function(y,_,h){return y+(s||_.height)},0)+r.top+r.bottom,d=ri(l,function(y,_,h){return _.width>y?_.width:y},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var m=je("text");Le(m,i),W(l,function(y){var _;switch(f+=s||y.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?d:u)-r.right-y.width;break;default:_=Math.max(((a?d:u)-y.width)/2+r.left,0)}var h=je("tspan");Le(h,{x:_,y:f}),h.textContent=y.text,tt(m,h)});var g={width:d,height:p};return{dimensions:g,element:m}};function Ck(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Ak=12,Tk=1.2,Pk=40;function qx(e){var t=J({fontFamily:"Arial, sans-serif",fontSize:Ak,fontWeight:"normal",lineHeight:Tk},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=J({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Il({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Vr.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:Aa});return{x:a.x,y:a.y,width:a.width,height:Math.max(Pk,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,J({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}qx.$inject=["config.textRenderer"];function kk(){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=Ik(i.d,{mx:o,my:r,e:a});return p}}var Ok=/\{([^{}]+)\}/g,Dk=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Lk(e,t,n){var i=n;return t.replace(Dk,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 Ik(e,t){return String(e).replace(Ok,function(n,i){return Lk(n,i,t)})}const Bk={__init__:["bpmnRenderer"],bpmnRenderer:["type",Wr],textRenderer:["type",qx],pathMap:["type",kk]};function Nk(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const js={translate:["value",Nk]};function Bl(e,t,n){return J({id:e.id,type:e.$type,businessObject:e,di:t},n)}function $k(e,t,n){var i=e.waypoint;return!i||i.length<2?[Qe(t),Qe(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Yx(e,t,n){return new Error(`element ${Vn(t)} referenced by ${Vn(e)}#${n} not yet drawn`)}function Mo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Mo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Mo.prototype.add=function(e,t,n){var i,o,r;if(A(t,"bpmndi:BPMNPlane")){var a=A(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Bl(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!mt(e,t),c=jk(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Bl(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})),A(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),A(e,"bpmn:Lane")&&(r=0),A(e,"bpmn:DataStoreReference")&&(Fk(n,Qe(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(A(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Bl(e,t,{hidden:o,source:u,target:p,waypoints:$k(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Vn(t)} for element ${Vn(e)}`);return ir(e)&&ci(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Mo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Vn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Yx(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Mo.prototype.addLabel=function(e,t,n){var i,o,r;return i=Hx(t,n),o=ci(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Bl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ci(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)},Mo.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?Yx(e,i,t+"Ref"):new Error(`${Vn(e)}#${t} Ref not specified`)},Mo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Mo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Mo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function Fk(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 jk(e){return A(e,"bpmn:Group")}const Kx={__depends__:[Bk,{__depends__:[js],bpmnImporter:["type",Mo]}]};function Hs(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Vi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function gf(e){return Math.log(e)/Math.log(10)}var Hk=1e3;function be(e){this._eventBus=e}be.$inject=["eventBus"];function zk(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}be.prototype.on=function(e,t,n,i,o,r){if((wn(t)||Je(t))&&(r=o,o=i,i=n,n=t,t=null),wn(n)&&(r=o,o=i,i=n,n=Hk),yn(o)&&(r=o,o=!1),!wn(i))throw new Error("handlerFn must be a function");Ze(e)||(e=[e]);var a=this._eventBus;W(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?zk(i,r):i,r)})},be.prototype.canExecute=Co("canExecute"),be.prototype.preExecute=Co("preExecute"),be.prototype.preExecuted=Co("preExecuted"),be.prototype.execute=Co("execute"),be.prototype.executed=Co("executed"),be.prototype.postExecute=Co("postExecute"),be.prototype.postExecuted=Co("postExecuted"),be.prototype.revert=Co("revert"),be.prototype.reverted=Co("reverted");function Co(e){return function(n,i,o,r,a){(wn(n)||Je(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var mf=["top","bottom","left","right"],Nl=10;function yf(e,t){be.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(Ol(o)&&!It(o)){var r=Wk(o);r&&i(o,r)}}function i(o,r){var a=Qe(o),s=o.label,c=Qe(s);if(s.parent){var l=qe(o),u;switch(r){case"top":u={x:a.x,y:l.top-Nl-s.height/2};break;case"left":u={x:l.left-Nl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Nl+s.height/2};break;case"right":u={x:l.right+Nl+s.width/2,y:a.y};break}var p=Vi(u,c);t.moveShape(s,p)}}}Ne(yf,be),yf.$inject=["eventBus","modeling"];function Gk(e){var t=e.host,n=Qe(e),i=Bn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=mf.filter(function(a){return o.indexOf(a)===-1});return r}function Vk(e){var t=Qe(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 Xx(t,i)});return n}function Wk(e){var t=Qe(e.label),n=Qe(e),i=Xx(n,t);if(Uk(i)){var o=Vk(e);if(e.host){var r=Gk(e);o=o.concat(r)}var a=mf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?Bn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Xx(e,t){return Bn(t,e,5)}function Uk(e){return mf.indexOf(e)!==-1}function vf(e){be.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(A(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)}Ne(vf,be),vf.$inject=["eventBus"];var qk=1500;function xf(e,t,n){e.invoke(be,this),this.preExecute("elements.delete",qk,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=dt(o,l=>A(l,"bpmn:Participant")||A(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>A(l,"bpmn:Artifact"))),c=new Set;return W(r,l=>{const u=new Set(fa(Sa(Array.from(s),ln(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ne(xf,be),xf.$inject=["injector","eventBus","canvas"];function bf(e,t){e.invoke(be,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=dt(o.incoming.concat(o.outgoing),function(a){return A(a,"bpmn:Association")});W(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ne(bf,be),bf.$inject=["injector","modeling"];function Pa(e,t){for(ii(t)&&(t=[t]);e=e.parent;)if(pt(e,t))return e;return null}function Zx(e,t){var n=Pa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Pa(e,i),n)return _n(n);if(pt(e,i))return _n(e);var o;for(o=we(e);o&&!A(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=we(a);return s&&s.get("processRef")===o});return r?_n(r):!0}var Jx=500;function $l(e,t){t.invoke(be,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jx,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Qx(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",Jx,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Qx(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}$l.$inject=["bpmnReplace","injector"],Ne($l,be),$l.prototype._replaceShape=function(e,t){var n=Yk(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Yk(e){var t=we(e),n=t.eventDefinitions;return n&&n[0]}function Qx(e,t){return!lt(e)&&pt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function wf(e,t){be.call(this,e);function n(i){return dt(i.attachers,function(o){return A(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);A(o,"bpmn:EventBasedGateway")&&A(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;A(o,"bpmn:Gateway")&&A(r,"bpmn:EventBasedGateway")&&W(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}wf.$inject=["eventBus","modeling"],Ne(wf,be);function eb(e){return e.create("bpmn:Category")}function Kk(e){return e.create("bpmn:CategoryValue")}function tb(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Kk(e)),n.$parent||(n.$parent=eb(e)),n}function Xk(e,t,n){return rn(t.get("categoryValue"),e),e.$parent=t,rn(n.get("rootElements"),t),t.$parent=n,e}function Zk(e){var t=e.$parent;return t&&(nn(t.get("categoryValue"),e),e.$parent=null),e}function Jk(e){var t=e.$parent;return t&&(nn(t.get("rootElements"),e),e.$parent=null),e}var Qk=500;function _f(e,t,n){n.invoke(be,this);function i(c){return t.filter(function(l){return A(l,"bpmn:Group")&&!l.labelTarget}).map(we).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&&Xk(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&Jk(l),c&&!o(c,u)&&Zk(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(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;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,we(l))},!0),this.executed(["shape.move","shape.resize"],Qk,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,we(l))},!0),this.executed("group.updateRefs",function(c){nb(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){nb(c).forEach(function(l){s(l.categoryValue,l.category,we(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,we(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}_f.$inject=["bpmnjs","elementRegistry","injector"],Ne(_f,be);function nb(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Ef(e,t,n){be.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,h=y.target;ka(_)&&zs(h)&&u(h)}function o(y){const _=y.connection,h=y.source,v=y.target;ka(h)&&Fl(v)&&(l(v),d(h,[_]))}function r(y){const _=y.newTarget,h=y.oldSource,v=y.oldTarget;if(v!==_){const b=h;zs(v)&&u(v),ka(b)&&Fl(_)&&l(_)}}function a(y){const{element:_}=y;zs(_)?(p(_),f(_)):Fl(_)&&m(_)}function s(y){const{newData:_,oldShape:h}=y;if(ka(y.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const v=h.outgoing.find(({target:b})=>zs(b));v&&v.target&&(y._connectionTarget=v.target)}else if(!ka(y.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const v=h.outgoing.find(({target:b})=>Fl(b));v&&v.target&&(y._connectionTarget=v.target),g(h)}}function c(y){const{_connectionTarget:_,newShape:h}=y;_&&t.connect(h,_)}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 d(y,_){y.outgoing.filter(b=>A(b,"bpmn:Association")).filter(b=>zs(b.target)&&!_.includes(b)).forEach(b=>t.removeConnection(b))}function f(y){const _=y.attachers.slice();_.length&&t.removeElements(_)}function m(y){const _=y.incoming.filter(h=>ka(h.source));t.removeElements(_)}function g(y){const _=y.outgoing.filter(h=>A(h,"bpmn:SequenceFlow"));t.removeElements(_)}}Ne(Ef,be),Ef.$inject=["eventBus","modeling","bpmnRules"];function zs(e){const t=we(e);return t&&t.get("isForCompensation")}function ka(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ca(e,"bpmn:CompensateEventDefinition")}function Fl(e){return e&&A(e,"bpmn:Activity")&&!Wn(e)}function Sf(e){e.invoke(be,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;A(i,"bpmn:Lane")&&!A(o,"bpmn:Lane")&&(n.parent=Pa(i,"bpmn:Participant"))})}Sf.$inject=["injector"],Ne(Sf,be);function Rf(e,t){be.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(A(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}})}Rf.$inject=["eventBus","bpmnFactory"],Ne(Rf,be);var Mf=20,Cf=20,ib=30,jl=2e3;function Af(e,t,n){be.call(this,t),t.on(["create.start","shape.move.start"],jl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!A(a,"bpmn:Participant")||!A(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!A(p,"bpmn:Group")&&!lt(p)&&!It(p)});if(c.length){var l=ln(c),u=eO(a,l);J(a,u),r.createConstraints=tO(a,l)}}}),t.on("create.start",jl,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}A(a,"bpmn:Participant")&&A(s,"bpmn:Process")&&(t.on("element.hover",jl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return A(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",jl,function(o){var r=o.elements,a=o.parent,s=nO(r),c;s&&A(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=we(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;A(a,"bpmn:Participant")&&A(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=we(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)&&we(s).set("processRef",we(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)&&we(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)}Af.$inject=["canvas","eventBus","modeling"],Ne(Af,be);function eO(e,t){t={width:t.width+Mf*2+ib,height:t.height+Cf*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 tO(e,t){return t=qe(t),{bottom:t.top+e.height/2-Cf,left:t.right-e.width/2+Mf,top:t.bottom-e.height/2+Cf,right:t.left+e.width/2-Mf-ib}}function nO(e){return Ft(e,function(t){return A(t,"bpmn:Participant")})}var ob="__targetRef_placeholder";function Tf(e,t){be.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],rb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],rb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Ft(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Ft(c,function(u){return u.name===ob});return!l&&s&&(l=t.create("bpmn:Property",{name:ob}),rn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||nn(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,d=s.newTarget,f=d&&d.businessObject,m=s.oldTarget||s.target,g=m&&m.businessObject,y=c.businessObject,_;g&&g!==p&&o(g,l),f&&f!==p&&o(f,l),p?(_=i(p,!0),y.targetRef=_):y.targetRef=null}}Tf.$inject=["eventBus","bpmnFactory"],Ne(Tf,be);function rb(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function Hl(e){this._bpmnUpdater=e}Hl.$inject=["bpmnUpdater"],Hl.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),[]},Hl.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 Pf(e,t,n,i){be.call(this,i),t.registerHandler("dataStore.updateContainment",Hl);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&we(s).processRef})[0]}function r(s){return s.children.filter(function(c){return A(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:vt(s),newSemanticParent:u.processRef||u,newDiParent:vt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;A(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 A(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!A(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(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(!A(u,"bpmn:Collaboration")&&A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(p,"bpmn:Collaboration")){var d=A(u,"bpmn:Participant")?u:oO(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();pt(l,["bpmn:Participant","bpmn:SubProcess"])&&A(u,"bpmn:Collaboration")&&r(u).filter(function(p){return iO(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(d){A(u,"bpmn:Process")&&a(d,u)})})}Pf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ne(Pf,be);function iO(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 oO(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var zl=Math.max,Gl=Math.min,rO=20;function ab(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function aO(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 sO(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],o=n.min&&n.min[e],r=n.max&&n.max[e];return Je(o)&&(i=(/top|left/.test(e)?Gl:zl)(i,o)),Je(r)&&(i=(/top|left/.test(e)?zl:Gl)(i,r)),i}function cO(e,t){if(!t)return e;var n=qe(e);return Ml({top:Vl("top",n,t),right:Vl("right",n,t),bottom:Vl("bottom",n,t),left:Vl("left",n,t)})}function lO(e,t,n,i){var o=qe(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?qe(i):r,s={top:Gl(r.top,a.top),left:Gl(r.left,a.left),bottom:zl(r.bottom,a.bottom),right:zl(r.right,a.right)};return Ml(s)}function Gs(e,t){return typeof e<"u"?e:rO}function uO(e,t){var n,i,o,r;return typeof t=="object"?(n=Gs(t.left),i=Gs(t.right),o=Gs(t.top),r=Gs(t.bottom)):n=i=o=r=Gs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function pO(e){return!(e.waypoints||e.type==="label")}function sb(e,t){var n;if(e.length===void 0?n=dt(e.children,pO):n=e,n.length)return uO(ln(n),t)}var or=Math.abs;function dO(e,t){return ab(qe(t),qe(e))}var fO=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Mi=30;function Wl(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(Wl(n,t),t.push(n))}),t}function rr(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Ci(e){return Pa(e,fO)||e}function hO(e,t){var n=Ci(e),i=A(n,"bpmn:Process")?[]:[n],o=Wl(n,i),r=qe(e),a=qe(t),s=dO(e,t),c=[],l=_n(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,d=l?s.right:0,f=l?0:s.bottom,m=l?s.left:0,g=qe(u);s.top&&(or(g.bottom-r.top)<10&&(f=a.top-g.bottom),or(g.top-r.top)<5&&(p=a.top-g.top)),s.left&&(or(g.right-r.left)<10&&(d=a.left-g.right),or(g.left-r.left)<5&&(m=a.left-g.left)),s.bottom&&(or(g.top-r.bottom)<10&&(p=a.bottom-g.top),or(g.bottom-r.bottom)<5&&(f=a.bottom-g.bottom)),s.right&&(or(g.left-r.right)<10&&(m=a.right-g.left),or(g.right-r.right)<5&&(d=a.right-g.right)),(p||d||f||m)&&c.push({shape:u,newBounds:sO(u,{top:p,right:d,bottom:f,left:m})})}}),c}var gO=500;function kf(e,t){be.call(this,e);function n(i,o){var r=_n(i),a=rr(o),s=[],c=[],l=[],u=[];if(zr(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 d,f,m,g;s.length&&(d=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},"s")),c.length&&(f=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:-p},"n")),l.length&&(m=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:p,y:0},"e")),u.length&&(g=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",gO,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;A(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}kf.$inject=["eventBus","spaceTool"],Ne(kf,be);var cb=500;function Ul(e,t){t.invoke(be,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",cb,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return lb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",cb,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;lb(a,yO(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Ul.$inject=["bpmnReplace","injector"],Ne(Ul,be),Ul.prototype._replaceShape=function(e){var t=mO(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function mO(e){var t=we(e),n=t.eventDefinitions;return n&&n[0]}function lb(e,t){return!lt(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function yO(e,t){return e.indexOf(t)!==-1}var ql=Math.round,vO=Math.max;function xO(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 bO(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ub=10;function wO(e,t){var n,i;for(n=0;i=e[n];n++)if(Ds(i,t)<=ub)return{point:e[n],bendpoint:!0,index:n};return null}function _O(e,t){var n=fx(xO(t,ub),bO(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=vO(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:ql(i.x+o.x)/2,y:ql(i.y+o.y)/2},index:i.segment2}:{point:{x:ql(i.x),y:ql(i.y)},index:i.segment2}:null}function Of(e,t){return wO(e,t)||_O(e,t)}function Df(e,t,n){be.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,m,g=o.outgoing.slice(),y=o.incoming.slice(),_;Je(a.width)?_=Qe(a):_=a;var h=Of(s,_);if(h){if(c=s.slice(0,h.index),l=s.slice(h.index+(h.bendpoint?1:0)),!c.length||!l.length)return;u=h.bendpoint?s[h.index]:_,(c.length===1||!pb(o,c[c.length-1]))&&c.push(db(u)),(l.length===1||!pb(o,l[0]))&&l.unshift(db(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),f=r),t.canConnect(o,d,r)&&(f?m=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),m=r));var v=[].concat(f&&dt(y,function(b){return b.source===f.source})||[],m&&dt(g,function(b){return b.target===m.target})||[]);v.length&&n.removeElements(v)}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=Qe(c),u={x:l.x+s.x,y:l.y+s.y},p=Ft(r.children,function(d){var f=t.canInsert(a,d);return f&&Of(d.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)}Ne(Df,be),Df.$inject=["eventBus","bpmnRules","modeling"];function pb(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 db(e){return J({},e)}function Lf(e,t){be.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)&&Oa(o)){var c=[];A(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Oa(l)):c=a.incoming.filter(l=>l!==o&&Oa(l)&&A(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(A(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Oa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Oa).forEach(function(s){const c=a.incoming.filter(Oa).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}Lf.$inject=["eventBus","modeling"],Ne(Lf,be);function Oa(e){return A(e,"bpmn:SequenceFlow")}var Yl=1500,fb=2e3;function hb(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"],Yl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;A(a,"bpmn:Lane")&&!pt(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ci(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||pt(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"],Yl,function(i){var o=i.hover;A(o,"bpmn:Lane")&&(i.hover=Ci(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Yl,function(i){var o=i.context,r=i.hover,a=o.type;A(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ci(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Yl,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Ci(r)||r)}),t.on("shape.move.start",fb,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Ci(o)||o)}),t.on("spaceTool.move",fb,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Ci(o))})}hb.$inject=["elementRegistry","eventBus","canvas"];var gb=770;function If(e,t,n,i){n.invoke(be,this);function o(s,c){var l=we(s),u=c.categoryValue||l.categoryValueRef;u||(u=tb(e,l));var p=c.category||u.$parent||eb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=we(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;A(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=we(l);if(!(!A(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(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=we(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!we(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!we(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||we(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(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",gb,function(s){var c=s.descriptor,l=s.element;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=we(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",gb,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})}If.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ne(If,be);function Bf(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 mb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=Bf(i,o,r,a),l=Bf(i,o,r,s),u;c&&l?yb(c,r)>yb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],Qe(i.source)),t(o[o.length-1],o[o.length-2],Qe(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}mb.$inject=["eventBus"];function yb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Nf(e){be.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=we(i),r=vt(i);if(pt(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}Nf.$inject=["eventBus"],Ne(Nf,be);function vb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function xb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function EO(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 SO(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 $f(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=SO([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 bb(e,t){var n=$f(e,t),i={x:n.x-e.x,y:n.y-e.y};return vb(i)}function Vs(e,t){return vb({x:e.x-t.x,y:e.y-t.y})}var wb=Math.sqrt,_b=Math.min,RO=Math.max,Eb=Math.abs;function Sb(e){return Math.pow(e,2)}function Ws(e,t){return wb(Sb(e.x-t.x)+Sb(e.y-t.y))}function MO(e,t){var n=0,i,o,r,a,s,c,l,u,p,d,f;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],Mb(i,o)?l=[i]:(r=Ws(e,i),a=Ws(e,o),c=_b(r,a),l=CO(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:Mb(i,l[0])?n:n+1}),l.length===2&&(s=TO(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ws(i,s)/Ws(i,o)}),p=Ws(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function CO(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,d=u/c,f=p*p-d;if(f<0&&f>-1e-6&&(f=0),f<0)return[];var m=wb(f),g=-p+m,y=-p-m,_={x:e.x-o*g,y:e.y-r*g};if(f===0)return[_];var h={x:e.x-o*y,y:e.y-r*y};return[_,h].filter(function(v){return AO(v,e,t)})}function AO(e,t,n){return Rb(e.x,t.x,n.x)&&Rb(e.y,t.y,n.y)}function Rb(e,t,n){return e>=_b(t,n)-Kl&&e<=RO(t,n)+Kl}function TO(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Kl=.1;function Mb(e,t){return Eb(e.x-t.x)<=Kl&&Eb(e.y-t.y)<=Kl}function PO(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=Ab(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 Cb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=MO(e,n),c=s.segmentIndex,l=PO(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Tb(n,c),p=Tb(t,l),d=s.position,f=OO(u,d),m=kO(u,p);if(s.type==="bendpoint"){var g=t.length-n.length,y=s.bendpointIndex,_=n[y];if(t.indexOf(_)!==-1)return a;if(g===0){var h=t[y];return o=h.x-s.position.x,r=h.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}g<0&&y!==0&&y<n.length-1&&(f=Ab(n,y))}var v={x:(p[1].x-p[0].x)*f+p[0].x,y:(p[1].y-p[0].y)*f+p[0].y},b=EO({x:e.x-d.x,y:e.y-d.y},m);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:So(v),delta:So({x:o,y:r})}}function Ab(e,t){var n=Vs(e[t-1],e[t]),i=Vs(e[t],e[t+1]),o=n/(n+i);return o}function kO(e,t){var n=xb(e),i=xb(t);return i-n}function Tb(e,t){return[e[t],e[t+1]]}function OO(e,t){var n=Vs(e[0],e[1]),i=Vs(e[0],t);return n===0?0:i/n}function DO(e,t,n,i){var o=Qe(e);return Cb(o,t,n,i).delta}function Us(e,t,n){var i=Hs(t),o=Hs(n),r=Vi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return So({x:o.x+a.x,y:o.y+a.y})}function Pb(e,t,n){var i=Hs(e),o=Hs(t),r=Hs(n),a=Vi(e,i),s=Vi(i,o),c=LO(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 So({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function LO(e,t,n){var i=qe(t),o=qe(n);if(IO(i,o))return null;var r=Bn(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=Bn(n,s),c!==r?null:a}function IO(e,t){return BO(e,t)||NO(e,t)}function BO(e,t){return e.right!==t.right&&e.left!==t.left}function NO(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var kb="name",Ob="text";function Ff(e,t,n,i){be.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{we(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(kb in l&&t.updateLabel(c,l[kb]),Ob in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Ob]||"");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;lt(l)||!ir(l)||ci(l)&&t.updateLabel(l,ci(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=J({},s.hints),p=s.newWaypoints||c.waypoints,d=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),DO(l,p,d,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=we(c);u&&ir(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(!(!lt(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(ci(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?m-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Ol(c)){var p=c.label,d=Qe(p),f=jO(u),m=FO(d,f),g=$O(m,u,l);t.moveShape(p,g)}})}Ne(Ff,be),Ff.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function $O(e,t,n){var i=Us(e,t,n);return So(Vi(i,e))}function FO(e,t){if(t.length){var n=HO(e,t);return $f(e,n)}}function jO(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 HO(e,t){var n=t.map(function(o){return{line:o,distance:bb(e,o)}}),i=Xi(n,"distance");return i[0].line}function zO(e,t,n,i){return Cb(e,t,n,i).point}function jf(e,t){be.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=J({},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),zO(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},d=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,d)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},d=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,d)})})}Ne(jf,be),jf.$inject=["eventBus","modeling"];function Xl(e,t,n){var i=Jl(e),o=Lb(i,t),r=i[0];return o.length?o[o.length-1]:Us(r.original||r,n,t)}function Zl(e,t,n){var i=Jl(e),o=Lb(i,t),r=i[i.length-1];return o.length?o[0]:Us(r.original||r,n,t)}function Hf(e,t,n){var i=Jl(e),o=Db(t,n),r=i[0];return Us(r.original||r,o,t)}function zf(e,t,n){var i=Jl(e),o=Db(t,n),r=i[i.length-1];return Us(r.original||r,o,t)}function Db(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Jl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Lb(e,t){var n=Hn(e,VO);return dt(n,function(i){return GO(i,t)})}function GO(e,t){return Bn(t,e,1)==="intersect"}function VO(e){return e.original||e}function Gf(e,t){be.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(WO(i,o)){var r=UO(i);r.incoming.forEach(function(a){var s=Zl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Xl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Gf.$inject=["eventBus","modeling"],Ne(Gf,be);function WO(e,t){return A(e,"bpmn:Participant")&&mt(e)&&A(t,"bpmn:Participant")&&!mt(t)}function UO(e){var t=ks([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){A(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){A(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const qO=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Ib(e){const t=we(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&Wn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:qO.some(i=>A(n[0],i))}function Bb(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Vf(e,t){e.invoke(be,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Ib(o))return;const a=Bb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=we(i).get(a),l=we(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Vf.$inject=["injector","modeling"],Ne(Vf,be);function Wf(e,t){be.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=vt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ne(Wf,be),Wf.$inject=["eventBus","modeling"];function Uf(e,t,n){be.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(!(!A(r,"bpmn:SequenceFlow")||!A(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=YO(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ne(Uf,be),Uf.$inject=["eventBus","bpmnRules","modeling"];function Da(e){return e.original||e}function YO(e,t){var n=Bf(Da(e[e.length-2]),Da(e[e.length-1]),Da(t[1]),Da(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Da(e[0]),Da(t[t.length-1])]}function qf(e,t){be.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;A(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)}qf.$inject=["eventBus","modeling"],Ne(qf,be);function Yf(e,t,n,i){be.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 d,f;A(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),A(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(f=!0),n.canConnectSequenceFlow(l,u)&&(d="bpmn:SequenceFlow")),f&&t.removeConnection(c),d&&t.connect(l,u,{type:d,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,d=l.newTarget||u.target,f,m;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(m=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,o&&s(u,m))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,d;!p||!p.length||(d=p.indexOf(c),d!==-1&&p.splice(d,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;W(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,d=p.businessObject,f;u.default&&(f=Ft(p.outgoing,ga({id:p.businessObject.default.id})),f&&t.updateProperties(f,{conditionExpression:void 0})),u.conditionExpression&&d.sourceRef.default===d&&t.updateProperties(p.source,{default:void 0})})}Ne(Yf,be),Yf.$inject=["eventBus","modeling","bpmnRules","injector"];function Ql(e,t,n,i,o,r){i.invoke(be,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=ri(l,function(p,d){var f=t.canReplace([d],d.host||d.parent||c);return f?p.concat(f.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=[];W(s.closure.topLevel,function(d){Wn(d)?u=u.concat(d.children):u=u.concat(d)}),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})})}Ne(Ql,be),Ql.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;W(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)},Ql.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var KO=1500,XO={width:140,height:120},Kf={width:300,height:60},Xf={width:60,height:300},eu={width:300,height:150},tu={width:150,height:300},Nb={width:140,height:120},$b={width:100,height:40};function Fb(e){e.on("resize.start",KO,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(A(i,"bpmn:Lane")||A(i,"bpmn:Participant"))&&(n.resizeConstraints=tD(i,o,r)),A(i,"bpmn:SubProcess")&&mt(i)&&(n.minDimensions=Nb),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=$b)})}Fb.$inject=["eventBus"];var ar=Math.abs,ZO=Math.min,JO=Math.max;function jb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function La(e,t,n){return jb(e,t,n,ZO)}function Ia(e,t,n){return jb(e,t,n,JO)}var QO={top:20,left:50,right:20,bottom:20},eD={top:50,left:20,right:20,bottom:20};function tD(e,t,n){var i=Ci(e),o=!0,r=!0,a=Wl(i,[i]),s=qe(e),c={},l={},u=_n(e),p=u?Kf:Xf;/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(m){var g=qe(m);u?(g.top<s.top-10&&(o=!1),g.bottom>s.bottom+10&&(r=!1)):(g.left<s.left-10&&(o=!1),g.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&ar(s.top-g.bottom)<10&&Ia(c,"top",g.top+p.height),ar(s.top-g.top)<5&&La(l,"top",g.bottom-p.height)),/e/.test(t)&&(n&&ar(s.right-g.left)<10&&La(c,"right",g.right-p.width),ar(s.right-g.right)<5&&Ia(l,"right",g.left+p.width)),/s/.test(t)&&(n&&ar(s.bottom-g.top)<10&&La(c,"bottom",g.bottom-p.height),ar(s.bottom-g.bottom)<5&&Ia(l,"bottom",g.top+p.height)),/w/.test(t)&&(n&&ar(s.left-g.right)<10&&Ia(c,"left",g.left+p.width),ar(s.left-g.left)<5&&La(l,"left",g.right-p.width))});var d=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(A(m,"bpmn:FlowElement")||A(m,"bpmn:Artifact"))}),f=u?QO:eD;return d.forEach(function(m){var g=qe(m);/n/.test(t)&&(!u||o)&&La(l,"top",g.top-f.top),/e/.test(t)&&(u||r)&&Ia(l,"right",g.right+f.right),/s/.test(t)&&(!u||r)&&Ia(l,"bottom",g.bottom+f.bottom),/w/.test(t)&&(u||o)&&La(l,"left",g.left-f.left)}),{min:l,max:c}}function Hb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ba(e){return e.originalEvent||e.srcEvent}function Zf(e){Hb(e),Hb(Ba(e))}function Ur(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 zb(){return/mac/i.test(navigator.platform)}function Gb(e,t){return(Ba(e)||e).button===t}function sr(e){return Gb(e,0)}function nD(e){return Gb(e,1)}function qs(e){var t=Ba(e)||e;return sr(e)?zb()?t.metaKey:t.ctrlKey:!1}function nu(e){var t=Ba(e)||e;return sr(e)&&t.shiftKey}var Vb=1001;function Wb(e,t){e.on("resize.start",Vb+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!qs(n))}),e.on("resize.end",Vb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))return r&&(a=vx(a),t.resizeLane(o,a,i.balanced)),!1})}Wb.$inject=["eventBus","modeling"];var iD=500;function Jf(e,t,n,i,o){n.invoke(be,this);function r(u){return pt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||oD(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!Ft(d,ga({id:u.id}))}function s(u){if(A(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(A(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(A(u,"bpmn:MessageEventDefinition"))return"messageRef";if(A(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(pt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),d=p[0];return d.get(s(d))}function l(u,p){if(pt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var d=u.get("eventDefinitions"),f=d[0];return f.set(s(f),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var d=we(p),f=c(d),m;f&&!a(f)&&(m=e.getDefinitions().get("rootElements"),rn(m,f),u.addedRootElement=f)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var d=e.getDefinitions().get("rootElements");nn(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=we(d),m=c(f);m&&(p.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",iD,function(u){var p=u.descriptor,d=p.businessObject,f=p.referencedRootElement;f&&(a(f)||(f=i.copyElement(f,o.create(f.$type))),l(d,f),delete p.referencedRootElement)})}Jf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ne(Jf,be);function oD(e,t){return Ze(t)||(t=[t]),zo(t,function(n){return Ca(e,n)})}var Ub=Math.max;function qb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return W(n,function(a){var s=a.id;A(a,"bpmn:Participant")&&(r[s]=aD(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=_n(a)?Kf:Xf),A(a,"bpmn:SubProcess")&&mt(a)&&(r[s]=Nb),A(a,"bpmn:TextAnnotation")&&(r[s]=$b),A(a,"bpmn:Group")&&(r[s]=XO)}),r})}qb.$inject=["eventBus"];function rD(e){return e==="x"}function aD(e,t,n){var i=_n(e);if(!lD(e))return i?eu:tu;var o=rD(t),r={};return o?i?r=eu:r={width:cD(e,n,o),height:tu.height}:i?r={width:eu.width,height:sD(e,n,o)}:r=tu,r}function sD(e,t,n){var i;return i=uD(e,t,n),Ub(eu.height,i)}function cD(e,t,n){var i;return i=pD(e,t,n),Ub(tu.width,i)}function lD(e){return!!rr(e).length}function uD(e,t,n){var i=rr(e),o;return o=Qf(i,t,n),e.height-o.height+Kf.height}function pD(e,t,n){var i=rr(e),o;return o=Qf(i,t,n),e.width-o.width+Xf.width}function Qf(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=rr(o),r.length?Qf(r,t,n):o}var Yb="_plane";function Kb(e){var t=e.id;return dD(t)}function so(e){var t=e.id;return A(e,"bpmn:SubProcess")?Xb(t):t}function qr(e){return Xb(e)}function iu(e){var t=vt(e);return A(t,"bpmndi:BPMNPlane")}function Xb(e){return e+Yb}function dD(e){return e.replace(new RegExp(Yb+"$"),"")}var Zb=400,fD=600,Jb={x:180,y:160};function Ao(e,t,n,i,o,r,a){be.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 A(p,"bpmn:SubProcess")&&!mt(p)}function l(p){var d=p.shape,f=p.newRootElement,m=we(d);f=s._addDiagram(f||m),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=we(d);s._removeDiagram(f);var m=p.newRootElement=a.get(so(f));e.removeRootElement(m)}this.executed("shape.create",function(p){var d=p.shape;c(d)&&l(p)},!0),this.postExecuted("elements.create",function(p){var d=p.elements;W(d,function(f){if(c(f)){var m=a.get(so(f));if(!(!m||!f.children||!f.children.length)){var g=Qb(f);s._showRecursively(g),s._moveChildrenToShape(g,m)}}})},!0),this.reverted("shape.create",function(p){var d=p.shape;c(d)&&u(p)},!0),this.preExecute("shape.delete",function(p){var d=p.shape;!A(d,"bpmn:SubProcess")||!mt(d)||W(Ns([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(so(d));f&&n.removeElements(f.children.slice())}},!0),this.executed("shape.delete",function(p){var d=p.shape;c(d)&&u(p)},!0),this.reverted("shape.delete",function(p){var d=p.shape;c(d)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var d=p.oldShape,f=p.newShape;!c(d)||!c(f)||(p.oldRoot=e.removeRootElement(so(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,m=e.findRoot(so(d));if(!(!f||!m)){var g=f.children;n.moveElements(g,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,g=m.id,y=f.id;if(g!==y){if(iu(d)){a.updateId(d,qr(y)),a.updateId(g,y);return}var _=a.get(qr(g));_&&a.updateId(qr(g),qr(y))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,g=m.id,y=f.id;if(g!==y){if(iu(d)){a.updateId(d,qr(g)),a.updateId(y,g);return}var _=a.get(qr(y));_&&a.updateId(_,qr(g))}}},!0),t.on("element.changed",function(p){var d=p.element;if(iu(d)){var f=d,m=a.get(Kb(f));!m||m===f||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",Zb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(mt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",Zb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(mt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",fD,function(p){var d=p.shape;if(A(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(mt(d))s._moveChildrenToShape(f.children.slice(),d),W(Ns(d.children),g=>{n.moveShape(g.annotation,{x:0,y:0},d.parent),W(g.associations,y=>{n.moveConnection(y,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var m=Qb(d);s._moveChildrenToShape(m,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var m=so(d),g=a.get(m);g&&f.push.apply(f,g.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,m=p.elements,g=f.parent,y=A(vt(g),"bpmndi:BPMNPlane");if(y){var _=Kb(g),h=Ft(m,function(v){return v.id===_});h&&(d.parent=h.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}Ne(Ao,be),Ao.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=ln(i),r;if(!t.x)r={x:Jb.x-o.x,y:Jb.y-o.y};else{var a=Qe(t),s=Qe(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},Ao.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Gx(e).map(i=>i.annotation));n.size&&W(Ns(e.children),i=>{n.has(i.annotation)&&W(i.associations,o=>{t.removeConnection(o)})})},Ao.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},Ao.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},Ao.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:so(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},Ao.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ft(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ao.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function hD(e){var t=[];return W(Ns(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Qb(e){return e.children.slice().concat(hD(e.children)).concat(gD(e))}function gD(e){return of(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function eh(e,t){e.invoke(be,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!A(o,"bpmn:SubProcess")||A(o,"bpmn:AdHocSubProcess")||!(A(i,"bpmn:Task")||A(i,"bpmn:CallActivity"))||!mt(o))){var r=mD(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}eh.$inject=["injector","modeling"],Ne(eh,be);function mD(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function th(e,t){be.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;A(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&&A(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(!(!A(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,ci(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}}})}Ne(th,be),th.$inject=["eventBus","textRenderer"];function nh(e,t){be.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(mt(i))return;var o=ks(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();W(s,function(l){r(l,!0)}),W(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||A(a,"bpmn:Association")&&(A(a.source,"bpmn:TextAnnotation")||A(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Qe(i)):t.reconnectStart(a,i,Qe(i)))}},!0)}Ne(nh,be),nh.$inject=["eventBus","modeling"];var ih=500;function oh(e,t,n){be.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=yD(c).concat([a]),p=sb(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"],ih,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?vt(c).isExpanded=!1:(i(c.children),vt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ih,function(a){var s=a.context,c=s.shape;c.collapsed?vt(c).isExpanded=!1:vt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ih,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"})})}Ne(oh,be),oh.$inject=["eventBus","elementFactory","modeling"];function yD(e){return e.filter(function(t){return!t.hidden})}function rh(e,t,n,i){t.invoke(be,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;lt(a)||(A(a,"bpmn:Participant")&&mt(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;A(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ne(rh,be),rh.$inject=["canvas","injector","moddle","modeling"];function ah(e,t){be.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;vD(o,r)&&t.updateProperties(r,{default:null})})}Ne(ah,be),ah.$inject=["eventBus","modeling"];function vD(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=we(t),i=we(e);return n.get("default")===i}var xD=500,bD=5e3,ew=["shape.create","shape.delete","shape.move","shape.resize"],tw=[...ew,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function sh(e,t){be.call(this,e);var n;function i(){return n=n||new wD,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(tw,bD,function(){i()}),this.postExecuted(tw,xD,function(){r()}),this.preExecute(ew,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(A(c,"bpmn:Lane")&&l.addLane(c),A(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}sh.$inject=["eventBus","modeling"],Ne(sh,be);function wD(){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 _D=500,ED=5e3,nw=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],iw=[...nw,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function ch(e,t){be.call(this,e);var n;function i(){return n=n||new SD,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(iw,ED,function(){i()}),this.postExecuted(iw,_D,function(){r()}),this.preExecute(nw,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(A(s,"bpmn:FlowElement")&&c.addFlowElement(s),A(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;A(s,"bpmn:Group")&&o().addGroup(s)})}ch.$inject=["eventBus","modeling"],Ne(ch,be);function SD(){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 lh(e,t){be.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)RD(r)&&!CD(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ne(lh,be),lh.$inject=["eventBus","modeling"];function RD(e){const t=we(e);return t&&t.isForCompensation}function MD(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ca(e,"bpmn:CompensateEventDefinition")}function CD(e){return e.incoming.filter(n=>MD(n.source)).length>0}const AD={__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",yf],appendBehavior:["type",vf],associationBehavior:["type",bf],attachEventBehavior:["type",$l],artifactBehavior:["type",xf],boundaryEventBehavior:["type",wf],categoryRootElementReferenceBehavior:["type",_f],compensateBoundaryEventBehaviour:["type",Ef],createBehavior:["type",Sf],createDataObjectBehavior:["type",Rf],createParticipantBehavior:["type",Af],dataInputAssociationBehavior:["type",Tf],dataStoreBehavior:["type",Pf],deleteLaneBehavior:["type",kf],detachEventBehavior:["type",Ul],dropOnFlowBehavior:["type",Df],eventBasedGatewayBehavior:["type",Lf],fixHoverBehavior:["type",hb],groupBehavior:["type",If],importDockingFix:["type",mb],isHorizontalFix:["type",Nf],labelBehavior:["type",Ff],layoutConnectionBehavior:["type",jf],messageFlowBehavior:["type",Gf],nonInterruptingBehavior:["type",Vf],removeElementBehavior:["type",Uf],removeEmbeddedLabelBoundsBehavior:["type",Wf],removeParticipantBehavior:["type",qf],replaceConnectionBehavior:["type",Yf],replaceElementBehaviour:["type",Ql],resizeBehavior:["type",Fb],resizeLaneBehavior:["type",Wb],rootElementReferenceBehavior:["type",Jf],spaceToolBehavior:["type",qb],subProcessPlaneBehavior:["type",Ao],subProcessStartEventBehavior:["type",eh],textAnnotationBehavior:["type",th],toggleCollapseConnectionBehaviour:["type",nh],toggleElementCollapseBehaviour:["type",oh],unclaimIdBehavior:["type",rh],unsetDefaultFlowBehavior:["type",ah],updateFlowNodeRefsBehavior:["type",sh],updateCategoryValueRefsBehavior:["type",ch],setCompensationActivityAfterPasteBehavior:["type",lh]};function uh(e){this._commandStack=e.get("commandStack",!1)}uh.$inject=["injector"],uh.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const co={__init__:["rules"],rules:["type",uh]};function Ai(e){be.call(this,e),this.init()}Ai.$inject=["eventBus"],Ne(Ai,be),Ai.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)})},Ai.prototype.init=function(){};function ow(e,t){var n=Bn(e,t,-15);return n!=="intersect"?n:null}function $n(e){Ai.call(this,e)}Ne($n,Ai),$n.$inject=["eventBus"],$n.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return TD(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 ru(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ru(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 yw(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return It(i)&&!au(t,i)?!1:Ho(t,function(o){return It(o)?ru(o.source,o.target,o):o.host?Ys(o,o.host,null,n):hh(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 pw(a)&&!n.includes(a.host)})?!1:Ys(n,t,null,i)||gw(n,t,i)||mw(n,t)||au(n,t)}),this.addRule("shape.create",function(e){return hh(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ys(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return _w(n,t)})},$n.prototype.canConnectMessageFlow=bw,$n.prototype.canConnectSequenceFlow=ww,$n.prototype.canConnectDataAssociation=gh,$n.prototype.canConnectAssociation=vw,$n.prototype.canConnectCompensationAssociation=xw,$n.prototype.canMove=mw,$n.prototype.canAttach=Ys,$n.prototype.canReplace=gw,$n.prototype.canDrop=Na,$n.prototype.canInsert=au,$n.prototype.canCreate=hh,$n.prototype.canConnect=ru,$n.prototype.canResize=yw,$n.prototype.canCopy=_w;function TD(e){return ph(e)?null:pt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function ph(e){return!e||lt(e)}function rw(e){do{if(A(e,"bpmn:Process"))return we(e);if(A(e,"bpmn:Participant"))return we(e).processRef||we(e)}while(e=e.parent)}function dh(e){return A(e,"bpmn:TextAnnotation")}function fh(e){return A(e,"bpmn:Group")&&!e.labelTarget}function aw(e){return A(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function ou(e){return we(e).isForCompensation}function PD(e,t){var n=rw(e),i=rw(t);return n===i}function kD(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&lw(e,"bpmn:MessageEventDefinition"))}function OD(e){return A(e,"bpmn:InteractionNode")&&!ou(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&lw(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!lo(e,"bpmn:MessageEventDefinition"))}function sw(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return we(t);if(A(t,"bpmn:Participant"))return we(t).processRef}return null}function cw(e,t){var n=sw(e),i=sw(t);return n===i}function lo(e,t){var n=we(e);return!!Ft(n.eventDefinitions||[],function(i){return A(i,t)})}function lw(e,t){var n=we(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function DD(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!Wn(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&lo(e,"bpmn:LinkEventDefinition"))&&!aw(e)&&!ou(e)}function LD(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!Wn(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&lo(e,"bpmn:LinkEventDefinition"))&&!ou(e)}function ID(e){return A(e,"bpmn:ReceiveTask")||A(e,"bpmn:IntermediateCatchEvent")&&(lo(e,"bpmn:MessageEventDefinition")||lo(e,"bpmn:TimerEventDefinition")||lo(e,"bpmn:ConditionalEventDefinition")||lo(e,"bpmn:SignalEventDefinition"))}function BD(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function uw(e,t){var n=BD(t);return n.indexOf(e)!==-1}function ru(e,t,n){if(ph(e)||ph(t))return null;if(!A(n,"bpmn:DataAssociation")){if(bw(e,t))return{type:"bpmn:MessageFlow"};if(ww(e,t))return{type:"bpmn:SequenceFlow"}}var i=gh(e,t);return i||(xw(e,t)?{type:"bpmn:Association",associationDirection:"One"}:vw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Na(e,t){return lt(e)||fh(e)?!0:A(t,"bpmn:Participant")&&!mt(t)?!1:A(e,"bpmn:Participant")?A(t,"bpmn:Process")||A(t,"bpmn:Collaboration"):pt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:A(e,"bpmn:Lane")?A(t,"bpmn:Participant")||A(t,"bpmn:Lane"):A(e,"bpmn:BoundaryEvent")&&!ND(e)?!1:A(e,"bpmn:FlowElement")&&!A(e,"bpmn:DataStoreReference")?A(t,"bpmn:FlowElementsContainer")?mt(t):pt(t,["bpmn:Participant","bpmn:Lane"]):A(e,"bpmn:DataStoreReference")&&A(t,"bpmn:Collaboration")?zo(we(t).get("participants"),function(n){return!!n.get("processRef")}):pt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?pt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):A(e,"bpmn:MessageFlow")?A(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function ND(e){return we(e).cancelActivity&&(dw(e)||fw(e))}function pw(e){return!lt(e)&&A(e,"bpmn:BoundaryEvent")}function $D(e){return A(e,"bpmn:Lane")}function FD(e){return pw(e)||A(e,"bpmn:IntermediateThrowEvent")&&dw(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&fw(e)}function dw(e){var t=we(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function fw(e){return hw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function hw(e,t){return t.some(function(n){return lo(e,n)})}function jD(e){return A(e,"bpmn:ReceiveTask")&&Ft(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function Ys(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return lt(o)||!FD(o)||Wn(t)||!A(t,"bpmn:Activity")||ou(t)||i&&!ow(i,t)||jD(t)?!1:"attach"}function gw(e,t,n){if(!t)return!1;var i={replacements:[]};return W(e,function(o){Wn(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&Na(o,t)&&(X2(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(Z2(o)||J2(o)||Q2(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),hw(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&A(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),A(t,"bpmn:Transaction")||lo(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(A(o,"bpmn:EndEvent")&&Na(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),A(o,"bpmn:BoundaryEvent")&&Ys(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function mw(e,t){return zo(e,$D)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Na(n,t)})}function hh(e,t,n,i){return t?lt(e)||fh(e)?!0:Na(e,t)||au(e,t):!1}function yw(e,t,n){return A(e,"bpmn:SubProcess")?mt(e)&&(!t||t.width>=100&&t.height>=80):A(e,"bpmn:Lane")||A(e,"bpmn:Participant")?!0:dh(e)?n?n==="e"||n==="w":!0:fh(e)?!0:lt(e)?n?n==="e"||n==="w":!0:!1}function HD(e,t){var n=dh(e),i=dh(t);return(n||i)&&n!==i}function vw(e,t){return uw(t,e)||uw(e,t)?!1:HD(e,t)?!0:!!gh(e,t)}function xw(e,t){return cw(e,t)&&aw(e)&&A(t,"bpmn:Activity")&&!GD(t,e)&&!Wn(t)}function bw(e,t){return Sw(e)&&!Sw(t)?!1:kD(e)&&OD(t)&&!PD(e,t)}function ww(e,t){return DD(e)&&LD(t)&&cw(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!ID(t))}function gh(e,t){return pt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&pt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:pt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&pt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function au(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:pt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!lt(t)&&A(e,"bpmn:FlowNode")&&!A(e,"bpmn:BoundaryEvent")&&Na(e,t.parent)}function mh(e,t){return e&&t&&e.indexOf(t)!==-1}function _w(e,t){return lt(t)?!0:!(A(t,"bpmn:Lane")&&!mh(e,t.parent)||A(t,"bpmn:MessageFlow")&&!zD(e,t))}function zD(e,t){var n=Ew(t.source),i=Ew(t.target);return mh(e,n)&&mh(e,i)}function Ew(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function Sw(e){return Pa(e,"bpmn:Process")||Pa(e,"bpmn:Collaboration")}function GD(e,t){return e.attachers.includes(t)}const VD={__depends__:[co],__init__:["bpmnRules"],bpmnRules:["type",$n]};var WD=2e3;function Rw(e,t){e.on("saveXML.start",WD,n);function n(){var i=t.getRootElements();W(i,function(o){var r=vt(o),a,s;a=ks([o]),a=dt(a,function(c){return c!==o&&!c.labelTarget}),s=Hn(a,vt),r.set("planeElement",s)})}}Rw.$inject=["eventBus","canvas"];const UD={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Rw]};function su(e){be.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)})}su.prototype.getOrdering=function(e,t){return null},Ne(su,be);function yh(e,t){su.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=Ft(n,function(c){return pt(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&&!pt(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||A(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=xm(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}}}yh.$inject=["eventBus","canvas"],Ne(yh,su);const qD={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",yh]};function Ks(){}Ks.prototype.get=function(){return this._data},Ks.prototype.set=function(e){this._data=e},Ks.prototype.clear=function(){var e=this._data;return delete this._data,e},Ks.prototype.isEmpty=function(){return!this._data};const YD={clipboard:["type",Ks]};var Mw=1500;function Cw(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",Mw,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Mw,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=Ur(a),c=document.elementFromPoint(s.x,s.y),KD(c)}}Cw.$inject=["elementRegistry","eventBus","injector"];function KD(e){return jr(e,"svg, .djs-element",!0)}const XD={__init__:["hoverFix"],hoverFix:["type",Cw]};function ZD(e){return!0}function cu(e){return sr(e)||nD(e)}var Aw=500;function Tw(e,t,n){var i=this;function o(P,k,N){if(!s(P,k)){var G,q,Y;N?q=t.getGraphics(N):(G=k.delegateTarget||k.target,G&&(q=G,N=t.get(q))),!(!q||!N)&&(Y=e.fire(P,{element:N,gfx:q,originalEvent:k}),Y===!1&&(k.stopPropagation(),k.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,k){var N=l[P]||sr;return!N(k)}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":ZD,"element.mousedown":cu,"element.mouseup":cu,"element.click":cu,"element.dblclick":cu};function u(P,k,N){var G=c[P];if(!G)throw new Error("unmapped DOM event name <"+P+">");return o(G,k,N)}var p="svg, .djs-element";function d(P,k,N,G){var q=r[N]=function(Y){o(N,Y)};G&&(l[N]=G),q.$delegate=ai.bind(P,p,k,q)}function f(P,k,N){var G=a(N);G&&ai.unbind(P,k,G.$delegate)}function m(P){W(c,function(k,N){d(P,N,k)})}function g(P){W(c,function(k,N){f(P,N,k)})}e.on("canvas.destroy",function(P){g(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var k=P.element,N=P.gfx;e.fire("interactionEvents.createHit",{element:k,gfx:N})}),e.on(["shape.changed","connection.changed"],Aw,function(P){var k=P.element,N=P.gfx;e.fire("interactionEvents.updateHit",{element:k,gfx:N})}),e.on("interactionEvents.createHit",Aw,function(P){var k=P.element,N=P.gfx;i.createDefaultHit(k,N)}),e.on("interactionEvents.updateHit",function(P){var k=P.element,N=P.gfx;i.updateDefaultHit(k,N)});var y=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),h=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),b={all:h,"click-stroke":_,stroke:y,"no-move":v};function E(P,k){return k=J({stroke:"white",strokeWidth:15},k||{}),n.cls(P,["no-fill","no-border"],k)}function M(P,k){var N=b[k];if(!N)throw new Error("invalid hit type <"+k+">");return Le(P,N),P}function B(P,k){tt(P,k)}this.removeHits=function(P){var k=Ms(".djs-hit",P);W(k,cn)},this.createDefaultHit=function(P,k){var N=P.waypoints,G=P.isFrame,q;return N?this.createWaypointsHit(k,N):(q=G?"stroke":"all",this.createBoxHit(k,q,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,k){var N=Ps(k);return M(N,"stroke"),B(P,N),N},this.createBoxHit=function(P,k,N){N=J({x:0,y:0},N);var G=je("rect");return M(G,k),Le(G,N),B(P,G),G},this.updateDefaultHit=function(P,k){var N=Ct(".djs-hit",k);if(N)return P.waypoints?nf(N,P.waypoints):Le(N,{width:P.width,height:P.height}),N},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}Tw.$inject=["eventBus","elementRegistry","styles"];const lu={__init__:["interactionEvents"],interactionEvents:["type",Tw]};function $a(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)})}$a.$inject=["eventBus","canvas"],$a.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()})}},$a.prototype.get=function(){return Array.from(this._selectedElements)},$a.prototype.isSelected=function(e){return this._selectedElements.has(e)},$a.prototype.select=function(e,t){var n=this.get();Ze(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?W(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Pw="hover",kw="selected";function Ow(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,Pw)}),t.on("element.out",function(o){i(o.element,Pw)}),t.on("selection.changed",function(o){function r(l){i(l,kw)}function a(l){n(l,kw)}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)})}Ow.$inject=["canvas","eventBus"];function Dw(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;Ze(l)?t.select(l):t.select(s.filter(JD))}}),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=Ft(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(sr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=nu(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Dw.$inject=["eventBus","selection","canvas","elementRegistry"];function JD(e){return!e.hidden}const Ti={__init__:["selectionVisuals","selectionBehavior"],__depends__:[lu],selection:["type",$a],selectionVisuals:["type",Ow],selectionBehavior:["type",Dw]};var QD=/^djs-cursor-.*$/;function uu(e){var t=Pt(document.body);t.removeMatching(QD),e&&t.add("djs-cursor-"+e)}function Lw(){uu(null)}var eL=5e3;function Iw(e,t){t=t||"element.click";function n(){return!1}return e.once(t,eL,n),function(){e.off(t,n)}}var tL=["c","C"],nL=["v","V"],iL=["d","D"],oL=["x","X"],rL=["y","Y"],Bw=["z","Z"];function aL(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ui(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function xn(e,t){return e=Ze(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function vh(e){return e.shiftKey}function sL(e){return ui(e)&&xn(tL,e)}function cL(e){return ui(e)&&xn(nL,e)}function lL(e){return ui(e)&&xn(iL,e)}function uL(e){return ui(e)&&xn(oL,e)}function pL(e){return ui(e)&&!vh(e)&&xn(Bw,e)}function dL(e){return ui(e)&&(xn(rL,e)||xn(Bw,e)&&vh(e))}var Fa=Math.round,Nw="djs-drag-active";function Yr(e){e.preventDefault()}function fL(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function hL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $w(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(v.x-E.left)/b.scale,y:b.y+(v.y-E.top)/b.scale}}function s(v,b){b=b||r;var E=e.createEvent(J({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(b.prefix+"."+v,E)}function c(v){var b=v.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function l(v,b){var E=r.payload,M=r.displacement,B=r.globalStart,P=Ur(v),k=Vi(P,B),N=r.localStart,G=a(P),q=Vi(G,N);if(!r.active&&(b||hL(k)>r.threshold)){if(J(E,{x:Fa(N.x+M.x),y:Fa(N.y+M.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&uu(r.cursor),t.addMarker(t.getRootElement(),Nw)}Zf(v),r.active&&(J(E,{x:Fa(G.x+M.x),y:Fa(G.y+M.y),dx:Fa(q.x),dy:Fa(q.y)},{originalEvent:v}),s("move"))}function u(v){var b,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Zf(v)),E=s("end")),E===!1&&s("rejected"),b=_(E!==!0),s("ended",b)}function p(v){xn("Escape",v)&&(Yr(v),y())}function d(v){var b;r.active&&(b=Iw(e),setTimeout(b,400),Yr(v)),u(v)}function f(v){l(v)}function m(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function g(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function y(v){var b;if(r){var E=r.active;E&&s("cancel"),b=_(v),E&&s("canceled",b)}}function _(v){var b,E;s("cleanup"),Lw(),r.trapClick?E=d:E=u,We.unbind(document,"mousemove",l),We.unbind(document,"dragstart",Yr),We.unbind(document,"selectstart",Yr),We.unbind(document,"mousedown",E,!0),We.unbind(document,"mouseup",E,!0),We.unbind(document,"keyup",p),We.unbind(document,"touchstart",f,!0),We.unbind(document,"touchcancel",y,!0),We.unbind(document,"touchmove",l,!0),We.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",g),t.removeMarker(t.getRootElement(),Nw);var M=r.payload.previousSelection;return v!==!1&&M&&!n.get().length&&c(M),b=r,r=null,b}function h(v,b,E,M){r&&y(!1),typeof b=="string"&&(M=E,E=b,b=null),M=J({},o,M||{});var B=M.data||{},P,k,N,G,q;if(M.trapClick?G=d:G=u,v?(P=Ba(v)||v,k=Ur(v),Zf(v),P.type==="dragstart"&&Yr(P)):(P=null,k={x:0,y:0}),N=a(k),b||(b=N),q=fL(P),r=J({prefix:E,data:B,payload:{},globalStart:k,displacement:Vi(b,N),localStart:N,isTouch:q},M),M.manual||(q?(We.bind(document,"touchstart",f,!0),We.bind(document,"touchcancel",y,!0),We.bind(document,"touchmove",l,!0),We.bind(document,"touchend",u,!0)):(We.bind(document,"mousemove",l),We.bind(document,"dragstart",Yr),We.bind(document,"selectstart",Yr),We.bind(document,"mousedown",G,!0),We.bind(document,"mouseup",G,!0)),We.bind(document,"keyup",p),e.on("element.hover",m),e.on("element.out",g)),s("init")===!1)return y(),!1;M.autoActivate&&l(v,!0)}e.on("diagram.destroy",y),this.init=h,this.move=l,this.hover=m,this.out=g,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){J(o,v)}}$w.$inject=["eventBus","canvas","selection","elementRegistry"];const To={__depends__:[XD,Ti],dragging:["type",$w]};function Kr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Kr.prototype.next=function(){return this._prefix+ ++this._counter};const gL=new Kr("ps");var mL=["marker-start","marker-mid","marker-end"],yL=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}cr.$inject=["elementRegistry","eventBus","canvas","styles"],cr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},cr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Yd(n);return this._cloneMarkers(tr(o),i),Le(o,this._styles.cls(i,[])),tt(t,o),Le(o,"data-preview-support-element-id",e.id),o},cr.prototype.addFrame=function(e,t){var n=je("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return tt(t,n),Le(n,"data-preview-support-element-id",e.id),n},cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),wL(e)&&mL.forEach(function(o){if(Le(e,o)){var r=vL(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},cr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,gL.next()].join("-"),a=Ct("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Yd(n);s.id=r,gt(s).add(o);var c=Ct(":scope > defs",e);c||(c=je("defs"),tt(e,c)),tt(c,s);var l=bL(s.id);Le(t,i,l)};function vL(e,t,n){var i=xL(Le(e,t));return Ct("marker#"+i,n||document)}function xL(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function bL(e){return"url(#"+e+")"}function wL(e){return yL.indexOf(e.nodeName)!==-1}const ja={__init__:["previewSupport"],previewSupport:["type",cr]};var _L="drop-ok",Fw="drop-not-ok",jw="attach-ok",Hw="new-parent",zw="create",EL=2e3;function Gw(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=dt(c,function(h){var v=h.labelTarget;return!h.parent&&!(lt(h)&&c.indexOf(v)!==-1)});var f=Ft(c,function(h){return!It(h)}),m=!1,g=!1,y=!1;Ww(c)&&(m=o.allowed("shape.attach",{position:u,shape:f,target:l})),m||(Ww(c)?y=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):y=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=d.connectionTarget;return y||m?(f&&p&&(g=o.allowed("connection.create",{source:_===p?f:p,target:_===p?p:f,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:g}):y===null||m===null?null:!1}function a(c,l){[jw,_L,Fw,Hw].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,d=l.source,f=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Vw(c);var m={x:c.x,y:c.y},g=l.canExecute=p&&r(u,p,m,d,f);p&&g!==null&&(l.target=p,g&&g.attach?a(p,jw):a(p,g?Hw:Fw))}),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,d=l.elements,f=l.target,m=l.canExecute,g=m&&m.attach,y=m&&m.connect,_=l.hints||{};if(m===!1||!f)return!1;Vw(c);var h={x:c.x,y:c.y};y?p=i.appendShape(u,p,h,f,{attach:g,connection:y===!0?{}:y,connectionTarget:_.connectionTarget}):(d=i.createElements(d,h,f,J({},_,{attach:g})),p=Ft(d,function(v){return!It(v)})),J(l,{elements:d,shape:p}),J(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===zw&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],EL,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ze(l)||(l=[l]);var p=Ft(l,function(m){return!It(m)});if(p){u=J({elements:l,hints:{},shape:p},u||{}),W(l,function(m){Je(m.x)||(m.x=0),Je(m.y)||(m.y=0)});var d=dt(l,function(m){return!m.hidden}),f=ln(d);W(l,function(m){It(m)&&(m.waypoints=Hn(m.waypoints,function(g){return{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2}})),J(m,{x:m.x-f.x-f.width/2,y:m.y-f.y-f.height/2})}),t.init(c,zw,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Gw.$inject=["canvas","dragging","eventBus","modeling","rules"];function Vw(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 Ww(e){return e&&e.length===1&&!It(e[0])}var SL=750;function Uw(e,t,n,i,o){function r(a){var s=je("g");Le(s,o.cls("djs-drag-group",["no-events"]));var c=je("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(tr(u),l)):(u=n._createContainer("shape",c),n.drawShape(tr(u),l),Nn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",SL,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(),tt(p,u)),Nn(u,a.x,a.y)):cn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&cn(c)})}Uw.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const pu={__depends__:[To,ja,co,Ti],__init__:["create","createPreview"],create:["type",Gw],createPreview:["type",Uw]};function xh(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)})}xh.$inject=["eventBus"],xh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||RL(0,0)};function RL(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 Xs={__init__:["mouse"],mouse:["type",xh]};var qw=2e3;function pi(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),ML(u)&&(l.priority=2,l.host=u.host.id),It(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=CL(u)),lt(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),W(["x","y","width","height"],function(d){Je(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",qw,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",qw,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;J(l,{createElementsBehavior:!1})})}pi.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],pi.prototype.copy=function(e,t={}){var n,i;return Ze(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ze(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},pi.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})}}},pi.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},pi.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},pi.prototype._getElementIdsFromTree=function(e){var t={};return W(e,function(n){W(n,function(i){i.id&&(t[i.id]=!0)})}),t},pi.prototype._paste=function(e,t,n,i){W(e,function(r){Je(r.x)||(r.x=0),Je(r.y)||(r.y=0)});var o=ln(e);return W(e,function(r){It(r)&&(r.waypoints=Hn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),J(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,J({},i))},pi.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return W(e,function(r,a){r=Xi(r,"priority"),W(r,function(s){var c=J({},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(It(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(lt(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},pi.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Zi(e,["id"]));return t},pi.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Zi(e,["id"]));return t},pi.prototype.createShape=function(e){var t=this._elementFactory.createShape(Zi(e,["id"]));return t},pi.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(It(e)&&(!n.has(e.source)||!n.has(e.target))||lt(e)&&!n.has(e.labelTarget))},pi.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=El(e);function s(p,d){return t.allowed("element.copy",{element:p,elements:d})}function c(p,d){var f=r.get(p);if(!f){var m={element:p,depth:d};o.push(m),r.set(p,m);return}if(f.depth<d){o=l(f,o);var g={element:f.element,depth:d};o.push(g),r.set(p,g)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}zr(a,function(p,d,f){if(lt(p))return;W(p.labels,function(y){c(y,f)});function m(y){y&&y.length&&W(y,function(_){W(_.labels,function(h){c(h,f)}),c(_,f)})}W([p.attachers,p.incoming,p.outgoing],m),c(p,f);var g=[];return p.children&&(g=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:g}),g}),e=Hn(o,function(p){return p.element});var u=new Set(e);return o=Hn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Xi(o,function(p){return p.descriptor.priority}),e=Hn(o,function(p){return p.element}),W(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){Kw(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Kw(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function ML(e){return!!e.host}function CL(e){return Hn(e.waypoints,function(t){return t=Yw(t),t.original&&(t.original=Yw(t.original)),t})}function Yw(e){return J({},e)}function Kw(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const AL={__depends__:[YD,pu,Xs,co],__init__:["copyPaste"],copyPaste:["type",pi]};function bh(e,t,n){Ze(n)||(n=[n]),W(n,function(i){Pr(e[i])||(t[i]=e[i])})}var wh=750;function Xw(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",wh,function(c){var l=c.descriptor,u=c.element,p=we(u);if(lt(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(vt(u),!0);f.bpmnElement=d,bh(d,l,"name"),bh(f,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=we(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(we(c).attachedToRef=we(l[c.host])),Zi(u,ri(u,function(d,f,m){var g=f.element,y=f.property;return m===c.id&&(g.set(y,p),d.push(c.id)),d},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,d=u.di;if(lt(u)){u.businessObject=we(l[u.labelTarget]),u.di=vt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,bh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",wh,function(c){var l=c.descriptor,u=c.element;if(A(u,"bpmn:Participant")){var p=we(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;A(l,"bpmn:SubProcess")&&W(Ns(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",wh,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Xw.$inject=["bpmnFactory","eventBus","moddleCopy"];const TL=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],PL=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Zs(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 Xi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=yn(o)&&o.$descriptor;if(a&&PL.includes(a))return r;if(a&&TL.includes(a)||a&&s&&!Ft(s.properties,ga({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(A(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Zs.$inject=["eventBus","bpmnFactory","moddle"],Zs.prototype.copyElement=function(e,t,n,i=!1){n&&!Ze(n)&&(n=[n]),n=n||_h(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Ze(o)&&(n=o),W(n,r=>{let a;oi(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!mn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Zs.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 yn(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):Ze(e)?ri(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):yn(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},Zs.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 _h(e,t){return ri(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Zw={__depends__:[AL],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Xw],moddleCopy:["type",Zs]};var Jw=Math.round;function Eh(e,t){this._modeling=e,this._eventBus=t}Eh.$inject=["modeling","eventBus"],Eh.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=Jw(s+r/2),u=Jw(c+a/2),p=i.replaceShape(e,J({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Qw(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Qw.$inject=["selection","eventBus"];const kL={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Qw],replace:["type",Eh]};function OL(e,t,n){Ze(n)||(n=[n]),W(n,function(i){Pr(e[i])||(t[i]=e[i])})}var DL=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function LL(e,t){var n=e&&oi(e,"collapsed")?e.collapsed:!mt(e),i;return t&&(oi(t,"collapsed")||oi(t,"isExpanded"))?i=oi(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function e_(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(du(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&LL(s,c))return i.toggleCollapse(s),s;var d=e.create(u),f={type:u,businessObject:d};f.di={},u==="bpmn:ExclusiveGateway"&&(f.di.isMarkerVisible=!0),OL(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var m=_h(p.$descriptor),g=_h(d.$descriptor,!0),y=IL(m,g);J(d,Fi(c,DL));var _=dt(y,function(b){return b==="eventDefinitions"?t_(s,c.eventDefinitionType):b==="loopCharacteristics"?!Wn(d):oi(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Wn(d):!0});if(d=n.copyElement(p,d,_),c.eventDefinitionType&&(t_(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(du(p))f.isExpanded=mt(s);else if(c&&oi(c,"isExpanded")){f.isExpanded=c.isExpanded;var h=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=h.width,f.height=h.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}mt(s)&&!A(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(du(p)&&!du(d)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=_n(s);vt(s).isHorizontal||(vt(f).isHorizontal=v),f.width=v?s.width:t.getDefaultSize(f).width,f.height=v?t.getDefaultSize(f).height:s.height}return r.allowed("shape.resize",{shape:d})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),d.name=p.name,pt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&pt(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!A(p,"bpmn:BoundaryEvent")&&A(d,"bpmn:BoundaryEvent")&&(f.host=c.host),(f.type==="bpmn:DataStoreReference"||f.type==="bpmn:DataObjectReference")&&(f.x=s.x+(s.width-f.width)/2),o.replaceElement(s,f,{...l,targetElement:c})}this.replaceElement=a}e_.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function du(e){return A(e,"bpmn:SubProcess")}function t_(e,t){var n=we(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function IL(e,t){return e.filter(function(n){return t.includes(n)})}const n_={__depends__:[Zw,kL,Ti],bpmnReplace:["type",e_]};var BL=250;function Xr(e){this._eventBus=e,this._tools=[],this._active=null}Xr.$inject=["eventBus"],Xr.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)},Xr.prototype.isActive=function(e){return e&&this._active===e},Xr.prototype.length=function(e){return this._tools.length},Xr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Xr.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),W(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,BL,function(o){this._active&&(NL(o)||this.setActive(null))},this)};function NL(e){var t=e.originalEvent&&e.originalEvent.target;return t&&jr(t,'.group[data-group="tools"]')}const fu={__depends__:[To],__init__:["toolManager"],toolManager:["type",Xr]};function $L(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 FL(e,t){var n=[],i=new Set(e);W(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;W(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 jL(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 Sh=Math.abs,HL=Math.round,Po={x:"width",y:"height"},i_="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},zL=1500,hu={n:"s",w:"e",s:"n",e:"w"},gu=20;function Pi(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",zL,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&r_(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,m=l.start;if(l.initialized){r_(c);var g={x:0,y:0};g[u]=HL(c["d"+u]),s.makeSpace(d,f,g,p,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Pi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Pi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:i_,data:{context:{reactivate:n}},trapClick:!1})},Pi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:i_,data:{context:{}}})},Pi.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Pi.prototype.init=function(e,t){var n=Sh(e.dx)>Sh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Sh(i)<5)return!1;i<0&&(i*=-1),qs(e)&&(i*=-1);var r=$L(n,i),a=this._canvas.getRootElement();!nu(e)&&e.hover&&(a=e.hover);var s=[...ks(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=GL(c,n,r,o,l);return J(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),uu("resize-"+(n==="x"?"ew":"ns")),!0},Pi.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(f){s.has(f)||(s.add(f),r.push(f));var m=f.label;m&&!s.has(m)&&(s.add(m),r.push(m))}function d(f){c.has(f)||(c.add(f),a.push(f))}return W(e,function(f){if(!(!f.parent||lt(f))){if(It(f)){u.push(f);return}var m=f[t],g=m+f[Po[t]];if(VL(f)&&(n>0&&Qe(f)[t]>i||n<0&&Qe(f)[t]<i)){l.push(f);return}if(n>0&&m>i||n<0&&g<i){p(f);return}if(m<i&&g>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),W(r,function(f){var m=f.attachers;m&&W(m,function(g){p(g)})}),W(l,function(f){var m=f.host;(s.has(m)||c.has(m))&&p(f)}),W(u,function(f){var m=f.source,g=f.target,y=f.label;(s.has(m)||c.has(m))&&(s.has(g)||c.has(g))&&y&&p(y)}),{movingShapes:r,resizingShapes:a}},Pi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Pi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function o_(e){return{top:e.top-gu,right:e.right+gu,bottom:e.bottom+gu,left:e.left-gu}}function r_(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Je(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Je(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Je(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Je(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function GL(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 W(a,function(d){var f=d.attachers,m=d.children,g=qe(d),y=dt(m,function(q){return!It(q)&&!lt(q)&&!u.has(q)&&!p.has(q)}),_=dt(m,function(q){return!It(q)&&!lt(q)&&u.has(q)}),h,v,b,E=[],M=[],B,P,k,N;y.length&&(v=o_(qe(ln(y))),h=i-g[lr[n]]+v[lr[n]],n==="n"?s.bottom=l=Je(l)?Math.min(l,h):h:n==="w"?s.right=l=Je(l)?Math.min(l,h):h:n==="s"?s.top=c=Je(c)?Math.max(c,h):h:n==="e"&&(s.left=c=Je(c)?Math.max(c,h):h)),_.length&&(b=o_(qe(ln(_))),h=i-b[lr[hu[n]]]+g[lr[hu[n]]],n==="n"?s.bottom=l=Je(l)?Math.min(l,h):h:n==="w"?s.right=l=Je(l)?Math.min(l,h):h:n==="s"?s.top=c=Je(c)?Math.max(c,h):h:n==="e"&&(s.left=c=Je(c)?Math.max(c,h):h)),f&&f.length&&(f.forEach(function(q){u.has(q)?E.push(q):M.push(q)}),E.length&&(B=qe(ln(E.map(Qe))),P=g[lr[hu[n]]]-(B[lr[hu[n]]]-i)),M.length&&(k=qe(ln(M.map(Qe))),N=k[lr[n]]-(g[lr[n]]-i)),n==="n"?(h=Math.min(P||1/0,N||1/0),s.bottom=l=Je(l)?Math.min(l,h):h):n==="w"?(h=Math.min(P||1/0,N||1/0),s.right=l=Je(l)?Math.min(l,h):h):n==="s"?(h=Math.max(P||-1/0,N||-1/0),s.top=c=Je(c)?Math.max(c,h):h):n==="e"&&(h=Math.max(P||-1/0,N||-1/0),s.left=c=Je(c)?Math.max(c,h):h));var G=o&&o[d.id];G&&(n==="n"?(h=i+d[Po[t]]-G[Po[t]],s.bottom=l=Je(l)?Math.min(l,h):h):n==="w"?(h=i+d[Po[t]]-G[Po[t]],s.right=l=Je(l)?Math.min(l,h):h):n==="s"?(h=i-d[Po[t]]+G[Po[t]],s.top=c=Je(c)?Math.max(c,h):h):n==="e"&&(h=i-d[Po[t]]+G[Po[t]],s.left=c=Je(c)?Math.max(c,h):h))}),s}}function VL(e){return!!e.host}var Rh="djs-dragging",a_="djs-resizing",WL=250,mu=Math.max;function s_(e,t,n,i,o){function r(a,s){W(a,function(c){o.addDragger(c,s),n.addMarker(c,Rh)})}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=je("g");Le(u,i.cls("djs-crosshair-group",["no-events"])),tt(s,u);var p=je("path");Le(p,"d",l.x),gt(p).add("djs-crosshair"),tt(u,p);var d=je("path");Le(d,"d",l.y),gt(d).add("djs-crosshair"),tt(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Nn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&cn(c)}),e.on("spaceTool.move",WL,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 d=n.getLayer("space");c=je("path"),Le(c,"d","M0,0 L0,0"),gt(c).add("djs-crosshair"),tt(d,c),s.line=c;var f=je("g");Le(f,i.cls("djs-drag-group",["no-events"])),tt(n.getActiveLayer(),f),r(u,f);var m=new Set(u);W(p,function(M){m.add(M)});var g=new Set,y=s.movingConnections=[];m.forEach(function(M){W(M.outgoing,function(B){g.has(B)||!It(B)||!m.has(B.target)||(g.add(B),y.push(B))})}),r(y,f),s.dragGroup=f}if(!s.frameGroup){var _=je("g");Le(_,i.cls("djs-frame-group",["no-events"])),tt(n.getActiveLayer(),_);var h=[];W(p,function(M){var B=o.addFrame(M,_),P=B.getBBox();h.push({element:B,initialBounds:P}),n.addMarker(M,a_)}),s.frameGroup=_,s.frames=h}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Le(c,{d:v[l]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[s.axis]]=0,Nn(s.dragGroup,E.x,E.y),W(s.frames,function(M){var B=M.element,P=M.initialBounds,k,N;s.direction==="e"?Le(B,{width:mu(P.width+E.x,5)}):(k=mu(P.width-E.x,5),Le(B,{width:k,x:P.x+P.width-k})),s.direction==="s"?Le(B,{height:mu(P.height+E.y,5)}):(N=mu(P.height-E.y,5),Le(B,{height:N,y:P.y+P.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,d=s.dragGroup,f=s.frameGroup;W(c,function(m){n.removeMarker(m,Rh)}),W(l,function(m){n.removeMarker(m,Rh)}),d&&(cn(p),cn(d)),W(u,function(m){n.removeMarker(m,a_)}),f&&cn(f)})}s_.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const UL={__init__:["spaceToolPreview"],__depends__:[To,co,fu,ja,Xs],spaceTool:["type",Pi],spaceToolPreview:["type",s_]};function yu(e,t){e.invoke(Pi,this),this._canvas=t}yu.$inject=["injector","canvas"],Ne(yu,Pi),yu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=fa(Sa(o.children.filter(l=>A(l,"bpmn:Artifact")),ln(r))));const s=[...e,...a];var c=Pi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(A(l,"bpmn:TextAnnotation")||qL(l)&&(t==="y"&&_n(l)||t==="x"&&!_n(l)))}),c};function qL(e){return A(e,"bpmn:Participant")&&!we(e).processRef}const c_={__depends__:[UL],spaceTool:["type",yu]};function Kt(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)}Kt.$inject=["eventBus","injector"],Kt.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()},Kt.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},Kt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Kt.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()}},Kt.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()}},Kt.prototype.register=function(e,t){this._setHandler(e,t)},Kt.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)},Kt.prototype.canUndo=function(){return!!this._getUndoAction()},Kt.prototype.canRedo=function(){return!!this._getRedoAction()},Kt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Kt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Kt.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)})},Kt.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},Kt.prototype._createId=function(){return this._uid++},Kt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Kt.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()},Kt.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)},Kt.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)},Kt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ze(e)?e:[e],t.dirty=t.dirty.concat(e))},Kt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Kt.prototype._revertedAction=function(e){this._stackIdx--},Kt.prototype._getHandler=function(e){return this._handlerMap[e]},Kt.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 YL={commandStack:["type",Kt]};function ur(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 KL=250,l_=1400;function Mh(e,t,n){be.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",l_,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=u_(a),r.validatedShapes=u_(s)}),i&&t.on("shape.move.start",KL,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",l_,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];W(s,function(l){W(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;ur(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=rf(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&&(rn(s.labels,a,c),a.labelTarget=s)})}Ne(Mh,be),Mh.$inject=["injector","eventBus","modeling"];function u_(e){var t=new Set(e);return dt(e,function(n){return!t.has(n.labelTarget)})}const XL={__init__:["labelSupport"],labelSupport:["type",Mh]};var ZL=251,p_=1401,d_="attach-ok";function Ch(e,t,n,i,o){be.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",p_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=JL(c),s.validatedShapes=QL(l)}),r&&t.on("shape.move.start",ZL,function(a){var s=a.context,c=s.shapes,l=Ah(c);W(l,function(u){r.makeDraggable(s,u,!0),W(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,d_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,d_)}))}}),this.preExecuted("elements.move",p_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Ah(l);W(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=dt(c,function(p){var d=p.host;return eI(p)&&!tI(c,d)}),W(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;W(s,function(c){W(c.attachers,function(l){W(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),W(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;ur(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&&W(l.attachers,function(u){var p=Pb(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,d=s.hints||{};d.attachSupport!==!1&&W(p,function(f){var m=Pb(f,l,u);o.moveShape(f,m,f.parent),W(f.labels,function(g){o.moveShape(g,m,g.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ur(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ne(Ch,be),Ch.$inject=["injector","eventBus","canvas","rules","modeling"];function Ah(e){return Hp(Hn(e,function(t){return t.attachers||[]}))}function JL(e){var t=Ah(e);return OR("id",e,t)}function QL(e){var t=ha(e,"id");return dt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function eI(e){return!!e.host}function tI(e,t){return e.indexOf(t)!==-1}const nI={__depends__:[co],__init__:["attachSupport"],attachSupport:["type",Ch]};function f_(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(ix(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)})}f_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Th={__init__:["changeSupport"],changeSupport:["type",f_]};function ki(e){this._model=e}ki.$inject=["moddle"],ki.prototype._needsId=function(e){return pt(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"])},ki.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;A(e,"bpmn:Activity")?t="Activity":A(e,"bpmn:Event")?t="Event":A(e,"bpmn:Gateway")?t="Gateway":pt(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))},ki.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ki.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ki.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",J({bpmnElement:e,bounds:this.createDiBounds()},t))},ki.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ki.prototype.createDiWaypoints=function(e){var t=this;return Hn(e,function(n){return t.createDiWaypoint(n)})},ki.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Fi(e,["x","y"]))},ki.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",J({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ki.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",J({bpmnElement:e},t))};function di(e,t,n){be.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var m=f.context,g=m.hints||{},y;!m.cropped&&g.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var m=f.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(f){var m=f.context,g=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(g,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fi(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fi(a));function s(f){var m=f.context,g=m.oldRoot,y=g.children;W(y,function(_){A(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var m=f.context.shape;A(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],fi(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],fi(function(f){f.context.shape.type!=="label"&&c(f)})),e.on("shape.changed",function(f){f.element.type==="label"&&c({context:{shape:f.element}})});function l(f){i.updateConnection(f.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],fi(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],fi(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],fi(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],fi(u)),this.executed("connection.reconnect",fi(function(f){var m=f.context,g=m.connection,y=m.oldSource,_=m.newSource,h=we(g),v=we(y),b=we(_);h.conditionExpression&&!pt(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=h.conditionExpression,delete h.conditionExpression),y!==_&&v.default===h&&(m.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",fi(function(f){var m=f.context,g=m.connection,y=m.oldSource,_=m.newSource,h=we(g),v=we(y),b=we(_);m.oldConditionExpression&&(h.conditionExpression=m.oldConditionExpression),m.oldDefault&&(v.default=m.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],fi(p)),this.reverted(["element.updateAttachment"],fi(p)),this.executed("element.updateLabel",fi(d)),this.reverted("element.updateLabel",fi(d));function d(f){const{element:m}=f.context,g=ci(m),y=vt(m),_=y&&y.get("label");ir(m)||iu(m)||(g&&!_?y.set("label",t.create("bpmndi:BPMNLabel")):!g&&_&&y.set("label",void 0))}}Ne(di,be),di.$inject=["eventBus","bpmnFactory","connectionDocking"],di.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},di.prototype.updateParent=function(e,t){if(!lt(e)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=vt(e),r=n&&n.businessObject,a=vt(n);A(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),A(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),A(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),A(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},di.prototype.updateBounds=function(e){var t=vt(e),n=oI(e);if(n){var i=Vi(n,t.get("bounds"));J(n,{x:e.x+i.x,y:e.y+i.y})}var o=lt(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),J(r,{x:e.x,y:e.y,width:e.width,height:e.height})},di.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),nn(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),rn(o,e))}},di.prototype.updateDiConnection=function(e,t,n){var i=vt(e),o=vt(t),r=vt(n);i.sourceElement&&i.sourceElement.bpmnElement!==we(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==we(n)&&(i.targetElement=n&&r)},di.prototype.updateDiParent=function(e,t){if(t&&!A(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(nn(n,e),e.$parent=null)}};function iI(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}di.prototype.getLaneSet=function(e){var t,n;return A(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(A(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)},di.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))&&(A(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(A(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(A(e,"bpmn:FlowElement")){if(t){if(A(t,"bpmn:Participant"))t=t.processRef;else if(A(t,"bpmn:Lane"))do t=t.$parent.$parent;while(A(t,"bpmn:Lane"))}i="flowElements"}else if(A(e,"bpmn:Artifact")){for(;t&&!A(t,"bpmn:Process")&&!A(t,"bpmn:SubProcess")&&!A(t,"bpmn:Collaboration");)if(A(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(A(e,"bpmn:MessageFlow"))i="messageFlows";else if(A(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=iI(e.$parent||t),e.$parent&&(nn(r.get("rootElements"),o),o.$parent=null),t&&(rn(r.get("rootElements"),o),o.$parent=r))}else A(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":A(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),nn(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);nn(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},di.prototype.updateConnectionWaypoints=function(e){var t=vt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},di.prototype.updateConnection=function(e){var t=e.connection,n=we(t),i=t.source,o=we(i),r=t.target,a=we(t.target),s;if(A(n,"bpmn:DataAssociation"))A(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):A(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=A(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(nn(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(nn(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)},di.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function fi(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;A(i,"bpmn:BaseElement")&&e(t)}}function oI(e){if(A(e,"bpmn:Activity")){var t=vt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function pr(e,t){Ro.call(this),this._bpmnFactory=e,this._moddle=t}Ne(pr,Ro),pr.$inject=["bpmnFactory","moddle"],pr.prototype._baseCreate=Ro.prototype.create,pr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,J({type:"label",di:n},Vr,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=J({},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(!aI(o)){var r=J({},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)}A(i,"bpmn:Group")&&(t=J({isFrame:!0},t)),t=rI(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ph(o,t,"isExpanded")),pt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ph(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!mt(i,o)),A(i,"bpmn:ExclusiveGateway")&&(oi(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),mn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),mn(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=J({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},pr.prototype.getDefaultSize=function(e,t){var n=we(e);if(t=t||vt(e),A(n,"bpmn:SubProcess"))return mt(n,t)?{width:350,height:200}:{width:100,height:80};if(A(n,"bpmn:Task"))return{width:100,height:80};if(A(n,"bpmn:Gateway"))return{width:50,height:50};if(A(n,"bpmn:Event"))return{width:36,height:36};if(A(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return mt(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return A(n,"bpmn:Lane")?{width:400,height:100}:A(n,"bpmn:DataObjectReference")?{width:36,height:50}:A(n,"bpmn:DataStoreReference")?{width:50,height:50}:A(n,"bpmn:TextAnnotation")?{width:100,height:40}:A(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},pr.prototype.createParticipantShape=function(e){return yn(e)||(e={isExpanded:e}),e=J({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function rI(e,t,n){return W(n,function(i){t=Ph(e,t,i)}),t}function Ph(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Zi(t,[n]))}function aI(e){return pt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function vu(e,t){this._modeling=e,this._canvas=t}vu.$inject=["modeling","canvas"],vu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;W(n,function(o){var r={x:0,y:0};mn(i.left)?r.x=i.left-o.x:mn(i.right)?r.x=i.right-o.width-o.x:mn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:mn(i.top)?r.y=i.top-o.y:mn(i.bottom)?r.y=i.bottom-o.height-o.y:mn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},vu.prototype.postExecute=function(e){};function xu(e){this._modeling=e}xu.$inject=["modeling"],xu.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},xu.prototype.postExecute=function(e){var t=e.hints||{};sI(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 sI(e,t){return zo(e.outgoing,function(n){return n.target===t})}function bu(e,t){this._canvas=e,this._layouter=t}bu.$inject=["canvas","layouter"],bu.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},bu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var wu=Math.round;function kh(e){this._modeling=e}kh.$inject=["modeling"],kh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;W(t,function(p){Je(p.x)||(p.x=0),Je(p.y)||(p.y=0)});var s=dt(t,function(p){return!p.hidden}),c=ln(s);W(t,function(p){It(p)&&(p.waypoints=Hn(p.waypoints,function(d){return{x:wu(d.x-c.x-c.width/2+o.x),y:wu(d.y-c.y-c.height/2+o.y)}})),J(p,{x:wu(p.x-c.x-c.width/2+o.x),y:wu(p.y-c.y-c.height/2+o.y)})});var l=new Set(El(t)),u={};W(t,function(p){if(It(p)){u[p.id]=Je(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 d=J({},r);l.has(p)||(d.autoResize=!1),lt(p)&&(d=Zi(d,["attach"])),u[p.id]=Je(i)?a.createShape(p,Fi(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,Fi(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=fa(u)};var h_=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?J(t,n):J(t,{x:n.x-h_(t.width/2),y:n.y-h_(t.height/2)}),this._canvas.addShape(t,i,o),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Js(e){dr.call(this,e)}Ne(Js,dr),Js.$inject=["canvas"];var cI=dr.prototype.execute;Js.prototype.execute=function(e){var t=e.shape;return uI(t),t.labelTarget=e.labelTarget,cI.call(this,e)};var lI=dr.prototype.revert;Js.prototype.revert=function(e){return e.shape.labelTarget=null,lI.call(this,e)};function uI(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Qs(e,t){this._canvas=e,this._modeling=t}Qs.$inject=["canvas","modeling"],Qs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Qs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=rf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Qs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,rn(n.children,t,i),this._canvas.addConnection(t,n),t};function Oh(e,t){this._modeling=e,this._elementRegistry=t}Oh.$inject=["modeling","elementRegistry"],Oh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;W(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function ec(e,t){this._canvas=e,this._modeling=t}ec.$inject=["canvas","modeling"],ec.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ur(n.children,function(i){It(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ec.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=rf(i.children,n),t.removeShape(n),n},ec.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return rn(i.children,n,o),t.addShape(n,i),n};function _u(e){this._modeling=e}_u.$inject=["modeling"];var g_={x:"y",y:"x"};_u.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 h={y:0};h[i]=y-a(_),h[i]&&(h[g_[i]]=0,t.moveElements([_],h,_.parent))}var u=n[0],p=s(n),d=n[p],f,m,g=0;W(n,function(y,_){var h,v,b;if(y.elements.length<2){_&&_!==n.length-1&&(r(y,y.elements[0]),g+=c(y.range));return}h=Xi(y.elements,i),v=h[0],_===p&&(v=h[s(h)]),b=a(v),y.range=null,W(h,function(E){if(l(b,E),y.range===null){y.range={min:E[i],max:E[i]+E[o]};return}r(y,E)}),_&&_!==n.length-1&&(g+=c(y.range))}),m=Math.abs(d.range.min-u.range.max),f=Math.round((m-g)/(n.length-1)),!(f<n.length-1)&&W(n,function(y,_){var h={},v;y===u||y===d||(v=n[_-1],y.range.max=0,W(y.elements,function(b,E){h[g_[i]]=0,h[i]=v.range.max-b[i]+f,y.range.min!==b[i]&&(h[i]+=b[i]-y.range.min),h[i]&&t.moveElements([b],h,b.parent),y.range.max=Math.max(b[i]+b[o],E?y.range.max:0)}))})},_u.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 J(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 Dh(){}Dh.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=nn(r.children,t),rn(i.children,t,o),t.parent=i,W(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},Dh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return nn(n.children,t),rn(i.children,t,o),t.parent=i,W(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 Lh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Lh.prototype.add=function(e,t){return this.addAll([e],t)},Lh.prototype.addAll=function(e,t){var n=zP(e,!!t,this);return J(this,n),this};function tc(e){this._modeling=e}tc.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},tc.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),W(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),W(s,function(p){var d=!!a[p.source.id],f=!!a[p.target.id];c[p.id]&&d&&f?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:d&&Hf(p,p.source,t),connectionEnd:f&&zf(p,p.target,t)})})},tc.prototype.getClosure=function(e){return new Lh().addAll(e,!0)};function Su(e){this._helper=new tc(e)}Su.$inject=["modeling"],Su.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Su.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Zr(e){this._modeling=e,this._helper=new tc(e)}Zr.$inject=["modeling"],Zr.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=Fi(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=nn(r.children,t),rn(i.children,t,o),J(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(W(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:zf(r,t,n)})}),W(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Hf(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return rn(n.children,t,i),J(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function nc(e){this._modeling=e}nc.$inject=["modeling"],nc.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 Ze(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},nc.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||m_(Ze(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||m_(Ze(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},nc.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 m_(e){return e.original||e}function ko(e,t){this._modeling=e,this._rules=t}ko.$inject=["modeling","rules"],ko.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(m,g,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:g})}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 d=o.incoming.slice(),f=o.outgoing.slice();W(d,function(m){var g=m.source,y=c(g,s,m);y&&t.reconnectEnd(m,s,Zl(m,s,u),a)}),W(f,function(m){var g=m.target,y=c(s,g,m);y&&t.reconnectStart(m,s,Xl(m,s,u),a)})},ko.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ko.prototype.execute=function(e){},ko.prototype.revert=function(e){},ko.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ko.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ko.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ic(e){this._modeling=e}ic.$inject=["modeling"],ic.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},J(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ic.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(W(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Zl(r,n,i)})}),W(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Xl(r,n,i)})}))},ic.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return J(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function fr(e){this._modeling=e}fr.$inject=["modeling"],fr.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),W(o,function(s){a[s.id]=dI(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(FL(i,o),t,n,r,i,o,a)},fr.prototype.execute=function(){},fr.prototype.revert=function(){},fr.prototype.moveShapes=function(e,t){var n=this;W(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},fr.prototype.resizeShapes=function(e,t,n){var i=this;W(e,function(o){var r=jL(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},fr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);W(e,function(u){var p=u.source,d=u.target,f=pI(u),m=v_(n),g={},y=c.has(p)||l.has(p),_=c.has(d)||l.has(d);y&&_?(f=Hn(f,function(h){return x_(h,i,n)&&(h[m]=h[m]+t[m]),h.original&&x_(h.original,i,n)&&(h.original[m]=h.original[m]+t[m]),h}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(y||_)&&(c.has(p)?g.connectionStart=Hf(u,p,t):c.has(d)?g.connectionEnd=zf(u,d,t):l.has(p)?g.connectionStart=Xl(u,p,a[p.id]):l.has(d)&&(g.connectionEnd=Zl(u,d,a[d.id])),s._modeling.layoutConnection(u,g))})};function y_(e){return J({},e)}function pI(e){return Hn(e.waypoints,function(t){return t=y_(t),t.original&&(t.original=y_(t.original)),t})}function v_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function x_(e,t,n){var i=v_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function dI(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ru(e){this._modeling=e}Ru.$inject=["modeling"],Ru.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=b_(n),t.collapsed=!t.collapsed;var i=w_(n,t.collapsed);return[t].concat(i)},Ru.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=__(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function b_(e){var t={};return W(e,function(n){t[n.id]=n.hidden,n.children&&(t=J({},t,b_(n.children)))}),t}function w_(e,t){var n=[];return W(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(w_(i.children,i.collapsed||t)))}),n}function __(e,t){var n=[];return W(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(__(i.children,t)))}),n}function Mu(e){this._modeling=e}Mu.$inject=["modeling"],Mu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=E_(i,t),S_(n,t),t.host=n,t},Mu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,E_(n,t),S_(i,t,o),t};function E_(e,t){return nn(e&&e.attachers,t)}function S_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),rn(i,t,n)}}function Ih(){}Ih.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Ih.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Bt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Bt.$inject=["eventBus","elementFactory","commandStack"],Bt.prototype.getHandlers=function(){return{"shape.append":xu,"shape.create":dr,"shape.delete":ec,"shape.move":Zr,"shape.resize":ic,"shape.replace":ko,"shape.toggleCollapse":Ru,spaceTool:fr,"label.create":Js,"connection.create":bu,"connection.delete":Qs,"connection.move":Dh,"connection.layout":Eu,"connection.updateWaypoints":Ih,"connection.reconnect":nc,"elements.create":kh,"elements.move":Su,"elements.delete":Oh,"elements.distribute":_u,"elements.align":vu,"element.updateAttachment":Mu}},Bt.prototype.registerHandlers=function(e){W(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Bt.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)},Bt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Bt.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)},Bt.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)},Bt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Bt.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},Bt.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},Bt.prototype.createElements=function(e,t,n,i,o){Ze(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},Bt.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},Bt.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},Bt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Bt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Bt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Bt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Bt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Bt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Bt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Bt.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)},Bt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Bt.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)},Bt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,J(i,{docking:"source"}))},Bt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,J(i,{docking:"target"}))},Bt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Bt.prototype._create=function(e,t){return C2(t)?t:this._elementFactory.create(e,t)},Bt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function oc(e){this._elementRegistry=e}oc.$inject=["elementRegistry"],oc.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||fI(n,zc(i));return R_(n,i),e.oldProperties=r,e.changed=o,o},oc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return R_(n,t),i},oc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?hI(e,t):[]};function fI(e,t){return ri(t,function(n,i){return n[i]=e.get(i),n},{})}function R_(e,t){W(t,function(n,i){e.set(i,n)})}function hI(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&we(n).dataObjectRef===e})}var rc="default",Oo="id",M_="di",gI={width:0,height:0};function ac(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ac.$inject=["elementRegistry","moddle","modeling","textRenderer"],ac.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=bI(e.properties),s=e.oldProperties||mI(t,a);return C_(a,r)&&(o.unclaim(r[Oo]),i.updateId(t,a[Oo]),o.claim(a[Oo],r)),rc in a&&(a[rc]&&n.push(i.get(a[rc].id)),r[rc]&&n.push(i.get(r[rc].id))),A_(t,a),e.oldProperties=s,e.changed=n,n},ac.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&we(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,gI)}},ac.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 A_(t,i),C_(n,o)&&(a.unclaim(n[Oo]),r.updateId(t,i[Oo]),a.claim(i[Oo],o)),e.changed};function C_(e,t){return Oo in e&&e[Oo]!==t[Oo]}function mI(e,t){var n=zc(t),i=e.businessObject,o=vt(e);return ri(n,function(r,a){return a!==M_?r[a]=i.get(a):r[a]=yI(o,zc(t.di)),r},{})}function yI(e,t){return ri(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function A_(e,t){var n=e.businessObject,i=vt(e);W(t,function(o,r){r!==M_?n.set(r,o):i&&vI(i,o)})}function vI(e,t){W(t,function(n,i){e.set(i,n)})}var xI=["default"];function bI(e){var t=J({},e);return xI.forEach(function(n){n in e&&(t[n]=we(t[n]))}),t}function Cu(e,t){this._canvas=e,this._modeling=t}Cu.$inject=["canvas","modeling"],Cu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=vt(o);return t.setRootElement(n),t.removeRootElement(o),rn(a.rootElements,i),i.$parent=a,nn(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},Cu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=vt(n);return t.setRootElement(o),t.removeRootElement(n),nn(a.rootElements,i),i.$parent=null,rn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function Bh(e,t){this._modeling=e,this._spaceTool=t}Bh.$inject=["modeling","spaceTool"],Bh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ci(i),a=r===i,s=a?i:i.parent,c=rr(s),l=_n(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+Mi,y:i.y,width:i.width-Mi,height:i.height}:{x:i.x,y:i.y+Mi,width:i.width,height:i.height-Mi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];zr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:dt(b.children,function(E){return E!==i})});var d,f,m,g,y;o==="top"?(d=-120,f=i.y,m=f+10,g="n",y="y"):o==="left"?(d=-120,f=i.x,m=f+10,g="w",y="x"):o==="bottom"?(d=120,f=i.y+i.height,m=f-10,g="s",y="y"):o==="right"&&(d=120,f=i.x+i.width,m=f-10,g="e",y="x");var _=t.calculateAdjustments(p,y,d,m),h=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,h,g,m);var v=l?{x:i.x+(a?Mi:0),y:f-(o==="top"?120:0),width:i.width-(a?Mi:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Mi:0),width:120,height:i.height-(a?Mi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function Nh(e){this._modeling=e}Nh.$inject=["modeling"],Nh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=rr(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=_n(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,d;for(d=0;d<i;d++)d===i-1?l=s-c*d:l=c,u=a?{x:n.x+Mi,y:n.y+d*c,width:n.width-Mi,height:l}:{x:n.x+d*c,y:n.y+Mi,width:l,height:n.height-Mi},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function sc(e,t){this._modeling=e,this._spaceTool=t}sc.$inject=["modeling","spaceTool"],sc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},sc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=hO(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},sc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=qe(e),o=qe(t),r=ab(o,i),a=Ci(e),s=[],c=[];zr(a,function(m){return s.push(m),(A(m,"bpmn:Lane")||A(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,p,d,f;(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",d=r.top>0||r.bottom<0?-l:l,f=n.calculateAdjustments(s,"y",d,u),n.makeSpace(f.movingShapes,f.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",d=r.left>0||r.right<0?-l:l,f=n.calculateAdjustments(c,"x",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},p))};var cc="flowNodeRef",$h="lanes";function Au(){}Au.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=qe(p),f={x:u.x+u.width/2,y:u.y+u.height/2};return f.x>d.left&&f.x<d.right&&f.y>d.top&&f.y<d.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ci(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(d){return a(u,d)}).map(function(d){return d.businessObject})}return t.forEach(function(u){var p=Ci(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return A(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get($h),f=d.slice(),m=l(u);i.push({flowNode:p,remove:f,add:m})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(cc).forEach(function(d){i.push({flowNode:d,remove:[p],add:[]})})}),i},Au.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($h);n.remove.forEach(function(r){nn(o,r),nn(r.get(cc),i)}),n.add.forEach(function(r){rn(o,r),rn(r.get(cc),i)})}),[]},Au.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get($h);n.add.forEach(function(r){nn(o,r),nn(r.get(cc),i)}),n.remove.forEach(function(r){rn(o,r),rn(r.get(cc),i)})}),[]};var Fh="categoryValueRef";function lc(e,t){this._bpmnFactory=e,this._elementRegistry=t}lc.$inject=["bpmnFactory","elementRegistry"],lc.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(h,v,b){if(v){var E=a.get(h);E||(E={},a.set(h,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:v,root:jh(h)}:E.past={categoryValue:v}))}}function c(h){o.set(h,we(h))}function l(){n.filter(function(h){return A(h,"bpmn:FlowElement")&&!lt(h)&&h.parent}).forEach(c)}function u(h){var v=we(h),b=v.get("categoryValueRef");return b||(b=tb(i,v),r.push(wI(h,b))),b}function p(h){return h.reduce(function(v,b){var E=jh(b),M=v.get(E);return M||(M=[],v.set(E,M)),M.push(b),v},new Map)}e=Array.from(e||[]);var d=p(e);t.length&&l(),e.forEach(c),n.filter(function(h){return A(h,"bpmn:Group")&&!lt(h)&&h.parent}).forEach(function(h){var v=we(h).get("categoryValueRef");if(!v){var b=jh(h),E=d.get(b)||[],M=Sa(E,h),B=Object.keys(M).length>0;B&&(v=u(h))}s(h,v,!0)}),t.forEach(function(h){s(h.groupShape,h.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),m=Array.from(a.values()).reduce(function(h,v){return v.present&&h.add(v.present.categoryValue),v.past&&h.add(v.past.categoryValue),h},new Set),g=new Map,y=p(f);a.forEach(function(h,v){var b=h.present;if(b){var E=y.get(b.root)||[],M=Sa(E,v);E.forEach(function(B){if(M[B.id]){var P=g.get(B);P||(P=new Set,g.set(B,P)),P.add(b.categoryValue)}})}});var _=f.reduce(function(h,v){var b=o.get(v),E=b.get(Fh),M=new Set(E),B=g.get(v)||new Set,P=Array.from(B).filter(function(N){return!M.has(N)}),k=E.filter(function(N){return m.has(N)&&!B.has(N)});return(P.length||k.length)&&h.push({businessObject:b,categoryValuesToAdd:P,categoryValuesToRemove:k}),h},[]);return{flowElements:_,groups:r}},lc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),_I(t.groups),SI(t.flowElements),[]},lc.prototype.revert=function(e){var t=e.updates;return RI(t.flowElements),EI(t.groups),[]};function wI(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function _I(e){e.forEach(function(t){we(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function EI(e){e.forEach(function(t){we(t.groupShape).categoryValueRef=null})}function SI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Fh);t.categoryValuesToRemove.forEach(function(o){nn(i,o)}),t.categoryValuesToAdd.forEach(function(o){rn(i,o,!0)})})}function RI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Fh);t.categoryValuesToAdd.forEach(function(o){nn(i,o)}),t.categoryValuesToRemove.forEach(function(o){rn(i,o,!0)})})}function jh(e){for(;e.parent;)e=e.parent;return e}function Tu(e){this._moddle=e}Tu.$inject=["moddle"],Tu.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),[]},Tu.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 MI={fill:void 0,stroke:void 0};function Hh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ii(t)){var n=CI(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Hh.$inject=["commandStack"],Hh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||MI,i=this,o={};"fill"in n&&J(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&J(o,{"border-color":this._normalizeColor(n.stroke)}),W(t,function(r){var a=It(r)?Fi(o,["border-color"]):o,s=vt(r);if(AI(a),lt(r)){if(!s||!A(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!pt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function CI(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 AI(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var TI={width:0,height:0};function T_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return ik(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!lt(l)&&ir(l)&&!Ol(l)&&!P_(p)){var d=7,f=pf(l);f={x:f.x,y:f.y+d},e.createLabel(l,f,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=ci(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,d=c.newBounds,f=c.hints||{};if(!(!lt(u)&&!A(u,"bpmn:TextAnnotation"))){if(lt(u)&&P_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=ci(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,m)),d&&e.resizeShape(u,d,TI)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}T_.$inject=["modeling","textRenderer","bpmnFactory"];function P_(e){return!e||!e.trim()}function Fn(e,t,n,i){Bt.call(this,e,t,n),this._bpmnRules=i}Ne(Fn,Bt),Fn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Fn.prototype.getHandlers=function(){var e=Bt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=oc,e["element.updateProperties"]=ac,e["canvas.updateRoot"]=Cu,e["lane.add"]=Bh,e["lane.resize"]=sc,e["lane.split"]=Nh,e["lane.updateRefs"]=Au,e["group.updateRefs"]=lc,e["id.updateClaim"]=Tu,e["element.setColor"]=Hh,e["element.updateLabel"]=T_,e},Fn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Fn.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)},Fn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Fn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Fn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Fn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Fn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Fn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Fn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Fn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Fn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Fn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Fn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Fn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function k_(){}k_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Qe(t.source||e.source),t.connectionEnd||Qe(t.target||e.target)]};var Pu=20,PI=5,ku=Math.round,O_=20,kI={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function OI(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function DI(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function D_(e,t,n){var i=Bn(t,e,PI),o=n.split(":")[0],r=ku((t.x-e.x)/2+e.x),a=ku((t.y-e.y)/2+e.y),s,c,l=DI(o,i),u=/h|r|l/.test(o),p=!1,d=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=OI(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+Pu*(/l/.test(o)?-1:1),y:d?a+Pu:a}):(d=r===e.x,s={x:d?r+Pu:r,y:e.y+Pu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:zh(e,s,c).concat(s),directions:c,turnNextDirections:d}}function LI(e,t,n){return D_(e,t,n)}function II(e,t,n){var i=D_(t,e,L_(n));return{waypoints:i.waypoints.slice().reverse(),directions:L_(i.directions),turnNextDirections:i.turnNextDirections}}function BI(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=zh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function L_(e){return e.split(":").reverse().join(":")}function NI(e,t,n){var i=ku((t.x-e.x)/2+e.x),o=ku((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 zh(e,t,n){if(n=n||"h:h",!UI(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(B_(n)){var i=LI(e,t,n),o=II(e,t,n),r=BI(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return NI(e,t,n)}function $I(e,t,n){var i=zh(e,t,n);return i.unshift(e),i.push(t),$_(i)}function FI(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=PR(r,"straight")[0]||"h:h",s=kI[a]||0,c=Bn(e,t,s),l=WI(c,a);n=n||Qe(e),i=i||Qe(t);var u=l.split(":"),p=N_(n,e,u[0],qI(c)),d=N_(i,t,u[1],c);return $I(p,d,l)}function jI(e,t,n,i,o,r){Ze(n)&&(o=n,r=i,n=Qe(e),i=Qe(t)),r=J({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&zI(e,t,n,i,r),c||(c=r.connectionEnd&&VI(t,e,i,o),c)||(c=r.connectionStart&&GI(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:FI(e,t,n,i,r)}function HI(e,t,n){return e>=t&&e<=n}function I_(e,t,n){var i={x:"width",y:"height"};return HI(t[e],n[e],n[e]+n[i[e]])}function zI(e,t,n,i,o){var r={},a,s;return s=Bn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?I_(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:I_(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 GI(e,t,n,i){return Gh(e,t,n,i)}function VI(e,t,n,i){var o=i.slice().reverse();return o=Gh(e,t,n,o),o?o.reverse():null}function Gh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Ft(u,function(p,d){var f=u[d-1];return f&&Ds(p,f)<3})}function r(u,p,d){var f=Eo(p,u);switch(f){case"v":return{x:d.x,y:u.y};case"h":return{x:u.x,y:d.y}}return{x:u.x,y:u.y}}function a(u,p,d){var f;for(f=u.length-2;f!==0;f--)if(rx(u[f],p,O_)||rx(u[f],d,O_))return u.slice(f);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=Gh(e,t,n,l)),c&&Eo(c)?null:c}function WI(e,t){if(B_(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 UI(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function B_(e){return e&&/t|r|b|l/.test(e)}function qI(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 N_(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 $_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return af(o,r,n,0)||t.push(n),t},[])}var YI=-10,KI=40,XI={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},ZI={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},Vh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},uc={top:"t",right:"r",bottom:"b",left:"l"};function Ou(e){this._elementRegistry=e}Ne(Ou,k_),Ou.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=F_(o&&o[0],n)),a||(a=F_(o&&o[o.length-1],i)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!j_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Zx(n,s)?XI:ZI;return A(e,"bpmn:MessageFlow")?c=QI(n,i,u):(A(e,"bpmn:SequenceFlow")||j_(n,i))&&(n===i?c={preferredLayouts:rB(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:aB(n,i,a,u)}:pc(n)||pc(i)?c={preferredLayouts:u.subProcess,preserveDocking:tB(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=J(c,t),l=$_(jI(n,i,r,a,o,c))),l||[r,a]};function JI(e){var t=e.host;return Bn(Qe(e),t,YI)}function QI(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:eB(e,t)}}function eB(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":pc(t)?"source":pc(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function tB(e){return pc(e)?"target":"source"}function F_(e,t){return e?e.original||e:Qe(t)}function j_(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function pc(e){return A(e,"bpmn:SubProcess")&&mt(e)}function Jr(e,t){return e===t}function nB(e,t){return t.indexOf(e)!==-1}function Ha(e){var t=/right|left/.exec(e);return t&&t[0]}function za(e){var t=/top|bottom/.exec(e);return t&&t[0]}function H_(e,t){return Vh[e]===t}function iB(e,t){var n=Ha(e),i=Vh[n];return t.indexOf(i)!==-1}function oB(e,t){var n=za(e),i=Vh[n];return t.indexOf(i)!==-1}function z_(e){return e==="right"||e==="left"}function rB(e,t,n){var i=t.waypoints,o=i&&i.length&&Bn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function aB(e,t,n,i){var o=Qe(e),r=Qe(t),a=JI(e),s,c,l=Jr(e.host,t),u=nB(a,["top","right","bottom","left"]),p=Bn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?sB(a,u,e,t,n,i):(s=cB(a,p,u,i.isHorizontal),c=lB(a,p,u,i.isHorizontal),[s+":"+c])}function sB(e,t,n,i,o,r){var a=t?e:r.isHorizontal?za(e):Ha(e),s=uc[a],c;return t?z_(e)?c=G_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=G_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function G_(e,t,n,i){var o=KI;return!(Wh(e,i,n,o)||Wh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Wh(e,i,Qe(t),o))}function Wh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function cB(e,t,n,i){if(n)return uc[e];var o=za(e),r=Ha(e),a=za(t),s=Ha(t);if(i){if(Jr(o,a)||H_(r,s))return uc[o]}else if(Jr(r,s)||H_(o,a))return uc[r];return uc[i?r:o]}function lB(e,t,n,i){if(n)return z_(e)?iB(e,t)||Jr(e,t)?"h":"v":oB(e,t)||Jr(e,t)?"v":"h";var o=za(e),r=Ha(e),a=za(t),s=Ha(t);return a&&!s?"v":s&&!a?"h":i?Jr(o,a)?"h":"v":Jr(r,s)?"v":"h"}Ou.$inject=["elementRegistry"];function V_(e){return J({original:e.point.original||e.point},e.actual)}function hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}hr.$inject=["elementRegistry","graphicsFactory"],hr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(V_(i)),r.push(V_(o)),r},hr.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}},hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Ls(i,o,n)},hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Uh={__init__:["modeling","bpmnUpdater"],__depends__:[AD,VD,UD,qD,n_,YL,XL,nI,Ti,Th,c_],bpmnFactory:["type",ki],bpmnUpdater:["type",di],elementFactory:["type",pr],modeling:["type",Fn],layouter:["type",Ou],connectionDocking:["type",hr]};var uB=10,W_=50,pB=250;function qh(e,t,n,i){for(var o;o=dB(e,n,t);)n=i(t,n,o);return n}function Yh(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 dB(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=hB(e);return Ft(o,function(r){if(r===n)return!1;var a=Bn(r,i,uB);return a==="intersect"})}function fB(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||W_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||pB,c=t.reference||"start";r||(r=yB);function l(m,g){return o==="n"?c==="start"?qe(m).top-qe(g).bottom:c==="center"?qe(m).top-Qe(g).y:qe(m).top-qe(g).top:o==="w"?c==="start"?qe(m).left-qe(g).right:c==="center"?qe(m).left-Qe(g).x:qe(m).left-qe(g).left:o==="s"?c==="start"?qe(g).top-qe(m).bottom:c==="center"?Qe(g).y-qe(m).bottom:qe(g).bottom-qe(m).bottom:c==="start"?qe(g).left-qe(m).right:c==="center"?Qe(g).x-qe(m).right:qe(g).right-qe(m).right}var u=e.incoming.filter(r).map(function(m){var g=a(m),y=g<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:g}}),p=e.outgoing.filter(r).map(function(m){var g=a(m),y=g>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:g}}),d=u.concat(p).reduce(function(m,g){return m[g.id+"__weight_"+g.weight]=g,m},{}),f=ri(d,function(m,g){var y=g.distance,_=g.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*_,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return f.distance||i}function hB(e){var t=Kh(e);return e.host&&(t=t.concat(Kh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Kh(i))},[]))),t}function Kh(e){return mB(e).concat(gB(e))}function gB(e){return e.incoming.map(function(t){return t.source})}function mB(e){return e.outgoing.map(function(t){return t.target})}function yB(){return!0}var vB=100;function U_(e,t,n){e.on("autoPlace",vB,function(i){var o=i.shape,r=i.source;return xB(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}}U_.$inject=["eventBus","modeling","canvas"];function xB(e,t,n){n||(n={});var i=n.defaultDistance||W_,o=Qe(e),r=qe(e);return{x:r.right+i+t.width/2,y:o.y}}function q_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}q_.$inject=["eventBus","selection"];const bB={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",U_],autoPlaceSelectionBehavior:["type",q_]};function Y_(e,t,n){var i=Zx(e,n);if(A(t,"bpmn:TextAnnotation"))return _B(e,t,i);if(pt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return EB(e,t,i);if(A(t,"bpmn:FlowNode"))return wB(e,t,i)}function wB(e,t,n){var i=qe(e),o=Qe(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=fB(e,{filter:function(f){return A(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;A(e,"bpmn:BoundaryEvent")&&(l=Bn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+K_(l,c,r)}:{x:o.x+K_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return qh(e,t,u,Yh(d))}function K_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function _B(e,t,n){var i=qe(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};It(e)&&(o=Qe(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 qh(e,t,o,Yh(a))}function EB(e,t,n){var i=qe(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 qh(e,t,o,Yh(a))}function X_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return Y_(o,i,t)})}X_.$inject=["eventBus","elementRegistry"];const Du={__depends__:[bB],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",X_]};function Do(e,t,n,i){be.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=Hp(fa(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ha(s,function(p){return p.parent.id});W(u,function(p,d){Ze(l)&&(p=p.filter(function(f){return Ft(l,ga({id:f.id}))})),o._expand(p,d)})}}),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)})}Do.$inject=["eventBus","elementRegistry","modeling","rules"],Ne(Do,be),Do.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=qe(ln(e)),r=qe(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),Ml(J({},r,a))},Do.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(SB(i,t)){var o=RB(Fi(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Do.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Do.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Do.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function SB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function RB(e,t){var n="";return e=qe(e),t=qe(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(Do,this)}Lu.$inject=["injector"],Ne(Lu,Do),Lu.prototype.resize=function(e,t,n){A(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function dc(e){Ai.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}dc.$inject=["eventBus"],Ne(dc,Ai),dc.prototype.canResize=function(e,t){return!1};function Iu(e,t){dc.call(this,e),this._modeling=t}Ne(Iu,dc),Iu.$inject=["eventBus","modeling"],Iu.prototype.canResize=function(e,t){if(A(t.di,"bpmndi:BPMNPlane")||!A(t,"bpmn:Participant")&&!A(t,"bpmn:Lane")&&!A(t,"bpmn:SubProcess"))return!1;var n=!0;return W(e,function(i){if(A(i,"bpmn:Lane")||lt(i)){n=!1;return}}),n};const Z_={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Lu],bpmnAutoResizeProvider:["type",Iu]},MB=1500;class J_{constructor(t){t.on("moddleCopy.canCopyProperties",MB,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,kr)))return;const o=Rn(n);o!==void 0&&i.set("xml:lang",o)})}}an(J_,"$inject",["eventBus"]);const Q_={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",J_]},CB=500,Bu=1,e0=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Bu||n>e.x+e.width+Bu||i<e.y-Bu||i>e.y+e.height+Bu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class t0{constructor(t){t.on("bpmnElement.added",CB,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(e0(n.source,i[0]),e0(n.target,i[i.length-1]))})}}an(t0,"$inject",["eventBus"]);const n0={__init__:["annotationImportDocking"],annotationImportDocking:["type",t0]},Xh=[Kx,js,Uh,Du,Z_,Zp,Q_,n0,uv];function AB(e={}){Wm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Gr({container:t,moddleExtensions:e.moddleExtensions??gs,additionalModules:[...Xh,...e.additionalModules??[]]})}const i0={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","merge-before-predecessor":"연결","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":"풀"},TB={이:["이","가"],을:["을","를"],와:["과","와"]};function PB(e,t){const[n,i]=TB[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 kB={"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":"연관선"},OB="요소";function Zh(e){return(e&&kB[e.type])??OB}const o0=20;function DB(e){const t=e.replace(/\s+/g," ").trim();return t.length>o0?`${t.slice(0,o0)}…`:t}function Nu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:DB(o.name),a=r===void 0?i+Zh(o):r,s=r===void 0?a:`「${r}」`;return n?s+PB(a,n).slice(a.length):s}function LB(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&&Zh(r)===Zh(a);return[Nu(e,t,i),Nu(e,n,o,s?"다른 ":"")]}function IB(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 BB(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];case"merge-before-predecessor":return[e.merge,e.edge]}}const $u={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function NB(e,t){const n=(o,r)=>Nu(t,o,r),i=(o,r,a,s)=>LB(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)}의 ${$u[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)}의 ${$u[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${$u[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${$u[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} 겹칩니다.`}case"merge-before-predecessor":return`합류 ${n(e.merge,"이")} 앞 단계보다 앞에 놓여 ${n(e.edge,"이")} 거꾸로 들어갑니다.`}}function $B(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Nu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const r0="기타",Jh={error:0,warning:1,info:2};function a0(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:IB(i),targetRefs:BB(i),category:i0[i.kind]??r0,message:NB(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:i0[i.ruleId]??r0,message:$B(i,t)});return n}function s0(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ga(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Qh(e,t){if(t===void 0||e.length===0)return!1;const n=Ga(e[0],t);return e.some(i=>Ga(i,t)!==n)}function c0(e,t){const n=Qh(e,t);return e.slice().sort((i,o)=>(n?Number(Ga(o,t))-Number(Ga(i,t)):0)||Jh[i.severity]-Jh[o.severity])}const l0="i18n-untranslated",u0="i18n-review-requested",fc="i18nDisplay.redrawn",p0=[["untranslated",l0],["reviewRequested",u0]];class eg{constructor(t,n,i,o,r,a,s,c){an(this,"config");an(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=(d,f,m)=>this.withDisplayText(f,()=>l(d,f,m),d);const u=r.activate.bind(r);r.activate=d=>this.withDisplayText(d,()=>u(d));const p=r.update.bind(r);r.update=(d,f,m,g)=>{const y=this.resolve(d);if(!y||y.native)return p(d,f,m,g);(f??"").trim()!==(m??"").trim()&&i.execute(Vc,{element:d.labelTarget??d,locale:this.displayLocale,text:f,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",d=>{if(!this.config)return;const{element:f,newLabel:m,oldLabel:g}=d.context;(m??"")!==(g??"")&&i.execute(Vc,{element:f.labelTarget??f,locale:this.displayLocale,text:m??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:g??""})})}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=Or(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Go(n).filter(d=>Rn(d)),s=d=>d.body??"",c=a.find(d=>Rn(d)===o&&s(d)),l=Vo(n).some(d=>d.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(d=>s(d)===r).map(Rn);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 d;if(!this.config)return n();const o=this.resolve(t),r=(d=i==null?void 0:i.parentNode)==null?void 0:d.classList;if(r)for(const[f,m]of p0)r.toggle(m,(o==null?void 0:o.status)===f);if(!o||o.native)return n();const{target:a,key:s}=Or((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 f=n();return p&&(f!=null&&f.setAttribute)&&f.setAttribute("transform",`translate(${p.dx}, 0)`),f}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 p0)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(fc)}}an(eg,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const d0={__depends__:[Zp],__init__:["i18nDisplay"],i18nDisplay:["type",eg]};var FB=2e3;function tg(e,t,n){e.on("autoPlace",FB,function(i){var o=i.source,r=Qe(o),a=i.shape,s=Y_(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],A(a,"bpmn:TextAnnotation")&&(jB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}tg.$inject=["eventBus","gridSnapping","elementRegistry"];function jB(e){return e==="x"}var HB=3e3;function Va(e,t,n){be.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],HB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||zB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Va.$inject=["eventBus","gridSnapping","modeling"],Ne(Va,be),Va.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=WB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function zB(e){return e.length>3}function GB(e){return e==="h"}function VB(e){return e==="v"}function WB(e,t,n){var i=Eo(t,n),o={};return GB(i)&&(o.y=e.snapValue(t.y)),VB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=J({},t,o),n=J({},n,o)),[t,n]}function UB(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Br(e,t),fontBoundingBoxAscent:t*Qi.ascentEm,fontBoundingBoxDescent:t*Qi.descentEm,actualBoundingBoxAscent:t*Qi.ascentEm,actualBoundingBoxDescent:t*Qi.descentEm}}class ng{constructor(t,n,i,o,r,a){an(this,"active",!1);an(this,"shadow");an(this,"shadowContainer");this.eventBus=t,this.elementRegistry=n,this.textRenderer=i,this.graphicsFactory=o,this.canvas=r,this.bpmnjs=a,t.on("diagram.destroy",()=>this.disposeShadow());let s=[];t.on("elements.changed",c=>{this.active||(s=c.elements??[])}),t.on("commandStack.changed",c=>{const l=s;s=[],!(this.active||(c==null?void 0:c.trigger)!=="undo"&&(c==null?void 0:c.trigger)!=="redo")&&this.remeasureLabelsOf(l)})}isActive(){return this.active}run(t){if(this.active)throw new Error("headlessReplay.run: 이미 창 안이다(중첩 금지)");const n=typeof CanvasRenderingContext2D>"u"?void 0:CanvasRenderingContext2D.prototype,i=n==null?void 0:n.measureText;n&&(n.measureText=UB),this.active=!0;try{return this.reproject(),t()}finally{this.active=!1,n&&i&&(n.measureText=i),this.relabel(),this.syncGraphicsOrder(),this.redrawAll()}}atBatchBoundary(){if(!this.active)throw new Error("headlessReplay.atBatchBoundary: 창 밖이다");this.eventBus.fire("saveXML.start",{definitions:this.bpmnjs.getDefinitions()}),this.reproject()}reproject(){const t=this.ensureShadow();t.get("eventBus").fire("diagram.clear");let n=!1;t.get("eventBus").once("import.render.complete",()=>n=!0);let i;if(Dx(t,this.bpmnjs.getDefinitions()).catch(u=>i=u),!n)throw new Error(`headlessReplay: 그림자 import 가 동기로 끝나지 않았다${i?` — ${String(i)}`:""}`);const o=t.get("elementRegistry"),r=this.elementRegistry,a=u=>u?r.get(u.id):void 0,s=o.getAll();for(const u of s){const p=r.get(u.id);if(!p)continue;u.waypoints?p.waypoints=u.waypoints.map(f=>({x:f.x,y:f.y,...f.original?{original:{x:f.original.x,y:f.original.y}}:{}})):u.parent&&(p.x=u.x,p.y=u.y,p.width=u.width,p.height=u.height),p.collapsed=u.collapsed,p.hidden=u.hidden,p.isFrame=u.isFrame;const d=a(u.parent);d&&p.parent!==d&&(p.parent=d);for(const f of["incoming","outgoing"]){const m=(u[f]??[]).map(a).filter(Boolean),g=p[f];g&&m.length===g.length&&m.every(y=>g.includes(y))&&m.forEach((y,_)=>g[_]=y)}}for(const u of s){const p=r.get(u.id);if(!(p!=null&&p.children)||!u.children)continue;const d=u.children.map(a).filter(Boolean),f=p.children.filter(m=>!d.includes(m)&&m.parent===p);p.children.length=0,p.children.push(...d,...f)}const c=r._elements,l={};for(const u of s)u.id in c&&(l[u.id]=c[u.id]);for(const u of Object.keys(c))u in l||(l[u]=c[u]);r._elements=l}relabel(){for(const t of this.elementRegistry.filter(n=>n.type==="label"))this.remeasure(t)}remeasure(t){const n=t.labelTarget,i=n&&ci(n);if(!i)return!1;const o=this.textRenderer.getExternalLabelBounds(Hx(vt(n),n),i),r={x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)};return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height?!1:(Object.assign(t,r),!0)}remeasureLabelsOf(t){const n=new Set;for(const o of t){(o==null?void 0:o.type)==="label"&&n.add(o);for(const r of(o==null?void 0:o.labels)??[])n.add(r)}let i=0;for(const o of n){if(!this.elementRegistry.get(o.id)||!this.remeasure(o))continue;const r=this.elementRegistry.getGraphics(o);r&&this.graphicsFactory.update("shape",o,r),i++}i&&this.eventBus.fire(fc)}syncGraphicsOrder(){var t,n;for(const i of this.elementRegistry.getAll()){if(!((t=i.children)!=null&&t.length))continue;const o=this.graphicsFactory._getChildrenContainer(i);for(const r of i.children){const a=(n=this.elementRegistry.getGraphics(r))==null?void 0:n.parentNode;a&&o.appendChild(a)}}}redrawAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);i&&this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}this.eventBus.fire(fc)}ensureShadow(){if(this.shadow)return this.shadow;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-10000px;top:0;width:800px;height:600px;visibility:hidden",document.body.appendChild(t),this.shadowContainer=t,this.shadow=new Gr({container:t,moddleExtensions:gs,additionalModules:[...Xh]}),this.shadow}disposeShadow(){var t,n;(t=this.shadow)==null||t.destroy(),this.shadow=void 0,(n=this.shadowContainer)==null||n.remove(),this.shadowContainer=void 0}}an(ng,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function f0(e,t){const n=Object.create(e);return n.on=(i,o,r,a)=>{typeof o=="function"&&(a=r,r=o,o=1e3);const s=function(...c){return t.isActive()?void 0:r.apply(this,c)};return e.on(i,o,s,a)},n}function ig(e,t,n,i){tg.call(this,f0(e,i),t,n)}ig.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function Fu(e,t,n,i){Va.call(this,f0(e,i),t,n)}Fu.prototype=Object.create(Va.prototype),Fu.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function qB(e){return e instanceof ig||e instanceof Fu}const h0={__init__:["headlessReplay"],headlessReplay:["type",ng],gridSnappingAutoPlaceBehavior:["type",ig],gridSnappingLayoutConnectionBehavior:["type",Fu]};function Qr(e){return CSS.escape(e)}var YB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function g0(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return YB[t]})}var ju=50,KB=new Kr,m0={min:.2,max:4},XB=10,ZB=.1,JB=250,QB=100,eN=2e3;function jn(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=KB.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=Hu({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);og(p,r._canvas),r._update()}function s(u){return function(d){var f=rg(d);(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var m=Hu({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),g=i.viewbox(),y=nN(m,g),_=r._viewportDom.getBoundingClientRect(),h={x:f.x-_.left+1,y:f.y-_.top+1};J(r._state,{cachedViewbox:g,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:y,offsetViewportDom:h,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),We.bind(document,"mousemove",c),We.bind(document,"mouseup",l)}}function c(u){var p=rg(u);if(r._state.isDragging){(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,m=r._state.parentClientRect;J(r._viewportDom.style,{top:p.y-d.y-m.top+"px",left:p.x-d.x-m.left+"px"});var g=v0(m,{top:p.y-d.y-m.top,left:p.x-d.x-m.left,width:f.width,height:f.height});J(r._overlay.style,{clipPath:g});var y=Hu({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);og({x:y.x-r._state.offsetViewport.x,y:y.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=rg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),J(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),We.unbind(document,"mousemove",c),We.unbind(document,"mouseup",l))}We.bind(this._viewportDom,"mousedown",s(!1)),We.bind(this._svg,"mousedown",s(!0)),We.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!sN(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*cN(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>ZB){var f=d>0?1:-1,m=Math.log(i.zoom())/Math.log(10),g=lN(m0,XB*2),y=Math.round(m/g)*g;y+=g*f;var _=Math.pow(10,y);i.zoom(uN(m0,_),h),r._state.zoomDelta=0;var h=Hu({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);og(h,r._canvas),r._update()}}}),We.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",JB,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,d=u.newId;r._updateElementId(p,d)}),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(d){r._addElement(d)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}jn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],jn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Pt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Pt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Pt(o).add("map"),n.appendChild(o);var r=this._svg=je("svg");Le(r,{width:"100%",height:"100%"}),tt(o,r);var a=this._elementsGroup=je("g");tt(r,a);var s=this._viewportGroup=je("g");tt(r,s);var c=this._viewport=je("rect");gt(c).add("viewport"),tt(s,c),We.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Pt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Pt(u).add("overlay"),this._parent.appendChild(u)},jn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Je(this._config.debounceDelay)?this._config.debounceDelay:QB,n=Je(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:eN,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)}},jn.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)})}},jn.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(x0(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-ju,o=o-ju,r=r+ju*2,a=a+ju*2,this._lastViewbox={x:i,y:o,width:r,height:a},Le(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Le(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};J(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=v0(l,p);J(this._overlay.style,{clipPath:d})}}},jn.prototype.open=function(){J(this._state,{isOpen:!0}),Pt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Mn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},jn.prototype.close=function(){J(this._state,{isOpen:!1}),Pt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Mn(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},jn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},jn.prototype.isOpen=function(){return this._state.isOpen},jn.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)}},jn.prototype._updateElementId=function(e,t){try{var n=Ct("#"+Qr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},jn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},jn.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=Ct("#"+Qr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=oN(e);return s!==-1?a?rN(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),tN(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Le(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Le(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},jn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&cn(t)},jn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=tr(t),n)){var i=pN(Yd(n));return Le(i,{id:this._prefixId(e.id)}),i}},jn.prototype._clear=function(){Cs(this._elementsGroup)},jn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function tN(e){return e.waypoints}function nN(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 Hu(e,t,n){var i=t.getBoundingClientRect(),o=iN(n,i.width/i.height),r=y0(e.x,0,i.width,o.x,o.x+o.width),a=y0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function og(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 iN(e,t){var n=e.width/e.height,i=J({},{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;J(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;J(i,{x:s,width:a})}return i}function y0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function oN(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function rN(e,t,n){var i=aN(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function aN(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function zu(e){return e.width===0&&e.height===0}function sN(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var cN=Math.sign||function(e){return e>=0?1:-1};function lN(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 uN(e,t){return Math.max(e.min,Math.min(e.max,t))}function v0(e,t){var n=[uo(t.left,t.top),uo(t.left+t.width,t.top),uo(t.left+t.width,t.top+t.height),uo(t.left,t.top+t.height),uo(t.left,e.height),uo(e.width,e.height),uo(e.width,0),uo(0,0),uo(0,e.height),uo(t.left,e.height)].join(", ");return"polygon("+n+")"}function uo(e,t){return e+"px "+t+"px"}function x0(e){return Ho(e,function(t){return yn(t)?x0(t):Je(t)&&isFinite(t)})}function rg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function pN(e){return Ms("[id]",e).forEach(function(t){t.remove()}),e}var dN={__init__:["minimap"],minimap:["type",jn]};const b0={closed:"미니맵",open:"접기"};class w0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(fc,()=>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?b0.open:b0.closed)}}an(w0,"$inject",["eventBus","minimap","canvas"]);const _0=[d0,{__depends__:[dN],__init__:["minimapI18n"],minimapI18n:["type",w0]},Q_,n0,uv,h0];var fN=new Kr("ov"),hN=500;function Cn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=fN,this._overlayDefaults=J({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=gN(n.getContainer()),this._init()}Cn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Cn.prototype.get=function(e){if(ii(e)&&(e={id:e}),ii(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?dt(t.overlays,ga({type:e.type})):t.overlays.slice():[]}else return e.type?dt(this._overlays,ga({type:e.type})):e.id?this._overlays[e.id]:null},Cn.prototype.add=function(e,t,n){if(yn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=J({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Cn.prototype.remove=function(e){var t=this.get(e)||[];Ze(t)||(t=[t]);var n=this;W(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(no(i.html),no(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)}})},Cn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Cn.prototype.show=function(){Gu(this._overlayRoot)},Cn.prototype.hide=function(){Gu(this._overlayRoot,!1)},Cn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],xl(this._overlayRoot)},Cn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=ln(t);i=r.x,o=r.y}E0(n,i,o),Mn(e.html,"data-container-id",t.id)},Cn.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=ln(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=ln(i).height:s=i.height,r=t.bottom*-1+s}E0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Cn.prototype._createOverlayContainer=function(e){var t=Vt('<div class="djs-overlays" />');Yn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Cn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";S0(this._overlayRoot,n)},Cn.prototype._getOverlayContainer=function(e,t){var n=Ft(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Cn.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)),ii(i)&&(i=Vt(i)),r=this._getOverlayContainer(n),o=Vt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Yn(o,{position:"absolute"}),o.appendChild(i),e.type&&Pt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Gu(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())},Cn.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&&(mn(o)&&o>t.scale||mn(r)&&r<t.scale))&&(c=!1),Gu(a,c),this._updateOverlayScale(e,t)},Cn.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),mn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),mn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),mn(a)&&(s="scale("+a+","+a+")"),S0(r,s)},Cn.prototype._updateOverlaysVisibilty=function(e){var t=this;W(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Cn.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});W(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){no(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",hN,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(W(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&&Pt(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 gN(e){var t=Vt('<div class="djs-overlay-container" />');return Yn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function E0(e,t,n){Yn(e,{left:t+"px",top:n+"px"})}function Gu(e,t){e.style.display=t===!1?"none":""}function S0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Vu={__init__:["overlays"],overlays:["type",Cn]};function ag(e,t){t.invoke(be,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)})}Ne(ag,be),ag.$inject=["canvas","injector"];const mN={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ag]};var yN="bjs-breadcrumbs-shown";function R0(e,t,n){var i=Vt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Pt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=we(l),p=Ft(a,function(d){return d===u});p&&s()});function s(c){c&&(a=vN(c));var l=a.flatMap(function(p){var d=n.findRoot(so(p))||n.findRoot(p.id);if(!d&&A(p,"bpmn:Process")){var f=t.find(function(y){var _=we(y);return _&&_.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var m=g0(p.name||p.id),g=Vt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return g.addEventListener("click",function(){n.setRootElement(d)}),g});i.innerHTML="";var u=l.length>1;r.toggle(yN,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}R0.$inject=["eventBus","elementRegistry","canvas"];function vN(e){for(var t=we(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function M0(e,t){var n=null,i=new xN;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,!(!A(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})}M0.$inject=["eventBus","canvas"];function xN(){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 C0={x:180,y:160};function ea(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}ea.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)})}},ea.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;A(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),wN(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},ea.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=bN(e),i={x:n.x-C0.x,y:n.y-C0.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)})},ea.prototype._moveToDiPlane=function(e,t){var n=A0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},ea.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},ea.$inject=["eventBus","moddle"];function A0(e){return A(e,"bpmndi:BPMNDiagram")?e:A0(e.$parent)}function bN(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=qe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ml(t)}function wN(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||pt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Wu=250,_N='<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>',EN="bjs-drilldown-empty";function gr(e,t,n,i,o){be.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",Wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Wu,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"],Wu,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)})})}Ne(gr,be),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(so(e))},gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=we(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Pt(i.html).toggle(EN,!o)}},gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=we(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Vt('<button type="button" class="bjs-drilldown">'+_N+"</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(so(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const SN={__depends__:[Vu,Th,mN],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",R0],drilldownCentering:["type",M0],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",ea]};function mr(e){Yt.call(this,e)}Ne(mr,Yt),mr.prototype._modules=[Kx,SN,Vu,Ti,js],mr.prototype._moddleExtensions={};var Uu="keyboard.keydown",RN="keyboard.keyup",MN=1e3,T0="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 Kn(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(T0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Kn.$inject=["config.keyboard","eventBus"],Kn.prototype._keydownHandler=function(e){this._keyHandler(e,Uu)},Kn.prototype._keyupHandler=function(e){this._keyHandler(e,RN)},Kn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Uu,i),n&&e.preventDefault()}},Kn.prototype._isEventIgnored=function(e){return!1},Kn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(T0)),this.unbind(),e=this._node=this._target,We.bind(e,"keydown",this._keydownHandler),We.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Kn.prototype.getBinding=function(){return this._node},Kn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),We.unbind(e,"keydown",this._keydownHandler),We.unbind(e,"keyup",this._keyupHandler)),this._node=null},Kn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Kn.prototype.addListener=function(e,t,n){wn(e)&&(n=t,t=e,e=MN),this._eventBus.on(n||Uu,e,t)},Kn.prototype.removeListener=function(e,t){this._eventBus.off(t||Uu,e)},Kn.prototype.hasModifier=aL,Kn.prototype.isCmd=ui,Kn.prototype.isShift=vh,Kn.prototype.isKey=xn;var CN=500;function Wa(e,t){var n=this;e.on("editorActions.init",CN,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Wa.$inject=["eventBus","keyboard"],Wa.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(pL(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(dL(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(sL(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(cL(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(lL(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(uL(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(xn(["+","Add","="],o)&&ui(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(xn(["-","Subtract"],o)&&ui(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(xn("0",o)&&ui(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(xn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const sg={__init__:["keyboard","keyboardBindings"],keyboard:["type",Kn],keyboardBindings:["type",Wa]};var AN={moveSpeed:50,moveSpeedAccelerated:200};function P0(e,t,n){var i=this;this._config=J({},AN,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})}}P0.$inject=["config.keyboardMove","keyboard","canvas"];const k0={__depends__:[sg],__init__:["keyboardMove"],keyboardMove:["type",P0]};var TN=15;function O0(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=Ur(s),p=Vi(u,c);if(!n.dragging&&PN(p)>TN&&(n.dragging=!0,l===0&&Iw(e),uu("grab")),n.dragging){var d=n.last||n.start;p=Vi(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){We.unbind(document,"mousemove",o),We.unbind(document,"mouseup",r),n=null,Lw()}function a(s){if(!jr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Ur(s)},We.bind(document,"mousemove",o),We.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}O0.$inject=["eventBus","canvas"];function PN(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const D0={__init__:["moveCanvas"],moveCanvas:["type",O0]};function L0(e,t){var n=gf(e.min),i=gf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function kN(e,t){return Math.max(e.min,Math.min(e.max,t))}var ON=Math.sign||function(e){return e>=0?1:-1},cg={min:.2,max:4},I0=10,DN=.1,LN=.75;function po(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Zn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||LN;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}po.$inject=["config.zoomScroll","eventBus","canvas"],po.prototype.scroll=function(t){this._canvas.scroll(t)},po.prototype.reset=function(){this._canvas.zoom("fit-viewport")},po.prototype.zoom=function(t,n){var i=L0(cg,I0*2);this._totalDelta+=t,Math.abs(this._totalDelta)>DN&&(this._zoom(t,n,i),this._totalDelta=0)},po.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||zb()&&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))*ON(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)}},po.prototype.stepZoom=function(t,n){var i=L0(cg,I0);this._zoom(t,n,i)},po.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=gf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(kN(cg,s),t)},po.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&We[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},po.prototype._init=function(e){this.toggle(e)};const B0={__init__:["zoomScroll"],zoomScroll:["type",po]};function hc(e){mr.call(this,e)}Ne(hc,mr),hc.prototype._navigationModules=[k0,D0,B0],hc.prototype._modules=[].concat(mr.prototype._modules,hc.prototype._navigationModules);function lg(e){return e&&e[e.length-1]}function N0(e){return e.y}function $0(e){return e.x}var IN={left:$0,center:$0,right:function(e){return e.x+e.width},top:N0,middle:N0,bottom:function(e){return e.y+e.height}};function Ua(e,t){this._modeling=e,this._rules=t}Ua.$inject=["modeling","rules"],Ua.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}},Ua.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ua.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(d,f){return Math.round((d[i]+f[i]+f[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=lg(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(W(t,function(d){var f=d[i]+Math.round(d[o]/2);a[f]?a[f].elements.push(d):a[f]={elements:[d],center:f}}),c=Xi(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=lg(c).center,r;l=t[0],t=Xi(t,function(d){return d[i]+d[o]}),u=lg(t),r[e]=p(l,u)}return r},Ua.prototype.trigger=function(e,t){var n=this._modeling,i,o=dt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),Ze(i)&&(o=i),!(o.length<2||!i)){var r=IN[t],a=Xi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const BN={__init__:["alignElements"],alignElements:["type",Ua]},NN=new Kr;function qa(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}qa.$inject=["eventBus"],qa.prototype.schedule=function(e,t=NN.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},qa.prototype._schedule=function(e,t){const n=$N();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}},qa.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},qa.prototype._cancel=function(e){clearTimeout(e.executionId)};function $N(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const FN={scheduler:["type",qa]};var jN="djs-element-hidden",qu=".entry",HN=1e3,F0=8,zN=300;function pn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}pn.$inject=["canvas","elementRegistry","eventBus","scheduler"],pn.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=Ze(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=Ze(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},pn.prototype._createContainer=function(){var e=Vt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},pn.prototype.registerProvider=function(e,t){t||(t=e,e=HN),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},pn.prototype.getEntries=function(e){var t=this._getProviders(),n=Ze(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return W(t,function(o){if(wn(o[n])){var r=o[n](e);wn(r)?i=r(i):W(r,function(a,s){i[s]=a})}}),i},pn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Mn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},zN);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},pn.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(wn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},pn.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))}},pn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},pn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;W(t,function(o,r){var a=o.group||"default",s=Vt(o.html||'<div class="entry" draggable="true"></div>'),c;Mn(s,"data-action",r),c=Ct("[data-group="+Qr(a)+"]",n),c||(c=Vt('<div class="group"></div>'),Mn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&GN(s,o.className),o.title&&Mn(s,"title",o.title),o.imageUrl&&(i=Vt("<img>"),Mn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Pt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},pn.prototype._createHtml=function(e){var t=this,n=Vt('<div class="djs-context-pad"></div>');return ai.bind(n,qu,"click",function(i){t.trigger("click",i)}),ai.bind(n,qu,"dragstart",function(i){t.trigger("dragstart",i)}),ai.bind(n,qu,"mouseover",function(i){t.trigger("mouseover",i)}),ai.bind(n,qu,"mouseout",function(i){t.trigger("mouseout",i)}),We.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},pn.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()&&WN(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},pn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},pn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ze(e)!==Ze(n)?!1:Ze(e)?e.length===n.length&&Ho(e,function(i){return n.includes(i)}):n===e},pn.prototype.isShown=function(){return this.isOpen()&&Pt(this._current.html).has("open")},pn.prototype.show=function(){this.isOpen()&&(Pt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},pn.prototype.hide=function(){this.isOpen()&&(Pt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},pn.prototype._getPosition=function(e){if(!Ze(e)&&It(e)){var t=this._canvas.viewbox(),n=VN(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+F0*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+F0*this._canvas.zoom(),top:s.top-a.top}},pn.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")},pn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ze(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,jN)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},pn.prototype._getTargetBounds=function(e){var t=this,n=Ze(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 GN(e,t){var n=Pt(e);t=Ze(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function VN(e){return e.waypoints[e.waypoints.length-1]}function WN(e,t){return e=Ze(e)?e:[e],t=Ze(t)?t:[t],e.length===t.length&&Ho(e,function(n){return t.includes(n)})}const j0={__depends__:[lu,FN,Vu],contextPad:["type",pn]};var Yu,Xt,H0,yr,z0,G0,V0,ug,Ku,gc,W0,pg,dg,fg,Xu={},Zu=[],UN=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ju=Array.isArray;function Lo(e,t){for(var n in t)e[n]=t[n];return e}function hg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function U0(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?Yu.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 Qu(e,a,i,o,null)}function Qu(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??++H0,__i:-1,__u:0};return o==null&&Xt.vnode!=null&&Xt.vnode(r),r}function ep(e){return e.children}function tp(e,t){this.props=e,this.context=t}function ta(e,t){if(t==null)return e.__?ta(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"?ta(e):null}function qN(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Lo({},t);r.__v=t.__v+1,Xt.vnode&&Xt.vnode(r),gg(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??ta(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,eE(i,r,o),t.__e=t.__=null,r.__e!=n&&q0(r)}}function q0(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}),q0(e)}function Y0(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!np.__r++||z0!=Xt.debounceRendering)&&((z0=Xt.debounceRendering)||G0)(np)}function np(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(V0),e=yr.shift(),t=yr.length,qN(e)}finally{yr.length=np.__r=0}}function K0(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,m,g,y,_=i&&i.__k||Zu,h=t.length;for(c=YN(n,t,_,c,h),p=0;p<h;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&_[f.__i]||Xu,f.__i=p,y=gg(e,f,d,o,r,a,s,c,l,u),m=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&mg(d.ref,null,f),u.push(f.ref,f.__c||m,f)),g==null&&m!=null&&(g=m),4&f.__u?(c=X0(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=g,c}function YN(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,d=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]=Qu(null,a,null,null,null):Ju(a)?a=e.__k[r]=Qu(ep,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Qu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+d,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=KN(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?d--:o<u&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,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=ta(s)),nE(s,s));return i}function X0(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=X0(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=ta(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function KN(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 Z0(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||UN.test(t)?n:n+"px"}function ip(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||Z0(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Z0(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(W0,"$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[gc]=i[gc]:(n[gc]=pg,e.addEventListener(t,r?fg:dg,r)):e.removeEventListener(t,r?fg:dg,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 J0(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ku]==null)t[Ku]=pg++;else if(t[Ku]<n[gc])return;return n(Xt.event?Xt.event(t):t)}}}function gg(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,m,g,y,_,h,v,b,E,M,B,P,k,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Xt.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(h=t.props,v=N.prototype&&N.prototype.render,b=(u=N.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?_=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new N(h,E):(t.__c=d=new tp(h,E),d.constructor=N,d.render=ZN),b&&b.sub(d),d.state||(d.state={}),d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),v&&d.__s==null&&(d.__s=d.state),v&&N.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Lo({},d.__s)),Lo(d.__s,N.getDerivedStateFromProps(h,d.__s))),m=d.props,g=d.state,d.__v=t,f)v&&N.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&N.getDerivedStateFromProps==null&&h!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(h,E),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(h,d.__s,E)===!1){t.__v!=n.__v&&(d.props=h,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(G){G&&(G.__=t)}),Zu.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=ta(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(h,d.__s,E),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,y)})}if(d.context=E,d.props=h,d.__P=e,d.__e=!1,M=Xt.__r,B=0,v)d.state=d.__s,d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),Zu.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++B<25);d.state=d.__s,d.getChildContext!=null&&(i=Lo(Lo({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(m,g)),P=u!=null&&u.type===ep&&u.key==null?tE(u.props.children):u,s=K0(e,Ju(P)?P:[P],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(G){if(a.length=p,t.__v=null,c||r!=null){if(G.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(k=r.length;k--;)hg(r[k])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),G.then||Q0(t),Xt.__e(G,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=XN(n.__e,t,n,i,o,r,a,c,l);return(u=Xt.diffed)&&u(t),128&t.__u?void 0:s}function Q0(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Q0))}function eE(e,t,n){for(var i=0;i<n.length;i++)mg(n[i],n[++i],n[++i]);Xt.__c&&Xt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Xt.__e(r,o.__v)}})}function tE(e){return typeof e!="object"||e==null||e.__b>0?e:Ju(e)?e.map(tE):e.constructor!==void 0?null:Lo({},e)}function XN(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,m,g,y=n.props||Xu,_=t.props,h=t.type;if(h=="svg"?o="http://www.w3.org/2000/svg":h=="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((f=r[l])&&"setAttribute"in f==!!h&&(h?f.localName==h:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(h==null)return document.createTextNode(_);e=document.createElementNS(o,h,_.is&&_),s&&(Xt.__m&&Xt.__m(t,r),s=!1),r=null}if(h==null)y===_||s&&e.data==_||(e.data=_);else{if(r=h=="textarea"&&_.defaultValue!=null?null:r&&Yu.call(e.childNodes),!s&&r!=null)for(y={},l=0;l<e.attributes.length;l++)y[(f=e.attributes[l]).name]=f.value;for(l in y)f=y[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||ip(e,l,null,f,o);for(l in _)f=_[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?m=f:l=="checked"?g=f:s&&typeof f!="function"||y[l]===f||ip(e,l,f,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=""),K0(t.type=="template"?e.content:e,Ju(d)?d:[d],t,n,i,h=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&ta(n,0),s,c),r!=null)for(l=r.length;l--;)hg(r[l]);s&&h!="textarea"||(l="value",h=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||h=="progress"&&!m||h=="option"&&m!=y[l])&&ip(e,l,m,y[l],o),l="checked",g!=null&&g!=e[l]&&ip(e,l,g,y[l],o))}return e}function mg(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){Xt.__e(o,n)}}function nE(e,t,n){var i,o;if(Xt.unmount&&Xt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||mg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Xt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&nE(i[o],t,n||typeof e.type!="function");n||hg(e.__e),e.__c=e.__=e.__e=void 0}function ZN(e,t,n){return this.constructor(e,n)}function iE(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Xt.__&&Xt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],gg(t,e=t.__k=U0(ep,null,[e]),o||Xu,Xu,t.namespaceURI,o?null:t.firstChild?Yu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),eE(r,e,a),e.props.children=null}Yu=Zu.slice,Xt={__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}},H0=0,tp.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Lo({},this.state),typeof e=="function"&&(e=e(Lo({},n),this.props)),e&&Lo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Y0(this))},tp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Y0(this))},tp.prototype.render=ep,yr=[],G0=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,V0=function(e,t){return e.__v.__b-t.__v.__b},np.__r=0,ug=Math.random().toString(8),Ku="__d"+ug,gc="__a"+ug,W0=/(PointerCapture)$|Capture$/i,pg=0,dg=J0(!1),fg=J0(!0);var oE=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,oE(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},rE=new Map;function JN(e){var t=rE.get(this);return t||(t=new Map,rE.set(this,t)),(t=oE(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(d){r===1&&(d||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,d,a):r===3&&(d||a)?(c.push(3,d,a),r=2):r===2&&a==="..."&&d?c.push(4,d,0):r===2&&a&&!d?c.push(5,0,!0,a):r>=5&&((a||!d&&r===5)&&(c.push(r,0,a,o),r=6),d&&(c.push(r,d,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===`
10
+ `||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 Nt=JN.bind(U0),Ya,dn,yg,aE,mc=0,sE=[],bn=Xt,cE=bn.__b,lE=bn.__r,uE=bn.diffed,pE=bn.__c,dE=bn.unmount,fE=bn.__;function op(e,t){bn.__h&&bn.__h(dn,e,mc||t),mc=0;var n=dn.__H||(dn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function vg(e){return mc=1,QN(gE,e)}function QN(e,t,n){var i=op(Ya++,2);if(i.t=e,!i.__c&&(i.__=[gE(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=dn,!dn.__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(f){if(f.__N){u=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),r){var d=r.call(this,s,c,l);return u?d||p:d}return!u||p};dn.__f=!0;var r=dn.shouldComponentUpdate,a=dn.componentWillUpdate;dn.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)},dn.shouldComponentUpdate=o}return i.__N||i.__}function rp(e,t){var n=op(Ya++,3);!bn.__s&&wg(n.__H,t)&&(n.__=e,n.u=t,dn.__H.__h.push(n))}function xg(e,t){var n=op(Ya++,4);!bn.__s&&wg(n.__H,t)&&(n.__=e,n.u=t,dn.__h.push(n))}function ap(e){return mc=5,Io(function(){return{current:e}},[])}function Io(e,t){var n=op(Ya++,7);return wg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function yc(e,t){return mc=8,Io(function(){return e},t)}function e$(){for(var e;e=sE.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(sp),t.__h.some(bg),t.__h=[]}catch(n){t.__h=[],bn.__e(n,e.__v)}}}bn.__b=function(e){dn=null,cE&&cE(e)},bn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),fE&&fE(e,t)},bn.__r=function(e){lE&&lE(e),Ya=0;var t=(dn=e.__c).__H;t&&(yg===dn?(t.__h=[],dn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(sp),t.__h.some(bg),t.__h=[],Ya=0)),yg=dn},bn.diffed=function(e){uE&&uE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(sE.push(t)!==1&&aE===bn.requestAnimationFrame||((aE=bn.requestAnimationFrame)||t$)(e$)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),yg=dn=null},bn.__c=function(e,t){t.some(function(n){try{n.__h.some(sp),n.__h=n.__h.filter(function(i){return!i.__||bg(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],bn.__e(i,n.__v)}}),pE&&pE(e,t)},bn.unmount=function(e){dE&&dE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{sp(i)}catch(o){t=o}}),n.__H=void 0,t&&bn.__e(t,n.__v))};var hE=typeof requestAnimationFrame=="function";function t$(e){var t,n=function(){clearTimeout(i),hE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);hE&&(t=requestAnimationFrame(n))}function sp(e){var t=dn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),dn=t}function bg(e){var t=dn;e.__c=e.__(),dn=t}function wg(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function gE(e,t){return typeof t=="function"?t(e):t}function n$(e){const{navigationStack:t,setNavigationStack:n}=e,i=Io(()=>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 Nt`
11
11
  <div class="djs-popup-breadcrumbs">
12
12
  ${o&&Nt`
13
13
  <button
@@ -40,7 +40,7 @@
40
40
  </span>
41
41
  `}
42
42
  </div>
43
- `}function gE(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=gE(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function cp(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=gE(e))&&(i&&(i+=" "),i+=t);return i}function i$(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Io(()=>o$(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Nt`
43
+ `}function mE(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=mE(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function cp(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=mE(e))&&(i&&(i+=" "),i+=t);return i}function i$(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Io(()=>o$(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Nt`
44
44
  <div class="djs-popup-header">
45
45
  <h3 class="djs-popup-title" title=${r}>${r}</h3>
46
46
  ${a.map(l=>Nt`
@@ -69,11 +69,11 @@
69
69
  </ul>
70
70
  `)}
71
71
  </div>
72
- `}function o$(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 r$(e,t){return cp("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function mE(e,t){return`${e}-entry-${t.id}`}function a$(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 Nt`
72
+ `}function o$(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 r$(e,t){return cp("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function yE(e,t){return`${e}-entry-${t.id}`}function a$(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 Nt`
73
73
  <li
74
74
  class=${cp("entry",{selected:i,disabled:n.disabled})}
75
75
  data-id=${n.id}
76
- id=${mE(t,n)}
76
+ id=${yE(t,n)}
77
77
  role="option"
78
78
  aria-selected=${i||void 0}
79
79
  aria-haspopup=${n.entries?"true":void 0}
@@ -143,7 +143,7 @@
143
143
  >
144
144
  ${i.map(g=>Nt`
145
145
  ${g.name&&Nt`
146
- <div key=${g.id} id=${yE(r,g)} class="entry-header" title=${g.name}>
146
+ <div key=${g.id} id=${vE(r,g)} class="entry-header" title=${g.name}>
147
147
  ${g.name}
148
148
  </div>
149
149
  `}
@@ -151,7 +151,7 @@
151
151
  class="djs-popup-group"
152
152
  data-group=${g.id}
153
153
  role="group"
154
- aria-labelledby=${g.name?yE(r,g):void 0}
154
+ aria-labelledby=${g.name?vE(r,g):void 0}
155
155
  >
156
156
  ${g.entries.map(y=>Nt`
157
157
  <${a$}
@@ -167,8 +167,8 @@
167
167
  </ul>
168
168
  `)}
169
169
  </div>
170
- `}function yE(e,t){return`${e}-group-${t.id}`}function c$(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const l$=new Kr("djs-popup");function u$(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:d,onOpened:f,onClosed:m}=e,[g,y]=vg([]);rp(()=>{y([])},[d]);const[_,h]=vg(""),v=_.trim().length>0,b=Io(()=>f$(d),[d]),E=Io(()=>mn(l)?b.length>5:!1,[l,b]),M=Io(()=>{const V=g.length?g[g.length-1].entries:d;return E?v?p(b.filter(({searchable:Z})=>Z!==!1),_,{keys:["label","search","description"]}).map(({item:Z})=>Z):V.filter(({rank:Z=0})=>Z>=0):V},[E,v,b,_,p,g,d]),B=Io(()=>v?M.length?[{id:"default",entries:M}]:[]:h$(M),[M,v]),[P,k]=vg(M[0]),N=ap(null),G=ap(!1),q=Io(()=>l$.next(),[]),Y=`${q}-results`,ae=P&&mE(q,P);rp(()=>{const V=N.current;V&&M.includes(V)?k(V):k(M[0]),N.current=null},[M]);const X=yc(V=>{const Z=d$(B);let ve=Z.indexOf(P)+V;ve<0&&(ve=Z.length-1),ve>=Z.length&&(ve=0),G.current=!0,k(Z[ve])},[B,P]),Me=yc(V=>{V>0&&P&&P.entries&&(G.current=!0,y(Z=>[...Z,P])),V<0&&g.length>0&&(G.current=!0,N.current=g[g.length+V],y(Z=>Z.slice(0,V)))},[P,g]),Te=yc((V,Z,pe)=>{if(!(!Z||Z.disabled))return Z.entries?(V.preventDefault(),Me(1)):n(V,Z,pe)},[n,Me]),Pe=yc(V=>{if(V.key==="Enter"&&P){const Z=V.target;return!!jr(Z,"a, button",!0)||P.disabled?void 0:Te(V,P)}if(V.key==="Backspace"){const Z=V.target;if(!(Ud(Z,"input")&&Z.value!==""))return Me(-1),V.preventDefault()}if(V.key==="ArrowUp")return X(-1),V.preventDefault();if(V.key==="ArrowDown")return X(1),V.preventDefault();if(V.key==="ArrowRight")return Me(1),V.preventDefault();if(V.key==="ArrowLeft")return Me(-1),V.preventDefault()},[P,X,Me,Te]),fe=yc(V=>{Ud(V.target,"input")&&h(()=>V.target.value)},[h]);rp(()=>(f(),()=>{m()}),[]);const z=!v&&g.length>0,se=(a||o.length>0)&&!z;return Nt`
171
- <${vE}
170
+ `}function vE(e,t){return`${e}-group-${t.id}`}function c$(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const l$=new Kr("djs-popup");function u$(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:d,onOpened:f,onClosed:m}=e,[g,y]=vg([]);rp(()=>{y([])},[d]);const[_,h]=vg(""),v=_.trim().length>0,b=Io(()=>f$(d),[d]),E=Io(()=>mn(l)?b.length>5:!1,[l,b]),M=Io(()=>{const V=g.length?g[g.length-1].entries:d;return E?v?p(b.filter(({searchable:Z})=>Z!==!1),_,{keys:["label","search","description"]}).map(({item:Z})=>Z):V.filter(({rank:Z=0})=>Z>=0):V},[E,v,b,_,p,g,d]),B=Io(()=>v?M.length?[{id:"default",entries:M}]:[]:h$(M),[M,v]),[P,k]=vg(M[0]),N=ap(null),G=ap(!1),q=Io(()=>l$.next(),[]),Y=`${q}-results`,ae=P&&yE(q,P);rp(()=>{const V=N.current;V&&M.includes(V)?k(V):k(M[0]),N.current=null},[M]);const X=yc(V=>{const Z=d$(B);let ve=Z.indexOf(P)+V;ve<0&&(ve=Z.length-1),ve>=Z.length&&(ve=0),G.current=!0,k(Z[ve])},[B,P]),Me=yc(V=>{V>0&&P&&P.entries&&(G.current=!0,y(Z=>[...Z,P])),V<0&&g.length>0&&(G.current=!0,N.current=g[g.length+V],y(Z=>Z.slice(0,V)))},[P,g]),Te=yc((V,Z,pe)=>{if(!(!Z||Z.disabled))return Z.entries?(V.preventDefault(),Me(1)):n(V,Z,pe)},[n,Me]),Pe=yc(V=>{if(V.key==="Enter"&&P){const Z=V.target;return!!jr(Z,"a, button",!0)||P.disabled?void 0:Te(V,P)}if(V.key==="Backspace"){const Z=V.target;if(!(Ud(Z,"input")&&Z.value!==""))return Me(-1),V.preventDefault()}if(V.key==="ArrowUp")return X(-1),V.preventDefault();if(V.key==="ArrowDown")return X(1),V.preventDefault();if(V.key==="ArrowRight")return Me(1),V.preventDefault();if(V.key==="ArrowLeft")return Me(-1),V.preventDefault()},[P,X,Me,Te]),fe=yc(V=>{Ud(V.target,"input")&&h(()=>V.target.value)},[h]);rp(()=>(f(),()=>{m()}),[]);const z=!v&&g.length>0,se=(a||o.length>0)&&!z;return Nt`
171
+ <${xE}
172
172
  onClose=${t}
173
173
  onKeyup=${fe}
174
174
  onKeydown=${Pe}
@@ -256,8 +256,8 @@
256
256
  ${u&&M.length===0&&Nt`
257
257
  <div class="djs-popup-no-results">${wn(u)?u(_):u}</div>
258
258
  `}
259
- </${vE}>
260
- `}function vE(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=ap();return xg(()=>{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]),xg(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),rp(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!jr(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)}},[]),Nt`
259
+ </${xE}>
260
+ `}function xE(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=ap();return xg(()=>{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]),xg(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),rp(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!jr(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)}},[]),Nt`
261
261
  <div
262
262
  class=${cp("djs-popup",o)}
263
263
  style=${p$(e)}
@@ -268,7 +268,7 @@
268
268
  >
269
269
  ${r}
270
270
  </div>
271
- `}function p$(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:mn(t)?n:void 0,maxWidth:mn(t)?"unset":void 0,"transform-origin":"top left"}}function d$(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function f$(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function h$(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 g$="data-id",xE=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],m$=1e3;function Zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=mn(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()})}Zt.$inject=["config.popupMenu","eventBus","canvas","search"],Zt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=bE(n),s=Object.entries(i).map(([d,f])=>({id:d,...f})),c=e&&(d=>this._ensureVisible(d,e)),l=this._updateScale(this._current.container);nE(Nt`
271
+ `}function p$(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:mn(t)?n:void 0,maxWidth:mn(t)?"unset":void 0,"transform-origin":"top left"}}function d$(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function f$(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function h$(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 g$="data-id",bE=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],m$=1e3;function Zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=mn(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()})}Zt.$inject=["config.popupMenu","eventBus","canvas","search"],Zt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=wE(n),s=Object.entries(i).map(([d,f])=>({id:d,...f})),c=e&&(d=>this._ensureVisible(d,e)),l=this._updateScale(this._current.container);iE(Nt`
272
272
  <${u$}
273
273
  onClose=${d=>this.close(d)}
274
274
  onSelect=${(d,f,m)=>this.trigger(d,f,m)}
@@ -283,7 +283,7 @@
283
283
  searchFn=${this._search}
284
284
  ...${{...r}}
285
285
  />
286
- `,this._current.container)},Zt.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()},Zt.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()},Zt.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)}},Zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Zt.prototype.reset=function(){const e=this._current.container;nE(null,e),no(e)},Zt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Zt.prototype._onOpened=function(){this._emit("opened")},Zt.prototype._onClosed=function(){this._emit("closed")},Zt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Vt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Zt.prototype._bindAutoClose=function(){this._eventBus.once(xE,this.close,this)},Zt.prototype._unbindAutoClose=function(){this._eventBus.off(xE,this.close,this)},Zt.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),mn(n)&&e<n&&(o=n),mn(i)&&e>i&&(o=i)),o},Zt.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}},Zt.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},Zt.prototype.registerProvider=function(e,t,n){n||(n=t,t=m$),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Zt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Zt.prototype._getEntries=function(e,t){var n={};return W(t,function(i){if(!i.getPopupMenuEntries){W(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);wn(o)?n=o(n):W(o,function(r,a){n[a]=r})}),n},Zt.prototype._getHeaderEntries=function(e,t){var n={};return W(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;W(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);wn(o)?n=o(n):W(o,function(r,a){n[a]=r})}),n},Zt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>wn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Zt.prototype.isOpen=function(){return!!this._current},Zt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=jr(e.delegateTarget||e.target,".entry",!0),r=Mn(o,g$);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(wn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Zt.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 bE(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=bE(o.entries,[...t,...wE(o.search)]):t.length&&(o.search=[...t,...wE(o.search)]),o})}function wE(e){return e?Ze(e)?e:[e]:[]}function y$(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=v$(r,o,i);return a?{item:r,tokens:a}:[]}).sort(x$(i))}function v$(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ze(s)?s.reduce((u,p)=>{const{tokens:d,matchedWords:f}=ME(p,t);return{tokens:[...u.tokens,d],matchedWords:{...u.matchedWords,...f}}},{matchedWords:{},tokens:[]}):ME(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function x$(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=b$(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=_E;continue}const s=w$(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=_E;continue}}return i}}function b$(e,t){return EE(t)-EE(e)}const _E=.5,Ka={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function EE(e){const t=e.reduce((s,c)=>s+SE(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 SE(e){if(Ze(e))return Math.max(...e.map(SE));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Ka.FULL:e.wordEnd?Ka.START_FULL_WORD:Ka.START_WORD_PART:e.wordStart?Ka.WORD_START:Ka.WORD_PART)*t:Ka.NO_MATCH*t}function RE(e=""){return Ze(e)?e.join(", "):e}function w$(e,t){return RE(e).localeCompare(RE(t))}function ME(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(_$),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,d=s.index+u.length,f=p===0,m=d===e.length,g=!!((l=s.groups)!=null&&l.all),y=f||/\s/.test(e.charAt(p-1)),_=m||/\s/.test(e.charAt(d));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:f,end:m,all:g});const h=g?t:[u];for(const v of h)i[v.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function _$(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const CE={search:["value",y$]},_g={__depends__:[CE],__init__:["popupMenu"],popupMenu:["type",Zt]};var AE={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
286
+ `,this._current.container)},Zt.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()},Zt.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()},Zt.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)}},Zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Zt.prototype.reset=function(){const e=this._current.container;iE(null,e),no(e)},Zt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Zt.prototype._onOpened=function(){this._emit("opened")},Zt.prototype._onClosed=function(){this._emit("closed")},Zt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Vt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Zt.prototype._bindAutoClose=function(){this._eventBus.once(bE,this.close,this)},Zt.prototype._unbindAutoClose=function(){this._eventBus.off(bE,this.close,this)},Zt.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),mn(n)&&e<n&&(o=n),mn(i)&&e>i&&(o=i)),o},Zt.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}},Zt.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},Zt.prototype.registerProvider=function(e,t,n){n||(n=t,t=m$),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Zt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Zt.prototype._getEntries=function(e,t){var n={};return W(t,function(i){if(!i.getPopupMenuEntries){W(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);wn(o)?n=o(n):W(o,function(r,a){n[a]=r})}),n},Zt.prototype._getHeaderEntries=function(e,t){var n={};return W(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;W(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);wn(o)?n=o(n):W(o,function(r,a){n[a]=r})}),n},Zt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>wn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Zt.prototype.isOpen=function(){return!!this._current},Zt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=jr(e.delegateTarget||e.target,".entry",!0),r=Mn(o,g$);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(wn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Zt.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 wE(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=wE(o.entries,[...t,..._E(o.search)]):t.length&&(o.search=[...t,..._E(o.search)]),o})}function _E(e){return e?Ze(e)?e:[e]:[]}function y$(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=v$(r,o,i);return a?{item:r,tokens:a}:[]}).sort(x$(i))}function v$(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ze(s)?s.reduce((u,p)=>{const{tokens:d,matchedWords:f}=CE(p,t);return{tokens:[...u.tokens,d],matchedWords:{...u.matchedWords,...f}}},{matchedWords:{},tokens:[]}):CE(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function x$(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=b$(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=EE;continue}const s=w$(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=EE;continue}}return i}}function b$(e,t){return SE(t)-SE(e)}const EE=.5,Ka={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function SE(e){const t=e.reduce((s,c)=>s+RE(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 RE(e){if(Ze(e))return Math.max(...e.map(RE));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Ka.FULL:e.wordEnd?Ka.START_FULL_WORD:Ka.START_WORD_PART:e.wordStart?Ka.WORD_START:Ka.WORD_PART)*t:Ka.NO_MATCH*t}function ME(e=""){return Ze(e)?e.join(", "):e}function w$(e,t){return ME(e).localeCompare(ME(t))}function CE(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(_$),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,d=s.index+u.length,f=p===0,m=d===e.length,g=!!((l=s.groups)!=null&&l.all),y=f||/\s/.test(e.charAt(p-1)),_=m||/\s/.test(e.charAt(d));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:f,end:m,all:g});const h=g?t:[u];for(const v of h)i[v.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function _$(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const AE={search:["value",y$]},_g={__depends__:[AE],__init__:["popupMenu"],popupMenu:["type",Zt]};var TE={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
287
  <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
288
288
  <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
289
289
  <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -311,8 +311,8 @@
311
311
  <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
312
312
  <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
313
313
  <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
314
- </svg>`},E$=900;function Xa(e,t,n,i){e.registerProvider(E$,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Xa.$inject=["contextPad","popupMenu","translate","canvas"],Xa.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&J(t,this._getEntries(e)),t},Xa.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Xa.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${AE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);J(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Xa.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 S$=["left","center","right","top","middle","bottom"];function vc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}vc.$inject=["popupMenu","alignElements","translate","rules"],vc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&J(t,this._getEntries(e)),t},vc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},vc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return W(S$,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:AE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function lp(e){Ai.call(this,e)}lp.$inject=["eventBus"],Ne(lp,Ai),lp.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=dt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=El(n),n.length<2?!1:n})};const R$={__depends__:[BN,F0,_g],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Xa],alignElementsMenuProvider:["type",vc],bpmnAlignElements:["type",lp]};function Za(e,t,n){this._canvas=n,this._opts=J({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Za.$inject=["config.autoScroll","eventBus","canvas"],Za.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++)M$(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 M$(e,t,n){return t<e&&e<n}Za.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Za.prototype.setOptions=function(e){this._opts=J({},this._opts,e)},Za.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Ur(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const C$={__depends__:[To],__init__:["autoScroll"],autoScroll:["type",Za]};var TE="djs-bendpoint",PE="djs-segment-dragger";function A$(e,t){var n=Ur(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 Eg(e,t,n){var i=A$(e,n),o=Of(t,i);return o}function Sg(e,t){var n=je("g");gt(n).add(TE),tt(e,n);var i=je("circle");Le(i,{cx:0,cy:0,r:4}),gt(i).add("djs-visual"),tt(n,i);var o=je("circle");return Le(o,{cx:0,cy:0,r:10}),gt(o).add("djs-hit"),tt(n,o),t&&gt(n).add(t),n}function T$(e,t,n,i){var o=je("g");tt(e,o);var r=18,a=6,s=11,c=k$(t,n,i),l=a+s,u=je("rect");Le(u,{x:-r/2,y:-a/2,width:r,height:a}),gt(u).add("djs-visual"),tt(o,u);var p=je("rect");return Le(p,{x:-c/2,y:-l/2,width:c,height:l}),gt(p).add("djs-hit"),tt(o,p),kx(o,i==="v"?90:0),o}function kE(e,t,n){var i=je("g"),o=sf(t,n),r=Eo(t,n);return tt(e,i),T$(i,t,n,r),gt(i).add(PE),gt(i).add(r==="h"?"horizontal":"vertical"),Nn(i,o.x,o.y),i}function Rg(e){return Math.abs(Math.round(e*2/3))}function P$(e,t){var n=O$(e,t);return $f(e,n)}function k$(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Rg(n==="h"?i:o)}function O$(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=xb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function OE(e,t,n,i,o){function r(v,b,E){var M=v.index,B=v.point,P,k,N,G,q,Y;return M<=0||v.bendpoint?!1:(P=b[M-1],k=b[M],N=sf(P,k),G=Eo(P,k),q=Math.abs(B.x-N.x),Y=Math.abs(B.y-N.y),G&&q<=E&&Y<=E)}function a(v,b){var E=v.waypoints,M,B,P,k;return b.index<=0||b.bendpoint||(M={start:E[b.index-1],end:E[b.index]},B=Eo(M.start,M.end),!B)?null:(B==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,k=Rg(P)/2,k)}function s(v,b){var E=b.waypoints,M=Eg(t,E,v),B;if(M){B=a(b,M);var P;if(r(M,E,B)?P=o.start(v,b,M.index):P=i.start(v,b,M.index,!M.bendpoint),P!==!1)return!0}}function c(v,b,E){We.bind(v,b,function(M){n.triggerMouseEvent(b,M,E),M.stopPropagation()})}function l(v,b){var E=t.getLayer("overlays"),M=Ct('.djs-bendpoints[data-element-id="'+Qr(v.id)+'"]',E);return!M&&b&&(M=je("g"),Le(M,{"data-element-id":v.id}),gt(M).add("djs-bendpoints"),tt(E,M),c(M,"mousedown",v),c(M,"click",v),c(M,"dblclick",v)),M}function u(v,b){return Ct('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(E,M){var B=Sg(v);tt(v,B),Nn(B,E.x,E.y)}),Sg(v,"floating")}function d(v,b){for(var E=b.waypoints,M,B,P,k=1;k<E.length;k++)M=E[k-1],B=E[k],Eo(M,B)&&(P=kE(v,M,B),Le(P,{"data-segment-idx":k}),c(P,"mousemove",b))}function f(v){W(Ms("."+TE,v),function(b){cn(b)})}function m(v){W(Ms("."+PE,v),function(b){cn(b)})}function g(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function y(v){var b=l(v);b&&(m(b),f(b),d(b,v),p(b,v))}function _(v,b){var E=Ct(".floating",v),M=b.point;E&&(Nn(E,M.x,M.y),gt(E).add("positioned"))}function h(v,b,E){var M=u(b.index,v),B=E[b.index-1],P=E[b.index],k=b.point,N=sf(B,P),G=Eo(B,P),q,Y;M&&(q=D$(M),Y={x:k.x-N.x,y:k.y-N.y},G==="v"&&(Y={x:Y.y,y:Y.x}),Nn(q,Y.x,Y.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&cn(b)}),e.on("element.marker.update",function(v){var b=v.element,E;b.waypoints&&(E=g(b),v.add?gt(E).add(v.marker):gt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,E=b.waypoints,M,B;if(E){if(M=l(b,!0),B=Eg(t,E,v.originalEvent),!B)return;_(M,B),B.bendpoint||h(M,B,E)}}),e.on("element.mousedown",function(v){if(sr(v)){var b=v.originalEvent,E=v.element;if(E.waypoints)return s(b,E)}}),e.on("selection.changed",function(v){var b=v.newSelection,E=b[0];E&&E.waypoints&&g(E)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&g(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var E=l(b);if(E){var M=Ct(".floating",E);M&&gt(M).remove("positioned")}}}),e.on("element.updateId",function(v){var b=v.element,E=v.newId;if(b.waypoints){var M=l(b);M&&Le(M,{"data-element-id":E})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}OE.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function D$(e){return Ct(".djs-visual",e)}var DE=Math.round,na="reconnectStart",ia="reconnectEnd",xc="updateWaypoints";function Mg(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,d=s.target,f=s.waypoints,m;!l&&c===0?m=na:!l&&c===f.length-1?m=ia:m=xc;var g=m===xc?"connection.updateWaypoints":"connection.reconnect",y=o.allowed(g,{connection:s,source:p,target:d});if(y===!1&&(y=o.allowed(g,{connection:s,source:d,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:d,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,d=s.type;s.hover=p;var f;if(p){var m=d===xc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(m,{connection:c,source:d===na?p:l,target:d===ia?p:u}),f){s.source=d===na?p:l,s.target=d===ia?p:u;return}f===!1&&(f=s.allowed=o.allowed(m,{connection:c,source:d===ia?p:u,target:d===na?p:l})),f&&(s.source=d===ia?p:u,s.target=d===na?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!==xc&&(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,d=u.waypoints.slice(),f=s.source,m=s.target,g=s.type,y=s.hints||{},_={x:DE(a.x),y:DE(a.y)};if(!c)return!1;g===xc?(p?d.splice(l,0,_):d[l]=_,y.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,h2(d),y)):(g===na?(y.docking="source",up(s)&&(y.docking="target",y.newWaypoints=d.reverse())):g===ia&&(y.docking="target",up(s)&&(y.docking="source",y.newWaypoints=d.reverse())),r.reconnect(u,f,m,_,y))},this)}Mg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Mg.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 up(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===na)return t&&i&&t===i&&n!==i;if(o===ia)return t&&n&&t===n&&n!==i}var L$="reconnectStart",I$="reconnectEnd",LE="updateWaypoints",bc="connect-ok",pp="connect-not-ok",IE="connect-hover",BE="djs-updating",NE="djs-dragging",$E=1100;function FE(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 d=a.draggerGfx=Sg(i.getLayer("overlays"));gt(d).add("djs-dragging"),i.addMarker(c,NE),i.addMarker(c,BE)}),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,IE),l===LE)return;s?(i.removeMarker(c,pp),i.addMarker(c,bc)):s===!1&&(i.removeMarker(c,bc),i.addMarker(c,pp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],$E,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,IE),i.removeMarker(s,c?bc:pp))}),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,d=a.connection,f=d.source,m=d.target,g=d.waypoints.slice(),y={x:r.x,y:r.y},_=a.hints||{},h={};o&&(_.connectionStart&&(h.connectionStart=_.connectionStart),_.connectionEnd&&(h.connectionEnd=_.connectionEnd),p===L$?up(a)?(h.connectionEnd=h.connectionEnd||y,h.source=m,h.target=u||f,g=g.reverse()):(h.connectionStart=h.connectionStart||y,h.source=u||f,h.target=m):p===I$?up(a)?(h.connectionStart=h.connectionStart||y,h.source=u||m,h.target=f,g=g.reverse()):(h.connectionEnd=h.connectionEnd||y,h.source=f,h.target=u||m):(h.noCropping=!0,h.noLayout=!0,g[c]=y),p===LE&&(g=e.cropWaypoints(d,g)),h.waypoints=g,o.drawPreview(a,s,h)),Nn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],$E,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,cn(c),i.removeMarker(s,BE),i.removeMarker(s,NE),l&&(i.removeMarker(l,bc),i.removeMarker(l,u?bc:pp)),o&&o.cleanUp(a)})}FE.$inject=["bendpointMove","injector","eventBus","canvas"];var jE="connect-hover",HE="djs-updating";function zE(e,t,n){return Cg(e,t,e[t]+n)}function Cg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function B$(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 Cg(t,i,s)}function GE(e){return e==="x"?"y":"x"}function VE(e,t,n){var i,o;return e.original?e.original:(i=Qe(t),o=GE(n),Cg(e,o,i[o]))}function WE(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var m,g=n.getGraphics(d),y=f-1,_=f,h=d.waypoints,v=h[y],b=h[_],E=Eg(n,h,p),M,B,P;if(M=Eo(v,b),!!M)return B=M==="v"?"x":"y",y===0&&(v=VE(v,d.source,B)),_===h.length-1&&(b=VE(b,d.target,B)),E?P=E.point:P={x:(v.x+b.x)/2,y:(v.y+b.y)/2},m={connection:d,segmentStartIndex:y,segmentEndIndex:_,segmentStart:v,segmentEnd:b,axis:B,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:g,context:m}})};function s(p,d){if(!a)return d;var f=p.waypoints,m;return p.waypoints=d,m=a.getCroppedWaypoints(p),p.waypoints=f,m}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var m=p.newWaypoints,g=p.segmentStartIndex+d,y=m[g],_=p.segmentEndIndex+d,h=m[_],v=GE(p.axis),b=B$(f,y,h,v);Nn(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,m=p.filter(function(g,y){return af(p[y-1],p[y+1],g)?(f=y<=d?f-1:f,!1):!0});return{waypoints:m,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,m=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=kE(m,d.segmentStart,d.segmentEnd),gt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,HE)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,m=d.segmentStartIndex,g=d.segmentEndIndex,y=d.segmentStart,_=d.segmentEnd,h=d.axis,v=d.originalWaypoints.slice(),b=zE(y,h,p["d"+h]),E=zE(_,h,p["d"+h]),M=v.length,B=0;v[m]=b,v[g]=E;var P,k;m<2&&(P=Bn(f.source,b),m===1?P==="intersect"&&(v.shift(),v[0]=b,B--):P!=="intersect"&&(v.unshift(y),B++)),g>M-3&&(k=Bn(f.target,E),g===M-2?k==="intersect"&&(v.pop(),v[v.length-1]=E):k!=="intersect"&&v.push(_)),d.newWaypoints=f.waypoints=s(f,v),l(d,B,p),d.newSegmentStartIndex=m+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,jE)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,jE)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&cn(d.draggerGfx),n.removeMarker(f,HE)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var d=p.context,f=d.connection;f.waypoints=d.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var d=p.context,f=d.connection,m=d.newWaypoints,g=d.newSegmentStartIndex;m=m.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var y=u(m,g),_=y.waypoints,h=s(f,_),v=y.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:g+v}};r.updateWaypoints(f,h,b)})}WE.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var N$=Math.abs,UE=Math.round;function $$(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],N$(o-e)<=n)return o}function qE(e){return{x:e.x,y:e.y}}function YE(e){return{x:e.x+e.width,y:e.y+e.height}}function Oi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:UE(e.x+e.width/2),y:UE(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 fn(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 KE(e){return e.children||[]}var F$=Math.abs,XE=Math.round,Ag=10;function ZE(e){function t(r,a){if(Ze(r)){for(var s=r.length;s--;)if(F$(r[s]-a)<=Ag)return r[s]}else{r=+r;var c=a%r;if(c<Ag)return a-c;if(c>r-Ag)return a-c+r}return a}function n(r,a){if(r.waypoints)return P$(a,r);if(r.width)return{x:XE(r.width/2+r.x),y:XE(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,d=a.segmentEnd,f=a.segmentEndIndex,m=a.axis;if(s)return s;var g=[l[p-1],u,d,l[f+1]];return p<2&&g.unshift(n(c.source,r)),f>l.length-3&&g.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},W(g,function(y){y&&(y=y.original||y,m==="y"&&s.horizontal.push(y.y),m==="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,d=c-u;J(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&fn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&fn(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:[]},W(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);!It(s)||!c||!c.x||!c.y||(fn(r,"x",c.x),fn(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,d,f;if(s){d=t(l?s.vertical.concat([l.x]):s.vertical,u),f=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var m=u-d,g=p-f;J(r,{dx:r.dx-m,dy:r.dy-g,x:r.x-m,y:r.y-g}),(m||s.vertical.indexOf(u)!==-1)&&fn(r,"x",d),(g||s.horizontal.indexOf(p)!==-1)&&fn(r,"y",f)}})}ZE.$inject=["eventBus"];const j$={__depends__:[To,co],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",OE],bendpointMove:["type",Mg],bendpointMovePreview:["type",FE],connectionSegmentMove:["type",WE],bendpointSnapping:["type",ZE]};function JE(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),!da(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!da(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,d=s.target;if(!c)return!1;var f=null,m={connectionStart:Tg(s)?u:l,connectionEnd:Tg(s)?l:u};yn(c)&&(f=c),s.connection=n.connect(p,d,f,m)}),this.start=function(a,s,c,l){yn(c)||(l=c,c=Qe(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}JE.$inject=["eventBus","dragging","modeling","rules"];function Tg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var H$=1100,z$=900,QE="connect-ok",e1="connect-not-ok";function t1(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,d=r.connectionStart||u,f=r.connectionEnd||{x:o.x,y:o.y},m=d,g=f;Tg(r)&&(m=f,g=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:m,connectionEnd:g})}),t.on("connect.hover",z$,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?QE:e1)}),t.on(["connect.out","connect.cleanup"],H$,function(o){var r=o.hover;r&&(n.removeMarker(r,QE),n.removeMarker(r,e1))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}t1.$inject=["injector","eventBus","canvas"];const Pg={__depends__:[Ti,co,To],__init__:["connectPreview"],connect:["type",JE],connectPreview:["type",t1]};var G$="djs-dragger";function Bo(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)}Bo.$inject=["injector","canvas","graphicsFactory","elementFactory"],Bo.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,d=n.noNoop,f,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Cs(i),o||(o=e.getConnection=V$(function(g,y,_){return m.getConnection(g,y,_)})),t&&(f=o(t,r,a)),!f){!d&&this.drawNoopPreview(i,n);return}f.waypoints=s||[],this._layouter&&!u&&(f.waypoints=this._layouter.layoutConnection(f,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||f.waypoints})),(!f.waypoints||!f.waypoints.length)&&(f.waypoints=[r?Qe(r):c,a?Qe(a):l]),this._connectionDocking&&(r||a)&&!p&&(f.waypoints=this._connectionDocking.getCroppedWaypoints(f,r,a)),this._graphicsFactory.drawConnection(i,f,{stroke:"var(--element-dragger-color)"})},Bo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||Qe(n),r=t.connectionEnd||Qe(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);tt(e,s)},Bo.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&&Ls(r,s,!0)||e,t=i&&Ls(a,s,!1)||t,[e,t]},Bo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&cn(e.connectionPreviewGfx)},Bo.prototype.getConnection=function(e){var t=W$(e);return this._elementFactory.createConnection(t)},Bo.prototype.createConnectionPreviewGfx=function(){var e=je("g");return Le(e,{pointerEvents:"none"}),gt(e).add(G$),tt(this._canvas.getActiveLayer(),e),e},Bo.prototype.createNoopConnection=function(e,t){return Ps([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function V$(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 W$(e){return yn(e)?e:{}}const U$={__init__:["connectionPreview"],connectionPreview:["type",Bo]},dp="complex-preview";class n1{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(dp);n.filter(s=>!q$(s)).forEach(s=>{let c;It(s)?(c=this._graphicsFactory._createContainer("connection",je("g")),this._graphicsFactory.drawConnection(tr(c),s)):(c=this._graphicsFactory._createContainer("shape",je("g")),this._graphicsFactory.drawShape(tr(c),s),Nn(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);It(s)?Nn(l,c.x,c.y):Nn(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",je("g"));this._graphicsFactory.drawShape(tr(l),s,{width:c.width,height:c.height}),Nn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Cs(this._canvas.getLayer(dp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(dp)}hide(){this._canvas.hideLayer(dp)}}n1.$inject=["canvas","graphicsFactory","previewSupport"];function q$(e){return e.hidden}const Y$={__depends__:[ja],__init__:["complexPreview"],complexPreview:["type",n1]},i1=Math.round;function fp(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}fp.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(J({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;J(l,{x:u.x-i1(l.width/2),y:u.y-i1(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let d=null;p&&(d=r.createConnection(p),d.waypoints=s.layoutConnection(d,{source:e,target:l}),d.waypoints=o.getCroppedWaypoints(d,e,l)),i.create({created:[l,d].filter(f=>!da(f))})},fp.prototype.cleanUp=function(){this._complexPreview.cleanUp()},fp.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const K$={__depends__:[Du,Y$,Uh],__init__:["appendPreview"],appendPreview:["type",fp]};var o1=Math.min,r1=Math.max;function kg(e){e.preventDefault()}function wc(e){e.stopPropagation()}function X$(e){return e.nodeType===Node.TEXT_NODE}function Z$(e){return[].slice.call(e)}function Wi(e){this.container=e.container,this.parent=Vt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ct("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Zn(this.autoResize,this),this.handlePaste=Zn(this.handlePaste,this)}Wi.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=Fi(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);J(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=Fi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return J(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&J(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,We.bind(a,"keydown",this.keyHandler),We.bind(a,"mousedown",wc),We.bind(a,"paste",o.handlePaste),We.bind(a,"focusout",this.focusoutHandler),i.autoResize&&We.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Wi.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)}},Wi.prototype.insertText=function(e){e=J$(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Wi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=Z$(a.childNodes),c,l;if(X$(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 d=s.indexOf(n),f=s.indexOf(i);s.forEach(function(m,g){g===d?m.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):g>d&&g<=f&&no(m)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Wi.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})}},Wi.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=Vt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(m){kg(m),wc(m),s=m.clientX,c=m.clientY;var g=t.getBoundingClientRect();l=g.width,u=g.height,We.bind(document,"mousemove",d),We.bind(document,"mouseup",f)},d=function(m){kg(m),wc(m);var g=o1(r1(l+m.clientX-s,i),r),y=o1(r1(u+m.clientY-c,o),a);t.style.width=g+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:m.clientX-s,dy:m.clientY-c})},f=function(m){kg(m),wc(m),We.unbind(document,"mousemove",d,!1),We.unbind(document,"mouseup",f,!1)};We.bind(n,"mousedown",p)}J(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Wi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),We.unbind(t,"keydown",this.keyHandler),We.unbind(t,"mousedown",wc),We.unbind(t,"input",this.autoResize),We.unbind(t,"paste",this.handlePaste),We.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),no(n)),no(e)},Wi.prototype.getValue=function(){return this.content.innerText.trim()},Wi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Wi.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 J$(e){return e.replace(/\r\n|\r|\n/g,`
315
- `)}function hi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Wi({container:t.getContainer(),keyHandler:Zn(this._handleKey,this),resizeHandler:Zn(this._handleResize,this),focusoutHandler:Zn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}hi.$inject=["eventBus","canvas"],hi.prototype.registerProvider=function(e){this._providers.push(e)},hi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},hi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},hi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},hi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},hi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},hi.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()}},hi.prototype.getValue=function(){return this._textbox.getValue()},hi.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()},hi.prototype._handleResize=function(e){this._fire("resize",e)},hi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},hi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ft(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 a1={__depends__:[lu],__init__:["directEditing"],directEditing:["type",hi]};function Q$(e){return function(t){var n=t.target,i=we(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===mt(e);return!r||!a||!s||!c}}const e5={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 xe(e,t={}){var n=e5[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var t5=[xe("none-start-event",{actionName:"replace-with-none-start"}),xe("none-intermediate-throwing"),xe("none-end-event",{actionName:"replace-with-none-end"}),xe("message-start"),xe("timer-start"),xe("conditional-start"),xe("signal-start")],n5=[xe("none-start-event",{actionName:"replace-with-none-start"}),xe("none-intermediate-throwing"),xe("none-end-event",{actionName:"replace-with-none-end"})],i5=[xe("none-start-event",{actionName:"replace-with-none-start"}),xe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),xe("none-end-event",{actionName:"replace-with-none-end"}),xe("message-intermediate-catch"),xe("message-intermediate-throw"),xe("timer-intermediate-catch"),xe("escalation-intermediate-throw"),xe("conditional-intermediate-catch"),xe("link-intermediate-catch"),xe("link-intermediate-throw"),xe("compensation-intermediate-throw"),xe("signal-intermediate-catch"),xe("signal-intermediate-throw")],o5=[xe("none-start-event",{actionName:"replace-with-none-start"}),xe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),xe("none-end-event",{actionName:"replace-with-none-end"}),xe("message-end"),xe("escalation-end"),xe("error-end"),xe("cancel-end"),xe("compensation-end"),xe("signal-end"),xe("terminate-end")],r5=[xe("exclusive-gateway"),xe("parallel-gateway"),xe("inclusive-gateway"),xe("complex-gateway"),xe("event-based-gateway")],a5=[xe("transaction"),xe("event-subprocess"),xe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),xe("collapsed-subprocess")],s5=[xe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),xe("transaction"),xe("event-subprocess"),xe("collapsed-ad-hoc-subprocess")],s1=[xe("transaction"),xe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),xe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),xe("event-subprocess")],c5=s1,c1=[xe("task"),xe("user-task"),xe("service-task"),xe("send-task"),xe("receive-task"),xe("manual-task"),xe("rule-task"),xe("script-task"),xe("call-activity"),xe("collapsed-subprocess"),xe("expanded-subprocess"),xe("collapsed-ad-hoc-subprocess"),xe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],l5=[xe("data-store-reference")],u5=[xe("data-object-reference")],p5=[xe("message-boundary"),xe("timer-boundary"),xe("escalation-boundary"),xe("conditional-boundary"),xe("error-boundary"),xe("cancel-boundary"),xe("signal-boundary"),xe("compensation-boundary"),xe("non-interrupting-message-boundary"),xe("non-interrupting-timer-boundary"),xe("non-interrupting-escalation-boundary"),xe("non-interrupting-conditional-boundary"),xe("non-interrupting-signal-boundary")],d5=[xe("message-start"),xe("timer-start"),xe("conditional-start"),xe("signal-start"),xe("error-start"),xe("escalation-start"),xe("compensation-start"),xe("non-interrupting-message-start"),xe("non-interrupting-timer-start"),xe("non-interrupting-conditional-start"),xe("non-interrupting-signal-start"),xe("non-interrupting-escalation-start")],f5=[{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"}],h5=[xe("expanded-pool"),xe("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],g5={"bpmn:MessageEventDefinition":[xe("message-start"),xe("message-intermediate-catch"),xe("message-intermediate-throw"),xe("message-end")],"bpmn:TimerEventDefinition":[xe("timer-start"),xe("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[xe("conditional-start"),xe("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[xe("signal-start"),xe("signal-intermediate-catch"),xe("signal-intermediate-throw"),xe("signal-end")],"bpmn:ErrorEventDefinition":[xe("error-start"),xe("error-end")],"bpmn:EscalationEventDefinition":[xe("escalation-start"),xe("escalation-intermediate-throw"),xe("escalation-end")],"bpmn:CompensateEventDefinition":[xe("compensation-start"),xe("compensation-intermediate-throw"),xe("compensation-end")]};const l1={"start-event-non-interrupting":`
314
+ </svg>`},E$=900;function Xa(e,t,n,i){e.registerProvider(E$,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Xa.$inject=["contextPad","popupMenu","translate","canvas"],Xa.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&J(t,this._getEntries(e)),t},Xa.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Xa.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${TE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);J(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Xa.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 S$=["left","center","right","top","middle","bottom"];function vc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}vc.$inject=["popupMenu","alignElements","translate","rules"],vc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&J(t,this._getEntries(e)),t},vc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},vc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return W(S$,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:TE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function lp(e){Ai.call(this,e)}lp.$inject=["eventBus"],Ne(lp,Ai),lp.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=dt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=El(n),n.length<2?!1:n})};const R$={__depends__:[BN,j0,_g],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Xa],alignElementsMenuProvider:["type",vc],bpmnAlignElements:["type",lp]};function Za(e,t,n){this._canvas=n,this._opts=J({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Za.$inject=["config.autoScroll","eventBus","canvas"],Za.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++)M$(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 M$(e,t,n){return t<e&&e<n}Za.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Za.prototype.setOptions=function(e){this._opts=J({},this._opts,e)},Za.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Ur(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const C$={__depends__:[To],__init__:["autoScroll"],autoScroll:["type",Za]};var PE="djs-bendpoint",kE="djs-segment-dragger";function A$(e,t){var n=Ur(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 Eg(e,t,n){var i=A$(e,n),o=Of(t,i);return o}function Sg(e,t){var n=je("g");gt(n).add(PE),tt(e,n);var i=je("circle");Le(i,{cx:0,cy:0,r:4}),gt(i).add("djs-visual"),tt(n,i);var o=je("circle");return Le(o,{cx:0,cy:0,r:10}),gt(o).add("djs-hit"),tt(n,o),t&&gt(n).add(t),n}function T$(e,t,n,i){var o=je("g");tt(e,o);var r=18,a=6,s=11,c=k$(t,n,i),l=a+s,u=je("rect");Le(u,{x:-r/2,y:-a/2,width:r,height:a}),gt(u).add("djs-visual"),tt(o,u);var p=je("rect");return Le(p,{x:-c/2,y:-l/2,width:c,height:l}),gt(p).add("djs-hit"),tt(o,p),Ox(o,i==="v"?90:0),o}function OE(e,t,n){var i=je("g"),o=sf(t,n),r=Eo(t,n);return tt(e,i),T$(i,t,n,r),gt(i).add(kE),gt(i).add(r==="h"?"horizontal":"vertical"),Nn(i,o.x,o.y),i}function Rg(e){return Math.abs(Math.round(e*2/3))}function P$(e,t){var n=O$(e,t);return $f(e,n)}function k$(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Rg(n==="h"?i:o)}function O$(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=bb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function DE(e,t,n,i,o){function r(v,b,E){var M=v.index,B=v.point,P,k,N,G,q,Y;return M<=0||v.bendpoint?!1:(P=b[M-1],k=b[M],N=sf(P,k),G=Eo(P,k),q=Math.abs(B.x-N.x),Y=Math.abs(B.y-N.y),G&&q<=E&&Y<=E)}function a(v,b){var E=v.waypoints,M,B,P,k;return b.index<=0||b.bendpoint||(M={start:E[b.index-1],end:E[b.index]},B=Eo(M.start,M.end),!B)?null:(B==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,k=Rg(P)/2,k)}function s(v,b){var E=b.waypoints,M=Eg(t,E,v),B;if(M){B=a(b,M);var P;if(r(M,E,B)?P=o.start(v,b,M.index):P=i.start(v,b,M.index,!M.bendpoint),P!==!1)return!0}}function c(v,b,E){We.bind(v,b,function(M){n.triggerMouseEvent(b,M,E),M.stopPropagation()})}function l(v,b){var E=t.getLayer("overlays"),M=Ct('.djs-bendpoints[data-element-id="'+Qr(v.id)+'"]',E);return!M&&b&&(M=je("g"),Le(M,{"data-element-id":v.id}),gt(M).add("djs-bendpoints"),tt(E,M),c(M,"mousedown",v),c(M,"click",v),c(M,"dblclick",v)),M}function u(v,b){return Ct('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(E,M){var B=Sg(v);tt(v,B),Nn(B,E.x,E.y)}),Sg(v,"floating")}function d(v,b){for(var E=b.waypoints,M,B,P,k=1;k<E.length;k++)M=E[k-1],B=E[k],Eo(M,B)&&(P=OE(v,M,B),Le(P,{"data-segment-idx":k}),c(P,"mousemove",b))}function f(v){W(Ms("."+PE,v),function(b){cn(b)})}function m(v){W(Ms("."+kE,v),function(b){cn(b)})}function g(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function y(v){var b=l(v);b&&(m(b),f(b),d(b,v),p(b,v))}function _(v,b){var E=Ct(".floating",v),M=b.point;E&&(Nn(E,M.x,M.y),gt(E).add("positioned"))}function h(v,b,E){var M=u(b.index,v),B=E[b.index-1],P=E[b.index],k=b.point,N=sf(B,P),G=Eo(B,P),q,Y;M&&(q=D$(M),Y={x:k.x-N.x,y:k.y-N.y},G==="v"&&(Y={x:Y.y,y:Y.x}),Nn(q,Y.x,Y.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&cn(b)}),e.on("element.marker.update",function(v){var b=v.element,E;b.waypoints&&(E=g(b),v.add?gt(E).add(v.marker):gt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,E=b.waypoints,M,B;if(E){if(M=l(b,!0),B=Eg(t,E,v.originalEvent),!B)return;_(M,B),B.bendpoint||h(M,B,E)}}),e.on("element.mousedown",function(v){if(sr(v)){var b=v.originalEvent,E=v.element;if(E.waypoints)return s(b,E)}}),e.on("selection.changed",function(v){var b=v.newSelection,E=b[0];E&&E.waypoints&&g(E)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&g(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var E=l(b);if(E){var M=Ct(".floating",E);M&&gt(M).remove("positioned")}}}),e.on("element.updateId",function(v){var b=v.element,E=v.newId;if(b.waypoints){var M=l(b);M&&Le(M,{"data-element-id":E})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}DE.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function D$(e){return Ct(".djs-visual",e)}var LE=Math.round,na="reconnectStart",ia="reconnectEnd",xc="updateWaypoints";function Mg(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,d=s.target,f=s.waypoints,m;!l&&c===0?m=na:!l&&c===f.length-1?m=ia:m=xc;var g=m===xc?"connection.updateWaypoints":"connection.reconnect",y=o.allowed(g,{connection:s,source:p,target:d});if(y===!1&&(y=o.allowed(g,{connection:s,source:d,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:d,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,d=s.type;s.hover=p;var f;if(p){var m=d===xc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(m,{connection:c,source:d===na?p:l,target:d===ia?p:u}),f){s.source=d===na?p:l,s.target=d===ia?p:u;return}f===!1&&(f=s.allowed=o.allowed(m,{connection:c,source:d===ia?p:u,target:d===na?p:l})),f&&(s.source=d===ia?p:u,s.target=d===na?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!==xc&&(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,d=u.waypoints.slice(),f=s.source,m=s.target,g=s.type,y=s.hints||{},_={x:LE(a.x),y:LE(a.y)};if(!c)return!1;g===xc?(p?d.splice(l,0,_):d[l]=_,y.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,h2(d),y)):(g===na?(y.docking="source",up(s)&&(y.docking="target",y.newWaypoints=d.reverse())):g===ia&&(y.docking="target",up(s)&&(y.docking="source",y.newWaypoints=d.reverse())),r.reconnect(u,f,m,_,y))},this)}Mg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Mg.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 up(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===na)return t&&i&&t===i&&n!==i;if(o===ia)return t&&n&&t===n&&n!==i}var L$="reconnectStart",I$="reconnectEnd",IE="updateWaypoints",bc="connect-ok",pp="connect-not-ok",BE="connect-hover",NE="djs-updating",$E="djs-dragging",FE=1100;function jE(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 d=a.draggerGfx=Sg(i.getLayer("overlays"));gt(d).add("djs-dragging"),i.addMarker(c,$E),i.addMarker(c,NE)}),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,BE),l===IE)return;s?(i.removeMarker(c,pp),i.addMarker(c,bc)):s===!1&&(i.removeMarker(c,bc),i.addMarker(c,pp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],FE,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,BE),i.removeMarker(s,c?bc:pp))}),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,d=a.connection,f=d.source,m=d.target,g=d.waypoints.slice(),y={x:r.x,y:r.y},_=a.hints||{},h={};o&&(_.connectionStart&&(h.connectionStart=_.connectionStart),_.connectionEnd&&(h.connectionEnd=_.connectionEnd),p===L$?up(a)?(h.connectionEnd=h.connectionEnd||y,h.source=m,h.target=u||f,g=g.reverse()):(h.connectionStart=h.connectionStart||y,h.source=u||f,h.target=m):p===I$?up(a)?(h.connectionStart=h.connectionStart||y,h.source=u||m,h.target=f,g=g.reverse()):(h.connectionEnd=h.connectionEnd||y,h.source=f,h.target=u||m):(h.noCropping=!0,h.noLayout=!0,g[c]=y),p===IE&&(g=e.cropWaypoints(d,g)),h.waypoints=g,o.drawPreview(a,s,h)),Nn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],FE,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,cn(c),i.removeMarker(s,NE),i.removeMarker(s,$E),l&&(i.removeMarker(l,bc),i.removeMarker(l,u?bc:pp)),o&&o.cleanUp(a)})}jE.$inject=["bendpointMove","injector","eventBus","canvas"];var HE="connect-hover",zE="djs-updating";function GE(e,t,n){return Cg(e,t,e[t]+n)}function Cg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function B$(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 Cg(t,i,s)}function VE(e){return e==="x"?"y":"x"}function WE(e,t,n){var i,o;return e.original?e.original:(i=Qe(t),o=VE(n),Cg(e,o,i[o]))}function UE(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var m,g=n.getGraphics(d),y=f-1,_=f,h=d.waypoints,v=h[y],b=h[_],E=Eg(n,h,p),M,B,P;if(M=Eo(v,b),!!M)return B=M==="v"?"x":"y",y===0&&(v=WE(v,d.source,B)),_===h.length-1&&(b=WE(b,d.target,B)),E?P=E.point:P={x:(v.x+b.x)/2,y:(v.y+b.y)/2},m={connection:d,segmentStartIndex:y,segmentEndIndex:_,segmentStart:v,segmentEnd:b,axis:B,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:g,context:m}})};function s(p,d){if(!a)return d;var f=p.waypoints,m;return p.waypoints=d,m=a.getCroppedWaypoints(p),p.waypoints=f,m}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var m=p.newWaypoints,g=p.segmentStartIndex+d,y=m[g],_=p.segmentEndIndex+d,h=m[_],v=VE(p.axis),b=B$(f,y,h,v);Nn(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,m=p.filter(function(g,y){return af(p[y-1],p[y+1],g)?(f=y<=d?f-1:f,!1):!0});return{waypoints:m,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,m=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=OE(m,d.segmentStart,d.segmentEnd),gt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,zE)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,m=d.segmentStartIndex,g=d.segmentEndIndex,y=d.segmentStart,_=d.segmentEnd,h=d.axis,v=d.originalWaypoints.slice(),b=GE(y,h,p["d"+h]),E=GE(_,h,p["d"+h]),M=v.length,B=0;v[m]=b,v[g]=E;var P,k;m<2&&(P=Bn(f.source,b),m===1?P==="intersect"&&(v.shift(),v[0]=b,B--):P!=="intersect"&&(v.unshift(y),B++)),g>M-3&&(k=Bn(f.target,E),g===M-2?k==="intersect"&&(v.pop(),v[v.length-1]=E):k!=="intersect"&&v.push(_)),d.newWaypoints=f.waypoints=s(f,v),l(d,B,p),d.newSegmentStartIndex=m+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,HE)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,HE)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&cn(d.draggerGfx),n.removeMarker(f,zE)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var d=p.context,f=d.connection;f.waypoints=d.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var d=p.context,f=d.connection,m=d.newWaypoints,g=d.newSegmentStartIndex;m=m.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var y=u(m,g),_=y.waypoints,h=s(f,_),v=y.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:g+v}};r.updateWaypoints(f,h,b)})}UE.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var N$=Math.abs,qE=Math.round;function $$(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],N$(o-e)<=n)return o}function YE(e){return{x:e.x,y:e.y}}function KE(e){return{x:e.x+e.width,y:e.y+e.height}}function Oi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:qE(e.x+e.width/2),y:qE(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 fn(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 XE(e){return e.children||[]}var F$=Math.abs,ZE=Math.round,Ag=10;function JE(e){function t(r,a){if(Ze(r)){for(var s=r.length;s--;)if(F$(r[s]-a)<=Ag)return r[s]}else{r=+r;var c=a%r;if(c<Ag)return a-c;if(c>r-Ag)return a-c+r}return a}function n(r,a){if(r.waypoints)return P$(a,r);if(r.width)return{x:ZE(r.width/2+r.x),y:ZE(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,d=a.segmentEnd,f=a.segmentEndIndex,m=a.axis;if(s)return s;var g=[l[p-1],u,d,l[f+1]];return p<2&&g.unshift(n(c.source,r)),f>l.length-3&&g.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},W(g,function(y){y&&(y=y.original||y,m==="y"&&s.horizontal.push(y.y),m==="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,d=c-u;J(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&fn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&fn(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:[]},W(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);!It(s)||!c||!c.x||!c.y||(fn(r,"x",c.x),fn(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,d,f;if(s){d=t(l?s.vertical.concat([l.x]):s.vertical,u),f=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var m=u-d,g=p-f;J(r,{dx:r.dx-m,dy:r.dy-g,x:r.x-m,y:r.y-g}),(m||s.vertical.indexOf(u)!==-1)&&fn(r,"x",d),(g||s.horizontal.indexOf(p)!==-1)&&fn(r,"y",f)}})}JE.$inject=["eventBus"];const j$={__depends__:[To,co],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",DE],bendpointMove:["type",Mg],bendpointMovePreview:["type",jE],connectionSegmentMove:["type",UE],bendpointSnapping:["type",JE]};function QE(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),!da(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!da(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,d=s.target;if(!c)return!1;var f=null,m={connectionStart:Tg(s)?u:l,connectionEnd:Tg(s)?l:u};yn(c)&&(f=c),s.connection=n.connect(p,d,f,m)}),this.start=function(a,s,c,l){yn(c)||(l=c,c=Qe(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}QE.$inject=["eventBus","dragging","modeling","rules"];function Tg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var H$=1100,z$=900,e1="connect-ok",t1="connect-not-ok";function n1(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,d=r.connectionStart||u,f=r.connectionEnd||{x:o.x,y:o.y},m=d,g=f;Tg(r)&&(m=f,g=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:m,connectionEnd:g})}),t.on("connect.hover",z$,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?e1:t1)}),t.on(["connect.out","connect.cleanup"],H$,function(o){var r=o.hover;r&&(n.removeMarker(r,e1),n.removeMarker(r,t1))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}n1.$inject=["injector","eventBus","canvas"];const Pg={__depends__:[Ti,co,To],__init__:["connectPreview"],connect:["type",QE],connectPreview:["type",n1]};var G$="djs-dragger";function Bo(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)}Bo.$inject=["injector","canvas","graphicsFactory","elementFactory"],Bo.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,d=n.noNoop,f,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Cs(i),o||(o=e.getConnection=V$(function(g,y,_){return m.getConnection(g,y,_)})),t&&(f=o(t,r,a)),!f){!d&&this.drawNoopPreview(i,n);return}f.waypoints=s||[],this._layouter&&!u&&(f.waypoints=this._layouter.layoutConnection(f,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||f.waypoints})),(!f.waypoints||!f.waypoints.length)&&(f.waypoints=[r?Qe(r):c,a?Qe(a):l]),this._connectionDocking&&(r||a)&&!p&&(f.waypoints=this._connectionDocking.getCroppedWaypoints(f,r,a)),this._graphicsFactory.drawConnection(i,f,{stroke:"var(--element-dragger-color)"})},Bo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||Qe(n),r=t.connectionEnd||Qe(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);tt(e,s)},Bo.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&&Ls(r,s,!0)||e,t=i&&Ls(a,s,!1)||t,[e,t]},Bo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&cn(e.connectionPreviewGfx)},Bo.prototype.getConnection=function(e){var t=W$(e);return this._elementFactory.createConnection(t)},Bo.prototype.createConnectionPreviewGfx=function(){var e=je("g");return Le(e,{pointerEvents:"none"}),gt(e).add(G$),tt(this._canvas.getActiveLayer(),e),e},Bo.prototype.createNoopConnection=function(e,t){return Ps([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function V$(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 W$(e){return yn(e)?e:{}}const U$={__init__:["connectionPreview"],connectionPreview:["type",Bo]},dp="complex-preview";class i1{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(dp);n.filter(s=>!q$(s)).forEach(s=>{let c;It(s)?(c=this._graphicsFactory._createContainer("connection",je("g")),this._graphicsFactory.drawConnection(tr(c),s)):(c=this._graphicsFactory._createContainer("shape",je("g")),this._graphicsFactory.drawShape(tr(c),s),Nn(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);It(s)?Nn(l,c.x,c.y):Nn(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",je("g"));this._graphicsFactory.drawShape(tr(l),s,{width:c.width,height:c.height}),Nn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Cs(this._canvas.getLayer(dp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(dp)}hide(){this._canvas.hideLayer(dp)}}i1.$inject=["canvas","graphicsFactory","previewSupport"];function q$(e){return e.hidden}const Y$={__depends__:[ja],__init__:["complexPreview"],complexPreview:["type",i1]},o1=Math.round;function fp(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}fp.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(J({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;J(l,{x:u.x-o1(l.width/2),y:u.y-o1(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let d=null;p&&(d=r.createConnection(p),d.waypoints=s.layoutConnection(d,{source:e,target:l}),d.waypoints=o.getCroppedWaypoints(d,e,l)),i.create({created:[l,d].filter(f=>!da(f))})},fp.prototype.cleanUp=function(){this._complexPreview.cleanUp()},fp.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const K$={__depends__:[Du,Y$,Uh],__init__:["appendPreview"],appendPreview:["type",fp]};var r1=Math.min,a1=Math.max;function kg(e){e.preventDefault()}function wc(e){e.stopPropagation()}function X$(e){return e.nodeType===Node.TEXT_NODE}function Z$(e){return[].slice.call(e)}function Wi(e){this.container=e.container,this.parent=Vt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ct("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Zn(this.autoResize,this),this.handlePaste=Zn(this.handlePaste,this)}Wi.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=Fi(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);J(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=Fi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return J(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&J(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,We.bind(a,"keydown",this.keyHandler),We.bind(a,"mousedown",wc),We.bind(a,"paste",o.handlePaste),We.bind(a,"focusout",this.focusoutHandler),i.autoResize&&We.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Wi.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)}},Wi.prototype.insertText=function(e){e=J$(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Wi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=Z$(a.childNodes),c,l;if(X$(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 d=s.indexOf(n),f=s.indexOf(i);s.forEach(function(m,g){g===d?m.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):g>d&&g<=f&&no(m)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Wi.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})}},Wi.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=Vt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(m){kg(m),wc(m),s=m.clientX,c=m.clientY;var g=t.getBoundingClientRect();l=g.width,u=g.height,We.bind(document,"mousemove",d),We.bind(document,"mouseup",f)},d=function(m){kg(m),wc(m);var g=r1(a1(l+m.clientX-s,i),r),y=r1(a1(u+m.clientY-c,o),a);t.style.width=g+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:m.clientX-s,dy:m.clientY-c})},f=function(m){kg(m),wc(m),We.unbind(document,"mousemove",d,!1),We.unbind(document,"mouseup",f,!1)};We.bind(n,"mousedown",p)}J(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Wi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),We.unbind(t,"keydown",this.keyHandler),We.unbind(t,"mousedown",wc),We.unbind(t,"input",this.autoResize),We.unbind(t,"paste",this.handlePaste),We.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),no(n)),no(e)},Wi.prototype.getValue=function(){return this.content.innerText.trim()},Wi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Wi.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 J$(e){return e.replace(/\r\n|\r|\n/g,`
315
+ `)}function hi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Wi({container:t.getContainer(),keyHandler:Zn(this._handleKey,this),resizeHandler:Zn(this._handleResize,this),focusoutHandler:Zn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}hi.$inject=["eventBus","canvas"],hi.prototype.registerProvider=function(e){this._providers.push(e)},hi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},hi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},hi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},hi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},hi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},hi.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()}},hi.prototype.getValue=function(){return this._textbox.getValue()},hi.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()},hi.prototype._handleResize=function(e){this._fire("resize",e)},hi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},hi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ft(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 s1={__depends__:[lu],__init__:["directEditing"],directEditing:["type",hi]};function Q$(e){return function(t){var n=t.target,i=we(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===mt(e);return!r||!a||!s||!c}}const e5={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 xe(e,t={}){var n=e5[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var t5=[xe("none-start-event",{actionName:"replace-with-none-start"}),xe("none-intermediate-throwing"),xe("none-end-event",{actionName:"replace-with-none-end"}),xe("message-start"),xe("timer-start"),xe("conditional-start"),xe("signal-start")],n5=[xe("none-start-event",{actionName:"replace-with-none-start"}),xe("none-intermediate-throwing"),xe("none-end-event",{actionName:"replace-with-none-end"})],i5=[xe("none-start-event",{actionName:"replace-with-none-start"}),xe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),xe("none-end-event",{actionName:"replace-with-none-end"}),xe("message-intermediate-catch"),xe("message-intermediate-throw"),xe("timer-intermediate-catch"),xe("escalation-intermediate-throw"),xe("conditional-intermediate-catch"),xe("link-intermediate-catch"),xe("link-intermediate-throw"),xe("compensation-intermediate-throw"),xe("signal-intermediate-catch"),xe("signal-intermediate-throw")],o5=[xe("none-start-event",{actionName:"replace-with-none-start"}),xe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),xe("none-end-event",{actionName:"replace-with-none-end"}),xe("message-end"),xe("escalation-end"),xe("error-end"),xe("cancel-end"),xe("compensation-end"),xe("signal-end"),xe("terminate-end")],r5=[xe("exclusive-gateway"),xe("parallel-gateway"),xe("inclusive-gateway"),xe("complex-gateway"),xe("event-based-gateway")],a5=[xe("transaction"),xe("event-subprocess"),xe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),xe("collapsed-subprocess")],s5=[xe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),xe("transaction"),xe("event-subprocess"),xe("collapsed-ad-hoc-subprocess")],c1=[xe("transaction"),xe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),xe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),xe("event-subprocess")],c5=c1,l1=[xe("task"),xe("user-task"),xe("service-task"),xe("send-task"),xe("receive-task"),xe("manual-task"),xe("rule-task"),xe("script-task"),xe("call-activity"),xe("collapsed-subprocess"),xe("expanded-subprocess"),xe("collapsed-ad-hoc-subprocess"),xe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],l5=[xe("data-store-reference")],u5=[xe("data-object-reference")],p5=[xe("message-boundary"),xe("timer-boundary"),xe("escalation-boundary"),xe("conditional-boundary"),xe("error-boundary"),xe("cancel-boundary"),xe("signal-boundary"),xe("compensation-boundary"),xe("non-interrupting-message-boundary"),xe("non-interrupting-timer-boundary"),xe("non-interrupting-escalation-boundary"),xe("non-interrupting-conditional-boundary"),xe("non-interrupting-signal-boundary")],d5=[xe("message-start"),xe("timer-start"),xe("conditional-start"),xe("signal-start"),xe("error-start"),xe("escalation-start"),xe("compensation-start"),xe("non-interrupting-message-start"),xe("non-interrupting-timer-start"),xe("non-interrupting-conditional-start"),xe("non-interrupting-signal-start"),xe("non-interrupting-escalation-start")],f5=[{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"}],h5=[xe("expanded-pool"),xe("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],g5={"bpmn:MessageEventDefinition":[xe("message-start"),xe("message-intermediate-catch"),xe("message-intermediate-throw"),xe("message-end")],"bpmn:TimerEventDefinition":[xe("timer-start"),xe("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[xe("conditional-start"),xe("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[xe("signal-start"),xe("signal-intermediate-catch"),xe("signal-intermediate-throw"),xe("signal-end")],"bpmn:ErrorEventDefinition":[xe("error-start"),xe("error-end")],"bpmn:EscalationEventDefinition":[xe("escalation-start"),xe("escalation-intermediate-throw"),xe("escalation-end")],"bpmn:CompensateEventDefinition":[xe("compensation-start"),xe("compensation-intermediate-throw"),xe("compensation-end")]};const u1={"start-event-non-interrupting":`
316
316
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
317
317
  <g transform="translate(0 995.64)">
318
318
  <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
@@ -323,7 +323,7 @@
323
323
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
324
324
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
325
325
  </g>
326
- </svg>`};function Di(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()}Di.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Di.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Di.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(Ze(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Q$(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,l5):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,u5):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=g5[o]||[],!Wn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")&&(i=dt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),A(t,"bpmn:StartEvent")&&!A(t.$parent,"bpmn:SubProcess")?(r=dt(t5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=dt(h5,function(c){return mt(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&Wn(t.$parent)?(r=dt(d5.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)):A(t,"bpmn:StartEvent")&&!Wn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=dt(n5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=dt(o5.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):A(t,"bpmn:BoundaryEvent")?(r=dt(p5,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(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)):A(t,"bpmn:IntermediateCatchEvent")||A(t,"bpmn:IntermediateThrowEvent")?(r=dt(i5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Gateway")?(r=dt(r5,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=dt(s1,a),this._createEntries(e,r)):Wn(t)&&mt(e)?(r=dt(c5,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&mt(e)?(r=dt(s5,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&mt(e)?(r=dt(a5,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!mt(e)?(r=dt(c1,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):A(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,f5):A(t,"bpmn:FlowNode")?(r=dt(c1,a),this._createEntries(e,r)):{})},Di.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!Wn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Lb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Di.prototype._createEntries=function(e,t){var n={},i=this;return W(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Di.prototype._createSequenceFlowEntries=function(e,t){var n=we(e),i={},o=this._modeling,r=this._moddle,a=this;return W(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(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&&A(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:A(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(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},Di.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}},Di.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&&A(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=we(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"}}}},Di.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}}},Di.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}}},Di.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=we(e),i=this,o=Ib(e),r=A(e,"bpmn:BoundaryEvent")?l1["intermediate-event-non-interrupting"]:l1["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 m5={__depends__:[_g,t_,Du],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Di]};function _c(e,t,n,i,o,r,a,s,c,l,u,p,d){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=d,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(f){var m=f.context,g=m.shape;if(!(!qs(f)||!i.isOpen(g))){var y=i.getEntries(g);y.replace&&y.replace.action.click(f,g)}}),n.on("contextPad.close",function(){d.cleanUp()})}_c.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],_c.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&J(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},_c.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ze(t)?Ho(e,n=>t.includes(n)):t},_c.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])&&J(u,m()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function g(v){var b=5,E=t.getPad(v).html,M=E.getBoundingClientRect(),B={x:M.left,y:M.bottom+b};return B}function y(v,b,E,M){function B(N,G){var q=i.createShape(J({type:v},M));r.start(N,q,{source:G})}var P=s?function(N,G){var q=i.createShape(J({type:v},M));s.append(G,q)}:B,k=s?function(N,G){return l.create(G,v,M),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:B,click:P,hover:k}}}function _(v){return function(b,E){n.splitLane(E,v),t.open(E,!0)}}if(pt(p,["bpmn:Lane","bpmn:Participant"])&&mt(e)){var h=rr(e);J(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,b){n.addLane(b,"top")}}}}),h.length<2&&((_n(e)?e.height>=120:e.width>=120)&&J(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(_n(e)?e.height>=180:e.width>=180)&&J(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),J(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,b){n.addLane(b,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?J(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"})}):u1(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?J(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!u1(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Wn(p)&&J(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")||J(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var E=J(g(b),{cursor:{x:v.x,y:v.y}});a.open(b,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&J(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&J(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),pt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&J(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:d,dragstart:d}}}),A(p,"bpmn:TextAnnotation")&&J(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),pt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&J(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),A(p,"bpmn:Group")&&J(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&J(u,m()),u};function u1(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return W(r,function(a){a.$type===n&&(o=!0)}),i&&o}const y5={__depends__:[K$,a1,F0,Ti,Pg,pu,m5],__init__:["contextPadProvider"],contextPadProvider:["type",_c]};var v5={horizontal:["x","width"],vertical:["y","height"]},p1=5;function No(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ze(i)?i:i?n:[]})}No.$inject=["modeling","rules"],No.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},No.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},No.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(W(t,function(r){o=r(o,n,i)}),o):e},No.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=Xi(e,i);return W(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},No.prototype._setOrientation=function(e){var t=v5[e];this._axis=t[0],this._dimension=t[1]},No.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)},No.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+p1,max:t+n-p1}};const x5={__init__:["distributeElements"],distributeElements:["type",No]};function hp(e){Ai.call(this,e)}hp.$inject=["eventBus"],Ne(hp,Ai),hp.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=dt(t,function(n){var i=pt(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 d1={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
326
+ </svg>`};function Di(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()}Di.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Di.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Di.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(Ze(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Q$(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,l5):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,u5):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=g5[o]||[],!Wn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")&&(i=dt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),A(t,"bpmn:StartEvent")&&!A(t.$parent,"bpmn:SubProcess")?(r=dt(t5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=dt(h5,function(c){return mt(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&Wn(t.$parent)?(r=dt(d5.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)):A(t,"bpmn:StartEvent")&&!Wn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=dt(n5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=dt(o5.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):A(t,"bpmn:BoundaryEvent")?(r=dt(p5,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(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)):A(t,"bpmn:IntermediateCatchEvent")||A(t,"bpmn:IntermediateThrowEvent")?(r=dt(i5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Gateway")?(r=dt(r5,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=dt(c1,a),this._createEntries(e,r)):Wn(t)&&mt(e)?(r=dt(c5,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&mt(e)?(r=dt(s5,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&mt(e)?(r=dt(a5,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!mt(e)?(r=dt(l1,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):A(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,f5):A(t,"bpmn:FlowNode")?(r=dt(l1,a),this._createEntries(e,r)):{})},Di.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!Wn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Ib(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Di.prototype._createEntries=function(e,t){var n={},i=this;return W(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Di.prototype._createSequenceFlowEntries=function(e,t){var n=we(e),i={},o=this._modeling,r=this._moddle,a=this;return W(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(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&&A(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:A(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(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},Di.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}},Di.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&&A(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=we(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"}}}},Di.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}}},Di.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}}},Di.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=we(e),i=this,o=Bb(e),r=A(e,"bpmn:BoundaryEvent")?u1["intermediate-event-non-interrupting"]:u1["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 m5={__depends__:[_g,n_,Du],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Di]};function _c(e,t,n,i,o,r,a,s,c,l,u,p,d){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=d,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(f){var m=f.context,g=m.shape;if(!(!qs(f)||!i.isOpen(g))){var y=i.getEntries(g);y.replace&&y.replace.action.click(f,g)}}),n.on("contextPad.close",function(){d.cleanUp()})}_c.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],_c.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&J(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},_c.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ze(t)?Ho(e,n=>t.includes(n)):t},_c.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])&&J(u,m()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function g(v){var b=5,E=t.getPad(v).html,M=E.getBoundingClientRect(),B={x:M.left,y:M.bottom+b};return B}function y(v,b,E,M){function B(N,G){var q=i.createShape(J({type:v},M));r.start(N,q,{source:G})}var P=s?function(N,G){var q=i.createShape(J({type:v},M));s.append(G,q)}:B,k=s?function(N,G){return l.create(G,v,M),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:B,click:P,hover:k}}}function _(v){return function(b,E){n.splitLane(E,v),t.open(E,!0)}}if(pt(p,["bpmn:Lane","bpmn:Participant"])&&mt(e)){var h=rr(e);J(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,b){n.addLane(b,"top")}}}}),h.length<2&&((_n(e)?e.height>=120:e.width>=120)&&J(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(_n(e)?e.height>=180:e.width>=180)&&J(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),J(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,b){n.addLane(b,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?J(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"})}):p1(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?J(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!p1(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Wn(p)&&J(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")||J(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var E=J(g(b),{cursor:{x:v.x,y:v.y}});a.open(b,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&J(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&J(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),pt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&J(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:d,dragstart:d}}}),A(p,"bpmn:TextAnnotation")&&J(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),pt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&J(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),A(p,"bpmn:Group")&&J(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&J(u,m()),u};function p1(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return W(r,function(a){a.$type===n&&(o=!0)}),i&&o}const y5={__depends__:[K$,s1,j0,Ti,Pg,pu,m5],__init__:["contextPadProvider"],contextPadProvider:["type",_c]};var v5={horizontal:["x","width"],vertical:["y","height"]},d1=5;function No(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ze(i)?i:i?n:[]})}No.$inject=["modeling","rules"],No.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},No.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},No.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(W(t,function(r){o=r(o,n,i)}),o):e},No.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=Xi(e,i);return W(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},No.prototype._setOrientation=function(e){var t=v5[e];this._axis=t[0],this._dimension=t[1]},No.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)},No.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+d1,max:t+n-d1}};const x5={__init__:["distributeElements"],distributeElements:["type",No]};function hp(e){Ai.call(this,e)}hp.$inject=["eventBus"],Ne(hp,Ai),hp.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=dt(t,function(n){var i=pt(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 f1={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
327
  <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
328
328
  <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
329
329
  <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -331,7 +331,7 @@
331
331
  <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
332
332
  <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
333
333
  <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
334
- </svg>`},b5=900;function Ec(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",b5,this)}Ec.$inject=["popupMenu","distributeElements","translate","rules"],Ec.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&J(t,this._getEntries(e)),t},Ec.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ec.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:d1.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:d1.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const w5={__depends__:[_g,x5],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",hp],distributeElementsMenuProvider:["type",Ec]};var f1="is not a registered action",_5="is already registered";function Li(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Li.$inject=["eventBus","injector"],Li.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 d=Ze(p)?p:u;return r.cut(d.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}),d;p!==!1&&(Ze(p)?d=p:d=u,d.length&&n.removeElements(d.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Li.prototype.trigger=function(e,t){if(!this._actions[e])throw Og(e,f1);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Li.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);W(e,function(i,o){n._registerAction(o,i)})},Li.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Og(e,_5);this._actions[e]=t},Li.prototype.unregister=function(e){if(!this.isRegistered(e))throw Og(e,f1);this._actions[e]=void 0},Li.prototype.getActions=function(){return Object.keys(this._actions)},Li.prototype.isRegistered=function(e){return!!this._actions[e]};function Og(e,t){return new Error(e+" "+t)}const E5={__init__:["editorActions"],editorActions:["type",Li]};function gp(e){e.invoke(Li,this)}Ne(gp,Li),gp.$inject=["injector"],gp.prototype._registerDefaultActions=function(e){Li.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),d=e.get("modeling",!1),f=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),g=n.filter(function(y){return y!==m});return i.select(g),g}),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(m){var g=i.get(),y=m.type;g.length&&c.trigger(g,y)}),i&&l&&this._registerAction("alignElements",function(m){var g=i.get(),y=[],_=m.type;g.length&&(y=dt(g,function(h){return!A(h,"bpmn:Lane")}),l.trigger(y,_))}),i&&d&&this._registerAction("setColor",function(m){var g=i.get();g.length&&d.setColor(g,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&d&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),g,y;A(m,"bpmn:Collaboration")?y=n.filter(function(_){return A(_.parent,"bpmn:Collaboration")}):y=n.filter(function(_){return _!==m&&!A(_.parent,"bpmn:SubProcess")}),g=ln(y),d.moveElements(y,{x:-g.x,y:-g.y},m)}),i&&f&&this._registerAction("replaceElement",function(m){f.triggerEntry("replace","click",m)})};const S5={__depends__:[E5],editorActions:["type",gp]};function h1(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;pt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}h1.$inject=["eventBus"];function oa(e,t){be.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;ii(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}oa.$inject=["eventBus","gridSnapping","modeling"],Ne(oa,be),oa.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},oa.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},oa.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),J(e,r),e},oa.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),J(e,r),e};var R5=2e3;function g1(e,t){e.on(["spaceTool.move","spaceTool.end"],R5,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)}})}g1.$inject=["eventBus","gridSnapping"];const M5={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",oa],gridSnappingSpaceToolBehavior:["type",g1]};var mp=10;function Dg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var C5=1200,A5=800;function vr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",A5,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"],C5,function(r){var a=r.originalEvent;if(!(!o.active||a&&ui(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=P5(r,l,e);p&&(u.offset=p);var d=T5(r,l);d&&J(u,d),Ja(r,l)||o.snapEvent(r,l,u)})}})}vr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);fn(e,t,i)},vr.prototype.getGridSpacing=function(){return mp},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Dg(e,mp);var i,o;return t&&t.min&&(i=t.min,Je(i)&&(i=Dg(i+n,mp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Je(o)&&(o=Dg(o+n,mp,"floor"),e=Math.min(e,o))),e-=n,e},vr.prototype.isActive=function(){return this.active},vr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},vr.prototype.toggleActive=function(){this.setActive(!this.active)},vr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function T5(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&&(yp(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&&(yp(t)?y1(s)?a.x.max=c.left:a.x.min=c.right:m1(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(yp(t)?y1(s)?a.x.min=l.left:a.x.max=l.right:m1(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function P5(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Je(s[t])||(s||(s=r.snapOffset={}),Je(s[t])||(s[t]=0),!o)||(n.get(o.id)||(yp(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 yp(e){return e==="x"}function m1(e){return e.indexOf("n")!==-1}function y1(e){return e.indexOf("w")!==-1}const k5={__depends__:[M5],__init__:["gridSnapping"],gridSnapping:["type",vr]};var O5=1750;function v1(e,t,n){t.on(["create.start","shape.move.start"],O5,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!A(r,"bpmn:Participant")||!A(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}))}})}v1.$inject=["canvas","eventBus","gridSnapping"];const D5={__depends__:[k5,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",tg],gridSnappingParticipantBehavior:["type",v1],gridSnappingLayoutConnectionBehavior:["type",Va]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",h1]};var L5=30,x1=30;function Sc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(A(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(A(o,"bpmn:Participant"))return mt(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(A(o,"bpmn:SubProcess"))return mt(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}Sc.$inject=["eventBus","interactionEvents"],Sc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Sc.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=_n(e)?{width:L5,height:e.height}:{width:e.width,height:x1};return this._interactionEvents.createBoxHit(t,"all",n),!0},Sc.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:x1}),!0};const I5={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Sc]};function vp(e){e.invoke(Wa,this)}Ne(vp,Wa),vp.$inject=["injector"],vp.prototype.registerBindings=function(e,t){Wa.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 B5={__depends__:[sg],__init__:["keyboardBindings"],keyboardBindings:["type",vp]};var N5={moveSpeed:1,moveSpeedAccelerated:10},$5=1500,b1="left",w1="up",_1="right",E1="down",F5={ArrowLeft:b1,Left:b1,ArrowUp:w1,Up:w1,ArrowRight:_1,Right:_1,ArrowDown:E1,Down:E1},j5={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 S1(e,t,n,i,o){var r=this;this._config=J({},N5,e||{}),t.addListener($5,function(a){var s=a.keyEvent,c=F5[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=j5[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}S1.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const H5={__depends__:[sg,Ti],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",S1]};var R1=10;function Rc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,d=c.resizeConstraints,f;c.delta=l,f=aO(u,p,l),c.newBounds=cO(f,d),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:qe(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=yx(p),!z5(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)})}Rc.prototype.canResize=function(e){var t=this._rules,n=Fi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Rc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=J({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,M1(t,r),"resize",{autoActivate:!0,cursor:G5(r),data:{shape:t,context:o}})},Rc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:R1,height:R1},o=ab(t,e.childrenBoxPadding),lO(n,t,i,o)},Rc.$inject=["eventBus","rules","modeling","dragging"];function z5(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function M1(e,t){var n=Qe(e),i=qe(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 G5(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 C1="djs-resizing",A1="resize-not-ok",V5=500;function T1(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,C1)),s.width>5&&Le(c,{x:s.x,width:s.width}),s.height>5&&Le(c,{y:s.y,height:s.height}),r.canExecute?gt(c).remove(A1):gt(c).add(A1)}function o(r){var a=r.shape,s=r.frame;s&&cn(r.frame),t.removeMarker(a,C1)}e.on("resize.move",V5,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}T1.$inject=["eventBus","canvas","previewSupport"];var xp=-6,bp=8,wp=20,Mc="djs-resizer",W5=["n","w","s","e","nw","ne","se","sw"];function xr(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&&W(a,Zn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}xr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){sr(r)&&i.activate(r,e,n)}We.bind(t,"mousedown",o),We.bind(t,"touchstart",o)},xr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=U5(i),a=je("g");gt(a).add(Mc),gt(a).add(Mc+"-"+e.id),gt(a).add(Mc+"-"+i),tt(o,a);var s=je("rect");Le(s,{x:-bp/2+r.x,y:-bp/2+r.y,width:bp,height:bp}),gt(s).add(Mc+"-visual"),tt(a,s);var c=je("rect");return Le(c,{x:-wp/2+r.x,y:-wp/2+r.y,width:wp,height:wp}),gt(c).add(Mc+"-hit"),tt(a,c),Tl(a,t,n),a},xr.prototype.createResizer=function(e,t){var n=M1(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},xr.prototype.addResizer=function(e){var t=this;It(e)||W(W5,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},xr.prototype.removeResizers=function(){var e=this._getResizersParent();Cs(e)},xr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},xr.$inject=["eventBus","canvas","selection","resize"];function U5(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-xp:e.indexOf("w")!==-1&&(t.x=xp),e.indexOf("s")!==-1?t.y=-xp:e.indexOf("n")!==-1&&(t.y=xp),t}const P1={__depends__:[co,To,ja],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Rc],resizePreview:["type",T1],resizeHandles:["type",xr]};var q5=2e3;function Cc(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"],q5,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,d=c.isTouch;d||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||pt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Cc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Cc.prototype.activate=function(e){var t=ci(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);J(n,i);var o={},r=n.style||{};return J(r,{backgroundColor:null,border:null}),(pt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||k1(e))&&J(o,{centerVertically:!0}),ir(e)&&(J(o,{resizable:!0,autoResize:!0}),J(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(J(o,{resizable:!0,autoResize:!0}),J(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),J(n,{options:o,style:r}),n}},Cc.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,d=s.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(A(e,"bpmn:Lane")||X5(e)){var m=_n(e),g=m?{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};J(r,g),J(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(K5(e)){var y=_n(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};J(r,_),J(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(pt(e,["bpmn:Task","bpmn:CallActivity"])||k1(e))&&(J(r,{width:i.width,height:i.height}),J(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Y5(e)&&(J(r,{width:i.width,x:i.x}),J(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var h=1,v=i.width+2*h;if(n.labelTarget&&(J(r,{width:v,height:i.height+2*h,x:i.x-h,y:i.y-h}),J(f,{fontSize:l+"px",lineHeight:u})),ir(n)&&!Ol(n)&&!lt(n)){var b=pf(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),M=l,B=Vr.width*a+2*h;J(r,{width:B,height:M+2*h,x:E.x-B/2,y:E.y-M/2-h}),J(f,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(J(r,{width:i.width+2*h,height:i.height+2*h,x:i.x-h,y:i.y-h,minWidth:30*a,minHeight:10*a}),J(f,{textAlign:"left",paddingTop:Aa*a+"px",paddingBottom:Aa*a+"px",paddingLeft:Aa*a+"px",paddingRight:Aa*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Cc.prototype.update=function(e,t,n,i){var o,r;A(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}),Z5(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function k1(e){return A(e,"bpmn:SubProcess")&&!mt(e)}function Y5(e){return A(e,"bpmn:SubProcess")&&mt(e)}function K5(e){return A(e,"bpmn:Participant")&&!mt(e)}function X5(e){return A(e,"bpmn:Participant")&&mt(e)}function Z5(e){return!e||!e.trim()}var O1="djs-element-hidden",D1="djs-label-hidden";function L1(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,A(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=je("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=je("path");Le(p,{d:u,strokeWidth:2,stroke:J5(r)}),tt(s,p),tt(o,s),Nn(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,O1):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,D1)}),e.on("directEditing.resize",function(c){if(A(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),d=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});Le(i.path,{d})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,O1),t.removeMarker(r,D1)),r=void 0,a=void 0,s&&(cn(s),s=void 0)})}L1.$inject=["eventBus","canvas","pathMap"];function J5(e,t){var n=vt(e);return n.get("stroke")||t||"black"}const Q5={__depends__:[Th,P1,a1],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Cc],labelEditingPreview:["type",L1]};var e3=500,t3=1e3;function fo(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){u2(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){W(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],e3,function(r){var a=r.element,s=r.gfx,c=Ct(".djs-outline",s);c&&i.updateOutline(a,c)})}fo.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Ct(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),tt(t,n),this.updateOutline(e,n)),n},fo.prototype._createOutlineGfx=function(){var e=je("rect");return Le(e,J({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},fo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},fo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&W(i,function(o){n=n||o.updateOutline(t,e)}),n||Le(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},fo.prototype.updateConnectionOutline=function(e,t){var n=ln(t);Le(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},fo.prototype.registerProvider=function(e,t){t||(t=e,e=t3),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},fo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},fo.prototype.getOutline=function(e){var t,n=this._getProviders();return W(n,function(i){wn(i.getOutline)&&(t=t||i.getOutline(e))}),t},fo.$inject=["eventBus","styles","elementRegistry"];var _p=6;function Lg(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)})}Lg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Cs(t);var n=e.length>1,i=this._canvas.getContainer();if(gt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=n3(ln(e)),r=je("rect");Le(r,J({rx:3},o)),gt(r).add("djs-selection-outline"),tt(t,r)}},Lg.$inject=["eventBus","canvas","selection"];function n3(e){return{x:e.x-_p,y:e.y-_p,width:e.width+_p*2,height:e.height+_p*2}}const Ig={__depends__:[Ti],__init__:["outline","multiSelectionOutline"],outline:["type",fo],multiSelectionOutline:["type",Lg]},I1=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],B1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},i3=15,Ep=2;function N1(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 f;const d=p.filter(m=>pt(m,I1));if(d.length===1){const m=d[0];lt(m)?a(m,m.labelTarget):(f=m.labels)!=null&&f.length&&a(m.labels[0],m)}if(d.length===2){const m=d.find(lt),g=d.find(y=>{var _;return(_=y.labels)==null?void 0:_.includes(m)});m&&g&&a(m,g)}}),e.on("shape.changed",function({element:p}){var d;!pt(p,I1)||!u(p)||(lt(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=Ps([Qe(d),Qe(p)],B1),m=f.getAttribute("d"),y=o.isSelected(p)?c(p):l(p),_=Ls(y,m);if(!_)return;const v=o.isSelected(d)?c(d):l(d),b=Ls(v,m)||Qe(d);Vs(b,_)<i3||(nf(f,[b,_]),tt(r,f))}function s(){Ms(`.${B1.class}`,r).forEach(cn)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+br(d,"x")-Ep,y:p.y+br(d,"y")-Ep,width:br(d,"width")+Ep*2,height:br(d,"height")+Ep*2};return ff(f,br(d,"rx"))}if(d.cx){const f=br(d,"r"),m={x:p.x+br(d,"cx")-f,y:p.y+br(d,"cy")-f,width:f*2,height:f*2};return Gx(m)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}N1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function br(e,t){return parseFloat(Le(e,t)||0)}const o3={__depends__:[Ti,Ig],__init__:["labelLink"],labelLink:["type",N1]};var r3=new Kr("tt");function a3(e){var t=Vt('<div class="djs-tooltip-container" />');return Yn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function s3(e,t,n){Yn(e,{left:t+"px",top:n+"px"})}function Bg(e,t){e.style.display=t===!1?"none":""}var $1="djs-tooltip",Ng="."+$1;function ei(e,t){this._eventBus=e,this._canvas=t,this._ids=r3,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=a3(t.getContainer());var n=this;ai.bind(this._tooltipRoot,Ng,"mousedown",function(i){i.stopPropagation()}),ai.bind(this._tooltipRoot,Ng,"mouseover",function(i){n.trigger("mouseover",i)}),ai.bind(this._tooltipRoot,Ng,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}ei.$inject=["eventBus","canvas"],ei.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=J({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ei.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Mn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},ei.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},ei.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ei.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)}},ei.prototype.remove=function(e){var t=this.get(e);t&&(no(t.html),no(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ei.prototype.show=function(){Bg(this._tooltipRoot)},ei.prototype.hide=function(){Bg(this._tooltipRoot,!1)},ei.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},ei.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)),ii(n)&&(n=Vt(n)),i=Vt('<div data-tooltip-id="'+t+'" class="'+$1+'">'),Yn(i,{position:"absolute"}),i.appendChild(n),e.type&&Pt(i).add("djs-tooltip-"+e.type),e.className&&Pt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},ei.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;s3(n,t.x,t.y)},ei.prototype._updateTooltipVisibilty=function(e){W(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Bg(i,o))})},ei.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 c3={__init__:["tooltips"],tooltips:["type",ei]};var l3="flow elements must be children of pools/participants",u3="Data object must be placed within a pool/participant.";function F1(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;A(s,"bpmn:Collaboration")&&(A(a,"bpmn:FlowNode")?i(o,n(l3)):A(a,"bpmn:DataObjectReference")&&i(o,n(u3)))})}F1.$inject=["eventBus","tooltips","translate"];const p3={__depends__:[c3],__init__:["modelingFeedback"],modelingFeedback:["type",F1]};var d3=500,f3=1250,h3=1500,Sp=Math.round;function g3(e){return{x:e.x+Sp(e.width/2),y:e.y+Sp(e.height/2)}}function j1(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",h3,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=m3(u),J(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",f3,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",d3,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},d={x:s.x,y:s.y},f;if(f=r(l,p,d,u),c.delta=p,c.canExecute=f,f===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",d=c.shapes;if(u===!1)return!1;l.x=Sp(l.x),l.y=Sp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(d,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(sr(s)){var c=Ba(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(yn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!gt(s.target).has("djs-hit-no-move")){var p=g3(c),d=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(d!==!1)return!0}}this.start=a}j1.$inject=["eventBus","dragging","modeling","selection","rules"];function m3(e){var t=ha(e,"id");return dt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var H1=499,$g="djs-dragging",z1="drop-ok",G1="drop-not-ok",V1="new-parent",W1="attach-ok";function U1(e,t,n,i){function o(c){var l=r(c),u=y3(l);return u}function r(c){var l=ks(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[W1,z1,G1,V1].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,$g),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",H1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=je("g");Le(f,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();tt(m,f),l.dragGroup=f}d.forEach(function(g){i.addDragger(g,l.dragGroup)}),p?p=Hp([p,r(u)]):p=r(u),W(p,function(g){t.addMarker(g,$g)}),l.allDraggedElements=p,l.differentParents=v3(u)}),e.on("shape.move.move",H1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,W1):l.canExecute&&d&&p.id!==d.id?a(p,V1):a(p,l.canExecute?z1:G1)),Nn(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;W(u,function(d){t.removeMarker(d,$g)}),p&&cn(p)}),this.makeDraggable=s}U1.$inject=["eventBus","canvas","styles","previewSupport"];function y3(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=dt(e,function(i){return It(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function v3(e){return PR(ha(e,function(t){return t.parent&&t.parent.id}))!==1}const x3={__depends__:[lu,Ti,Ig,co,To,ja],__init__:["move","movePreview"],move:["type",j1],movePreview:["type",U1]};var q1=".djs-palette-toggle",Y1=".entry",b3=q1+", "+Y1,Fg="djs-palette-",w3="shown",jg="open",K1="two-column",_3=1e3;function hn(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()})}hn.$inject=["eventBus","canvas"],hn.prototype.registerProvider=function(e,t){t||(t=e,e=_3),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},hn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(S3,{})},hn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},hn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Vt(hn.HTML_MARKUP);n.appendChild(i),Pt(n).add(Fg+w3),ai.bind(i,b3,"click",function(o){var r=o.delegateTarget;if(Ud(r,q1))return e.toggle();e.trigger("click",o)}),We.bind(i,"mousedown",function(o){o.stopPropagation()}),ai.bind(i,Y1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},hn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},hn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Pt(n),a=Pt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(K1,o),a.toggle(Fg+K1,o),"open"in e&&(r.toggle(jg,e.open),a.toggle(Fg+jg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},hn.prototype._update=function(){var e=Ct(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xl(e),W(t,function(n,i){var o=n.group||"default",r=Ct("[data-group="+Qr(o)+"]",e);r||(r=Vt('<div class="group"></div>'),Mn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Vt(a);if(r.appendChild(s),!n.separator&&(Mn(s,"data-action",i),n.title&&Mn(s,"title",n.title),n.className&&E3(s,n.className),n.imageUrl)){var c=Vt("<img>");Mn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},hn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Mn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},hn.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(wn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},hn.prototype._layoutChanged=function(){this._toggleState({})},hn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},hn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},hn.prototype.open=function(){this._toggleState({open:!0})},hn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},hn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ct(".djs-palette-entries",this._container),this._toolsContainer=Ct("[data-group=tools]",t)),n=this._toolsContainer,W(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Pt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},hn.prototype.isOpen=function(){return Pt(this._container).has(jg)},hn.prototype._getParentContainer=function(){return this._canvas.getContainer()},hn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function E3(e,t){var n=Pt(e),i=Ze(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function S3(e,t){var n=t.getPaletteEntries();return wn(n)?n(e):(W(n,function(i,o){e[o]=i}),e)}const R3={__init__:["palette"],palette:["type",hn]};var X1="crosshair",Z1="selected",M3="djs-dragging-active-lasso";function wr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var d=t.getActiveLayer(),f=p.frame=je("rect");Le(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),tt(d,f),l(!0),this.update(p)},update:function(p){var d=p.frame,f=p.bbox;d&&f&&Le(d,{x:f.x,y:f.y,width:f.width,height:f.height});var m=p.marked,g=p.lastMarked;if(m&&g){for(const y of g)m.has(y)||t.removeMarker(y,Z1);for(const y of m)g.has(y)||t.addMarker(y,Z1)}},remove:function(p){this.update(p),p.frame&&cn(p.frame),l(!1)}};function l(p){gt(t.getContainer()).toggle(M3,p)}function u(p){var d=i.getAll();return new Set(fa(Sa(d,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var d=p.originalEvent.target;!p.hover&&!(d instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var d=p.context;s._select(Array.from(d.marked))}),e.on("lasso.start",function(p){var d=p.context;d.bbox=J1(p),d.add=nu(p),d.lastMarked=new Set(o.get()),d.add?d.marked=d.lastMarked:d.marked=new Set,d.initialMarked=d.marked,c.create(d)}),e.on("lasso.move",function(p){var d=p.context,f=d.bbox=J1(p),m=u(f),g=d.initialMarked.union(m);d.lastMarked=d.marked,d.marked=g,c.update(d)}),e.on("lasso.cleanup",function(p){var d=p.context;d.lastMarked=d.marked,d.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(nu(p))return s.activateLasso(p.originalEvent),!0})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:X1,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:X1,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=fa(Sa(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function J1(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 C3={__depends__:[fu,Xs],__init__:["lassoTool"],lassoTool:["type",wr]};var Hg=1500,Q1="grab";function Qa(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",Hg,function(c){if(qs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Hg,function(c){if(!(!eS(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Hg,function(c){!eS(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!qs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Qa.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Qa.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Q1,data:{context:n||{}}})},Qa.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Q1,data:{context:{reactivate:n}}})},Qa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Qa.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function eS(e){return xn("Space",e)}const A3={__depends__:[fu,Xs],__init__:["handTool"],handTool:["type",Qa]};var tS="connect-ok",nS="connect-not-ok";function es(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?tS:nS))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?tS:nS)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},d=s.canStartConnect(u);if(d)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})}es.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],es.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},es.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},es.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},es.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const T3={__depends__:[Pg,co,To,fu,Xs],globalConnect:["type",es]};function zg(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)}zg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],zg.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,d,f,m,g){function y(_){var h=n.createShape(J({type:p},g));t.start(_,h)}return{group:d,className:f,title:m,action:{dragstart:y,click:y}}}function l(p){var d=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),f=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:d});t.start(p,[d,f],{hints:{autoSelect:[d]}})}function u(p){t.start(p,n.createParticipantShape())}return J(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 P3={__depends__:[R3,pu,s_,C3,A3,T3,js],__init__:["paletteProvider"],paletteProvider:["type",zg]};var k3=250;function Gg(e,t,n,i,o){be.call(this,e);function r(s){var c=s.canExecute.replacements;W(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);J(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var m=Ct('[data-element-id="'+Qr(d.id)+'"]',s.dragGroup);m&&Le(m,{display:"none"});var g=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=g,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;W(c,function(l,u){var p=Ct('[data-element-id="'+Qr(u)+'"]',s.dragGroup);p&&Le(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",k3,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}Gg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ne(Gg,be);const O3={__depends__:[ja],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Gg]};var D3=1250,Vg=40,L3=20,I3=10,iS=20,oS=["x","y"],B3=Math.abs;function rS(e){e.on(["connect.hover","connect.move","connect.end"],D3,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&ui(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&N3(t,r,H3(r)),r&&j3(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Oi(o),pt(r,["bpmn:Event","bpmn:Gateway"])&&aS(t,Oi(r)),pt(r,["bpmn:Task","bpmn:SubProcess"])&&$3(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&F3(t)):sS(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=Oi(o)),A(r,"bpmn:Event")&&aS(t,Oi(r))):n.connectionStart=n.initialConnectionStart)})}rS.$inject=["eventBus"];function N3(e,t,n){oS.forEach(function(i){var o=cS(i,t);e[i]<t[i]+n?fn(e,i,t[i]+n):e[i]>t[i]+o-n&&fn(e,i,t[i]+o-n)})}function $3(e,t){var n=Oi(t);oS.forEach(function(i){z3(e,t,i)&&fn(e,i,n[i])})}function F3(e){var t=e.context,n=t.source,i=t.target;if(!G3(t)){var o=Oi(n),r=Bn(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;B3(c-o[s])<Vg&&(c>o[s]?l=o[s]+Vg:l=o[s]-Vg,fn(e,s,l))})}}function aS(e,t){fn(e,"x",t.x),fn(e,"y",t.y)}function sS(e,t){return e&&e.type===t}function j3(e,t){return zo(t,function(n){return sS(e,n)})}function cS(e,t){return e==="x"?t.width:t.height}function H3(e){return A(e,"bpmn:Task")?I3:L3}function z3(e,t,n){return e[n]>t[n]+iS&&e[n]<t[n]+cS(n,t)-iS}function G3(e){var t=e.hover,n=e.source;return t&&n&&t===n}function _r(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}_r.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},_r.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},_r.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},_r.prototype.getSnapLocations=function(){return this._snapLocations},_r.prototype.setSnapLocations=function(e){this._snapLocations=e},_r.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Rp,n.initDefaults(this._defaultSnaps)),n};function Rp(){this._snapValues={}}Rp.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)},Rp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&$$(e[n],o[n],i)},Rp.prototype.initDefaults=function(e){var t=this;W(e||{},function(n,i){W(n,function(o){t.add(i,o)})})};var V3=1250;function ho(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"],V3,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ui(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()})}ho.$inject=["elementRegistry","eventBus","snapping"],ho.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new _r);var r;t.get(i.id)?r=Oi(i,e):r={x:e.x+Oi(i).x,y:e.y+Oi(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}),lt(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},ho.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return W(i,function(o){if(lt(o)){lt(t)&&e.add("mid",Oi(o));return}if(It(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);W(r,function(a){e.add("mid",a)});return}e.add("mid",Oi(o))}),!Je(t.x)||!Je(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Oi(t)),e},ho.prototype.getSnapTargets=function(e,t){return KE(t).filter(function(n){return!W3(n)})};function W3(e){return!!e.hidden}var lS=1500;function ts(e,t){t.invoke(ho,this),e.on(["create.move","create.end"],lS,K3),e.on(["create.move","create.end","shape.move.move","shape.move.end"],lS,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ja(n)&&U3(n,r)})}Ne(ts,ho),ts.$inject=["eventBus","injector"],ts.prototype.initSnap=function(e){var t=ho.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return W(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",pS(r,i,e))}),W(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",pS(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ts.prototype.addSnapTargetPoints=function(e,t,n){ho.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);W(i,function(r){(Y3(r)||q3([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",qE(r)),e.add("bottom-right",YE(r)))});var o=this._elementRegistry;return W(t.incoming,function(r){if(o.get(t.id)){uS(i,r.source)||e.add("mid",Qe(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),W(t.outgoing,function(r){if(o.get(t.id)){uS(i,r.target)||e.add("mid",Qe(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),A(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},ts.prototype.getSnapTargets=function(e,t){return ho.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function U3(e,t){var n=qe(t),i=iw(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=Qe(r),/top/.test(i)?fn(e,"y",n.top-a.y):/bottom/.test(i)&&fn(e,"y",n.bottom-a.y),/left/.test(i)?fn(e,"x",n.left-a.x):/right/.test(i)&&fn(e,"x",n.right-a.x)}function q3(e,t){return e.every(function(n){return A(n,t)})}function Y3(e){return A(e,"bpmn:SubProcess")&&mt(e)?!0:A(e,"bpmn:Participant")}function K3(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)&&fn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&fn(e,"y",e.y)}}function uS(e,t){return e.indexOf(t)!==-1}function pS(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var X3=1250;function Ac(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],X3,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&ui(i.originalEvent))&&!Ja(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),Q3(s)&&fn(i,"x",i.x),eF(s)&&fn(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,o=t.snapContext;o||(o=t.snapContext=new _r);var r=dS(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Ac.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return W(o,function(r){e.add("corner",YE(r)),e.add("corner",qE(r))}),e.add("corner",dS(t,i)),e},Ac.$inject=["eventBus","snapping"],Ac.prototype.getSnapTargets=function(e,t){return KE(t).filter(function(n){return!Z3(n,e)&&!It(n)&&!J3(n)&&!lt(n)})};function dS(e,t){var n=Qe(e),i=qe(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 Z3(e,t){return e.host===t}function J3(e){return!!e.hidden}function Q3(e){return e==="n"||e==="s"}function eF(e){return e==="e"||e==="w"}var tF=7,nF=1e3;function Er(e){this._canvas=e,this._asyncHide=Gp(Zn(this.hide,this),nF)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ja(e,"x"),y:Ja(e,"y")};W(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(W(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,tF),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),W(["x","y"],function(a){var s=r[a];yn(s)&&fn(e,a,s.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=je("path");return Le(n,{d:"M0,0 L0,0"}),gt(n).add("djs-snap-line"),tt(t,n),{update:function(i){Je(i)?e==="horizontal"?Le(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Le(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Le(n,{display:"none"})}}},Er.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Er.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Er.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Er.prototype.hide=function(){W(this._snapLines,function(e){e.update()})};const iF={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ho],resizeSnapping:["type",Ac],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",rS],createMoveSnapping:["type",ts]};var fS=300;function ot(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=Ct(ot.INPUT_SELECTOR,this._container),this._resultsContainer=Ct(ot.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ot.$inject=["canvas","eventBus","selection","translate"],ot.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ai.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ot.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ot.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ot.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ot.INPUT_SELECTOR,"keydown",function(n){xn("ArrowUp",n)&&n.preventDefault(),xn("ArrowDown",n)&&n.preventDefault()}),t(this._container,ot.INPUT_SELECTOR,"keyup",function(n){if(xn("Escape",n))return e.close();if(xn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(xn("ArrowUp",n))return e._scrollToDirection(!0);if(xn("ArrowDown",n))return e._scrollToDirection();xn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ot.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ai.unbind(e.el,e.type,e.listener)})},ot.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=Ct(ot.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},ot.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ot.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)}},ot.prototype._clearResults=function(){xl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ot.prototype._getCurrentResult=function(){return Ct(ot.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ot.prototype._createResultNode=function(e,t){var n=Vt(ot.RESULT_HTML);return e.primaryTokens.length>0&&hS(n,e.primaryTokens,ot.RESULT_PRIMARY_HTML),hS(n,e.secondaryTokens,ot.RESULT_SECONDARY_HTML),Mn(n,ot.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ot.prototype.registerProvider=function(e){this._searchProvider=e},ot.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,Pt(this._canvas.getContainer()).add("djs-search-open"),Pt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ot.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,Pt(this._canvas.getContainer()).remove("djs-search-open"),Pt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ot.prototype.isOpen=function(){return this._open},ot.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Pt(t).remove(ot.RESULT_SELECTED_CLASS);var n=Mn(e,ot.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Pt(e).add(ot.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:fS}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ot.prototype._select=function(e){var t=Mn(e,ot.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:fS}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ot.prototype._getBoxHtml=function(){const e=Vt(ot.BOX_HTML),t=Ct(ot.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function hS(e,t,n){var i=oF(t),o=Vt(n);o.innerHTML=i,e.appendChild(o)}function oF(e){var t="";return e.forEach(function(n){var i=h0(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+ot.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}ot.CONTAINER_SELECTOR=".djs-search-container",ot.INPUT_SELECTOR=".djs-search-input input",ot.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ot.RESULT_SELECTOR=".djs-search-result",ot.RESULT_SELECTED_CLASS="djs-search-result-selected",ot.RESULT_SELECTED_SELECTOR="."+ot.RESULT_SELECTED_CLASS,ot.RESULT_ID_ATTRIBUTE="data-result-id",ot.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ot.BOX_HTML=`<div class="djs-search-container djs-scrollable">
334
+ </svg>`},b5=900;function Ec(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",b5,this)}Ec.$inject=["popupMenu","distributeElements","translate","rules"],Ec.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&J(t,this._getEntries(e)),t},Ec.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ec.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:f1.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:f1.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const w5={__depends__:[_g,x5],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",hp],distributeElementsMenuProvider:["type",Ec]};var h1="is not a registered action",_5="is already registered";function Li(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Li.$inject=["eventBus","injector"],Li.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 d=Ze(p)?p:u;return r.cut(d.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}),d;p!==!1&&(Ze(p)?d=p:d=u,d.length&&n.removeElements(d.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Li.prototype.trigger=function(e,t){if(!this._actions[e])throw Og(e,h1);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Li.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);W(e,function(i,o){n._registerAction(o,i)})},Li.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Og(e,_5);this._actions[e]=t},Li.prototype.unregister=function(e){if(!this.isRegistered(e))throw Og(e,h1);this._actions[e]=void 0},Li.prototype.getActions=function(){return Object.keys(this._actions)},Li.prototype.isRegistered=function(e){return!!this._actions[e]};function Og(e,t){return new Error(e+" "+t)}const E5={__init__:["editorActions"],editorActions:["type",Li]};function gp(e){e.invoke(Li,this)}Ne(gp,Li),gp.$inject=["injector"],gp.prototype._registerDefaultActions=function(e){Li.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),d=e.get("modeling",!1),f=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),g=n.filter(function(y){return y!==m});return i.select(g),g}),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(m){var g=i.get(),y=m.type;g.length&&c.trigger(g,y)}),i&&l&&this._registerAction("alignElements",function(m){var g=i.get(),y=[],_=m.type;g.length&&(y=dt(g,function(h){return!A(h,"bpmn:Lane")}),l.trigger(y,_))}),i&&d&&this._registerAction("setColor",function(m){var g=i.get();g.length&&d.setColor(g,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&d&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),g,y;A(m,"bpmn:Collaboration")?y=n.filter(function(_){return A(_.parent,"bpmn:Collaboration")}):y=n.filter(function(_){return _!==m&&!A(_.parent,"bpmn:SubProcess")}),g=ln(y),d.moveElements(y,{x:-g.x,y:-g.y},m)}),i&&f&&this._registerAction("replaceElement",function(m){f.triggerEntry("replace","click",m)})};const S5={__depends__:[E5],editorActions:["type",gp]};function g1(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;pt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}g1.$inject=["eventBus"];function oa(e,t){be.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;ii(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}oa.$inject=["eventBus","gridSnapping","modeling"],Ne(oa,be),oa.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},oa.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},oa.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),J(e,r),e},oa.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),J(e,r),e};var R5=2e3;function m1(e,t){e.on(["spaceTool.move","spaceTool.end"],R5,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)}})}m1.$inject=["eventBus","gridSnapping"];const M5={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",oa],gridSnappingSpaceToolBehavior:["type",m1]};var mp=10;function Dg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var C5=1200,A5=800;function vr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",A5,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"],C5,function(r){var a=r.originalEvent;if(!(!o.active||a&&ui(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=P5(r,l,e);p&&(u.offset=p);var d=T5(r,l);d&&J(u,d),Ja(r,l)||o.snapEvent(r,l,u)})}})}vr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);fn(e,t,i)},vr.prototype.getGridSpacing=function(){return mp},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Dg(e,mp);var i,o;return t&&t.min&&(i=t.min,Je(i)&&(i=Dg(i+n,mp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Je(o)&&(o=Dg(o+n,mp,"floor"),e=Math.min(e,o))),e-=n,e},vr.prototype.isActive=function(){return this.active},vr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},vr.prototype.toggleActive=function(){this.setActive(!this.active)},vr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function T5(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&&(yp(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&&(yp(t)?v1(s)?a.x.max=c.left:a.x.min=c.right:y1(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(yp(t)?v1(s)?a.x.min=l.left:a.x.max=l.right:y1(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function P5(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Je(s[t])||(s||(s=r.snapOffset={}),Je(s[t])||(s[t]=0),!o)||(n.get(o.id)||(yp(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 yp(e){return e==="x"}function y1(e){return e.indexOf("n")!==-1}function v1(e){return e.indexOf("w")!==-1}const k5={__depends__:[M5],__init__:["gridSnapping"],gridSnapping:["type",vr]};var O5=1750;function x1(e,t,n){t.on(["create.start","shape.move.start"],O5,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!A(r,"bpmn:Participant")||!A(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}))}})}x1.$inject=["canvas","eventBus","gridSnapping"];const D5={__depends__:[k5,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",tg],gridSnappingParticipantBehavior:["type",x1],gridSnappingLayoutConnectionBehavior:["type",Va]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",g1]};var L5=30,b1=30;function Sc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(A(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(A(o,"bpmn:Participant"))return mt(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(A(o,"bpmn:SubProcess"))return mt(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}Sc.$inject=["eventBus","interactionEvents"],Sc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Sc.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=_n(e)?{width:L5,height:e.height}:{width:e.width,height:b1};return this._interactionEvents.createBoxHit(t,"all",n),!0},Sc.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:b1}),!0};const I5={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Sc]};function vp(e){e.invoke(Wa,this)}Ne(vp,Wa),vp.$inject=["injector"],vp.prototype.registerBindings=function(e,t){Wa.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 B5={__depends__:[sg],__init__:["keyboardBindings"],keyboardBindings:["type",vp]};var N5={moveSpeed:1,moveSpeedAccelerated:10},$5=1500,w1="left",_1="up",E1="right",S1="down",F5={ArrowLeft:w1,Left:w1,ArrowUp:_1,Up:_1,ArrowRight:E1,Right:E1,ArrowDown:S1,Down:S1},j5={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 R1(e,t,n,i,o){var r=this;this._config=J({},N5,e||{}),t.addListener($5,function(a){var s=a.keyEvent,c=F5[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=j5[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}R1.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const H5={__depends__:[sg,Ti],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",R1]};var M1=10;function Rc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,d=c.resizeConstraints,f;c.delta=l,f=aO(u,p,l),c.newBounds=cO(f,d),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:qe(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=vx(p),!z5(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)})}Rc.prototype.canResize=function(e){var t=this._rules,n=Fi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Rc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=J({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,C1(t,r),"resize",{autoActivate:!0,cursor:G5(r),data:{shape:t,context:o}})},Rc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:M1,height:M1},o=sb(t,e.childrenBoxPadding),lO(n,t,i,o)},Rc.$inject=["eventBus","rules","modeling","dragging"];function z5(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function C1(e,t){var n=Qe(e),i=qe(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 G5(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 A1="djs-resizing",T1="resize-not-ok",V5=500;function P1(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,A1)),s.width>5&&Le(c,{x:s.x,width:s.width}),s.height>5&&Le(c,{y:s.y,height:s.height}),r.canExecute?gt(c).remove(T1):gt(c).add(T1)}function o(r){var a=r.shape,s=r.frame;s&&cn(r.frame),t.removeMarker(a,A1)}e.on("resize.move",V5,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}P1.$inject=["eventBus","canvas","previewSupport"];var xp=-6,bp=8,wp=20,Mc="djs-resizer",W5=["n","w","s","e","nw","ne","se","sw"];function xr(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&&W(a,Zn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}xr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){sr(r)&&i.activate(r,e,n)}We.bind(t,"mousedown",o),We.bind(t,"touchstart",o)},xr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=U5(i),a=je("g");gt(a).add(Mc),gt(a).add(Mc+"-"+e.id),gt(a).add(Mc+"-"+i),tt(o,a);var s=je("rect");Le(s,{x:-bp/2+r.x,y:-bp/2+r.y,width:bp,height:bp}),gt(s).add(Mc+"-visual"),tt(a,s);var c=je("rect");return Le(c,{x:-wp/2+r.x,y:-wp/2+r.y,width:wp,height:wp}),gt(c).add(Mc+"-hit"),tt(a,c),Tl(a,t,n),a},xr.prototype.createResizer=function(e,t){var n=C1(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},xr.prototype.addResizer=function(e){var t=this;It(e)||W(W5,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},xr.prototype.removeResizers=function(){var e=this._getResizersParent();Cs(e)},xr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},xr.$inject=["eventBus","canvas","selection","resize"];function U5(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-xp:e.indexOf("w")!==-1&&(t.x=xp),e.indexOf("s")!==-1?t.y=-xp:e.indexOf("n")!==-1&&(t.y=xp),t}const k1={__depends__:[co,To,ja],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Rc],resizePreview:["type",P1],resizeHandles:["type",xr]};var q5=2e3;function Cc(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"],q5,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,d=c.isTouch;d||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||pt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Cc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Cc.prototype.activate=function(e){var t=ci(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);J(n,i);var o={},r=n.style||{};return J(r,{backgroundColor:null,border:null}),(pt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||O1(e))&&J(o,{centerVertically:!0}),ir(e)&&(J(o,{resizable:!0,autoResize:!0}),J(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(J(o,{resizable:!0,autoResize:!0}),J(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),J(n,{options:o,style:r}),n}},Cc.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,d=s.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(A(e,"bpmn:Lane")||X5(e)){var m=_n(e),g=m?{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};J(r,g),J(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(K5(e)){var y=_n(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};J(r,_),J(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(pt(e,["bpmn:Task","bpmn:CallActivity"])||O1(e))&&(J(r,{width:i.width,height:i.height}),J(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Y5(e)&&(J(r,{width:i.width,x:i.x}),J(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var h=1,v=i.width+2*h;if(n.labelTarget&&(J(r,{width:v,height:i.height+2*h,x:i.x-h,y:i.y-h}),J(f,{fontSize:l+"px",lineHeight:u})),ir(n)&&!Ol(n)&&!lt(n)){var b=pf(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),M=l,B=Vr.width*a+2*h;J(r,{width:B,height:M+2*h,x:E.x-B/2,y:E.y-M/2-h}),J(f,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(J(r,{width:i.width+2*h,height:i.height+2*h,x:i.x-h,y:i.y-h,minWidth:30*a,minHeight:10*a}),J(f,{textAlign:"left",paddingTop:Aa*a+"px",paddingBottom:Aa*a+"px",paddingLeft:Aa*a+"px",paddingRight:Aa*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Cc.prototype.update=function(e,t,n,i){var o,r;A(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}),Z5(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function O1(e){return A(e,"bpmn:SubProcess")&&!mt(e)}function Y5(e){return A(e,"bpmn:SubProcess")&&mt(e)}function K5(e){return A(e,"bpmn:Participant")&&!mt(e)}function X5(e){return A(e,"bpmn:Participant")&&mt(e)}function Z5(e){return!e||!e.trim()}var D1="djs-element-hidden",L1="djs-label-hidden";function I1(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,A(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=je("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=je("path");Le(p,{d:u,strokeWidth:2,stroke:J5(r)}),tt(s,p),tt(o,s),Nn(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,D1):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,L1)}),e.on("directEditing.resize",function(c){if(A(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),d=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});Le(i.path,{d})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,D1),t.removeMarker(r,L1)),r=void 0,a=void 0,s&&(cn(s),s=void 0)})}I1.$inject=["eventBus","canvas","pathMap"];function J5(e,t){var n=vt(e);return n.get("stroke")||t||"black"}const Q5={__depends__:[Th,k1,s1],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Cc],labelEditingPreview:["type",I1]};var e3=500,t3=1e3;function fo(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){u2(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){W(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],e3,function(r){var a=r.element,s=r.gfx,c=Ct(".djs-outline",s);c&&i.updateOutline(a,c)})}fo.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Ct(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),tt(t,n),this.updateOutline(e,n)),n},fo.prototype._createOutlineGfx=function(){var e=je("rect");return Le(e,J({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},fo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},fo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&W(i,function(o){n=n||o.updateOutline(t,e)}),n||Le(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},fo.prototype.updateConnectionOutline=function(e,t){var n=ln(t);Le(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},fo.prototype.registerProvider=function(e,t){t||(t=e,e=t3),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},fo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},fo.prototype.getOutline=function(e){var t,n=this._getProviders();return W(n,function(i){wn(i.getOutline)&&(t=t||i.getOutline(e))}),t},fo.$inject=["eventBus","styles","elementRegistry"];var _p=6;function Lg(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)})}Lg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Cs(t);var n=e.length>1,i=this._canvas.getContainer();if(gt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=n3(ln(e)),r=je("rect");Le(r,J({rx:3},o)),gt(r).add("djs-selection-outline"),tt(t,r)}},Lg.$inject=["eventBus","canvas","selection"];function n3(e){return{x:e.x-_p,y:e.y-_p,width:e.width+_p*2,height:e.height+_p*2}}const Ig={__depends__:[Ti],__init__:["outline","multiSelectionOutline"],outline:["type",fo],multiSelectionOutline:["type",Lg]},B1=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],N1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},i3=15,Ep=2;function $1(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 f;const d=p.filter(m=>pt(m,B1));if(d.length===1){const m=d[0];lt(m)?a(m,m.labelTarget):(f=m.labels)!=null&&f.length&&a(m.labels[0],m)}if(d.length===2){const m=d.find(lt),g=d.find(y=>{var _;return(_=y.labels)==null?void 0:_.includes(m)});m&&g&&a(m,g)}}),e.on("shape.changed",function({element:p}){var d;!pt(p,B1)||!u(p)||(lt(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=Ps([Qe(d),Qe(p)],N1),m=f.getAttribute("d"),y=o.isSelected(p)?c(p):l(p),_=Ls(y,m);if(!_)return;const v=o.isSelected(d)?c(d):l(d),b=Ls(v,m)||Qe(d);Vs(b,_)<i3||(nf(f,[b,_]),tt(r,f))}function s(){Ms(`.${N1.class}`,r).forEach(cn)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+br(d,"x")-Ep,y:p.y+br(d,"y")-Ep,width:br(d,"width")+Ep*2,height:br(d,"height")+Ep*2};return ff(f,br(d,"rx"))}if(d.cx){const f=br(d,"r"),m={x:p.x+br(d,"cx")-f,y:p.y+br(d,"cy")-f,width:f*2,height:f*2};return Vx(m)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}$1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function br(e,t){return parseFloat(Le(e,t)||0)}const o3={__depends__:[Ti,Ig],__init__:["labelLink"],labelLink:["type",$1]};var r3=new Kr("tt");function a3(e){var t=Vt('<div class="djs-tooltip-container" />');return Yn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function s3(e,t,n){Yn(e,{left:t+"px",top:n+"px"})}function Bg(e,t){e.style.display=t===!1?"none":""}var F1="djs-tooltip",Ng="."+F1;function ei(e,t){this._eventBus=e,this._canvas=t,this._ids=r3,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=a3(t.getContainer());var n=this;ai.bind(this._tooltipRoot,Ng,"mousedown",function(i){i.stopPropagation()}),ai.bind(this._tooltipRoot,Ng,"mouseover",function(i){n.trigger("mouseover",i)}),ai.bind(this._tooltipRoot,Ng,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}ei.$inject=["eventBus","canvas"],ei.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=J({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ei.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Mn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},ei.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},ei.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ei.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)}},ei.prototype.remove=function(e){var t=this.get(e);t&&(no(t.html),no(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ei.prototype.show=function(){Bg(this._tooltipRoot)},ei.prototype.hide=function(){Bg(this._tooltipRoot,!1)},ei.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},ei.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)),ii(n)&&(n=Vt(n)),i=Vt('<div data-tooltip-id="'+t+'" class="'+F1+'">'),Yn(i,{position:"absolute"}),i.appendChild(n),e.type&&Pt(i).add("djs-tooltip-"+e.type),e.className&&Pt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},ei.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;s3(n,t.x,t.y)},ei.prototype._updateTooltipVisibilty=function(e){W(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Bg(i,o))})},ei.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 c3={__init__:["tooltips"],tooltips:["type",ei]};var l3="flow elements must be children of pools/participants",u3="Data object must be placed within a pool/participant.";function j1(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;A(s,"bpmn:Collaboration")&&(A(a,"bpmn:FlowNode")?i(o,n(l3)):A(a,"bpmn:DataObjectReference")&&i(o,n(u3)))})}j1.$inject=["eventBus","tooltips","translate"];const p3={__depends__:[c3],__init__:["modelingFeedback"],modelingFeedback:["type",j1]};var d3=500,f3=1250,h3=1500,Sp=Math.round;function g3(e){return{x:e.x+Sp(e.width/2),y:e.y+Sp(e.height/2)}}function H1(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",h3,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=m3(u),J(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",f3,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",d3,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},d={x:s.x,y:s.y},f;if(f=r(l,p,d,u),c.delta=p,c.canExecute=f,f===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",d=c.shapes;if(u===!1)return!1;l.x=Sp(l.x),l.y=Sp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(d,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(sr(s)){var c=Ba(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(yn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!gt(s.target).has("djs-hit-no-move")){var p=g3(c),d=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(d!==!1)return!0}}this.start=a}H1.$inject=["eventBus","dragging","modeling","selection","rules"];function m3(e){var t=ha(e,"id");return dt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var z1=499,$g="djs-dragging",G1="drop-ok",V1="drop-not-ok",W1="new-parent",U1="attach-ok";function q1(e,t,n,i){function o(c){var l=r(c),u=y3(l);return u}function r(c){var l=ks(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[U1,G1,V1,W1].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,$g),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",z1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=je("g");Le(f,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();tt(m,f),l.dragGroup=f}d.forEach(function(g){i.addDragger(g,l.dragGroup)}),p?p=Hp([p,r(u)]):p=r(u),W(p,function(g){t.addMarker(g,$g)}),l.allDraggedElements=p,l.differentParents=v3(u)}),e.on("shape.move.move",z1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,U1):l.canExecute&&d&&p.id!==d.id?a(p,W1):a(p,l.canExecute?G1:V1)),Nn(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;W(u,function(d){t.removeMarker(d,$g)}),p&&cn(p)}),this.makeDraggable=s}q1.$inject=["eventBus","canvas","styles","previewSupport"];function y3(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=dt(e,function(i){return It(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function v3(e){return kR(ha(e,function(t){return t.parent&&t.parent.id}))!==1}const x3={__depends__:[lu,Ti,Ig,co,To,ja],__init__:["move","movePreview"],move:["type",H1],movePreview:["type",q1]};var Y1=".djs-palette-toggle",K1=".entry",b3=Y1+", "+K1,Fg="djs-palette-",w3="shown",jg="open",X1="two-column",_3=1e3;function hn(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()})}hn.$inject=["eventBus","canvas"],hn.prototype.registerProvider=function(e,t){t||(t=e,e=_3),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},hn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(S3,{})},hn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},hn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Vt(hn.HTML_MARKUP);n.appendChild(i),Pt(n).add(Fg+w3),ai.bind(i,b3,"click",function(o){var r=o.delegateTarget;if(Ud(r,Y1))return e.toggle();e.trigger("click",o)}),We.bind(i,"mousedown",function(o){o.stopPropagation()}),ai.bind(i,K1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},hn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},hn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Pt(n),a=Pt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(X1,o),a.toggle(Fg+X1,o),"open"in e&&(r.toggle(jg,e.open),a.toggle(Fg+jg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},hn.prototype._update=function(){var e=Ct(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xl(e),W(t,function(n,i){var o=n.group||"default",r=Ct("[data-group="+Qr(o)+"]",e);r||(r=Vt('<div class="group"></div>'),Mn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Vt(a);if(r.appendChild(s),!n.separator&&(Mn(s,"data-action",i),n.title&&Mn(s,"title",n.title),n.className&&E3(s,n.className),n.imageUrl)){var c=Vt("<img>");Mn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},hn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Mn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},hn.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(wn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},hn.prototype._layoutChanged=function(){this._toggleState({})},hn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},hn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},hn.prototype.open=function(){this._toggleState({open:!0})},hn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},hn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ct(".djs-palette-entries",this._container),this._toolsContainer=Ct("[data-group=tools]",t)),n=this._toolsContainer,W(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Pt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},hn.prototype.isOpen=function(){return Pt(this._container).has(jg)},hn.prototype._getParentContainer=function(){return this._canvas.getContainer()},hn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function E3(e,t){var n=Pt(e),i=Ze(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function S3(e,t){var n=t.getPaletteEntries();return wn(n)?n(e):(W(n,function(i,o){e[o]=i}),e)}const R3={__init__:["palette"],palette:["type",hn]};var Z1="crosshair",J1="selected",M3="djs-dragging-active-lasso";function wr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var d=t.getActiveLayer(),f=p.frame=je("rect");Le(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),tt(d,f),l(!0),this.update(p)},update:function(p){var d=p.frame,f=p.bbox;d&&f&&Le(d,{x:f.x,y:f.y,width:f.width,height:f.height});var m=p.marked,g=p.lastMarked;if(m&&g){for(const y of g)m.has(y)||t.removeMarker(y,J1);for(const y of m)g.has(y)||t.addMarker(y,J1)}},remove:function(p){this.update(p),p.frame&&cn(p.frame),l(!1)}};function l(p){gt(t.getContainer()).toggle(M3,p)}function u(p){var d=i.getAll();return new Set(fa(Sa(d,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var d=p.originalEvent.target;!p.hover&&!(d instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var d=p.context;s._select(Array.from(d.marked))}),e.on("lasso.start",function(p){var d=p.context;d.bbox=Q1(p),d.add=nu(p),d.lastMarked=new Set(o.get()),d.add?d.marked=d.lastMarked:d.marked=new Set,d.initialMarked=d.marked,c.create(d)}),e.on("lasso.move",function(p){var d=p.context,f=d.bbox=Q1(p),m=u(f),g=d.initialMarked.union(m);d.lastMarked=d.marked,d.marked=g,c.update(d)}),e.on("lasso.cleanup",function(p){var d=p.context;d.lastMarked=d.marked,d.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(nu(p))return s.activateLasso(p.originalEvent),!0})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Z1,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Z1,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=fa(Sa(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Q1(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 C3={__depends__:[fu,Xs],__init__:["lassoTool"],lassoTool:["type",wr]};var Hg=1500,eS="grab";function Qa(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",Hg,function(c){if(qs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Hg,function(c){if(!(!tS(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Hg,function(c){!tS(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!qs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Qa.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Qa.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:eS,data:{context:n||{}}})},Qa.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:eS,data:{context:{reactivate:n}}})},Qa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Qa.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function tS(e){return xn("Space",e)}const A3={__depends__:[fu,Xs],__init__:["handTool"],handTool:["type",Qa]};var nS="connect-ok",iS="connect-not-ok";function es(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?nS:iS))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?nS:iS)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},d=s.canStartConnect(u);if(d)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})}es.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],es.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},es.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},es.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},es.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const T3={__depends__:[Pg,co,To,fu,Xs],globalConnect:["type",es]};function zg(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)}zg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],zg.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,d,f,m,g){function y(_){var h=n.createShape(J({type:p},g));t.start(_,h)}return{group:d,className:f,title:m,action:{dragstart:y,click:y}}}function l(p){var d=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),f=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:d});t.start(p,[d,f],{hints:{autoSelect:[d]}})}function u(p){t.start(p,n.createParticipantShape())}return J(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 P3={__depends__:[R3,pu,c_,C3,A3,T3,js],__init__:["paletteProvider"],paletteProvider:["type",zg]};var k3=250;function Gg(e,t,n,i,o){be.call(this,e);function r(s){var c=s.canExecute.replacements;W(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);J(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var m=Ct('[data-element-id="'+Qr(d.id)+'"]',s.dragGroup);m&&Le(m,{display:"none"});var g=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=g,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;W(c,function(l,u){var p=Ct('[data-element-id="'+Qr(u)+'"]',s.dragGroup);p&&Le(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",k3,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}Gg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ne(Gg,be);const O3={__depends__:[ja],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Gg]};var D3=1250,Vg=40,L3=20,I3=10,oS=20,rS=["x","y"],B3=Math.abs;function aS(e){e.on(["connect.hover","connect.move","connect.end"],D3,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&ui(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&N3(t,r,H3(r)),r&&j3(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Oi(o),pt(r,["bpmn:Event","bpmn:Gateway"])&&sS(t,Oi(r)),pt(r,["bpmn:Task","bpmn:SubProcess"])&&$3(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&F3(t)):cS(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=Oi(o)),A(r,"bpmn:Event")&&sS(t,Oi(r))):n.connectionStart=n.initialConnectionStart)})}aS.$inject=["eventBus"];function N3(e,t,n){rS.forEach(function(i){var o=lS(i,t);e[i]<t[i]+n?fn(e,i,t[i]+n):e[i]>t[i]+o-n&&fn(e,i,t[i]+o-n)})}function $3(e,t){var n=Oi(t);rS.forEach(function(i){z3(e,t,i)&&fn(e,i,n[i])})}function F3(e){var t=e.context,n=t.source,i=t.target;if(!G3(t)){var o=Oi(n),r=Bn(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;B3(c-o[s])<Vg&&(c>o[s]?l=o[s]+Vg:l=o[s]-Vg,fn(e,s,l))})}}function sS(e,t){fn(e,"x",t.x),fn(e,"y",t.y)}function cS(e,t){return e&&e.type===t}function j3(e,t){return zo(t,function(n){return cS(e,n)})}function lS(e,t){return e==="x"?t.width:t.height}function H3(e){return A(e,"bpmn:Task")?I3:L3}function z3(e,t,n){return e[n]>t[n]+oS&&e[n]<t[n]+lS(n,t)-oS}function G3(e){var t=e.hover,n=e.source;return t&&n&&t===n}function _r(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}_r.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},_r.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},_r.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},_r.prototype.getSnapLocations=function(){return this._snapLocations},_r.prototype.setSnapLocations=function(e){this._snapLocations=e},_r.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Rp,n.initDefaults(this._defaultSnaps)),n};function Rp(){this._snapValues={}}Rp.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)},Rp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&$$(e[n],o[n],i)},Rp.prototype.initDefaults=function(e){var t=this;W(e||{},function(n,i){W(n,function(o){t.add(i,o)})})};var V3=1250;function ho(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"],V3,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ui(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()})}ho.$inject=["elementRegistry","eventBus","snapping"],ho.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new _r);var r;t.get(i.id)?r=Oi(i,e):r={x:e.x+Oi(i).x,y:e.y+Oi(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}),lt(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},ho.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return W(i,function(o){if(lt(o)){lt(t)&&e.add("mid",Oi(o));return}if(It(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);W(r,function(a){e.add("mid",a)});return}e.add("mid",Oi(o))}),!Je(t.x)||!Je(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Oi(t)),e},ho.prototype.getSnapTargets=function(e,t){return XE(t).filter(function(n){return!W3(n)})};function W3(e){return!!e.hidden}var uS=1500;function ts(e,t){t.invoke(ho,this),e.on(["create.move","create.end"],uS,K3),e.on(["create.move","create.end","shape.move.move","shape.move.end"],uS,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ja(n)&&U3(n,r)})}Ne(ts,ho),ts.$inject=["eventBus","injector"],ts.prototype.initSnap=function(e){var t=ho.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return W(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",dS(r,i,e))}),W(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",dS(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ts.prototype.addSnapTargetPoints=function(e,t,n){ho.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);W(i,function(r){(Y3(r)||q3([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",YE(r)),e.add("bottom-right",KE(r)))});var o=this._elementRegistry;return W(t.incoming,function(r){if(o.get(t.id)){pS(i,r.source)||e.add("mid",Qe(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),W(t.outgoing,function(r){if(o.get(t.id)){pS(i,r.target)||e.add("mid",Qe(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),A(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},ts.prototype.getSnapTargets=function(e,t){return ho.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function U3(e,t){var n=qe(t),i=ow(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=Qe(r),/top/.test(i)?fn(e,"y",n.top-a.y):/bottom/.test(i)&&fn(e,"y",n.bottom-a.y),/left/.test(i)?fn(e,"x",n.left-a.x):/right/.test(i)&&fn(e,"x",n.right-a.x)}function q3(e,t){return e.every(function(n){return A(n,t)})}function Y3(e){return A(e,"bpmn:SubProcess")&&mt(e)?!0:A(e,"bpmn:Participant")}function K3(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)&&fn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&fn(e,"y",e.y)}}function pS(e,t){return e.indexOf(t)!==-1}function dS(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var X3=1250;function Ac(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],X3,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&ui(i.originalEvent))&&!Ja(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),Q3(s)&&fn(i,"x",i.x),eF(s)&&fn(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,o=t.snapContext;o||(o=t.snapContext=new _r);var r=fS(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Ac.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return W(o,function(r){e.add("corner",KE(r)),e.add("corner",YE(r))}),e.add("corner",fS(t,i)),e},Ac.$inject=["eventBus","snapping"],Ac.prototype.getSnapTargets=function(e,t){return XE(t).filter(function(n){return!Z3(n,e)&&!It(n)&&!J3(n)&&!lt(n)})};function fS(e,t){var n=Qe(e),i=qe(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 Z3(e,t){return e.host===t}function J3(e){return!!e.hidden}function Q3(e){return e==="n"||e==="s"}function eF(e){return e==="e"||e==="w"}var tF=7,nF=1e3;function Er(e){this._canvas=e,this._asyncHide=Gp(Zn(this.hide,this),nF)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ja(e,"x"),y:Ja(e,"y")};W(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(W(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,tF),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),W(["x","y"],function(a){var s=r[a];yn(s)&&fn(e,a,s.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=je("path");return Le(n,{d:"M0,0 L0,0"}),gt(n).add("djs-snap-line"),tt(t,n),{update:function(i){Je(i)?e==="horizontal"?Le(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Le(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Le(n,{display:"none"})}}},Er.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Er.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Er.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Er.prototype.hide=function(){W(this._snapLines,function(e){e.update()})};const iF={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ho],resizeSnapping:["type",Ac],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",aS],createMoveSnapping:["type",ts]};var hS=300;function ot(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=Ct(ot.INPUT_SELECTOR,this._container),this._resultsContainer=Ct(ot.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ot.$inject=["canvas","eventBus","selection","translate"],ot.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ai.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ot.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ot.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ot.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ot.INPUT_SELECTOR,"keydown",function(n){xn("ArrowUp",n)&&n.preventDefault(),xn("ArrowDown",n)&&n.preventDefault()}),t(this._container,ot.INPUT_SELECTOR,"keyup",function(n){if(xn("Escape",n))return e.close();if(xn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(xn("ArrowUp",n))return e._scrollToDirection(!0);if(xn("ArrowDown",n))return e._scrollToDirection();xn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ot.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ai.unbind(e.el,e.type,e.listener)})},ot.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=Ct(ot.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},ot.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ot.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)}},ot.prototype._clearResults=function(){xl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ot.prototype._getCurrentResult=function(){return Ct(ot.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ot.prototype._createResultNode=function(e,t){var n=Vt(ot.RESULT_HTML);return e.primaryTokens.length>0&&gS(n,e.primaryTokens,ot.RESULT_PRIMARY_HTML),gS(n,e.secondaryTokens,ot.RESULT_SECONDARY_HTML),Mn(n,ot.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ot.prototype.registerProvider=function(e){this._searchProvider=e},ot.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,Pt(this._canvas.getContainer()).add("djs-search-open"),Pt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ot.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,Pt(this._canvas.getContainer()).remove("djs-search-open"),Pt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ot.prototype.isOpen=function(){return this._open},ot.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Pt(t).remove(ot.RESULT_SELECTED_CLASS);var n=Mn(e,ot.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Pt(e).add(ot.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:hS}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ot.prototype._select=function(e){var t=Mn(e,ot.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:hS}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ot.prototype._getBoxHtml=function(){const e=Vt(ot.BOX_HTML),t=Ct(ot.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function gS(e,t,n){var i=oF(t),o=Vt(n);o.innerHTML=i,e.appendChild(o)}function oF(e){var t="";return e.forEach(function(n){var i=g0(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+ot.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}ot.CONTAINER_SELECTOR=".djs-search-container",ot.INPUT_SELECTOR=".djs-search-input input",ot.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ot.RESULT_SELECTOR=".djs-search-result",ot.RESULT_SELECTED_CLASS="djs-search-result-selected",ot.RESULT_SELECTED_SELECTOR="."+ot.RESULT_SELECTED_CLASS,ot.RESULT_ID_ATTRIBUTE="data-result-id",ot.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ot.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
335
  <div class="djs-search-input">
336
336
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
337
337
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -339,4 +339,4 @@
339
339
  <input type="text" spellcheck="false" />
340
340
  </div>
341
341
  <div class="djs-search-results" />
342
- </div>`,ot.RESULT_HTML='<div class="djs-search-result"></div>',ot.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ot.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const rF={__depends__:[js,Vu,Ti],searchPad:["type",ot]};function Wg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Wg.$inject=["elementRegistry","searchPad","canvas","search"],Wg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!lt(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:ci(i),id:i.id})),e,{keys:["label","id"]}).map(aF)};function aF(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const sF={__depends__:[rF,CE],__init__:["bpmnSearch"],bpmnSearch:["type",Wg]},cF="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",lF="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",uF={width:36,height:50},pF={width:50,height:50};function gS(e,t,n){return je("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Ii=5;function Mp(e,t){this._styles=t,e.registerProvider(this)}Mp.$inject=["outline","styles"],Mp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(ok(e))return n=je("rect"),Le(n,J({x:-Ii,y:-Ii,rx:4,width:e.width+Ii*2,height:e.height+Ii*2},t)),n;if(!lt(e))return A(e,"bpmn:Gateway")?(n=je("rect"),J(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Le(n,J({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):pt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=je("rect"),Le(n,J({x:-Ii,y:-Ii,rx:14,width:e.width+Ii*2,height:e.height+Ii*2},t))):A(e,"bpmn:EndEvent")?(n=je("circle"),Le(n,J({cx:e.width/2,cy:e.height/2,r:e.width/2+Ii+1},t))):A(e,"bpmn:Event")?(n=je("circle"),Le(n,J({cx:e.width/2,cy:e.height/2,r:e.width/2+Ii},t))):A(e,"bpmn:DataObjectReference")&&mS(e,"bpmn:DataObjectReference")?n=gS(cF,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&mS(e,"bpmn:DataStoreReference")&&(n=gS(lF,{x:-6,y:-6},t)),n},Mp.prototype.updateOutline=function(e,t){if(!lt(e))return pt(e,["bpmn:SubProcess","bpmn:Group"])?(Le(t,{width:e.width+Ii*2,height:e.height+Ii*2}),!0):!!pt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function mS(e,t){var n;return t==="bpmn:DataObjectReference"?n=uF:t==="bpmn:DataStoreReference"&&(n=pF),e.width===n.width&&e.height===n.height}const dF={__depends__:[Ig],__init__:["outlineProvider"],outlineProvider:["type",Mp]};var fF='<?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 go(e){Gr.call(this,e)}Ne(go,Gr),go.Viewer=mr,go.NavigatedViewer=hc,go.prototype.createDiagram=function(){return this.importXML(fF)},go.prototype._interactionModules=[P0,O0,I0],go.prototype._modelingModules=[R$,Du,C$,X_,j$,Pg,U$,y5,Xw,pu,w5,S5,D5,I5,B5,H5,Q5,o3,Uh,p3,x3,P3,O3,P1,iF,sF,dF],go.prototype._modules=[].concat(mr.prototype._modules,go.prototype._interactionModules,go.prototype._modelingModules);const hF=Ee.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Ee.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=ud(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 Ee.onMounted(async()=>{a=new go({container:r.value,moddleExtensions:gs,additionalModules:[...w0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Ee.watch(()=>i.xml,l=>{l&&a&&s(l)}),Ee.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Ee.openBlock(),Ee.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),Ug=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},gF=Ug(hF,[["__scopeId","data-v-7cfbebdb"]]),mF=["title","aria-expanded"],yF=["title","onClick"],vF={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},xF={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},bF={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},wF={key:0,class:"bwl-validation__body"},_F={key:0,class:"bwl-validation__empty"},EF={key:1,class:"bwl-validation__empty"},SF={key:2,class:"bwl-validation__list"},RF=["onClick"],MF={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},CF={class:"bwl-validation__msg"},AF=["title"],TF=Ug(Ee.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Ee.computed(()=>r0(n.issues.value,n.describeElement)),o=Ee.computed(()=>a0(i.value)),r=m=>Ga(m,n.changeScope.value),a=Ee.computed(()=>Qh(i.value,n.changeScope.value)),s=Ee.ref({error:!0,warning:!0,info:!0}),c=Ee.computed(()=>s0(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=Ee.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function f(m){const g=m.targetRefs[0];g&&n.requestFocus(g)}return(m,g)=>(Ee.openBlock(),Ee.createElementBlock("section",{class:Ee.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Ee.createElementVNode("header",{class:"bwl-validation__head",onClick:g[1]||(g[1]=y=>l.value=!l.value)},[Ee.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Ee.openBlock(),Ee.createElementBlock("svg",{class:Ee.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...g[2]||(g[2]=[Ee.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),g[3]||(g[3]=Ee.createElementVNode("span",null,"검증",-1))],8,mF),Ee.createElementVNode("div",{class:"bwl-validation__counts",onClick:g[0]||(g[0]=Ee.withModifiers(()=>{},["stop"]))},[(Ee.openBlock(),Ee.createElementBlock(Ee.Fragment,null,Ee.renderList(u,y=>Ee.createElementVNode("button",{key:y,type:"button",class:Ee.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>d(y)},[(Ee.openBlock(),Ee.createElementBlock("svg",vF,[g[4]||(g[4]=Ee.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(Ee.openBlock(),Ee.createElementBlock("path",xF)):(Ee.openBlock(),Ee.createElementBlock("path",bF))])),Ee.createElementVNode("span",null,Ee.toDisplayString(o.value[y]),1)],10,yF)),64))])]),l.value?(Ee.openBlock(),Ee.createElementBlock("div",wF,[i.value.length===0?(Ee.openBlock(),Ee.createElementBlock("p",_F,"발견된 문제가 없습니다.")):c.value.length===0?(Ee.openBlock(),Ee.createElementBlock("p",EF," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Ee.openBlock(),Ee.createElementBlock("ul",SF,[(Ee.openBlock(!0),Ee.createElementBlock(Ee.Fragment,null,Ee.renderList(c.value,y=>(Ee.openBlock(),Ee.createElementBlock("li",{key:y.key,class:Ee.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:_=>f(y)},[g[5]||(g[5]=Ee.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(y)?(Ee.openBlock(),Ee.createElementBlock("span",MF,"이번 변경")):Ee.createCommentVNode("",!0),Ee.createElementVNode("span",CF,Ee.toDisplayString(y.message),1),Ee.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},Ee.toDisplayString(y.category),9,AF)],10,RF))),128))]))])):Ee.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),PF={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},kF=["aria-checked","title","data-locale","onClick"],OF={class:"bwl-locale__label"},DF={key:0,class:"bwl-locale__badge"},LF=Ug(Ee.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=Ee.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?(Ee.openBlock(),Ee.createElementBlock("div",PF,[(Ee.openBlock(!0),Ee.createElementBlock(Ee.Fragment,null,Ee.renderList(o.value,s=>(Ee.openBlock(),Ee.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Ee.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=>Ee.unref(n).setDisplayLocale(s.locale)},[Ee.createElementVNode("span",OF,Ee.toDisplayString(s.label),1),s.pending>0?(Ee.openBlock(),Ee.createElementBlock("span",DF,Ee.toDisplayString(s.pending),1)):Ee.createCommentVNode("",!0)],10,kF))),128))])):Ee.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);re.ADDABLE_FLOW_NODE_TYPES=Nc,re.APPLY_BPMN_OPS_SCHEMA=QR,re.BPMN_EVENT_DEFINITION_TYPES=Fc,re.BPMN_MODDLE_EXTENSIONS=gs,re.BPMN_MODELER_VIEW_MODULES=w0,re.BWL_MODDLE_SCHEMA=hm,re.BWL_NS=fm,re.BWL_PREFIX=$p,re.BWL_REVIEW_REQUEST_TYPE=Hc,re.BWL_SIDES=Fp,re.BpmnDisplayLocaleSwitcher=LF,re.BpmnModelerView=gF,re.BpmnValidationPanel=TF,re.EDITOR=YT,re.FLOW_LABEL_INDENT=Zm,re.GROUP_BORDER_MIN_RUN=pd,re.GROUP_BORDER_NEAR=xa,re.HEADLESS_BPMN_MODULES=Xh,re.HEADLESS_TEXT_METRICS=Qi,re.HeadlessReplay=ng,re.HeadlessReplayModule=f0,re.I18N_DISPLAY_REDRAWN_EVENT=fc,re.I18N_NS=IR,re.I18N_PREFIX=wm,re.I18N_REVIEW_REQUESTED_CLASS=l0,re.I18N_TRANSLATION_TYPE=kr,re.I18N_UNTRANSLATED_CLASS=c0,re.I18nDisplay=eg,re.I18nDisplayModule=p0,re.IR_EVENT_DEFINITIONS=$c,re.IR_FLOW_NODE_TYPES=Tr,re.IR_TEXT_LOCALES=jc,re.LABEL_FORK_MARGIN=hd,re.LABEL_SHAPE_MIN_DEPTH=ly,re.SET_TRANSLATIONS_COMMAND=qp,re.SEVERITY_ORDER=Jh,re.SYMBOLIC_OP_KINDS=_m,re.SYMBOLIC_OP_SCHEMA=Em,re.SetTranslationsHandler=Yp,re.TranslationCommands=Xp,re.TranslationCommandsModule=Zp,re.TranslationStateIndex=tP,re.UNDO_EPISODE_COMMAND=jp,re.UPDATE_TRANSLATION_COMMAND=Vc,re.UpdateTranslationHandler=Up,re.applyBpmnOpBatch=Ov,re.applyBpmnOps=$d,re.applyLocaleBackfill=eP,re.applyTranslationLocaleRestore=aP,re.approximateTextWidth=Br,re.auditBpmnGeometry=dy,re.auditBpmnGeometryXml=XC,re.auditBpmnSemantics=jd,re.auditBpmnSemanticsXml=IT,re.auditGeometry=ft,re.auditTargetsOf=Dn,re.axisSegmentsOf=sn,re.blackBoxNameRect=dd,re.buildBpmnOpBatch=GT,re.buildRegistryIndex=hy,re.collectTranslationStates=jv,re.containerBoundarySegments=wa,re.countBySeverity=a0,re.createBpmnEditorController=KT,re.createBpmnModdle=zm,re.createHeadlessBpmnModeler=AB,re.crossedShapesOf=Ot,re.crossingCost=Gn,re.describeProcess=Sv,re.describeProcessXml=TT,re.diffBpmnElements=Cv,re.diffBpmnElementsXml=HT,re.documentLocalesOf=ps,re.edgeCrossCount=ys,re.edgeCrossingPairsOf=eo,re.edgeCrossingStatsOf=oy,re.executeAsUndoEpisode=mm,re.feedGeneratedIds=kv,re.followMovedEdgeLabels=Uy,re.forwardThreePointCandidates=nl,re.geometryFindingKey=ct,re.inferScriptLocale=vl,re.installHeadlessBpmnDom=Wm,re.irEventDefinitionOf=Np,re.isAddableFlowNodeType=pm,re.isChangeScopeMixed=Qh,re.isEdgeOverlapFinding=fd,re.isGuardedGridSnapping=qB,re.isInChangeScope=Ga,re.isIrEventDefinition=dm,re.isIrFlowNodeType=um,re.isIrTextLocale=RR,re.labelRectsOf=Yo,re.labelShapeDepth=uy,re.labelSlot=Or,re.lineCrossesLabel=ji,re.lineThroughLabel=Qm,re.lineThroughShapeLabel=cy,re.loadBpmnXml=va,re.localeTextsOf=Wp,re.lowerOps=xv,re.mergeUndoSteps=vm,re.oppositeOverlapCount=IC,re.oppositeOverlapOf=Xm,re.planBackEdgeBoundaryClearance=Oy,re.planCrossPoolRoute=Cy,re.planEdgeRepair=ol,re.planLabelLineClearance=Od,re.planLabelPlacement=Gy,re.planLocaleBackfill=QT,re.planMiddleSegmentShifts=by,re.planOppositeOverlapRepair=By,re.planSegmentDetours=tl,re.planShapeLabelClearance=Ky,re.planTranslationLocaleRestore=rP,re.poolOverlapsOf=yd,re.recordGeneratedIds=Pv,re.redockIntroducedDetachedEndpoints=Zy,re.repairIntroducedBoundaryHugging=Dy,re.repairIntroducedCrossings=wd,re.repairIntroducedEdgeCrossings=_y,re.repairIntroducedFakeMerges=$y,re.repairIntroducedLabelLines=qy,re.repairIntroducedOppositeOverlaps=zy,re.repairIntroducedShapeLabelLines=Xy,re.repairIntroducedSharedSegmentLabels=Yy,re.replayAgentTurn=Dv,re.rerouteIntroducedCrossPoolEdges=Ay,re.resolverServicesOf=uv,re.reviewRequestValuesOf=Kp,re.reviewRequestsOf=Vo,re.rootLangOf=Vp,re.saveBpmnXml=EC,re.sceneCrossingCost=iy,re.sceneFromDefinitions=py,re.sceneFromRegistry=Ge,re.segmentShapeClearance=bo,re.shapesUnderLabel=vs,re.sharedEndpointCrossingPairsOf=_i,re.sharedSegmentUnderLabel=el,re.sharedSpansOf=Qc,re.sortPanelIssues=s0,re.toPanelIssues=r0,re.touchedElements=zT,re.translationLocale=Rn,re.translationsOf=Go,re.undoStepMark=ym,re.unreadableOverlapCount=Jn,re.unreadableOverlapOf=Nr,re.validateOps=tv,re.warningMessages=ud,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})}));
342
+ </div>`,ot.RESULT_HTML='<div class="djs-search-result"></div>',ot.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ot.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const rF={__depends__:[js,Vu,Ti],searchPad:["type",ot]};function Wg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Wg.$inject=["elementRegistry","searchPad","canvas","search"],Wg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!lt(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:ci(i),id:i.id})),e,{keys:["label","id"]}).map(aF)};function aF(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const sF={__depends__:[rF,AE],__init__:["bpmnSearch"],bpmnSearch:["type",Wg]},cF="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",lF="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",uF={width:36,height:50},pF={width:50,height:50};function mS(e,t,n){return je("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Ii=5;function Mp(e,t){this._styles=t,e.registerProvider(this)}Mp.$inject=["outline","styles"],Mp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(ok(e))return n=je("rect"),Le(n,J({x:-Ii,y:-Ii,rx:4,width:e.width+Ii*2,height:e.height+Ii*2},t)),n;if(!lt(e))return A(e,"bpmn:Gateway")?(n=je("rect"),J(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Le(n,J({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):pt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=je("rect"),Le(n,J({x:-Ii,y:-Ii,rx:14,width:e.width+Ii*2,height:e.height+Ii*2},t))):A(e,"bpmn:EndEvent")?(n=je("circle"),Le(n,J({cx:e.width/2,cy:e.height/2,r:e.width/2+Ii+1},t))):A(e,"bpmn:Event")?(n=je("circle"),Le(n,J({cx:e.width/2,cy:e.height/2,r:e.width/2+Ii},t))):A(e,"bpmn:DataObjectReference")&&yS(e,"bpmn:DataObjectReference")?n=mS(cF,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&yS(e,"bpmn:DataStoreReference")&&(n=mS(lF,{x:-6,y:-6},t)),n},Mp.prototype.updateOutline=function(e,t){if(!lt(e))return pt(e,["bpmn:SubProcess","bpmn:Group"])?(Le(t,{width:e.width+Ii*2,height:e.height+Ii*2}),!0):!!pt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function yS(e,t){var n;return t==="bpmn:DataObjectReference"?n=uF:t==="bpmn:DataStoreReference"&&(n=pF),e.width===n.width&&e.height===n.height}const dF={__depends__:[Ig],__init__:["outlineProvider"],outlineProvider:["type",Mp]};var fF='<?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 go(e){Gr.call(this,e)}Ne(go,Gr),go.Viewer=mr,go.NavigatedViewer=hc,go.prototype.createDiagram=function(){return this.importXML(fF)},go.prototype._interactionModules=[k0,D0,B0],go.prototype._modelingModules=[R$,Du,C$,Z_,j$,Pg,U$,y5,Zw,pu,w5,S5,D5,I5,B5,H5,Q5,o3,Uh,p3,x3,P3,O3,k1,iF,sF,dF],go.prototype._modules=[].concat(mr.prototype._modules,go.prototype._interactionModules,go.prototype._modelingModules);const hF=Ee.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Ee.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=ud(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 Ee.onMounted(async()=>{a=new go({container:r.value,moddleExtensions:gs,additionalModules:[..._0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Ee.watch(()=>i.xml,l=>{l&&a&&s(l)}),Ee.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Ee.openBlock(),Ee.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),Ug=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},gF=Ug(hF,[["__scopeId","data-v-7cfbebdb"]]),mF=["title","aria-expanded"],yF=["title","onClick"],vF={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},xF={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},bF={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},wF={key:0,class:"bwl-validation__body"},_F={key:0,class:"bwl-validation__empty"},EF={key:1,class:"bwl-validation__empty"},SF={key:2,class:"bwl-validation__list"},RF=["onClick"],MF={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},CF={class:"bwl-validation__msg"},AF=["title"],TF=Ug(Ee.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Ee.computed(()=>a0(n.issues.value,n.describeElement)),o=Ee.computed(()=>s0(i.value)),r=m=>Ga(m,n.changeScope.value),a=Ee.computed(()=>Qh(i.value,n.changeScope.value)),s=Ee.ref({error:!0,warning:!0,info:!0}),c=Ee.computed(()=>c0(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=Ee.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function f(m){const g=m.targetRefs[0];g&&n.requestFocus(g)}return(m,g)=>(Ee.openBlock(),Ee.createElementBlock("section",{class:Ee.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Ee.createElementVNode("header",{class:"bwl-validation__head",onClick:g[1]||(g[1]=y=>l.value=!l.value)},[Ee.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Ee.openBlock(),Ee.createElementBlock("svg",{class:Ee.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...g[2]||(g[2]=[Ee.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),g[3]||(g[3]=Ee.createElementVNode("span",null,"검증",-1))],8,mF),Ee.createElementVNode("div",{class:"bwl-validation__counts",onClick:g[0]||(g[0]=Ee.withModifiers(()=>{},["stop"]))},[(Ee.openBlock(),Ee.createElementBlock(Ee.Fragment,null,Ee.renderList(u,y=>Ee.createElementVNode("button",{key:y,type:"button",class:Ee.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>d(y)},[(Ee.openBlock(),Ee.createElementBlock("svg",vF,[g[4]||(g[4]=Ee.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(Ee.openBlock(),Ee.createElementBlock("path",xF)):(Ee.openBlock(),Ee.createElementBlock("path",bF))])),Ee.createElementVNode("span",null,Ee.toDisplayString(o.value[y]),1)],10,yF)),64))])]),l.value?(Ee.openBlock(),Ee.createElementBlock("div",wF,[i.value.length===0?(Ee.openBlock(),Ee.createElementBlock("p",_F,"발견된 문제가 없습니다.")):c.value.length===0?(Ee.openBlock(),Ee.createElementBlock("p",EF," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Ee.openBlock(),Ee.createElementBlock("ul",SF,[(Ee.openBlock(!0),Ee.createElementBlock(Ee.Fragment,null,Ee.renderList(c.value,y=>(Ee.openBlock(),Ee.createElementBlock("li",{key:y.key,class:Ee.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:_=>f(y)},[g[5]||(g[5]=Ee.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(y)?(Ee.openBlock(),Ee.createElementBlock("span",MF,"이번 변경")):Ee.createCommentVNode("",!0),Ee.createElementVNode("span",CF,Ee.toDisplayString(y.message),1),Ee.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},Ee.toDisplayString(y.category),9,AF)],10,RF))),128))]))])):Ee.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),PF={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},kF=["aria-checked","title","data-locale","onClick"],OF={class:"bwl-locale__label"},DF={key:0,class:"bwl-locale__badge"},LF=Ug(Ee.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=Ee.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?(Ee.openBlock(),Ee.createElementBlock("div",PF,[(Ee.openBlock(!0),Ee.createElementBlock(Ee.Fragment,null,Ee.renderList(o.value,s=>(Ee.openBlock(),Ee.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Ee.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=>Ee.unref(n).setDisplayLocale(s.locale)},[Ee.createElementVNode("span",OF,Ee.toDisplayString(s.label),1),s.pending>0?(Ee.openBlock(),Ee.createElementBlock("span",DF,Ee.toDisplayString(s.pending),1)):Ee.createCommentVNode("",!0)],10,kF))),128))])):Ee.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);re.ADDABLE_FLOW_NODE_TYPES=Nc,re.APPLY_BPMN_OPS_SCHEMA=eM,re.BPMN_EVENT_DEFINITION_TYPES=Fc,re.BPMN_MODDLE_EXTENSIONS=gs,re.BPMN_MODELER_VIEW_MODULES=_0,re.BWL_MODDLE_SCHEMA=hm,re.BWL_NS=fm,re.BWL_PREFIX=$p,re.BWL_REVIEW_REQUEST_TYPE=Hc,re.BWL_SIDES=Fp,re.BpmnDisplayLocaleSwitcher=LF,re.BpmnModelerView=gF,re.BpmnValidationPanel=TF,re.EDITOR=YT,re.FLOW_LABEL_INDENT=Zm,re.GROUP_BORDER_MIN_RUN=pd,re.GROUP_BORDER_NEAR=xa,re.HEADLESS_BPMN_MODULES=Xh,re.HEADLESS_TEXT_METRICS=Qi,re.HeadlessReplay=ng,re.HeadlessReplayModule=h0,re.I18N_DISPLAY_REDRAWN_EVENT=fc,re.I18N_NS=BR,re.I18N_PREFIX=wm,re.I18N_REVIEW_REQUESTED_CLASS=u0,re.I18N_TRANSLATION_TYPE=kr,re.I18N_UNTRANSLATED_CLASS=l0,re.I18nDisplay=eg,re.I18nDisplayModule=d0,re.IR_EVENT_DEFINITIONS=$c,re.IR_FLOW_NODE_TYPES=Tr,re.IR_TEXT_LOCALES=jc,re.LABEL_FORK_MARGIN=hd,re.LABEL_SHAPE_MIN_DEPTH=ly,re.SET_TRANSLATIONS_COMMAND=qp,re.SEVERITY_ORDER=Jh,re.SYMBOLIC_OP_KINDS=_m,re.SYMBOLIC_OP_SCHEMA=Em,re.SetTranslationsHandler=Yp,re.TranslationCommands=Xp,re.TranslationCommandsModule=Zp,re.TranslationStateIndex=tP,re.UNDO_EPISODE_COMMAND=jp,re.UPDATE_TRANSLATION_COMMAND=Vc,re.UpdateTranslationHandler=Up,re.applyBpmnOpBatch=Dv,re.applyBpmnOps=$d,re.applyLocaleBackfill=eP,re.applyTranslationLocaleRestore=aP,re.approximateTextWidth=Br,re.auditBpmnGeometry=dy,re.auditBpmnGeometryXml=ZC,re.auditBpmnSemantics=jd,re.auditBpmnSemanticsXml=IT,re.auditGeometry=ft,re.auditTargetsOf=Dn,re.axisSegmentsOf=sn,re.blackBoxNameRect=dd,re.buildBpmnOpBatch=GT,re.buildRegistryIndex=hy,re.collectTranslationStates=Hv,re.containerBoundarySegments=wa,re.countBySeverity=s0,re.createBpmnEditorController=KT,re.createBpmnModdle=zm,re.createHeadlessBpmnModeler=AB,re.crossedShapesOf=Ot,re.crossingCost=Gn,re.describeProcess=Rv,re.describeProcessXml=TT,re.diffBpmnElements=Av,re.diffBpmnElementsXml=HT,re.documentLocalesOf=ps,re.edgeCrossCount=ys,re.edgeCrossingPairsOf=eo,re.edgeCrossingStatsOf=oy,re.executeAsUndoEpisode=mm,re.feedGeneratedIds=Ov,re.followMovedEdgeLabels=qy,re.forwardThreePointCandidates=nl,re.geometryFindingKey=ct,re.inferScriptLocale=vl,re.installHeadlessBpmnDom=Wm,re.irEventDefinitionOf=Np,re.isAddableFlowNodeType=pm,re.isChangeScopeMixed=Qh,re.isEdgeOverlapFinding=fd,re.isGuardedGridSnapping=qB,re.isInChangeScope=Ga,re.isIrEventDefinition=dm,re.isIrFlowNodeType=um,re.isIrTextLocale=MR,re.labelRectsOf=Yo,re.labelShapeDepth=uy,re.labelSlot=Or,re.lineCrossesLabel=ji,re.lineThroughLabel=Qm,re.lineThroughShapeLabel=cy,re.loadBpmnXml=va,re.localeTextsOf=Wp,re.lowerOps=bv,re.mergeUndoSteps=vm,re.oppositeOverlapCount=BC,re.oppositeOverlapOf=Xm,re.planBackEdgeBoundaryClearance=Oy,re.planCrossPoolRoute=Cy,re.planEdgeRepair=ol,re.planLabelLineClearance=Od,re.planLabelPlacement=Vy,re.planLocaleBackfill=QT,re.planMiddleSegmentShifts=by,re.planOppositeOverlapRepair=Ny,re.planSegmentDetours=tl,re.planShapeLabelClearance=Xy,re.planTranslationLocaleRestore=rP,re.poolOverlapsOf=yd,re.recordGeneratedIds=kv,re.redockIntroducedDetachedEndpoints=Jy,re.repairIntroducedBoundaryHugging=Dy,re.repairIntroducedCrossings=wd,re.repairIntroducedEdgeCrossings=_y,re.repairIntroducedFakeMerges=Fy,re.repairIntroducedLabelLines=Yy,re.repairIntroducedOppositeOverlaps=Gy,re.repairIntroducedShapeLabelLines=Zy,re.repairIntroducedSharedSegmentLabels=Ky,re.replayAgentTurn=Lv,re.rerouteIntroducedCrossPoolEdges=Ay,re.resolverServicesOf=pv,re.reviewRequestValuesOf=Kp,re.reviewRequestsOf=Vo,re.rootLangOf=Vp,re.saveBpmnXml=SC,re.sceneCrossingCost=iy,re.sceneFromDefinitions=py,re.sceneFromRegistry=Ge,re.segmentShapeClearance=bo,re.shapesUnderLabel=vs,re.sharedEndpointCrossingPairsOf=_i,re.sharedSegmentUnderLabel=el,re.sharedSpansOf=Qc,re.sortPanelIssues=c0,re.toPanelIssues=a0,re.touchedElements=zT,re.translationLocale=Rn,re.translationsOf=Go,re.undoStepMark=ym,re.unreadableOverlapCount=Jn,re.unreadableOverlapOf=Nr,re.validateOps=nv,re.warningMessages=ud,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})}));