@g1cloud/bpmn-modeler-next 5.0.0-beta.95 → 5.0.0-beta.96

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(le,Ce){typeof exports=="object"&&typeof module<"u"?Ce(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ce):(le=typeof globalThis<"u"?globalThis:le||self,Ce(le.BpmnModeler={},le.Vue))})(this,(function(le,Ce){"use strict";var Y6=Object.defineProperty;var K6=(le,Ce,Nr)=>Ce in le?Y6(le,Ce,{enumerable:!0,configurable:!0,writable:!0,value:Nr}):le[Ce]=Nr;var pn=(le,Ce,Nr)=>K6(le,typeof Ce!="symbol"?Ce+"":Ce,Nr);const Nr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Vc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Sm(e){return Nr.includes(e)}function Rm(e){return Vc.includes(e)}const Wc=["timer"],Uc={timer:"bpmn:TimerEventDefinition"};function Mm(e){return typeof e=="string"&&Wc.includes(e)}function Gp(e){if(e.length===1)return Wc.find(t=>Uc[t]===e[0])}const qc=["ko","en","ja","zh"];function qR(e){return typeof e=="string"&&qc.includes(e)}const Cm="http://g1project.net/spec/bpmn/bwl/1.0",zp="bwl",Vp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Yc="bwl:ReviewRequest",Am={name:"bwl-hints",uri:Cm,prefix:zp,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"}]}]},Wp="bwl.undoEpisode",Pm=new WeakSet;function YR(e){Pm.has(e)||(e.register(Wp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Pm.add(e))}function Tm(e,t){YR(e);const n={run:t};if(e.execute(Wp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function km(e){return e._stackIdx+1}function Om(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 Up(e){return Array.prototype.concat.apply([],e)}const vs=Object.prototype.toString,KR=Object.prototype.hasOwnProperty;function $r(e){return e===void 0}function _n(e){return e!==void 0}function va(e){return e==null}function et(e){return vs.call(e)==="[object Array]"}function En(e){return vs.call(e)==="[object Object]"}function tt(e){return vs.call(e)==="[object Number]"}function Cn(e){const t=vs.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function oi(e){return vs.call(e)==="[object String]"}function XR(e){if(!et(e))throw new Error("must supply array")}function ri(e,t){return!va(e)&&KR.call(e,t)}function Ht(e,t){const n=Xc(t);let i;return K(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Dm(e,t){const n=Xc(t);let i=et(e)?-1:void 0;return K(e,function(o,r){if(n(o,r))return i=r,!1}),i}function gt(e,t){const n=Xc(t);let i=[];return K(e,function(o,r){n(o,r)&&i.push(o)}),i}function K(e,t){let n,i;if($r(e))return;const o=et(e)?tM:eM;for(let r in e)if(ri(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function ZR(e,t){if($r(e))return[];XR(e);const n=Xc(t);return e.filter(function(i,o){return!n(i,o)})}function ai(e,t,n){return K(e,function(i,o){n=t(n,i,o)}),n}function qo(e,t){return!!ai(e,function(n,i,o){return n&&t(i,o)},!0)}function Yo(e,t){return!!Ht(e,t)}function Wn(e,t){let n=[];return K(e,function(i,o){n.push(t(i,o))}),n}function Kc(e){return e&&Object.keys(e)||[]}function JR(e){return Kc(e).length}function xa(e){return Wn(e,t=>t)}function ba(e,t,n={}){return t=qp(t),K(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Lm(e,...t){e=qp(e);let n={};return K(t,o=>ba(o,e,n)),Wn(n,function(o,r){return o[0]})}const QR=Lm;function to(e,t){t=qp(t);let n=[];return K(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)}),Wn(n,i=>i.v)}function wa(e){return function(t){return qo(e,function(n,i){return t[i]===n})}}function qp(e){return Cn(e)?e:t=>t[e]}function Xc(e){return Cn(e)?e:t=>t===e}function eM(e){return e}function tM(e){return Number(e)}function Yp(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 ei(e,t){return e.bind(t)}function te(e,...t){return Object.assign(e,...t)}function nM(e,t,n){let i=e;return K(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];_n(a)&&va(s)&&(s=i[o]=isNaN(+a)?{}:[]),$r(a)?$r(n)?delete i[o]:i[o]=n:i=s}),e}function Vi(e,t){let n={},i=Object(e);return K(t,function(o){o in i&&(n[o]=e[o])}),n}function no(e,t){let n={},i=Object(e);return K(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function P(e,t){var n=Ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ht(e,t){return Yo(t,function(n){return P(e,n)})}function Ee(e){return e&&e.businessObject||e}function wt(e){return e&&e.di}const iM="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Im="i18n",Fr="i18n:Translation";function jr(e){if(e){if(P(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(P(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(P(e,"bpmn:FlowElement")||P(e,"bpmn:Participant")||P(e,"bpmn:Lane")||P(e,"bpmn:MessageFlow")||P(e,"bpmn:DataInput")||P(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Ko(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,Fr)})}function Bn(e){return e.get("xml:lang")}function Xo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Yc)})}function xs(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Kp(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}const oM=/^[\t\n\r\x20-\x7E]+$/;function Zc(e,t,n,i){if(!e)return[];const o=t.filter(a=>(a.body??"")===e).map(Bn),r=o.length?o:[i??n];return!r.includes(n)&&oM.test(e)&&!t.some(a=>Bn(a)===n&&a.body)?[...r,n]:r}function Xp(e,t,n){const i=jr(e);if(!i)return{};const o=i.target[i.key]??"",r=Ko(e).filter(l=>Bn(l)),a=l=>l.body??"",s=Zc(o,r,t.designLocale,n),c={};for(const l of xs(t)){if(s.includes(l)){c[l]=o;continue}const u=r.find(p=>Bn(p)===l&&a(p));u&&(c[l]=a(u))}return c}const Jc="bwl.updateTranslation";class Zp{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=jr(c),u=[];t.undo=u;const p=Ko(c).filter(A=>Bn(A)),d=s??(l?l.target[l.key]??"":""),f=a??o,y=Zc(d,p,o,a),h=s!==void 0&&d&&!y.includes(t.locale)?y[0]:t.locale,m=A=>{var L;return((L=p.find(H=>Bn(H)===A&&H.body))==null?void 0:L.body)??(y.includes(A)?d:"")},w=A=>Xo(c).some(L=>L.locale===A),g=m(h);if(g===i)return[];const v=!!g&&!w(h),b=v?r.filter(A=>A!==h&&m(A)&&!w(A)):[],E=()=>{let A=c.extensionElements;return A||(A=this.moddle.create("bpmn:ExtensionElements",{values:[]}),A.$parent=c,c.extensionElements=A,u.push(()=>delete c.extensionElements)),A.get("values")},M=(A,L)=>{const H=E();let V=H.find(G=>{var ie;return((ie=G.$instanceOf)==null?void 0:ie.call(G,Fr))&&Bn(G)===A});if(V){const G=V.body;V.body=L,u.push(()=>V.body=G)}else V=this.moddle.create(Fr,{body:L}),V.set("xml:lang",A),V.$parent=c.extensionElements,H.push(V),u.push(()=>H.splice(H.indexOf(V),1))},B=A=>{const L=E(),H=L.indexOf(A);L.splice(H,1),u.push(()=>L.splice(H,0,A))};if(s===void 0){if(h===o&&l){if(d&&!p.some(L=>L.body===d)){const L=a&&a!==o?a:void 0;L&&M(L,d)}const A=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{A?l.target[l.key]=d:delete l.target[l.key]})}M(h,i)}else(p.some(A=>Bn(A)===h)||!d&&h!==f)&&M(h,i);if(!v)for(const A of Xo(c).filter(L=>L.locale===h))B(A);for(const A of b){const L=E(),H=this.moddle.create(Yc,{locale:A,sourceLocale:h,previous:g});H.$parent=c.extensionElements,L.push(H),u.push(()=>L.splice(L.indexOf(H),1))}for(const A of Xo(c).filter(L=>L.sourceLocale===h&&(L.previous??"")===i))B(A);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):[]}}pn(Zp,"$inject",["moddle"]);const Jp="bwl.setTranslations",rM=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Qp{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,!jr(l))return[];const p=()=>{let w=l.extensionElements;return w||(w=this.moddle.create("bpmn:ExtensionElements",{values:[]}),w.$parent=l,l.extensionElements=w,u.push(()=>delete l.extensionElements)),w.get("values")},d=w=>{const g=p(),v=g.indexOf(w);v<0||(g.splice(v,1),u.push(()=>g.splice(v,0,w)))},f=w=>Ko(l).find(g=>Bn(g)===w);if(i===null)for(const w of a){const g=f(w);g&&d(g)}else if(i)for(const w of a){const g=i[w];if(g===void 0)continue;const v=f(w);if(v){if(v.body===g)continue;const M=v.body;v.body=g,u.push(()=>v.body=M);continue}if(w===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(Fr,{body:g});E.set("xml:lang",w),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(w=>!o.includes(w.locale)&&!(i&&i[w.locale]!==void 0&&i[w.locale]!==c.texts[w.locale])&&!(i&&w.sourceLocale&&i[w.sourceLocale]===w.previous))];for(const w of Xo(l)){const g=h.findIndex(v=>rM(w,v));g>=0?h.splice(g,1):d(w)}for(const w of h){const g=p(),v=this.moddle.create(Yc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});v.$parent=l.extensionElements,g.push(v),u.push(()=>g.splice(g.indexOf(v),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),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):[]}}pn(Qp,"$inject",["moddle"]);function ed(e){return Xo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class td{constructor(t){t.registerHandler(Jc,Zp),t.registerHandler(Jp,Qp)}}pn(td,"$inject",["commandStack"]);const nd={__init__:["translationCommands"],translationCommands:["type",td]},Bm=["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"],aM={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},sM={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(qc.map(e=>[e,{type:"string"}])),additionalProperties:!1},cM={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},lM={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},uM={type:"string",enum:[...Wc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},pM={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Vc]},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},dM={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},fM={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},hM={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},gM={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},mM={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},yM={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},vM={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},xM={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},bM={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Vp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const wM={"participant.add":Nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Nn("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":Nn("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":Nn("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:[...Vc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Nn("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":Nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Nn("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":Nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Nn("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":Nn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...qc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Nm={anyOf:Bm.map(e=>wM[e])},_M={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:cM,irParticipant:lM,irNode:pM,irFlowCondition:dM,irSequenceFlow:fM,irMessageFlow:hM,irDataStore:gM,irDataAssociation:mM,irTextAnnotation:yM,irAssociation:vM,irGroup:xM,bwlPlacement:bM,eventDefinition:uM,localeTexts:sM,nullableString:aM,symbolicOp:Nm}};function id(){}id.prototype.get=function(e){return this.$model.properties.get(this,e)},id.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function $m(e,t){this.model=e,this.properties=t}$m.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(id.prototype);K(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var 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}),K(a,ei(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=te(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Fm=te(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 od(e,t){var n=Fm[e];return n?n(t):t}function rd(e){return!!EM[e]}function jm(e){return!!Fm[e]}function Un(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 xi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}xi.prototype.build=function(){return Vi(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},xi.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)},xi.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},xi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=Un(o[0],i),a=Un(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},xi.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},xi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},xi.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},xi.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},xi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},xi.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")},xi.prototype.hasProperty=function(e){return this.propertiesByName[e]},xi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(K(e.properties,ei(function(r){r=te({},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 Zo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,K(e,ei(this.registerPackage,this))}Zo.prototype.getPackage=function(e){return this.packageMap[e]},Zo.prototype.getPackages=function(){return this.packages},Zo.prototype.registerPackage=function(e){e=te({},e);var t=this.packageMap;Hm(t,e,"prefix"),Hm(t,e,"uri"),K(e.types,ei(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Zo.prototype.registerType=function(e,t){e=te({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:te({},e.meta||{})});var n=Un(e.name,t.prefix),i=n.name,o=Object.create(null);K(e.properties,ei(function(r){var a=Un(r.name,n.prefix),s=a.name;rd(r.type)||(r.type=Un(r.type,a.prefix).name),te(r,{ns:a,name:s}),o[s]=r},this)),te(e,{ns:n,name:i,propertiesByName:o}),K(e.extends,ei(function(r){var a=Un(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},Zo.prototype.mapTypes=function(e,t,n){var i=rd(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=Un(c,rd(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+">");K(i.superClass,n?a:s),t(i,!n),K(i.traits,a)},Zo.prototype.getEffectiveDescriptor=function(e){var t=Un(e),n=new xi(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},Zo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Hm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Hr(e){this.model=e}Hr.prototype.set=function(e,t,n){if(!oi(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;SM(n)?i?delete e[o]:delete e.$attrs[ad(t)]:i?o in e?e[o]=n:Gm(e,i,n):e.$attrs[ad(t)]=n},Hr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ad(t)];var i=n.name;return!e[i]&&n.isMany&&Gm(e,n,[]),e[i]},Hr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=te({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Hr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Hr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Hr.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 SM(e){return typeof e>"u"}function Gm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function ad(e){return e.replace(/^:/,"")}function Ei(e,t={}){this.properties=new Hr(this),this.factory=new $m(this,this.properties),this.registry=new Zo(e,this.properties),this.typeCache=Object.create(null),this.config=t}Ei.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Ei.prototype.getType=function(e){var t=this.typeCache,n=oi(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Ei.prototype.createAny=function(e,t,n){var i=Un(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){nM(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}),K(n,function(a,s){En(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},Ei.prototype.getPackage=function(e){return this.registry.getPackage(e)},Ei.prototype.getPackages=function(){return this.registry.getPackages()},Ei.prototype.getElementDescriptor=function(e){return e.$descriptor},Ei.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Ei.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Ei.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var zm=String.fromCharCode,RM=Object.prototype.hasOwnProperty,MM=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,bs={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(bs).forEach(function(e){bs[e.toUpperCase()]=bs[e]});function CM(e,t,n,i){return i?RM.call(bs,i)?bs[i]:"&"+i+";":zm(t||parseInt(n,16))}function Gr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(MM,CM):e}var Vm="non-whitespace outside of root node";function Jo(e){return new Error(e)}function AM(e){return"missing namespace for prefix <"+e+">"}function Qc(e){return{get:e,enumerable:!0}}function PM(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Wm=Symbol("nameCache");function sd(e){return e+"$uri"}function TM(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[sd(i)]=n;return t}function el(){return{line:0,column:0}}function kM(e){throw e}function Um(e){if(!this)return new Um(e);var t=e&&e.proxy,n,i,o,r,a=kM,s,c,l,u,p=el,d=!1,f=!1,y="",h=!1,m=!1,w=null,g=!1,v,b,E,M;function B(V){V instanceof Error||(V=Jo(V)),w=V,a(V,p)}function A(V){s&&(V instanceof Error||(V=Jo(V)),s(V,p))}this.on=function(V,G){if(typeof G!="function")throw Jo("required args <name, cb>");switch(V){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":o=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":r=G;break;case"attention":u=G;break;case"question":l=G;break;case"comment":c=G;break;default:throw Jo("unsupported event: "+V)}return this},this.ns=function(V){if(typeof V>"u"&&(V={}),typeof V!="object")throw Jo("required args <nsMap={}>");var G=Object.create(null),ie;for(ie in V)G[ie]=V[ie];return m=!0,M=G,this};function L(){v=m?[]:null,b=m?TM(M):null,E=[],p=el,g=!1,w=null,f=!1,y=""}this.parse=function(V){if(typeof V!="string")throw Jo("required args <xml=string>");if(d)throw Jo("parse during stream; call end() first");return L(),H(V),p=el,g=!1,w},this.write=function(V){if(typeof V!="string")throw Jo("required args <xml=string>");return d||(L(),d=!0),w||(y=H(y+V,!0)||""),this},this.end=function(){return d||L(),d=!1,w||H(y),y="",p=el,g=!1,w},this.stop=function(){g=!0};function H(V,G=!1){var ie=null,pe=null,q,Pe=0,Te=!1,ke=!1,ve=0,U=0,de,z,Q,he,se,Ae,j,C,R,Z="",ne=0,ge;function $e(bt,qt){var Kt=bt.indexOf(":");if(Kt===-1)return bt;var Dn=b[bt.substring(0,Kt)];return Dn?qt===Dn?bt.substr(Kt+1):Dn+bt.substr(Kt):(A(AM(bt.substring(0,Kt))),null)}function rt(){if(ge!==null)return ge;var bt,qt,Kt=m&&b.xmlns,Dn=m&&h?[]:null,Bt=ne,an=Z,zn=an.length,pa,ii,Ln,In,un,bo={},Fi=new Set,mi,St,Pt;e:for(;Bt<zn;Bt++)if(mi=!1,St=an.charCodeAt(Bt),!(St===32||St<14&&St>8)){for((St<65||St>122||St>90&&St<97)&&St!==95&&St!==58&&(A("illegal first char attribute name"),mi=!0),Pt=Bt+1;Pt<zn;Pt++)if(St=an.charCodeAt(Pt),!(St>96&&St<123||St>64&&St<91||St>47&&St<59||St===46||St===45||St===95)){if(St===32||St<14&&St>8){A("missing attribute value"),Bt=Pt;continue e}if(St===61)break;A("illegal attribute name char"),mi=!0}if(un=an.substring(Bt,Pt),un==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),mi=!0),St=an.charCodeAt(Pt+1),St===34)Pt=an.indexOf('"',Bt=Pt+2),Pt===-1&&(Pt=an.indexOf("'",Bt),Pt!==-1&&(A("attribute value quote missmatch"),mi=!0));else if(St===39)Pt=an.indexOf("'",Bt=Pt+2),Pt===-1&&(Pt=an.indexOf('"',Bt),Pt!==-1&&(A("attribute value quote missmatch"),mi=!0));else for(A("missing attribute value quotes"),mi=!0,Pt=Pt+1;Pt<zn&&(St=an.charCodeAt(Pt+1),!(St===32||St<14&&St>8));Pt++);for(Pt===-1&&(A("missing closing quotes"),Pt=zn,mi=!0),mi||(Ln=an.substring(Bt,Pt)),Bt=Pt;Pt+1<zn&&(St=an.charCodeAt(Pt+1),!(St===32||St<14&&St>8));Pt++)Bt===Pt&&(A("illegal character after attribute end"),mi=!0);if(Bt=Pt+1,mi)continue e;if(Fi.has(un)){A("attribute <"+un+"> already defined");continue}if(Fi.add(un),!m){bo[un]=Ln;continue}if(h){if(ii=un==="xmlns"?"xmlns":un.charCodeAt(0)===120&&un.substr(0,6)==="xmlns:"?un.substr(6):null,ii!==null){if(bt=Gr(Ln),qt=sd(ii),In=M[bt],!In){if(ii==="xmlns"||qt in b&&b[qt]!==bt)do In="ns"+Pe++;while(typeof b[In]<"u");else In=ii;M[bt]=In}b[ii]!==In&&(pa||(b=PM(b),pa=!0),b[ii]=In,ii==="xmlns"&&(b[sd(In)]=bt,Kt=In),b[qt]=bt),bo[un]=Ln;continue}Dn.push(un,Ln);continue}un=$e(un,Kt),un!==null&&(bo[un]=Ln)}if(h)for(Bt=0,zn=Dn.length;Bt<zn;Bt++)un=$e(Dn[Bt++],Kt),Ln=Dn[Bt],un!==null&&(bo[un]=Ln);return ge=bo}function ut(){for(var bt=/(\r\n|\r|\n)/g,qt=0,Kt=0,Dn=0,Bt=U,an,zn;ve>=Dn&&(an=bt.exec(V),!(!an||(Bt=an[0].length+an.index,Bt>ve)));)qt+=1,Dn=Bt;return ve==-1?(Kt=Bt,zn=V.substring(U)):U===0?zn=V.substring(U,ve):(Kt=ve-Dn,zn=U==-1?V.substring(ve):V.substring(ve,U+1)),{data:zn,line:qt,column:Kt}}for(p=ut,t&&(R=Object.create({},{name:Qc(function(){return j}),originalName:Qc(function(){return C}),attrs:Qc(rt),ns:Qc(function(){return b})}));U!==-1;){if(V.charCodeAt(U)===60?ve=U:ve=V.indexOf("<",U),ve===-1){if(G)return V.substring(U);if(E.length)return B("unexpected end of file");if(!f)return B("missing start tag");U<V.length&&V.substring(U).trim()&&A(Vm);return}if(f||(f=!0),U!==ve){if(E.length){if(n&&(n(V.substring(U,ve),Gr,p),g))return}else if(V.substring(U,ve).trim()&&(A(Vm),g))return}if(he=V.charCodeAt(ve+1),he===33){if(Q=V.charCodeAt(ve+2),Q===91&&V.substr(ve+3,6)==="CDATA["){if(U=V.indexOf("]]>",ve),U===-1)return G?V.substring(ve):B("unclosed cdata");if(r&&(r(V.substring(ve+9,U),p),g))return;U+=3;continue}if(Q===45&&V.charCodeAt(ve+3)===45){if(U=V.indexOf("-->",ve),U===-1)return G?V.substring(ve):B("unclosed comment");if(c&&(c(V.substring(ve+4,U),Gr,p),g))return;U+=3;continue}}if(he===63){if(U=V.indexOf("?>",ve),U===-1)return G?V.substring(ve):B("unclosed question");if(l&&(l(V.substring(ve,U+2),p),g))return;U+=2;continue}for(de=ve+1;;de++){if(se=V.charCodeAt(de),isNaN(se))return G?V.substring(ve):(U=-1,B("unclosed tag"));if(se===34)Q=V.indexOf('"',de+1),de=Q!==-1?Q:de;else if(se===39)Q=V.indexOf("'",de+1),de=Q!==-1?Q:de;else if(se===62){U=de;break}}if(he===33){if(u&&(u(V.substring(ve,U+1),Gr,p),g))return;U+=1;continue}if(ge={},he===47){if(Te=!1,ke=!0,!E.length)return B("missing open tag");if(de=j=E.pop(),Q=ve+2+de.length,V.substring(ve+2,Q)!==de)return B("closing tag mismatch");for(;Q<U;Q++)if(he=V.charCodeAt(Q),!(he===32||he>8&&he<14))return B("close tag")}else{if(V.charCodeAt(U-1)===47?(de=j=V.substring(ve+1,U-1),Te=!0,ke=!0):(de=j=V.substring(ve+1,U),Te=!0,ke=!1),!(he>96&&he<123||he>64&&he<91||he===95||he===58))return B("illegal first char nodeName");for(Q=1,z=de.length;Q<z;Q++)if(he=de.charCodeAt(Q),!(he>96&&he<123||he>64&&he<91||he>47&&he<59||he===45||he===95||he==46)){if(he===32||he<14&&he>8){j=de.substring(0,Q),ge=null;break}return B("invalid nodeName")}ke||E.push(j)}if(m){q=b,Te&&(ke||v.push(q),ge===null&&(h=de.indexOf("xmlns",Q)!==-1)&&(ne=Q,Z=de,rt(),h=!1)),C=j,pe!==b&&(ie=b[Wm],ie===void 0&&(ie=b[Wm]=Object.create(null)),pe=b);var ln=ie[j];if(ln!==void 0)j=ln;else{if(he=j.indexOf(":"),he!==-1){if(Ae=b[j.substring(0,he)],!Ae)return B("missing namespace on <"+C+">");j=j.substr(he+1)}else Ae=b.xmlns;Ae&&(j=Ae+":"+j),ie[C]=j}}if(Te&&(ne=Q,Z=de,i&&(t?i(R,Gr,ke,p):i(j,rt,Gr,ke,p),g)))return;if(ke){if(o&&(o(t?R:j,Gr,Te,p),g))return;m&&(Te?b=q:b=v.pop())}U+=1}}}function qm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var cd={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Ym="property";function Km(e){return e.xml&&e.xml.serialize}function OM(e){const t=Km(e);return t!==Ym&&(t||null)}function DM(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xm(e,t){return qm(t)?e.prefix+":"+DM(e.localName):e.name}function LM(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 IM(e,t,n){const i=Un(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=Un(o);var a=n.getPackage(r.prefix);return LM(r,a)}function Qo(e){return new Error(e)}function Co(e){return e.$descriptor}function BM(e){te(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=Co(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw Qo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ws(){}ws.prototype.handleEnd=function(){},ws.prototype.handleText=function(){},ws.prototype.handleNode=function(){};function ld(){}ld.prototype=Object.create(ws.prototype),ld.prototype.handleNode=function(){return this};function _a(){}_a.prototype=Object.create(ws.prototype),_a.prototype.handleText=function(e){this.body=(this.body||"")+e};function _s(e,t){this.property=e,this.context=t}_s.prototype=Object.create(_a.prototype),_s.prototype.handleNode=function(e){if(this.element)throw Qo("expected no sub nodes");return this.element=this.createReference(e),this},_s.prototype.handleEnd=function(){this.element.id=this.body},_s.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function ud(e,t){this.element=t,this.propertyDesc=e}ud.prototype=Object.create(_a.prototype),ud.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=od(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function tl(){}tl.prototype=Object.create(_a.prototype),tl.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 Xn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Xn.prototype=Object.create(tl.prototype),Xn.prototype.addReference=function(e){this.context.addReference(e)},Xn.prototype.handleText=function(e){var t=this.element,n=Co(t),i=n.bodyProperty;if(!i)throw Qo("unexpected body text <"+e+">");_a.prototype.handleText.call(this,e)},Xn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Co(t),i=n.bodyProperty;i&&e!==void 0&&(e=od(i.type,e),t.set(i.name,e))},Xn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Co(n),o=this.context,r=new n({}),a=this.model,s;return K(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),K(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=od(u.type,c):l==="xmlns"?l=":"+l:(s=Un(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},Xn.prototype.getPropertyForNode=function(e){var t=e.name,n=Un(t),i=this.type,o=this.model,r=Co(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=OM(s);if(l){const u=e.attributes[l];if(u){const p=IM(u,e.ns,o),d=o.getType(p);return te({},s,{effectiveType:Co(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Xm(n,c),u=o.getType(l);if(s=Ht(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return te({},s,{effectiveType:Co(u).name})}else if(s=Ht(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Qo("unrecognized element <"+n.name+">")},Xn.prototype.toString=function(){return"ElementDescriptor["+Co(this.type).name+"]"},Xn.prototype.valueHandler=function(e,t){return new ud(e,t)},Xn.prototype.referenceHandler=function(e){return new _s(e,this.context)},Xn.prototype.handler=function(e){return e==="Element"?new Ea(this.model,e,this.context):new Xn(this.model,e,this.context)},Xn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,jm(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?(te(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function pd(e,t,n){Xn.call(this,e,t,n)}pd.prototype=Object.create(Xn.prototype),pd.prototype.createElement=function(e){var t=e.name,n=Un(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Xm(n,r)||t;if(!o.hasType(a))throw Qo("unexpected element <"+e.originalName+">");return Xn.prototype.createElement.call(this,e)};function Ea(e,t,n){this.model=e,this.context=n}Ea.prototype=Object.create(tl.prototype),Ea.prototype.createElement=function(e){var t=e.name,n=Un(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},Ea.prototype.handleChild=function(e){var t=new Ea(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},Ea.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function dd(e){e instanceof Ei&&(e={model:e}),te(this,{lax:!1},e)}dd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Xn?(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 BM(te({},t,{rootHandler:i})),s=new Um({proxy:!0}),c=NM();i.context=a,c.push(i);function l(E,M,B){var A=M(),L=A.line,H=A.column,V=A.data;V.charAt(0)==="<"&&V.indexOf(" ")!==-1&&(V=V.slice(0,V.indexOf(" "))+">");var G="unparsable content "+(V?V+" ":"")+`detected
1
+ (function(le,Ce){typeof exports=="object"&&typeof module<"u"?Ce(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ce):(le=typeof globalThis<"u"?globalThis:le||self,Ce(le.BpmnModeler={},le.Vue))})(this,(function(le,Ce){"use strict";var Yj=Object.defineProperty;var Kj=(le,Ce,$r)=>Ce in le?Yj(le,Ce,{enumerable:!0,configurable:!0,writable:!0,value:$r}):le[Ce]=$r;var on=(le,Ce,$r)=>Kj(le,typeof Ce!="symbol"?Ce+"":Ce,$r);const $r=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Wc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Rm(e){return $r.includes(e)}function Mm(e){return Wc.includes(e)}const Uc=["timer"],qc={timer:"bpmn:TimerEventDefinition"};function Cm(e){return typeof e=="string"&&Uc.includes(e)}function zp(e){if(e.length===1)return Uc.find(t=>qc[t]===e[0])}const Yc=["ko","en","ja","zh"];function qR(e){return typeof e=="string"&&Yc.includes(e)}const Am="http://g1project.net/spec/bpmn/bwl/1.0",Vp="bwl",Wp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Kc="bwl:ReviewRequest",Tm={name:"bwl-hints",uri:Am,prefix:Vp,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"}]}]},Up="bwl.undoEpisode",Pm=new WeakSet;function YR(e){Pm.has(e)||(e.register(Up,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Pm.add(e))}function km(e,t){YR(e);const n={run:t};if(e.execute(Up,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Om(e){return e._stackIdx+1}function Dm(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 qp(e){return Array.prototype.concat.apply([],e)}const vs=Object.prototype.toString,KR=Object.prototype.hasOwnProperty;function Fr(e){return e===void 0}function En(e){return e!==void 0}function va(e){return e==null}function et(e){return vs.call(e)==="[object Array]"}function Sn(e){return vs.call(e)==="[object Object]"}function tt(e){return vs.call(e)==="[object Number]"}function An(e){const t=vs.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ri(e){return vs.call(e)==="[object String]"}function XR(e){if(!et(e))throw new Error("must supply array")}function ai(e,t){return!va(e)&&KR.call(e,t)}function Ht(e,t){const n=Zc(t);let i;return K(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Lm(e,t){const n=Zc(t);let i=et(e)?-1:void 0;return K(e,function(o,r){if(n(o,r))return i=r,!1}),i}function gt(e,t){const n=Zc(t);let i=[];return K(e,function(o,r){n(o,r)&&i.push(o)}),i}function K(e,t){let n,i;if(Fr(e))return;const o=et(e)?tM:eM;for(let r in e)if(ai(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function ZR(e,t){if(Fr(e))return[];XR(e);const n=Zc(t);return e.filter(function(i,o){return!n(i,o)})}function si(e,t,n){return K(e,function(i,o){n=t(n,i,o)}),n}function Ko(e,t){return!!si(e,function(n,i,o){return n&&t(i,o)},!0)}function Xo(e,t){return!!Ht(e,t)}function Wn(e,t){let n=[];return K(e,function(i,o){n.push(t(i,o))}),n}function Xc(e){return e&&Object.keys(e)||[]}function JR(e){return Xc(e).length}function xa(e){return Wn(e,t=>t)}function ba(e,t,n={}){return t=Yp(t),K(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Im(e,...t){e=Yp(e);let n={};return K(t,o=>ba(o,e,n)),Wn(n,function(o,r){return o[0]})}const QR=Im;function no(e,t){t=Yp(t);let n=[];return K(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)}),Wn(n,i=>i.v)}function wa(e){return function(t){return Ko(e,function(n,i){return t[i]===n})}}function Yp(e){return An(e)?e:t=>t[e]}function Zc(e){return An(e)?e:t=>t===e}function eM(e){return e}function tM(e){return Number(e)}function Kp(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 ei(e,t){return e.bind(t)}function te(e,...t){return Object.assign(e,...t)}function nM(e,t,n){let i=e;return K(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];En(a)&&va(s)&&(s=i[o]=isNaN(+a)?{}:[]),Fr(a)?Fr(n)?delete i[o]:i[o]=n:i=s}),e}function Vi(e,t){let n={},i=Object(e);return K(t,function(o){o in i&&(n[o]=e[o])}),n}function io(e,t){let n={},i=Object(e);return K(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function T(e,t){var n=Ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ht(e,t){return Xo(t,function(n){return T(e,n)})}function Ee(e){return e&&e.businessObject||e}function wt(e){return e&&e.di}const iM="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Bm="i18n",jr="i18n:Translation";function Zo(e){if(e){if(T(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(T(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(T(e,"bpmn:FlowElement")||T(e,"bpmn:Participant")||T(e,"bpmn:Lane")||T(e,"bpmn:MessageFlow")||T(e,"bpmn:DataInput")||T(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Wi(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,jr)})}function ln(e){return e.get("xml:lang")}function Jo(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,Kc)})}function xs(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Xp(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}const oM=/^[\t\n\r\x20-\x7E]+$/;function bs(e,t,n,i){if(!e)return[];const o=t.filter(a=>(a.body??"")===e).map(ln),r=o.length?o:[i??n];return!r.includes(n)&&oM.test(e)&&!t.some(a=>ln(a)===n&&a.body)?[...r,n]:r}function Zp(e,t,n){const i=Zo(e);if(!i)return{};const o=i.target[i.key]??"",r=Wi(e).filter(l=>ln(l)),a=l=>l.body??"",s=bs(o,r,t.designLocale,n),c={};for(const l of xs(t)){if(s.includes(l)){c[l]=o;continue}const u=r.find(p=>ln(p)===l&&a(p));u&&(c[l]=a(u))}return c}const Jc="bwl.updateTranslation";class Jp{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=Zo(c),u=[];t.undo=u;const p=Wi(c).filter(A=>ln(A)),d=s??(l?l.target[l.key]??"":""),f=a??o,y=bs(d,p,o,a),h=s!==void 0&&d&&!y.includes(t.locale)?y[0]:t.locale,m=A=>{var L;return((L=p.find(H=>ln(H)===A&&H.body))==null?void 0:L.body)??(y.includes(A)?d:"")},w=A=>Jo(c).some(L=>L.locale===A),g=m(h);if(g===i)return[];const v=!!g&&!w(h),b=v?r.filter(A=>A!==h&&m(A)&&!w(A)):[],E=()=>{let A=c.extensionElements;return A||(A=this.moddle.create("bpmn:ExtensionElements",{values:[]}),A.$parent=c,c.extensionElements=A,u.push(()=>delete c.extensionElements)),A.get("values")},M=(A,L)=>{const H=E();let V=H.find(G=>{var ie;return((ie=G.$instanceOf)==null?void 0:ie.call(G,jr))&&ln(G)===A});if(V){const G=V.body;V.body=L,u.push(()=>V.body=G)}else V=this.moddle.create(jr,{body:L}),V.set("xml:lang",A),V.$parent=c.extensionElements,H.push(V),u.push(()=>H.splice(H.indexOf(V),1))},B=A=>{const L=E(),H=L.indexOf(A);L.splice(H,1),u.push(()=>L.splice(H,0,A))};if(s===void 0){if(h===o&&l){if(d&&!p.some(L=>L.body===d)){const L=a&&a!==o?a:void 0;L&&M(L,d)}const A=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{A?l.target[l.key]=d:delete l.target[l.key]})}M(h,i)}else(p.some(A=>ln(A)===h)||!d&&h!==f)&&M(h,i);if(!v)for(const A of Jo(c).filter(L=>L.locale===h))B(A);for(const A of b){const L=E(),H=this.moddle.create(Kc,{locale:A,sourceLocale:h,previous:g});H.$parent=c.extensionElements,L.push(H),u.push(()=>L.splice(L.indexOf(H),1))}for(const A of Jo(c).filter(L=>L.sourceLocale===h&&(L.previous??"")===i))B(A);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):[]}}on(Jp,"$inject",["moddle"]);const Qc="bwl.setTranslations",rM=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Qp{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,!Zo(l))return[];const p=()=>{let w=l.extensionElements;return w||(w=this.moddle.create("bpmn:ExtensionElements",{values:[]}),w.$parent=l,l.extensionElements=w,u.push(()=>delete l.extensionElements)),w.get("values")},d=w=>{const g=p(),v=g.indexOf(w);v<0||(g.splice(v,1),u.push(()=>g.splice(v,0,w)))},f=w=>Wi(l).find(g=>ln(g)===w);if(i===null)for(const w of a){const g=f(w);g&&d(g)}else if(i)for(const w of a){const g=i[w];if(g===void 0)continue;const v=f(w);if(v){if(v.body===g)continue;const M=v.body;v.body=g,u.push(()=>v.body=M);continue}if(w===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(jr,{body:g});E.set("xml:lang",w),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(w=>!o.includes(w.locale)&&!(i&&i[w.locale]!==void 0&&i[w.locale]!==c.texts[w.locale])&&!(i&&w.sourceLocale&&i[w.sourceLocale]===w.previous))];for(const w of Jo(l)){const g=h.findIndex(v=>rM(w,v));g>=0?h.splice(g,1):d(w)}for(const w of h){const g=p(),v=this.moddle.create(Kc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});v.$parent=l.extensionElements,g.push(v),u.push(()=>g.splice(g.indexOf(v),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),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):[]}}on(Qp,"$inject",["moddle"]);function ed(e){return Jo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class td{constructor(t){t.registerHandler(Jc,Jp),t.registerHandler(Qc,Qp)}}on(td,"$inject",["commandStack"]);const nd={__init__:["translationCommands"],translationCommands:["type",td]},Nm=["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"],aM={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},sM={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Yc.map(e=>[e,{type:"string"}])),additionalProperties:!1},cM={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},lM={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},uM={type:"string",enum:[...Uc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},pM={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Wc]},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},dM={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},fM={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},hM={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},gM={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},mM={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},yM={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},vM={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},xM={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},bM={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Wp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const wM={"participant.add":Nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Nn("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":Nn("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":Nn("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:[...Wc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Nn("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":Nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Nn("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":Nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Nn("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":Nn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Yc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},$m={anyOf:Nm.map(e=>wM[e])},_M={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:cM,irParticipant:lM,irNode:pM,irFlowCondition:dM,irSequenceFlow:fM,irMessageFlow:hM,irDataStore:gM,irDataAssociation:mM,irTextAnnotation:yM,irAssociation:vM,irGroup:xM,bwlPlacement:bM,eventDefinition:uM,localeTexts:sM,nullableString:aM,symbolicOp:$m}};function id(){}id.prototype.get=function(e){return this.$model.properties.get(this,e)},id.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Fm(e,t){this.model=e,this.properties=t}Fm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(id.prototype);K(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var 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}),K(a,ei(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=te(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),jm=te(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 od(e,t){var n=jm[e];return n?n(t):t}function rd(e){return!!EM[e]}function Hm(e){return!!jm[e]}function Un(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 xi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}xi.prototype.build=function(){return Vi(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},xi.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)},xi.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},xi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=Un(o[0],i),a=Un(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},xi.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},xi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},xi.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},xi.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},xi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},xi.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")},xi.prototype.hasProperty=function(e){return this.propertiesByName[e]},xi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(K(e.properties,ei(function(r){r=te({},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 Qo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,K(e,ei(this.registerPackage,this))}Qo.prototype.getPackage=function(e){return this.packageMap[e]},Qo.prototype.getPackages=function(){return this.packages},Qo.prototype.registerPackage=function(e){e=te({},e);var t=this.packageMap;Gm(t,e,"prefix"),Gm(t,e,"uri"),K(e.types,ei(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Qo.prototype.registerType=function(e,t){e=te({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:te({},e.meta||{})});var n=Un(e.name,t.prefix),i=n.name,o=Object.create(null);K(e.properties,ei(function(r){var a=Un(r.name,n.prefix),s=a.name;rd(r.type)||(r.type=Un(r.type,a.prefix).name),te(r,{ns:a,name:s}),o[s]=r},this)),te(e,{ns:n,name:i,propertiesByName:o}),K(e.extends,ei(function(r){var a=Un(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},Qo.prototype.mapTypes=function(e,t,n){var i=rd(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=Un(c,rd(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+">");K(i.superClass,n?a:s),t(i,!n),K(i.traits,a)},Qo.prototype.getEffectiveDescriptor=function(e){var t=Un(e),n=new xi(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},Qo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Gm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Hr(e){this.model=e}Hr.prototype.set=function(e,t,n){if(!ri(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;SM(n)?i?delete e[o]:delete e.$attrs[ad(t)]:i?o in e?e[o]=n:zm(e,i,n):e.$attrs[ad(t)]=n},Hr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ad(t)];var i=n.name;return!e[i]&&n.isMany&&zm(e,n,[]),e[i]},Hr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=te({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Hr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Hr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Hr.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 SM(e){return typeof e>"u"}function zm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function ad(e){return e.replace(/^:/,"")}function Ei(e,t={}){this.properties=new Hr(this),this.factory=new Fm(this,this.properties),this.registry=new Qo(e,this.properties),this.typeCache=Object.create(null),this.config=t}Ei.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Ei.prototype.getType=function(e){var t=this.typeCache,n=ri(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Ei.prototype.createAny=function(e,t,n){var i=Un(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){nM(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}),K(n,function(a,s){Sn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},Ei.prototype.getPackage=function(e){return this.registry.getPackage(e)},Ei.prototype.getPackages=function(){return this.registry.getPackages()},Ei.prototype.getElementDescriptor=function(e){return e.$descriptor},Ei.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Ei.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Ei.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Vm=String.fromCharCode,RM=Object.prototype.hasOwnProperty,MM=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ws={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ws).forEach(function(e){ws[e.toUpperCase()]=ws[e]});function CM(e,t,n,i){return i?RM.call(ws,i)?ws[i]:"&"+i+";":Vm(t||parseInt(n,16))}function Gr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(MM,CM):e}var Wm="non-whitespace outside of root node";function er(e){return new Error(e)}function AM(e){return"missing namespace for prefix <"+e+">"}function el(e){return{get:e,enumerable:!0}}function TM(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Um=Symbol("nameCache");function sd(e){return e+"$uri"}function PM(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[sd(i)]=n;return t}function tl(){return{line:0,column:0}}function kM(e){throw e}function qm(e){if(!this)return new qm(e);var t=e&&e.proxy,n,i,o,r,a=kM,s,c,l,u,p=tl,d=!1,f=!1,y="",h=!1,m=!1,w=null,g=!1,v,b,E,M;function B(V){V instanceof Error||(V=er(V)),w=V,a(V,p)}function A(V){s&&(V instanceof Error||(V=er(V)),s(V,p))}this.on=function(V,G){if(typeof G!="function")throw er("required args <name, cb>");switch(V){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":o=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":r=G;break;case"attention":u=G;break;case"question":l=G;break;case"comment":c=G;break;default:throw er("unsupported event: "+V)}return this},this.ns=function(V){if(typeof V>"u"&&(V={}),typeof V!="object")throw er("required args <nsMap={}>");var G=Object.create(null),ie;for(ie in V)G[ie]=V[ie];return m=!0,M=G,this};function L(){v=m?[]:null,b=m?PM(M):null,E=[],p=tl,g=!1,w=null,f=!1,y=""}this.parse=function(V){if(typeof V!="string")throw er("required args <xml=string>");if(d)throw er("parse during stream; call end() first");return L(),H(V),p=tl,g=!1,w},this.write=function(V){if(typeof V!="string")throw er("required args <xml=string>");return d||(L(),d=!0),w||(y=H(y+V,!0)||""),this},this.end=function(){return d||L(),d=!1,w||H(y),y="",p=tl,g=!1,w},this.stop=function(){g=!0};function H(V,G=!1){var ie=null,pe=null,q,Te=0,Pe=!1,ke=!1,ve=0,U=0,de,z,Q,he,se,Ae,j,C,R,Z="",ne=0,ge;function $e(bt,qt){var Kt=bt.indexOf(":");if(Kt===-1)return bt;var Ln=b[bt.substring(0,Kt)];return Ln?qt===Ln?bt.substr(Kt+1):Ln+bt.substr(Kt):(A(AM(bt.substring(0,Kt))),null)}function rt(){if(ge!==null)return ge;var bt,qt,Kt=m&&b.xmlns,Ln=m&&h?[]:null,Bt=ne,sn=Z,zn=sn.length,pa,oi,In,Bn,dn,_o={},Fi=new Set,mi,St,Tt;e:for(;Bt<zn;Bt++)if(mi=!1,St=sn.charCodeAt(Bt),!(St===32||St<14&&St>8)){for((St<65||St>122||St>90&&St<97)&&St!==95&&St!==58&&(A("illegal first char attribute name"),mi=!0),Tt=Bt+1;Tt<zn;Tt++)if(St=sn.charCodeAt(Tt),!(St>96&&St<123||St>64&&St<91||St>47&&St<59||St===46||St===45||St===95)){if(St===32||St<14&&St>8){A("missing attribute value"),Bt=Tt;continue e}if(St===61)break;A("illegal attribute name char"),mi=!0}if(dn=sn.substring(Bt,Tt),dn==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),mi=!0),St=sn.charCodeAt(Tt+1),St===34)Tt=sn.indexOf('"',Bt=Tt+2),Tt===-1&&(Tt=sn.indexOf("'",Bt),Tt!==-1&&(A("attribute value quote missmatch"),mi=!0));else if(St===39)Tt=sn.indexOf("'",Bt=Tt+2),Tt===-1&&(Tt=sn.indexOf('"',Bt),Tt!==-1&&(A("attribute value quote missmatch"),mi=!0));else for(A("missing attribute value quotes"),mi=!0,Tt=Tt+1;Tt<zn&&(St=sn.charCodeAt(Tt+1),!(St===32||St<14&&St>8));Tt++);for(Tt===-1&&(A("missing closing quotes"),Tt=zn,mi=!0),mi||(In=sn.substring(Bt,Tt)),Bt=Tt;Tt+1<zn&&(St=sn.charCodeAt(Tt+1),!(St===32||St<14&&St>8));Tt++)Bt===Tt&&(A("illegal character after attribute end"),mi=!0);if(Bt=Tt+1,mi)continue e;if(Fi.has(dn)){A("attribute <"+dn+"> already defined");continue}if(Fi.add(dn),!m){_o[dn]=In;continue}if(h){if(oi=dn==="xmlns"?"xmlns":dn.charCodeAt(0)===120&&dn.substr(0,6)==="xmlns:"?dn.substr(6):null,oi!==null){if(bt=Gr(In),qt=sd(oi),Bn=M[bt],!Bn){if(oi==="xmlns"||qt in b&&b[qt]!==bt)do Bn="ns"+Te++;while(typeof b[Bn]<"u");else Bn=oi;M[bt]=Bn}b[oi]!==Bn&&(pa||(b=TM(b),pa=!0),b[oi]=Bn,oi==="xmlns"&&(b[sd(Bn)]=bt,Kt=Bn),b[qt]=bt),_o[dn]=In;continue}Ln.push(dn,In);continue}dn=$e(dn,Kt),dn!==null&&(_o[dn]=In)}if(h)for(Bt=0,zn=Ln.length;Bt<zn;Bt++)dn=$e(Ln[Bt++],Kt),In=Ln[Bt],dn!==null&&(_o[dn]=In);return ge=_o}function ut(){for(var bt=/(\r\n|\r|\n)/g,qt=0,Kt=0,Ln=0,Bt=U,sn,zn;ve>=Ln&&(sn=bt.exec(V),!(!sn||(Bt=sn[0].length+sn.index,Bt>ve)));)qt+=1,Ln=Bt;return ve==-1?(Kt=Bt,zn=V.substring(U)):U===0?zn=V.substring(U,ve):(Kt=ve-Ln,zn=U==-1?V.substring(ve):V.substring(ve,U+1)),{data:zn,line:qt,column:Kt}}for(p=ut,t&&(R=Object.create({},{name:el(function(){return j}),originalName:el(function(){return C}),attrs:el(rt),ns:el(function(){return b})}));U!==-1;){if(V.charCodeAt(U)===60?ve=U:ve=V.indexOf("<",U),ve===-1){if(G)return V.substring(U);if(E.length)return B("unexpected end of file");if(!f)return B("missing start tag");U<V.length&&V.substring(U).trim()&&A(Wm);return}if(f||(f=!0),U!==ve){if(E.length){if(n&&(n(V.substring(U,ve),Gr,p),g))return}else if(V.substring(U,ve).trim()&&(A(Wm),g))return}if(he=V.charCodeAt(ve+1),he===33){if(Q=V.charCodeAt(ve+2),Q===91&&V.substr(ve+3,6)==="CDATA["){if(U=V.indexOf("]]>",ve),U===-1)return G?V.substring(ve):B("unclosed cdata");if(r&&(r(V.substring(ve+9,U),p),g))return;U+=3;continue}if(Q===45&&V.charCodeAt(ve+3)===45){if(U=V.indexOf("-->",ve),U===-1)return G?V.substring(ve):B("unclosed comment");if(c&&(c(V.substring(ve+4,U),Gr,p),g))return;U+=3;continue}}if(he===63){if(U=V.indexOf("?>",ve),U===-1)return G?V.substring(ve):B("unclosed question");if(l&&(l(V.substring(ve,U+2),p),g))return;U+=2;continue}for(de=ve+1;;de++){if(se=V.charCodeAt(de),isNaN(se))return G?V.substring(ve):(U=-1,B("unclosed tag"));if(se===34)Q=V.indexOf('"',de+1),de=Q!==-1?Q:de;else if(se===39)Q=V.indexOf("'",de+1),de=Q!==-1?Q:de;else if(se===62){U=de;break}}if(he===33){if(u&&(u(V.substring(ve,U+1),Gr,p),g))return;U+=1;continue}if(ge={},he===47){if(Pe=!1,ke=!0,!E.length)return B("missing open tag");if(de=j=E.pop(),Q=ve+2+de.length,V.substring(ve+2,Q)!==de)return B("closing tag mismatch");for(;Q<U;Q++)if(he=V.charCodeAt(Q),!(he===32||he>8&&he<14))return B("close tag")}else{if(V.charCodeAt(U-1)===47?(de=j=V.substring(ve+1,U-1),Pe=!0,ke=!0):(de=j=V.substring(ve+1,U),Pe=!0,ke=!1),!(he>96&&he<123||he>64&&he<91||he===95||he===58))return B("illegal first char nodeName");for(Q=1,z=de.length;Q<z;Q++)if(he=de.charCodeAt(Q),!(he>96&&he<123||he>64&&he<91||he>47&&he<59||he===45||he===95||he==46)){if(he===32||he<14&&he>8){j=de.substring(0,Q),ge=null;break}return B("invalid nodeName")}ke||E.push(j)}if(m){q=b,Pe&&(ke||v.push(q),ge===null&&(h=de.indexOf("xmlns",Q)!==-1)&&(ne=Q,Z=de,rt(),h=!1)),C=j,pe!==b&&(ie=b[Um],ie===void 0&&(ie=b[Um]=Object.create(null)),pe=b);var pn=ie[j];if(pn!==void 0)j=pn;else{if(he=j.indexOf(":"),he!==-1){if(Ae=b[j.substring(0,he)],!Ae)return B("missing namespace on <"+C+">");j=j.substr(he+1)}else Ae=b.xmlns;Ae&&(j=Ae+":"+j),ie[C]=j}}if(Pe&&(ne=Q,Z=de,i&&(t?i(R,Gr,ke,p):i(j,rt,Gr,ke,p),g)))return;if(ke){if(o&&(o(t?R:j,Gr,Pe,p),g))return;m&&(Pe?b=q:b=v.pop())}U+=1}}}function Ym(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var cd={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Km="property";function Xm(e){return e.xml&&e.xml.serialize}function OM(e){const t=Xm(e);return t!==Km&&(t||null)}function DM(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Zm(e,t){return Ym(t)?e.prefix+":"+DM(e.localName):e.name}function LM(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 IM(e,t,n){const i=Un(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=Un(o);var a=n.getPackage(r.prefix);return LM(r,a)}function tr(e){return new Error(e)}function To(e){return e.$descriptor}function BM(e){te(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw tr("expected element");var n=this.elementsById,i=To(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 tr("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function _s(){}_s.prototype.handleEnd=function(){},_s.prototype.handleText=function(){},_s.prototype.handleNode=function(){};function ld(){}ld.prototype=Object.create(_s.prototype),ld.prototype.handleNode=function(){return this};function _a(){}_a.prototype=Object.create(_s.prototype),_a.prototype.handleText=function(e){this.body=(this.body||"")+e};function Es(e,t){this.property=e,this.context=t}Es.prototype=Object.create(_a.prototype),Es.prototype.handleNode=function(e){if(this.element)throw tr("expected no sub nodes");return this.element=this.createReference(e),this},Es.prototype.handleEnd=function(){this.element.id=this.body},Es.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function ud(e,t){this.element=t,this.propertyDesc=e}ud.prototype=Object.create(_a.prototype),ud.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=od(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function nl(){}nl.prototype=Object.create(_a.prototype),nl.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 Xn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Xn.prototype=Object.create(nl.prototype),Xn.prototype.addReference=function(e){this.context.addReference(e)},Xn.prototype.handleText=function(e){var t=this.element,n=To(t),i=n.bodyProperty;if(!i)throw tr("unexpected body text <"+e+">");_a.prototype.handleText.call(this,e)},Xn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=To(t),i=n.bodyProperty;i&&e!==void 0&&(e=od(i.type,e),t.set(i.name,e))},Xn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=To(n),o=this.context,r=new n({}),a=this.model,s;return K(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),K(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=od(u.type,c):l==="xmlns"?l=":"+l:(s=Un(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},Xn.prototype.getPropertyForNode=function(e){var t=e.name,n=Un(t),i=this.type,o=this.model,r=To(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=OM(s);if(l){const u=e.attributes[l];if(u){const p=IM(u,e.ns,o),d=o.getType(p);return te({},s,{effectiveType:To(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Zm(n,c),u=o.getType(l);if(s=Ht(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return te({},s,{effectiveType:To(u).name})}else if(s=Ht(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw tr("unrecognized element <"+n.name+">")},Xn.prototype.toString=function(){return"ElementDescriptor["+To(this.type).name+"]"},Xn.prototype.valueHandler=function(e,t){return new ud(e,t)},Xn.prototype.referenceHandler=function(e){return new Es(e,this.context)},Xn.prototype.handler=function(e){return e==="Element"?new Ea(this.model,e,this.context):new Xn(this.model,e,this.context)},Xn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Hm(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?(te(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function pd(e,t,n){Xn.call(this,e,t,n)}pd.prototype=Object.create(Xn.prototype),pd.prototype.createElement=function(e){var t=e.name,n=Un(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Zm(n,r)||t;if(!o.hasType(a))throw tr("unexpected element <"+e.originalName+">");return Xn.prototype.createElement.call(this,e)};function Ea(e,t,n){this.model=e,this.context=n}Ea.prototype=Object.create(nl.prototype),Ea.prototype.createElement=function(e){var t=e.name,n=Un(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},Ea.prototype.handleChild=function(e){var t=new Ea(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},Ea.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function dd(e){e instanceof Ei&&(e={model:e}),te(this,{lax:!1},e)}dd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Xn?(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 BM(te({},t,{rootHandler:i})),s=new qm({proxy:!0}),c=NM();i.context=a,c.push(i);function l(E,M,B){var A=M(),L=A.line,H=A.column,V=A.data;V.charAt(0)==="<"&&V.indexOf(" ")!==-1&&(V=V.slice(0,V.indexOf(" "))+">");var G="unparsable content "+(V?V+" ":"")+`detected
2
2
  line: `+L+`
3
3
  column: `+H+`
4
- nested error: `+E.message;if(B)return a.addWarning({message:G,error:E}),!0;throw Qo(G)}function u(E,M){return l(E,M,!0)}function p(){var E=a.elementsById,M=a.references,B,A;for(B=0;A=M[B];B++){var L=A.element,H=E[A.id],V=Co(L).propertiesByName[A.property];if(H||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),V.isMany){var G=L.get(V.name),ie=G.indexOf(A);ie===-1&&(ie=G.length),H?G[ie]=H:G.splice(ie,1)}else L.set(V.name,H)}}function d(){c.pop().handleEnd()}var f=/^<\?xml /i,y=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(E){if(f.test(E)){var M=y.exec(E),B=M&&M[1];!B||h.test(B)||a.addWarning({message:"unsupported document encoding <"+B+">, falling back to UTF-8"})}}function w(E,M){var B=c.peek();try{c.push(B.handleNode(E))}catch(A){l(A,M,r)&&c.push(new ld)}}function g(E,M){try{c.peek().handleText(E)}catch(B){u(B,M)}}function v(E,M){E.trim()&&g(E,M)}var b=o.getPackages().reduce(function(E,M){return E[M.uri]=M.prefix,E},Object.entries(cd).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,A){var L=E.attrs||{},H=Object.keys(L).reduce(function(G,ie){var pe=M(L[ie]);return G[ie]=pe,G},{}),V={name:E.name,originalName:E.originalName,attributes:H,ns:E.ns};w(V,A)}).on("question",m).on("closeTag",d).on("cdata",g).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(G){B=G}var A=i.element;!B&&!A&&(B=Qo("failed to parse document as <"+i.type.$descriptor.name+">"));var L=a.warnings,H=a.references,V=a.elementsById;return B?(B.warnings=L,M(B)):E({rootElement:A,elementsById:V,references:H,warnings:L})})},dd.prototype.handler=function(e){return new pd(this.model,e)};function NM(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var $M=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,FM=/<|>|'|"|&|\n\r|\n/g,Zm=/<|>|&/g;function io(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}io.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},io.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},io.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},io.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)},io.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},io.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},io.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},io.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},io.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 jM(e){return e.charAt(0).toLowerCase()+e.slice(1)}function HM(e,t){return qm(t)?jM(e):e}function Jm(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Qm(e){return oi(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function GM(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 zM(e,t){return t.isGeneric?te({localName:t.ns.localName},e):te({localName:HM(t.ns.localName,t.$pkg)},e)}function VM(e,t){return te({localName:t.ns.localName},e)}function WM(e){var t=e.$descriptor;return gt(t.properties,function(n){var i=n.name;if(n.isVirtual||!ri(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var UM={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},qM={"<":"lt",">":"gt","&":"amp"};function ey(e,t,n){return e=oi(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function YM(e){return ey(e,FM,UM)}function KM(e){return ey(e,Zm,qM)}function XM(e){return gt(e,function(t){return t.isAttr})}function ZM(e){return gt(e,function(t){return!t.isAttr})}function fd(e){this.tagName=e}fd.prototype.build=function(e){return this.element=e,this},fd.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function zr(){}zr.prototype.serializeValue=zr.prototype.serializeTo=function(e){e.append(this.escape?KM(this.value):this.value)},zr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Zm)!==-1&&(this.escape=!0),this};function hd(e){this.tagName=e}Jm(hd,zr),hd.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Yt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Yt.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=WM(e),this.parseAttributes(XM(o)),this.parseContainments(ZM(o))),this.parseGenericAttributes(e,i),this},Yt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return zM(t,e)},Yt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return VM(t,e)},Yt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Yt.prototype.nsAttributeName=function(e){var t;if(oi(e)?t=Un(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}:te({localName:t.localName},n)},Yt.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}))},Yt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new zr().build({type:"String"},t));var n=e.$children;n&&K(n,i=>{this.body.push(new Yt(this).build(i))})},Yt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=Un(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)}},Yt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return K(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Yt.prototype.parseGenericAttributes=function(e,t){var n=this;K(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)}})},Yt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;K(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new zr().build(o,r[0]));else if(jm(o.type))K(r,function(l){n.push(new hd(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)K(r,function(l){n.push(new fd(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Km(o);K(r,function(l){var u;c?c===Ym?u=new Yt(t,o):u=new nl(t,o,c):u=new Yt(t),n.push(u.build(l))})}})},Yt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new io(i):t=i),t},Yt.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},Yt.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},Yt.prototype.parseAttributes=function(e){var t=this,n=this.element;K(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];K(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Yt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Qm(e)},Yt.prototype.addAttribute=function(e,t){var n=this.attrs;oi(t)&&(t=YM(t));var i=Dm(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)},Yt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=GM(n).concat(t)),K(t,function(i){e.append(" ").append(Qm(i.name)).append('="').append(i.value).append('"')})},Yt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==zr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),K(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function nl(e,t,n){Yt.call(this,e,t),this.serialization=n}Jm(nl,Yt),nl.prototype.parseNsAttributes=function(e){var t=Yt.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},nl.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function JM(){this.value="",this.write=function(e){this.value+=e}}function QM(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 eC(e){e=te({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new JM,r=new QM(o,e.format);e.preamble&&r.append($M);var a=new Yt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(tC(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function tC(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in cd)n[i]=cd[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 il(e,t){Ei.call(this,e,t)}il.prototype=Object.create(Ei.prototype),il.prototype.fromXML=function(e,t,n){oi(t)||(n=t,t="bpmn:Definitions");var i=new dd(te({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},il.prototype.toXML=function(e,t){var n=new eC(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var nC="BPMN20",iC="http://www.omg.org/spec/BPMN/20100524/MODEL",oC="bpmn",rC=[],aC=[{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"}]}],sC=[{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"}]}],cC={tagAlias:"lowerCase",typePrefix:"t"},lC={name:nC,uri:iC,prefix:oC,associations:rC,types:aC,enumerations:sC,xml:cC},uC="BPMNDI",pC="http://www.omg.org/spec/BPMN/20100524/DI",dC="bpmndi",fC=[{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"]}],hC=[{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"}]}],gC=[],mC={name:uC,uri:pC,prefix:dC,types:fC,enumerations:hC,associations:gC},yC="DC",vC="http://www.omg.org/spec/DD/20100524/DC",xC="dc",bC=[{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}]}],wC=[],_C={name:yC,uri:vC,prefix:xC,types:bC,associations:wC},EC="DI",SC="http://www.omg.org/spec/DD/20100524/DI",RC="di",MC=[{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"}]}],CC=[],AC={tagAlias:"lowerCase"},PC={name:EC,uri:SC,prefix:RC,types:MC,associations:CC,xml:AC},TC="bpmn.io colors for BPMN",kC="http://bpmn.io/schema/bpmn/biocolor/1.0",OC="bioc",DC=[{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"}]}],LC=[],IC=[],BC={name:TC,uri:kC,prefix:OC,types:DC,enumerations:LC,associations:IC},NC="BPMN in Color",$C="http://www.omg.org/spec/BPMN/non-normative/color/1.0",FC="color",jC=[{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"}]}],HC=[],GC=[],zC={name:NC,uri:$C,prefix:FC,types:jC,enumerations:HC,associations:GC};const VC={bpmn:lC,bpmndi:mC,dc:_C,di:PC,bioc:BC,color:zC};function ty(e,t){const n=te({},VC,e);return new il(n,t)}const WC={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"}},Es={[Im]:WC,[zp]:Am};function ny(){return ty(Es)}const iy=ny();async function Sa(e){const{rootElement:t,warnings:n}=await iy.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function UC(e){const{xml:t}=await iy.toXML(e,{format:!0});return t}function gd(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const oo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},oy=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function qC(e){return oy.test(e)}function YC(e){const t=oo;return oy.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 Vr(e,t){let n=0;for(const i of e)n+=t*YC(i);return n}function ry(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&KC(e),XC(e),ZC(e),JC(e)}function KC(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:Vr(o,r),fontBoundingBoxAscent:r*oo.ascentEm,fontBoundingBoxDescent:r*oo.descentEm,actualBoundingBoxAscent:r*oo.ascentEm,actualBoundingBoxDescent:r*oo.descentEm}}};t.getContext=()=>n}function XC(e){if(e.SVGMatrix)return;class t{constructor(){pn(this,"a",1);pn(this,"b",0);pn(this,"c",0);pn(this,"d",1);pn(this,"e",0);pn(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 ZC(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 JC(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:Vr(n,12),height:14}})}const ol=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),QC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),eA=1,rl=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),er=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}`;case"edge-crosses-own-endpoint":return`xo|${e.edge}|${e.shape}`;case"message-detours-own-pool-shape":return`md|${e.edge}|${e.shape}`}}const ay=20,al=5,sy=3,tA=8,Ra=15,md=50,cy=12,nA=cy*1.2;function yd(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Vr(r,cy))),o=n.length*nA;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const ly=1;function dn(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 tr(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 dn(e))for(const s of dn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>ly)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>=ay&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function vd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function uy(e,t){const n=tr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function iA(e,t){let n=0;for(const i of t)i.id!==e.id&&uy(e,i)&&n++;return n}function qn(e,t){let n=0;for(const i of t)i.id!==e.id&&tr(e,i)&&n++;return n}const py=15,dy=20;function oA(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-dy||t.at>n[1]+dy)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 xd=20;function sl(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>ly)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<ay||n.push([o-xd,r+xd])}return n}function Ma(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of dn(e)){const r=oA(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of sl(o,dn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const rA=10,aA=1,sA=(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 cA(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,y)=>{if(y===0)return f<=0;const h=f/y;if(y>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}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 bd(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 lA=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Ca=1;function Wi(e,t){const n=e.x+Ca,i=e.x+e.width-Ca,o=e.y+Ca,r=e.y+e.height-Ca;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 Aa(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function fy(e,t){const n=e.label;if(!n)return null;if(dn(e).some(i=>Wi(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(dn(i).some(o=>Wi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(Aa(i).some(o=>Wi(n,o)))return i.id;return null}function Tt(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(cA(e.waypoints[r],e.waypoints[r+1],o,er)){i.push(o);break}}return i}const uA=/Participant|Lane|SubProcess|TextAnnotation|Group/;function wd(e,t){for(const n of t){if(!n||uA.test(n.type))continue;const i=n.x+n.width/2,o=n.y+n.height/2,r=(a,s)=>{if(/Gateway$/.test(n.type)){const c=n.width/2-er,l=n.height/2-er;return c>0&&l>0&&Math.abs(a-i)/c+Math.abs(s-o)/l<1}return/Event$/.test(n.type)?Math.hypot(a-i,s-o)<Math.min(n.width,n.height)/2-er:a>n.x+er&&a<n.x+n.width-er&&s>n.y+er&&s<n.y+n.height-er};for(let a=0;a+1<e.length;a++){const s=e[a],c=e[a+1],l=Math.max(1,Math.ceil(Math.hypot(c.x-s.x,c.y-s.y)/2));for(let u=0;u<=l;u++)if(r(s.x+(c.x-s.x)*u/l,s.y+(c.y-s.y)*u/l))return!0}}return!1}const Ss=(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))},pA=(e,t,n,i)=>gy(e,t,n,i)?0:Math.min(Ss(e,n,i),Ss(t,n,i),Ss(n,e,t),Ss(i,e,t)),hy=(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 Ao(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,Ss({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(hy(e,s)||hy(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,pA(e,t,s[l],s[(l+1)%s.length]));return c}function gy(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 _d=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function my(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(gy(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function Pa(e,t){let n=0;for(const i of t)i.id===e.id||_d(e,i)||my(e,i)&&n++;return n}function Tn(e,t){let n=0;for(const i of t)i.id===e.id||_d(e,i)||Pa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function yy(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++)Pa(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function Si(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Pa(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 Ri(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(_d(n[i],n[o])&&my(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 vy(e){const t=Si(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:dA(e)}}function dA(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 xy(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!rl.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 by(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 wy=e=>e?{members:e}:{},fn=e=>e.shapes.filter(t=>!t.container);function fA(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 hA(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 _y(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(dn(i).some(o=>Wi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(Aa(i).some(o=>Wi(n,o)))return i.id;return null}function nr(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 Ey=3;function Sy(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 Ta(e,t){const n=[];for(const i of t.shapes){if(i.container||rl.has(i.type))continue;const o=Sy(e,i);o>=Ey&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function Ed(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 gA(e){const t=new Map,n=new Set;for(const d of e)t.set(d.source,[...t.get(d.source)??[],d.target]),n.add(d.target);const i=[...e.map(d=>d.source).filter(d=>!n.has(d)),...e.map(d=>d.source)],o=new Map,r=new Set,a=d=>{o.set(d,"open");for(const f of t.get(d)??[]){const y=o.get(f);y==="open"?r.add(`${d}>${f}`):y||a(f)}o.set(d,"done")};for(const d of i)o.has(d)||a(d);const s=(d,f)=>!r.has(`${d}>${f}`),c=[],l=new Set,u=d=>{l.add(d);for(const f of t.get(d)??[])s(d,f)&&!l.has(f)&&u(f);c.push(d)};for(const d of i)l.has(d)||u(d);const p=new Map;for(const d of c.reverse()){const f=p.get(d)??0;p.set(d,f);for(const y of t.get(d)??[])s(d,y)&&(p.get(y)??-1)<f+1&&p.set(y,f+1)}return p}function mA(e){const t=e.edges.filter(l=>l.type==="bpmn:SequenceFlow"&&!!l.source&&!!l.target),n=new Map,i=new Map;for(const l of t)n.set(l.source,[...n.get(l.source)??[],l.target]),i.set(l.target,[...i.get(l.target)??[],l.source]);const o=new Map(n);for(const l of e.shapes)l.host!==void 0&&o.set(l.host,[...o.get(l.host)??[],l.id]);const r=(l,u)=>{const p=new Set([l]),d=[l];for(;d.length;)for(const f of u.get(d.pop())??[])p.has(f)||(p.add(f),d.push(f));return p},a=gA(t),s=new Map(e.shapes.map(l=>[l.id,l])),c=[];for(const[l,u]of i){const p=s.get(l);if(!p)continue;const d=r(l,o),f=[...new Set(u)].filter(m=>!d.has(m)&&s.has(m));if(f.length<2)continue;const y=f.map(m=>r(m,i)),h=[...y[0]].some(m=>y.every(w=>w.has(m)));for(const m of f){if(p.x+p.width/2>=s.get(m).x)continue;const w=a.get(m)??0;if(!(!h&&!f.some(g=>g!==m&&w>=(a.get(g)??0)+2)))for(const g of t)g.source===m&&g.target===l&&c.push({kind:"merge-before-predecessor",merge:l,edge:g.id})}}return c}function yA(e){const t=new Map(e.shapes.map(i=>[i.id,i])),n=[];for(const i of e.edges)if(!(i.type!=="bpmn:SequenceFlow"&&i.type!=="bpmn:MessageFlow"))for(const o of new Set(i.endpoints)){const r=t.get(o);r&&!r.container&&wd(i.waypoints,[r])&&n.push({kind:"edge-crosses-own-endpoint",edge:i.id,shape:o})}return n}function vA(e){const t=new Map(e.shapes.map(o=>[o.id,o])),n=o=>{for(let r=t.get(o);r;r=r.parent?t.get(r.parent):void 0)if(r.type==="bpmn:Participant")return r.id},i=[];for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.waypoints.length<4)continue;const[r,a]=[o.source??o.endpoints[0],o.target??o.endpoints[1]].map(h=>h?t.get(h):void 0);if(!r||!a||r.type==="bpmn:Participant"==(a.type==="bpmn:Participant"))continue;const[s,c]=r.type==="bpmn:Participant"?[r,a]:[a,r];if(c.container)continue;const l=c.x+c.width/2;if(l<s.x+10||l>s.x+s.width-10)continue;const u=n(c.id);if(!u)continue;const p=s.y>c.y,[d,f]=p?[c.y+c.height,s.y]:[s.y+s.height,c.y],y=e.shapes.filter(h=>h.id!==c.id&&!h.container&&!h.attached&&h.type!=="bpmn:TextAnnotation"&&h.x<l&&l<h.x+h.width&&h.y<f&&h.y+h.height>d&&n(h.id)===u).sort((h,m)=>p?h.y-m.y:m.y-h.y);y.length&&i.push({kind:"message-detours-own-pool-shape",edge:o.id,shape:y[0].id})}return i}function dt(e,t={}){const n=[],i=e.shapes.filter(g=>!g.container);for(const g of e.edges)for(const v of Tt(g,i))n.push({kind:"edge-crosses-shape",edge:g.id,shape:v.id});const o=e.shapes.filter(g=>g.container&&QC.has(g.type));if(o.length){const g=(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 Tt(v,o))v.endpoints.includes(b.id)||v.endpoints.some(E=>g(b,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}for(const g of e.edges){if(g.waypoints.length<2)continue;const v=[[g.source,g.waypoints[0]],[g.target,g.waypoints[g.waypoints.length-1]]];for(const[b,E]of v){if(!b)continue;const M=e.shapes.find(H=>H.id===b);if(!M||M.container)continue;const B=Math.max(M.x-E.x,E.x-(M.x+M.width),0),A=Math.max(M.y-E.y,E.y-(M.y+M.height),0),L=Math.hypot(B,A);L>rA&&n.push({kind:"edge-endpoint-detached",edge:g.id,shape:b,distance:Math.round(L)})}}for(const g of Ed(e.shapes))n.push({kind:"pool-overlap",...g});const r=i.filter(g=>!g.attached);for(let g=0;g<r.length;g++)for(let v=g+1;v<r.length;v++){const b=r[g],E=r[v];if(!bd(b,E,eA))continue;const M=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:"shape-overlap",shapes:M,identical:lA(b,E)})}const a=e.shapes.filter(g=>g.type==="bpmn:Group"&&Array.isArray(g.members)&&g.members.length>0);for(let g=0;g<a.length;g++)for(let v=g+1;v<a.length;v++){const b=a[g],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<=al||B<=al)continue;const A=b.id<E.id?[b.id,E.id]:[E.id,b.id],L=new Set(E.members);if(b.members.some(V=>L.has(V))){const V=xy(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)});V.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:A,shapes:V});continue}const H=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:A,...H?{container:H}:{}})}const s=new Set(a.flatMap(g=>[...g.members])),c=g=>e.shapes.filter(v=>!v.container&&!rl.has(v.type)&&v.x>=g.x&&v.y>=g.y&&v.x+v.width<=g.x+g.width&&v.y+v.height<=g.y+g.height);for(const g of a){const v=c(g);if(!v.length)continue;const b=new Set(g.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:g.id,shapes:E.map(M=>M.id).sort()}))}for(const g of a){const v=new Set(c(g).map(L=>L.id)),b=new Set(g.members),E=new Set([...v].filter(L=>!b.has(L)&&s.has(L)));if(!E.size)continue;let M=!1,B=!1,A=!1;for(const L of e.edges){if(L.type!=="bpmn:SequenceFlow"||!L.source||!L.target)continue;const H=E.has(L.source),V=E.has(L.target);!H&&V&&!v.has(L.source)?M=!0:H&&!V&&!v.has(L.target)?B=!0:H&&V&&(A=!0)}M&&B&&A&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:g.id,shapes:[...E].sort()})}const l=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<l.length;g++)for(let v=g+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const E=[l[g],l[v],l[b]],M={x:Math.max(...E.map(L=>L.x)),y:Math.max(...E.map(L=>L.y)),right:Math.min(...E.map(L=>L.x+L.width)),bottom:Math.min(...E.map(L=>L.y+L.height))};if(M.right-M.x<=al||M.bottom-M.y<=al)continue;const B=xy(e,[],M);if(!B.length)continue;const A=E.map(L=>L.id).sort();n.push({kind:"group-stack-unreadable",groups:A,shapes:B})}for(const g of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||rl.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",g.y,"h",g.x,g.x+g.width],["bottom",g.y+g.height,"h",g.x,g.x+g.width],["left",g.x,"v",g.y,g.y+g.height],["right",g.x+g.width,"v",g.y,g.y+g.height]];for(const[E,M,B,A,L]of b){const H=B==="h"?v.x:v.y,V=B==="h"?v.x+v.width:v.y+v.height;if(!(H<L&&A<V))continue;const G=B==="h"?v.y:v.x,ie=B==="h"?v.y+v.height:v.x+v.width;if(!(G<M&&M<ie))continue;const pe=Math.min(M-G,ie-M);pe<tA||n.push({kind:"group-cuts-shape",group:g.id,shape:v.id,side:E,depth:pe})}}const u=t.includeObservationOnly?e.shapes.filter(g=>g.type==="bpmn:Group"&&g.width>0&&g.height>0):[];if(u.length){const g=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=dn(v);if(b.length)for(const E of u){const M=E.x+E.width,B=E.y+E.height,A=v.endpoints.some(H=>{const V=g.get(H);return!!V&&E.x<V.x&&V.x<M&&E.y<V.y&&V.y<B});let L=null;for(const H of b){const[V,G,ie]=H.axis==="v"?[E.y,B,[["left",E.x],["right",M]]]:[E.x,M,[["top",E.y],["bottom",B]]],pe=Math.min(H.hi,G)-Math.max(H.lo,V);if(pe<md)continue;const q=H.axis==="v"?E.x<H.at&&H.at<M:E.y<H.at&&H.at<B;if(!(q&&A))for(const[Pe,Te]of ie){const ke=Math.abs(H.at-Te);ke<=Ra&&(!L||ke<L.distance)&&(L={side:Pe,inside:q,distance:ke,length:pe})}}L&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:L.side,inside:L.inside,distance:Math.round(L.distance),length:Math.round(L.length)})}}}const p=e.shapes.filter(g=>g.container&&g.type!=="bpmn:Group"&&g.type!=="bpmn:Lane");for(const g of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const b=g.x<v.x+v.width&&v.x<g.x+g.width,E=g.y<v.y+v.height&&v.y<g.y+g.height,M=[["top",g.y,v.y,b],["bottom",g.y+g.height,v.y+v.height,b],["left",g.x,v.x,E],["right",g.x+g.width,v.x+v.width,E]];for(const[B,A,L,H]of M)H&&Math.abs(A-L)<=sy&&n.push({kind:"group-on-container-boundary",group:g.id,container:v.id,side:B})}const d=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<d.length;g++)for(let v=g+1;v<d.length;v++){const b=d[g],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,A=[["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[L,H,V,G]of A)if(G&&Math.abs(H-V)<=sy){n.push({kind:"group-on-group-boundary",groups:b.id<E.id?[b.id,E.id]:[E.id,b.id],axis:L});break}}for(let g=0;g<e.edges.length;g++)for(let v=g+1;v<e.edges.length;v++){const b=e.edges[g],E=e.edges[v],M=tr(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 g of e.edges){if(!g.label)continue;const v=Ma(g,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:g.id,other:v.other,axis:v.axis})}for(const g of e.edges){if(!g.label)continue;const v=fy(g,e);v&&n.push({kind:"label-over-line",edge:g.id,line:v})}if(t.includeObservationOnly){for(const g of e.edges)if(!(!g.label||g.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:b}of Ta(g.label,e))n.push({kind:"label-over-shape",edge:g.id,shape:v,depth:Math.round(b)})}t.includeObservationOnly&&n.push(...mA(e)),t.includeObservationOnly&&n.push(...yA(e)),t.includeObservationOnly&&n.push(...vA(e));const f=new Set(i.map(g=>g.id)),y=e.shapes.filter(g=>g.type==="bpmn:Participant"&&g.label);for(const g of[...i,...y.filter(v=>!f.has(v.id))]){if(!g.label)continue;const v=_y(g,e);v&&n.push({kind:"label-over-line",edge:g.id,line:v})}const h=new Set(e.shapes.filter(g=>g.type==="bpmn:TextAnnotation").map(g=>g.id));for(const g of y)for(const{owner:v,rect:b}of nr(e))v===g.id||h.has(v)||bd(g.label,b,Ca)&&n.push({kind:"pool-name-over-label",pool:g.id,label:v});const m=nr(e);for(const g of i)if(g.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of m)v!==g.id&&bd(g,b,Ca)&&n.push({kind:"annotation-over-label",annotation:g.id,label:v});const w=new Map(e.shapes.map(g=>[g.id,g]));for(const g of i){const v=g.parent??fA(g,e,w);if(!v)continue;const b=w.get(v);!b||!b.container||sA(b,g,aA)||g.type==="bpmn:TextAnnotation"&&!hA(g,b,e)||n.push({kind:"shape-outside-container",shape:g.id,container:b.id})}return n.sort((g,v)=>ct(g).localeCompare(ct(v)))}const Ut=e=>typeof e=="object"&&e!==null?e:void 0,on=e=>typeof e=="number"?e:0,Ui=e=>{const t=Ut(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function xA(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=Ui(r);a&&n.push(a)}}return n}function bA(e){const t=Ut(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ui(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ui(t.targetRef);return n&&i?{source:n,target:i}:{}}function wA(e,t){const n=Ut(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=Ui(n);return o?t.get(o):void 0}if(ol.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ui(n)}function Ry(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 y=Ut(f),h=Ui(y),m=Ui(y==null?void 0:y.processRef);h&&m?o.set(m,h):h&&r.add(h)}}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 y of f){const h=Ut(y);if(!h)continue;const m=Ut(h.bpmnElement),w=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!w)continue;const g=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",v=Ut(h.bounds);if(v){const E=h.isExpanded===!1&&g!=="bpmn:Participant",M=Ut((l=Ut(h.label))==null?void 0:l.bounds),B=Ui(m==null?void 0:m.attachedToRef),A={id:w,type:g,x:on(v.x),y:on(v.y),width:on(v.width),height:on(v.height),container:ol.has(g)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...B!==void 0?{host:B}:{},...m?{parent:wA(m,o)}:{},...M?{label:{x:on(M.x),y:on(M.y),width:on(M.width),height:on(M.height)}}:{},...g==="bpmn:Group"?wy(by(m)):{}},L=h.isHorizontal!==!1,H=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(w)&&L&&H&&(A.label=yd(A,H)),t.push(A);continue}const b=h.waypoint;if(Array.isArray(b)){const E=Ut((u=Ut(h.label))==null?void 0:u.bounds);n.push({id:w,type:g,waypoints:b.map(M=>{var B,A;return{x:on((B=Ut(M))==null?void 0:B.x),y:on((A=Ut(M))==null?void 0:A.y)}}),endpoints:xA(m),...bA(m),...E?{label:{x:on(E.x),y:on(E.y),width:on(E.width),height:on(E.height)}}:{}})}}}return{shapes:t,edges:n}}function My(e){return dt(Ry(e),{includeObservationOnly:!0})}async function _A(e){const{definitions:t,warnings:n}=await Sa(e);return{findings:My(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 m=Ut(r.label),w=Ui(r.source),g=Ui(r.target);n.push({id:r.id,type:a,waypoints:s.map(v=>({x:on(v.x),y:on(v.y)})),endpoints:[w,g].filter(v=>!!v),...w&&g?{source:w,target:g}:{},...m&&typeof m.x=="number"?{label:{x:m.x,y:on(m.y),width:on(m.width),height:on(m.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ut(r.businessObject),l=Ui(c==null?void 0:c.attachedToRef),u=Ut(r.label);let p=Ut(r.parent);for(;p&&p.type==="bpmn:Lane";)p=Ut(p.parent);const d=typeof(p==null?void 0:p.type)=="string"?p.type:"",f=p&&ol.has(d)&&d!=="bpmn:Group"&&typeof p.id=="string"?p.id:void 0,y={id:r.id,type:a,x:r.x,y:r.y,width:on(r.width),height:on(r.height),container:ol.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...l!==void 0?{host:l}:{},...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:on(u.y),width:on(u.width),height:on(u.height)}}:{},...a==="bpmn:Group"?wy(by(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=Ut(r.di))==null?void 0:i.isHorizontal)!==!1&&(y.label=yd(y,h)),t.push(y)}return{shapes:t,edges:n}}const EA={"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 SA(e,t){const n=EA[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Cy(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ay(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 SA(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Cy(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?Cy(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 Gp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Xo(i.businessObject).map(o=>o.locale)}}}const Wr=20,RA=4,He=(e,t)=>Math.abs(e-t)<.5,MA=15;function Sd(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,Ao(e[r-1],e[r],o));return i}function CA(e,t,n=MA){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=He(i.x,o.x)&&!He(i.y,o.y),a=He(i.y,o.y)&&!He(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=w=>{const g=w?t.find(v=>v.id===w):void 0;return g?r?[g.x+10,g.x+g.width-10]:[g.y+10,g.y+g.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),y=Math.min(u,d);if(!(y>=f))return[];const h=r?i.x:i.y,m=[];for(let w=5;w<=400;w+=5)for(const g of[-1,1]){const v=h+g*w;if(v<f||v>y)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Tt({...e,waypoints:b},t).length||Sd(b,t,s)<n||m.push(b)}return m}function Rd(e,t,n,i,o){const r=e.edges.filter(m=>m.id!==t.id),a={...t,waypoints:n},s={...t,waypoints:[...i]};if(Tn(a,r)>Tn(s,r)||qn(a,r)>qn(s,r))return!1;const c=`L|${t.id}|${t.id}`,l=m=>({...e,edges:e.edges.map(w=>w.id===t.id?{...w,waypoints:m}:w)}),u=m=>dt(m).filter(w=>ct(w)!==c),p=l(n);let d=u(p);const f=o?AA(p,d,t,o):null;f&&(d=u(f));const y=`"${t.id}"`;if(d.some(m=>JSON.stringify(m).includes(y)))return!1;const h=new Set(u(l([...i])).map(ct));return d.every(m=>h.has(ct(m)))}function AA(e,t,n,i){const o=t.filter(s=>s.kind==="label-over-line"&&s.line===n.id&&n.endpoints.includes(s.edge)&&!i.has(s.edge));if(o.length!==1)return null;const r=e.shapes.find(s=>s.id===o[0].edge);if(!r||!/Gateway$|Event$/.test(r.type))return null;const a=jd(r,e);return a?{...e,shapes:e.shapes.map(s=>s.id===r.id?{...s,label:a}:s)}:null}function Py(e,t,n,i){for(const o of CA(t,n))if(Rd(e,t,o,i))return o;return null}const PA=120;function Ty(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=Wr;u<=PA;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,y=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,h=r.x+r.width/2+c,m=a.x+a.width/2+l,w=[{x:h,y:d},{x:h,y},{x:m,y},{x:m,y:f}];if(!dl(w,i)||Tt({...e,waypoints:w},t).length||Tt({...e,endpoints:[],waypoints:w},[r,a]).length||Sd(w,t,e.endpoints)<Wr)continue;const g=Ld(w,n);(o===void 0?g<Dd:g>=Dd||g<o)||s.push(w)}return s}function ky(e,t,n,i,o,r){const a=e.shapes.filter(u=>u.type==="bpmn:Participant"||u.type==="bpmn:Lane"),s=Ty(t,n,a,o),c=Oy(e,t,i,s,r);if(c)return c;const l=Math.max(Ld(i,a),Wr);return Oy(e,t,i,Ty(t,n,a,o,l),r)}function Oy(e,t,n,i,o){const r=new Map;for(const l of i){const u=l[1].y<l[0].y?"top":"bottom";if(!r.has(u)&&(Rd(e,t,l,n,o)&&r.set(u,l),r.size===2))break}const a=e.edges.filter(l=>l.id!==t.id);let s=null,c=1/0;for(const l of["top","bottom"]){const u=r.get(l);if(!u)continue;const p=Tn({...t,waypoints:u},a);p<c&&(s=u,c=p)}return s}function cl(e,t,n,i=Wr){if(He(e.y,t.y)&&!He(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(He(e.x,t.x)&&!He(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 Dy(e,t,n,i=Wr){if(n.length<2)return null;if(He(e.y,t.y)&&!He(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(He(e.x,t.x)&&!He(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 Ly(e,t,n=Wr){if(e.length!==4)return null;const[i,o,r,a]=e;if(He(i.y,o.y)&&He(o.x,r.x)&&He(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(He(i.x,o.x)&&He(o.y,r.y)&&He(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 ll(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 ul=30,TA=[0,-25,25,-40,40];function kA(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+ul:s-ul,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return TA.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Tt({...e,endpoints:[],waypoints:d},[n]).length===0)}const Md=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ir=(e,t,n)=>Tt({...e,waypoints:t},n).length,OA=25;function Iy(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 DA(e,t,n,i){const r=(d,f,y)=>(f.x-d.x)*(y.y-d.y)-(f.y-d.y)*(y.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=Iy(i,e,t),f=Iy(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 LA(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=DA(e[s],e[s+1],a,r);if(c&&Math.hypot(c.x-r.x,c.y-r.y)<=OA){i++;break}}}return i}function pl(e,t,n,i){let o=[...e.waypoints],r=ir(e,o,t);if(r===0)return null;let a=!1;for(const p of ll(e,t))if(ir(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(dn),c=p=>dn({...e,waypoints:p}).some(d=>sl(d,s).length>0),l=kA(e,t).filter(p=>ir(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&&He(p.y+p.height/2,d.y+d.height/2)){const f=[o[0],o[o.length-1]];if(He(f[0].y,f[1].y)&&!He(f[0].x,f[1].x)){const y=t.filter(g=>!e.endpoints.includes(g.id)&&Tt({...e,waypoints:f},[g]).length>0),h=y.length>=2?Dy(f[0],f[1],y):null,w=(h?h.map(g=>[f[0],...g,f[1]]):y.length===1?(cl(f[0],f[1],y[0])??[]).map(g=>[f[0],...g,f[1]]):y.length===0?[f]:[]).filter(g=>ir(e,g,t)===0&&g.length<=o.length).sort((g,v)=>Number(u(v))-Number(u(g)));if(w.length)return w.find(g=>!c(g))??w[0]}}}for(let p=0;p+1<o.length;p++){const d=o[p],f=o[p+1],y=t.filter(w=>!e.endpoints.includes(w.id)&&Tt({...e,waypoints:[d,f]},[w]).length>0);if(y.length<2)continue;const h=Dy(d,f,y);if(!h)continue;const m=h.map(w=>Md(o,p,w)).filter(w=>ir(e,w,t)===0).sort((w,g)=>Number(u(g))-Number(u(w)));if(m.length)return m.find(w=>!c(w))??m[0]}for(let p=0;p<RA&&r>0;p++){let d=!1;for(let f=0;f+1<o.length&&!d;f++){const y=o[f],h=o[f+1];for(const m of t){if(e.endpoints.includes(m.id)||Tt({...e,waypoints:[y,h]},[m]).length===0)continue;const w=cl(y,h,m),v=[...(Ly(o,m)??[]).map((E,M)=>({pts:E,k:M,cross:ir(e,E,t),tip:LA(E,e,i??[])})).sort((E,M)=>E.cross-M.cross||E.tip-M.tip||E.k-M.k).map(E=>E.pts),...w?w.map(E=>Md(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=ir(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}const IA=40;function BA(e,t,n,i){if(t.length!==4||!e.target||e.label)return null;const[o,r,a,s]=t,c=He(o.y,r.y)&&He(r.x,a.x)&&He(a.y,s.y)&&!He(r.y,a.y),l=He(o.x,r.x)&&He(r.y,a.y)&&He(a.x,s.x)&&!He(r.x,a.x);if(!c&&!l)return null;const u=b=>c?b.x:b.y,p=b=>c?b.y:b.x,d=u(r),f=Math.sign(p(a)-p(r)),y=Math.min(u(o),u(s)),h=Math.max(u(o),u(s)),m=n.filter(b=>b.id!==e.id);let w=null;for(const b of m){if(b.type!==e.type||b.target!==e.target||b.waypoints.length<3)continue;const[E,M,B]=b.waypoints.slice(-3);if(!He(B.x,s.x)||!He(B.y,s.y)||!He(p(M),p(B))||!He(u(E),u(M))||Math.sign(p(M)-p(E))!==f)continue;const A=u(M),L=Math.abs(A-d);if(L<1||L>IA||A<=y||A>=h)continue;const H=c?[o,{x:A,y:o.y},{x:A,y:s.y},s]:[o,{x:o.x,y:A},{x:s.x,y:A},s];ir(e,H,i)===0&&(!w||L<w.gap)&&(w={pts:H,gap:L})}if(!w)return null;const g={...e,waypoints:[...t]},v={...e,waypoints:w.pts};if(qn(v,m)>qn(g,m)||Tn(v,m)>Tn(g,m))return null;for(const b of m){if(!b.label||b.target!==e.target)continue;const E=m.filter(M=>M.id!==b.id);if(!Ma(b,[...E,g])&&Ma(b,[...E,v]))return null}return w.pts}function Cd(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o),s=fn(a),c=new Set,l=dt(a).filter(p=>p.kind==="edge-crosses-shape"&&!t.has(ct(p)));if(!l.length)return c;const u=new Map;for(const p of l){if(p.kind!=="edge-crosses-shape"||u.has(p.edge))continue;const d=a.edges.find(f=>f.id===p.edge);d&&u.set(p.edge,d)}for(const[p,d]of u){if(i&&!i.has(p))continue;const f=o.get(p);if(!f)continue;const y=f.parent,h=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,m=Tt(d,s);if(!i&&m.length&&m.every(A=>A.type==="bpmn:TextAnnotation")){c.add(p);continue}let w=pl(d,s,h,a.edges);const g=Py(a,d,s,w??d.waypoints);g&&(w=g);const v=ky(a,d,s,w??d.waypoints,h,n);if(v&&Tn({...d,waypoints:v},a.edges.filter(A=>A.id!==p))===0&&(w=v),!w){m.some(A=>A.type==="bpmn:TextAnnotation")&&c.add(p);continue}const b=BA(d,w,a.edges,s);b&&(w=b);const E=a.edges.filter(A=>A.id!==p),M=qn(d,E);qn({...d,waypoints:w},E)>M||r.updateWaypoints(f,w)}return c}function NA(e,t,n,i){var f,y;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=h=>{const m=Ge(r);return[...Si(m),...Ri(m)].filter(([w,g])=>w===h||g===h).length},c=(h,m)=>h.kind==="label-over-line"||h.kind==="label-over-shape"||h.kind==="label-on-shared-segment"?h.edge===m:h.kind==="annotation-over-label"||h.kind==="pool-name-over-label"?h.label===m:!1,l=h=>new Set(dt(Ge(r)).filter(m=>!c(m,h)).map(ct)),u=(h,m)=>Math.abs(h-m)<=1,p=(h,m,w,g,v)=>{const b=fn(Ge(r));for(let E=0;E+3<h.length;E++){const[M,B,A,L]=[h[E],h[E+1],h[E+2],h[E+3]],H=u(M.y,L.y)&&u(M.x,B.x)&&u(A.x,L.x)&&u(B.y,A.y)&&Math.abs(B.y-M.y)>=5,V=u(M.x,L.x)&&u(M.y,B.y)&&u(A.y,L.y)&&u(B.x,A.x)&&Math.abs(B.x-M.x)>=5;if(!H&&!V)continue;const G={waypoints:[M,L],endpoints:w};if(Tt(G,[m]).length&&!Tt(G,b).length)return E}return-1},d=(h,m)=>[...h.slice(0,m+1),...h.slice(m+3)].filter((w,g,v)=>g===0||g===v.length-1||!(u(v[g-1].x,w.x)&&u(v[g+1].x,w.x)||u(v[g-1].y,w.y)&&u(v[g+1].y,w.y)));for(const h of t){const m=r.get(h.id);if(!m)continue;const w=new Set([...m.incoming??[],...m.outgoing??[]].map(b=>b.id)),g={...h,type:m.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)&&!w.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,(y=b.target)==null?void 0:y.id].filter(M=>!!M);for(;;){const M=b.waypoints.map(q=>({x:q.x,y:q.y})),B=p(M,g,E,b.id,b.type);if(B<0)break;const A=b.label,L=A&&{x:A.x,y:A.y},H=l(b.id),V=s(b.id);if(a.updateWaypoints(b,d(M,B)),A&&L){const q={x:L.x+A.width/2,y:L.y+A.height/2},Pe=(ke,ve)=>{const U=ve.x-ke.x,de=ve.y-ke.y,z=U*U+de*de,Q=z===0?0:Math.max(0,Math.min(1,((q.x-ke.x)*U+(q.y-ke.y)*de)/z));return Math.hypot(q.x-(ke.x+Q*U),q.y-(ke.y+Q*de))};let Te=0;for(let ke=1;ke+1<M.length;ke++)Pe(M[ke],M[ke+1])<Pe(M[Te],M[Te+1])&&(Te=ke);(Te<B||Te>B+2)&&(A.x!==L.x||A.y!==L.y)&&a.moveElements([A],{x:L.x-A.x,y:L.y-A.y})}const G=l(b.id),ie=[...G].filter(q=>!H.has(q)).length,pe=[...H].filter(q=>!G.has(q)).length;if(ie<=pe&&s(b.id)<=V){o.add(b.id);continue}a.updateWaypoints(b,M),A&&L&&(A.x!==L.x||A.y!==L.y)&&a.moveElements([A],{x:L.x-A.x,y:L.y-A.y});break}}}return o}const $A=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 Rs(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 dl=(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),Ad=(e,t)=>Pa(e,[t])>0;function By(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=fn(r);let s=r;const c=new Set(dt(r).map(ct));for(const[l,u]of Si(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),y=s.edges.find(B=>B.id===d);if(!f||!y)continue;const h=i.get(p);if(!h)continue;const m=Rs(h),w=$A(y),g=[...ll(f,a)??[]],v=pl(f,[...a,...w],m,r.edges);v&&g.push(v);for(let B=0;B+1<f.waypoints.length;B++)for(const A of w)for(const L of cl(f.waypoints[B],f.waypoints[B+1],A)??[])g.push(Md(f.waypoints,B,L));const b=s.edges.filter(B=>B.id!==p),E=B=>({...s,edges:s.edges.map(A=>A.id===p?{...A,waypoints:B}:A)}),M=g.find(B=>{const A={...f,waypoints:B};return Ad(A,y)||!dl(B,m)||b.some(L=>L.id!==d&&!Ad(f,L)&&Ad(A,L))?!1:dt(E(B)).every(L=>c.has(ct(L)))});if(M){o.updateWaypoints(h,M),s=E(M);break}}}const FA=["top","bottom","left","right"],Ny={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},Ms=20,jA=20;function HA(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&&He(e.y,t.y)&&o.push("top"),n&&He(e.y,t.y+t.height)&&o.push("bottom"),i&&He(e.x,t.x)&&o.push("left"),i&&He(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const GA=(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 $y(e,t,n,i){const o=Ny[t],r=Ny[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],y=r[p];if(He(e[d],n[d]))return f===-y&&f*(n[p]-e[p])>=Ms?[e,n]:null;let h;if(f===-y){const w=e[p]+f*Ms,g=n[p]-f*Ms;if(f*(g-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=f>0?Math.max(e[p],n[p])+ul:Math.min(e[p],n[p])-ul;const m=(w,g)=>a?{x:g,y:w}:{x:w,y:g};return[e,m(h,e[d]),m(h,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>=Ms&&u>=Ms?[e,c,n]:null}function zA(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?HA(a,r):null;if(!s)return[];const c=[];for(const l of FA){const u=GA(t,l),p=o?$y(u,l,a,s):$y(a,s,u,l);p&&c.push(p)}return c}const Fy=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 VA(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(dt(r).map(ct));let c=r;for(const[l,u]of Ri(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(L=>L.id===l),d=c.edges.find(L=>L.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Ri({edges:[p,d]}).length)continue;const f=p.endpoints.find(L=>d.endpoints.includes(L)),y=f?a.get(f):void 0;if(!y||y.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const w=L=>n.has(L.id)?[L.waypoints]:[L.waypoints,...zA(L,y,a)],g=L=>L.length-2,v=w(p).flatMap(L=>w(d).map(H=>({pa:L,pb:H}))).filter(({pa:L,pb:H})=>L!==p.waypoints||H!==d.waypoints).map(L=>({...L,cost:Fy(L.pa)+Fy(L.pb)+jA*(g(L.pa)+g(L.pb))})).sort((L,H)=>L.cost-H.cost),b=Rs(h),E=Rs(m),M=Ri(c).length,B=new Set(Si(c).map(([L,H])=>`${L}|${H}`)),A=v.find(({pa:L,pb:H})=>{const V={...p,waypoints:L},G={...d,waypoints:H};if(Ri({edges:[V,G]}).length||tr(V,G)||!dl(L,b)||!dl(H,E))return!1;const ie={...c,edges:c.edges.map(pe=>pe.id===l?V:pe.id===u?G:pe)};return Ri(ie).length>=M||Si(ie).some(([pe,q])=>!B.has(`${pe}|${q}`))?!1:dt(ie).every(pe=>s.has(ct(pe)))});A&&(A.pa!==p.waypoints&&o.updateWaypoints(h,A.pa),A.pb!==d.waypoints&&o.updateWaypoints(m,A.pb),c={...c,edges:c.edges.map(L=>L.id===l?{...p,waypoints:A.pa}:L.id===u?{...d,waypoints:A.pb}:L)})}}const WA=40,UA=20;function qA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=Ri(u);return{keys:new Set(dt(u).map(ct)),crossings:Si(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(Tt({...d,waypoints:u},fn(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 y=f.x+f.width/2;if(y>=d.x+10&&y<=d.x+d.width-10)continue;const h=y>d.x+d.width,m=d.y>f.y,w=m?f.y+f.height:f.y,g=m?d.y:d.y+d.height,v=Math.round((w+g)/2),b=H=>d===u?[...H].reverse():H,E=(l.waypoints??[]).map(H=>({x:H.x,y:H.y})),M=r(l.id),B=a(l.id,E)??new Set,A=h?d.x+d.width:d.x,L=d.x+d.width/2;for(let H=Math.min(WA,d.width/4);h?A-H>L:A+H<L;H+=UA){const V=Math.round(h?A-H:A+H),G=b([{x:y,y:w},{x:y,y:v},{x:V,y:v},{x:V,y:g}]),ie=a(l.id,G);if(!ie||[...ie].some(q=>!B.has(q)))continue;o.updateWaypoints(l,G);const pe=r(l.id);if(pe.crossings<=M.crossings&&pe.shared<=M.shared&&pe.mine<=M.mine&&[...pe.keys].every(q=>M.keys.has(q)))break;o.updateWaypoints(l,E)}}}const YA=10;function jy(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 Hy(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(pe=>pe.type==="bpmn:Participant"&&pe.container),i=t.shapes.find(pe=>pe.id===e.endpoints[0]),o=t.shapes.find(pe=>pe.id===e.endpoints[1]);if(!i||!o)return null;const r=jy(i,n),a=jy(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(pe=>pe.id!==r.id&&pe.id!==a.id&&pe.y>=c.y+c.height&&pe.y+pe.height<=l.y).sort((pe,q)=>pe.y-q.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,y=(d.y+d.height+l.y)/2,h=s?f:y,m=s?y:f,w=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],v=fn(t),b=t.edges.filter(pe=>pe.id!==e.id),E=Tn(e,b),M=Tt(e,v).length;if(E===0&&M===0||M===0&&e.waypoints.length===2)return null;const B=Math.min(...u.map(pe=>pe.x)),A=Math.max(...u.map(pe=>pe.x+pe.width)),L=(w.x+g.x)/2,H=pe=>pe.filter((q,Pe)=>Pe===0||!(He(q.x,pe[Pe-1].x)&&He(q.y,pe[Pe-1].y)));let V,G;for(let pe=B;pe<=A;pe+=YA){const q=H([w,{x:w.x,y:h},{x:pe,y:h},{x:pe,y:m},{x:g.x,y:m},g]),Pe={...e,waypoints:q};if(Tt(Pe,v).length>0)continue;const Te=Tn(Pe,b),ke=Math.abs(pe-L);(!V||Te<V.cross||Te===V.cross&&ke<V.detour)&&(V={pts:q,cross:Te,detour:ke}),Sd(q,v,e.endpoints)>=Wr&&(!G||Te<G.cross||Te===G.cross&&ke<G.detour)&&(G={pts:q,cross:Te,detour:ke})}G&&V&&G!==V&&Rd(t,e,G.pts,V.pts)&&(V=G);const ie=V&&(M>0?V.cross<=E:V.cross<E)?V.pts:null;if(M>0){const pe=Py(t,e,v,ie??e.waypoints);if(pe)return pe}return ie}const KA=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function XA(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=fn(a);for(const p of t.edges){if(!KA.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),y=r.get(p.target),h=s.get(p.source),m=s.get(p.target);if(!f||!y||!h||!m||!He(f.width,h.width)||!He(f.height,h.height)||!He(y.width,m.width)||!He(y.height,m.height))continue;const w=h.x-f.x,g=h.y-f.y;if(He(w,0)&&He(g,0)||!He(m.x-y.x,w)||!He(m.y-y.y,g))continue;const v=p.waypoints.map(M=>({x:M.x+w,y:M.y+g})),b=d.waypoints.map(M=>({x:M.x,y:M.y}));b.length===v.length&&b.every((M,B)=>He(M.x,v[B].x)&&He(M.y,v[B].y))||b.length===2&&(He(b[0].x,b[1].x)||He(b[0].y,b[1].y))&&Tt({...p,waypoints:b},c).length===0||Tt({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function Gy(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=Hy(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Pd=20,zy=10,qi=10,Td=40,ZA=6,JA=40,Vy=50;function QA(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<=ZA})}function kd(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(He(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 eP(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 Od(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=zy;o<=n-t;o+=zy)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function tP(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=(q,Pe)=>Pe>q.x+qi&&Pe<q.x+q.width-qi,y=(q,Pe)=>q.width<=2*Td?q.x+q.width/2:Math.min(Math.max(Pe,q.x+Td),q.x+q.width-Td),h=Math.max(e.x,t.x)+qi,m=Math.min(e.x+e.width,t.x+t.width)-qi;if(h<=m){const q=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((h+m)/2);r.push([{x:q,y:l},{x:q,y:u}])}const w=s?y(t,p):d,g=a?y(e,d):p;if(!a&&!f(e,w)){const q=w<e.x?e.x:e.x+e.width;for(const Pe of Od(e.y+e.height/2,e.y+qi,e.y+e.height-qi))r.push([{x:q,y:Pe},{x:w,y:Pe},{x:w,y:u}])}if(!s&&!f(t,g)){const q=g<t.x?t.x:t.x+t.width;for(const Pe of Od(t.y+t.height/2,t.y+qi,t.y+t.height-qi))r.push([{x:g,y:l},{x:g,y:Pe},{x:q,y:Pe}])}const v=(q,Pe)=>{if(Math.abs(Pe-q)<2*qi)return[];const Te=Math.min(q,Pe)+qi,ke=Math.max(q,Pe)-qi;return Od(Math.round((q+Pe)/2),Te,ke)};if(!a&&n)for(const q of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:q},{x:w,y:q},{x:w,y:u}]);if(!s&&i)for(const q of v(u,c?i.y:i.y+i.height))r.push([{x:g,y:l},{x:g,y:q},{x:d,y:q},{x:d,y:u}]);const b=Math.min(g,w),E=Math.max(g,w),M=[];for(const[q,Pe]of o.filter(Te=>Te.x<E&&Te.x+Te.width>b).map(Te=>[Te.y,Te.y+Te.height]).sort((Te,ke)=>Te[0]-ke[0])){const Te=M[M.length-1];Te&&q<=Te[1]?Te[1]=Math.max(Te[1],Pe):M.push([q,Pe])}const B=[];for(let q=1;q<M.length;q++)M[q][0]-M[q-1][1]>=JA&&B.push(Math.round((M[q-1][1]+M[q][0])/2));M.length&&B.push(M[0][0]-Vy,M[M.length-1][1]+Vy);const A=(q,Pe)=>Pe<q.y?q.y:Pe>q.y+q.height?q.y+q.height:void 0,L=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(q=>!!q)),H=e.y+e.height/2,V=t.y+t.height/2,G=V>H?1:-1,ie=(q,Pe,Te)=>o.some(ke=>!L.has(ke.id)&&ke.x<q&&q<ke.x+ke.width&&ke.y<Math.max(Pe,Te)-1&&ke.y+ke.height>Math.min(Pe,Te)+1),pe=[];for(const q of B){const Pe=A(e,q),Te=A(t,q);Pe===void 0||Te===void 0||(q-H)*G<0&&ie(g,Pe,q)||(q-V)*G>0&&ie(w,Te,q)||pe.push({pts:[{x:g,y:Pe},{x:g,y:q},{x:w,y:q},{x:w,y:Te}],len:Math.abs(q-Pe)+(E-b)+Math.abs(Te-q)})}return{inPools:r,outside:pe.sort((q,Pe)=>q.len-Pe.len).map(q=>q.pts)}}function nP(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 y=f;for(;y&&y.type!=="bpmn:Participant";)y=y.parent;return y==null?void 0:y.id},c=()=>{const f=Ge(i);return{keys:new Set(dt(f).map(ct)),crossings:Si(f).length,shared:Ri(f).length}},l=(f,y)=>f.length===y.length&&f.every((h,m)=>He(h.x,y[m].x)&&He(h.y,y[m].y)),u=f=>{const y=f.source,h=f.target;if(!y||!h)return"skip";const m=Ge(i),w=new Map(m.shapes.map(U=>[U.id,U])),g=s(y),v=s(h),b=new Set([g,v].filter(U=>!!U)),E=m.shapes.filter(U=>U.type==="bpmn:Participant"),M=(f.waypoints??[]).map(U=>({x:U.x,y:U.y})),B=kd(M,b,E);if(B<Pd)return"skip";if(t.has(f.id)){const U=r.get(f.id);if(U&&l(U,M)||B-(U?kd(U,b,a):0)<Pd)return"skip"}const A=w.get(y.id),L=w.get(h.id),H=m.edges.find(U=>U.id===f.id);if(!A||!L||!H)return"skip";const V=fn(m),G=new Set(Tt(H,V).map(U=>U.id)),ie=nr(m).filter(U=>U.owner!==f.id&&U.owner!==A.id&&U.owner!==L.id),pe=[...m.shapes.filter(U=>!U.container&&U.id!==A.id&&U.id!==L.id),...ie.map(U=>U.rect)],q=U=>dn({...H,waypoints:U}).some(de=>QA(de,pe)),Pe=tP(A,L,g?w.get(g):void 0,v?w.get(v):void 0,E),Te=U=>U.map((de,z)=>({pts:de,i:z,key:de.length*2+(q(de)?1:0)})).sort((de,z)=>de.key-z.key||de.i-z.i).map(de=>de.pts),ke=[...Te(Pe.inPools),...Te(Pe.outside)],ve=c();for(const U of ke){if(kd(U,b,E)>=Pd)continue;const de={...H,waypoints:U};if(Tt(de,V).some(he=>!G.has(he.id))||dn(de).some(he=>eP(he,m.shapes)||ie.some(se=>Wi(se.rect,he))))continue;o.updateWaypoints(f,U);const Q=c();if(Q.crossings<=ve.crossings&&Q.shared<=ve.shared&&[...Q.keys].every(he=>ve.keys.has(he)))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 Yi=[25,-25,40,-40],ka=35;function iP(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)-ka:Math.max(e.y+e.height,t.y+t.height)+ka,p=rP(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,oP]];for(const[f,y]of d)for(const h of[0,...Yi])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...Yi]){if(Math.abs(m)>=t.width/2-5)continue;const w=i+h,g=o+m,v=[{x:w,y:c},{x:w,y:f},{x:g,y:f},{x:g,y:l}];y&&Tt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:y+Math.abs(m)+Math.abs(h)})}}return r}const oP=45,fl=20;function rP(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(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,w)=>m.width*m.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),d=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...d.map(g=>g.y));for(let g=!0;g;){g=!1;for(const v of f)v.y<m&&v.y<l&&v.y+v.height>m-fl&&(m=v.y,g=!0)}const w=Math.max(u.y,...f.filter(g=>g.y+g.height<=m).map(g=>g.y+g.height));return m-w>=fl?Math.round((m+w)/2):null}let y=Math.max(...d.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const w of f)w.y+w.height>y&&w.y+w.height>l&&w.y<y+fl&&(y=w.y+w.height,m=!0)}const h=Math.min(u.y+u.height,...f.filter(m=>m.y>=y).map(m=>m.y));return h-y>=fl?Math.round((y+h)/2):null}function hl(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 iP(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-ka:n.y+n.height+ka,p=[];for(const g of[0,...Yi]){if(Math.abs(g)>=i.width/2-5)continue;const v=r+g;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(g)});for(const b of[0,...Yi]){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(g)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,y=s?n.y+n.height:n.y;for(const g of[0,...Yi]){if(Math.abs(g)>=n.width/2-5)continue;const v=a+g;p.push({pts:[{x:v,y},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(g)})}const h=60,m=s?i.y+i.height:i.y,w=s?i.y+i.height+ka:i.y-ka;for(const g of[0,...Yi]){if(Math.abs(g)>=i.width/2-5)continue;const v=r+g;for(const b of[0,...Yi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y},{x:E,y:w},{x:v,y:w},{x:v,y:m}],cost:h+Math.abs(g)+Math.abs(b)})}}return p}const Dd=30;function Wy(e,t){return Ld(e,t)<Dd}function Ld(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=He(o.y,r.y)&&!He(o.x,r.x),s=He(o.x,r.x)&&!He(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 gl=40;function aP(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-gl,a=o.x+o.width+gl,s=o.y-gl,c=o.y+o.height+gl;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 Uy(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=fn(t),r=t.edges.filter(M=>M.id!==e.id),a=qn(e,r),s=Tn(e,r),c=M=>aP(M,t.shapes,e.endpoints)+(Wy(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const B=M.x+M.width/2,A=M.y+M.height/2;return n.find(L=>L.type==="bpmn:Lane"&&B>=L.x&&B<=L.x+L.width&&A>=L.y&&A<=L.y+L.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,y=M=>{if(!f||!d)return!1;for(let B=1;B<M.length-2;B++){const A=M[B],L=M[B+1];if(He(A.y,L.y)&&!He(A.x,L.x)&&A.y>d.y&&A.y<d.y+d.height)return!0}return!1},h=y(e.waypoints),w=(M=>{if(!M)return;const B=M.x+M.width/2,A=M.y+M.height/2;return n.filter(L=>L.type==="bpmn:Participant"&&B>=L.x&&B<=L.x+L.width&&A>=L.y&&A<=L.y+L.height).sort((L,H)=>L.width*L.height-H.width*H.height)[0]})(i.get(e.endpoints[0]??"")),g=M=>{if(!w)return 0;let B=0;for(let A=1;A<M.length-1;A++){const L=M[A];(L.x<w.x||L.x>w.x+w.width||L.y<w.y||L.y>w.y+w.height)&&B++}return B},v=g(e.waypoints);if(!Wy(e.waypoints,n)&&!(f&&!h)&&v===0)return null;const b=M=>M.reduce((B,A,L)=>L?B+Math.abs(A.x-M[L-1].x)+Math.abs(A.y-M[L-1].y):0,0);let E;for(const{pts:M,cost:B}of hl(e,i)){const A={...e,waypoints:M};if(Tt(A,o).length>0||Zy(M,e,t))continue;const L=qn(A,r);if(L>a)continue;const H=g(M);if(H>v)continue;const V=H<v&&L===0;if(!V&&Tn(A,r)>s)continue;const G=c(M),ie=y(M);if(!V&&!(ie&&!h)&&G>=l)continue;const q=ie?0:1,Pe=b(M);(!E||H<E.out||H===E.out&&(q<E.lane||q===E.lane&&(L<E.opp||L===E.opp&&(G<E.sc||G===E.sc&&(B<E.cost||B===E.cost&&Pe<E.len)))))&&(E={pts:M,out:H,sc:G,lane:q,opp:L,cost:B,len:Pe})}return(E==null?void 0:E.pts)??null}function sP(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}const cP=1;function qy(e,t,n){if(t.type!=="bpmn:SequenceFlow"||e.length<3||!t.source)return null;const i=n.shapes.find(l=>l.id===t.source);if(!i||!i.type.endsWith("Gateway"))return null;const[o,r]=e,a=(l,u)=>Math.abs(l-u)<=cP,s=a(o.y,r.y)&&!a(o.x,r.x),c=a(o.x,r.x)&&!a(o.y,r.y);if(!s&&!c)return null;for(const l of n.edges){if(l.id===t.id||l.type!=="bpmn:SequenceFlow"||l.source!==t.source||l.waypoints.length!==2)continue;const[u,p]=l.waypoints;if(!(!a(u.x,o.x)||!a(u.y,o.y))&&(s&&a(u.y,p.y)&&Math.sign(p.x-u.x)===Math.sign(r.x-o.x)||c&&a(u.x,p.x)&&Math.sign(p.y-u.y)===Math.sign(r.y-o.y)))return l.id}return null}function lP(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o).edges.filter(s=>(!t.has(s.id)||n.has(s.id))&&s.waypoints.length>=4).map(s=>s.id).sort();for(const s of a){const c=Ge(o),l=c.edges.find(g=>g.id===s);if(!l||l.waypoints.length<4)continue;const u=fn(c),p=c.edges.filter(g=>g.id!==s),d=Tt(l,u).length,f=qn(l,p),y=Tn(l,p),h=n.has(s)?new Set(dt(c).map(ct)):null;if(l.waypoints.length>4){const g=o.get(s),v=g?ky(c,l,u,l.waypoints,Rs(g),i):null;if(g&&v&&v.length<l.waypoints.length){r.updateWaypoints(g,v);continue}}const m=ll(l,c.shapes);m.length===2&&sP(l,c)&&m.reverse();const w=[...m.filter(g=>!qy(g,l,c)),...m.filter(g=>qy(g,l,c))];for(const g of w){if(g.length>=l.waypoints.length)continue;const v={...l,waypoints:g};if(Tt(v,u).length>d||qn(v,p)>f||Tn(v,p)>y)continue;if(h){const E=new Set(dt({...c,edges:c.edges.map(A=>A.id===s?v:A)}).map(ct)),M=[...E].filter(A=>!h.has(A)).length,B=[...h].filter(A=>!E.has(A)).length;if(M>B)continue}const b=o.get(s);b&&r.updateWaypoints(b,g);break}}}function Yy(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=Uy(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Id(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=He(n[0].x,n[1].x)&&!He(n[0].y,n[1].y),s=He(n[n.length-1].x,n[n.length-2].x)&&!He(n[n.length-1].y,n[n.length-2].y);for(const c of Yi){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 Ky=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function uP(e,t,n){const i=e.waypoints;if(i.length<2||!Ky(e.type))return[];const o=i[0],r=i[1],a=He(o.y,r.y)&&!He(o.x,r.x),s=He(o.x,r.x)&&!He(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(y=>{if(!Ky(y.type)||y.type===e.type||y.waypoints.length<2)return!1;const h=y.waypoints[0],m=y.waypoints[1];return!He(h.x,o.x)||!He(h.y,o.y)?!1:a?He(h.y,m.y)&&Math.sign(m.x-h.x)===c:He(h.x,m.x)&&Math.sign(m.y-h.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(y,h)=>a?h>y.y+5&&h<y.y+y.height-5:h>y.x+5&&h<y.x+y.width-5,f=[];for(const y of Yi){const h=(a?o.y:o.x)+y;if(!d(u,h)||i.length===2&&(!p||!d(p,h)))continue;const m=i.map(w=>({...w}));for(const w of[m[0],m[1]])a?w.y=h:w.x=h;f.push({pts:m,cost:Math.abs(y)})}return f}function pP(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,y=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const w of[0,...Yi])Math.abs(w)<i.width/2-5&&m.push({pts:[{x:d,y:l},{x:u+w,y:l},{x:u+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&m.push({pts:[{x:c,y:f},{x:c,y:p+w},{x:y,y:p+w}],cost:Math.abs(w)});return m}const dP=[[1/2,0],[1/3,25],[2/3,25]],Xy=20;function fP(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 dP){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+Xy<=i.x&&s(n.x+n.width,i.x),i.x+i.width+Xy<=n.x&&s(n.x,i.x+i.width),a}const hP=1e3;function Bd(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=[],d=[n,i].filter(m=>/Gateway$/.test(m.type)),f=d.length?d[0].x+d[0].width/2:void 0,y=f!==void 0&&d.every(m=>Math.abs(m.x+m.width/2-f)<=.5)&&f>o&&f<r;y&&p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:0});const h=d.length?hP:0;for(const m of[0,...Yi]){const w=u+m;w<=o||w>=r||y&&Math.abs(w-f)<.5||p.push({pts:[{x:w,y:c},{x:w,y:l}],cost:Math.abs(m)+h})}return p}const Nd=2,gP=3;function Zy(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,Ao(e[a-1],e[a],i));if(o>Nd)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=>Fd(a,e)<=Nd);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)<=gP)&&Fd(c,e)<=Nd))return!0}}return!1}function Jy(e,t,n={}){const i=new Map(t.shapes.map(y=>[y.id,y])),o=fn(t),r=t.edges.filter(y=>y.id!==e.id),a=qn(e,r);if(a===0)return null;const s=Tn(e,r);let c;const l=y=>y.reduce((h,m,w)=>w?h+Math.abs(m.x-y[w-1].x)+Math.abs(m.y-y[w-1].y):0,0),u=3,p=y=>{const h=y[0],m=y[y.length-1],w=Math.hypot(m.x-h.x,m.y-h.y);return w>=1&&l(y)/w>=u?1:0},d=p(e.waypoints),f=[...hl(e,i),...Bd(e,i),...Id(e,i),...uP(e,r,i),...n.sideEntry?fP(e,i):[]];for(const{pts:y,cost:h}of f){const m={...e,waypoints:y};if(Tt(m,o).length>0||Zy(y,e,t))continue;const w=qn(m,r),g=Tn(m,r),v=a-w+(d-p(y));if(w>=a||g-s>v)continue;const b=l(y);(!c||w<c.opposite||w===c.opposite&&(g<c.cross||g===c.cross&&(h<c.cost||h===c.cost&&b<c.len)))&&(c={pts:y,opposite:w,cross:g,cost:h,len:b})}return(c==null?void 0:c.pts)??null}function Qy(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=tr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function mP(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=fn(t),o=t.edges.filter(d=>d.id!==e.id),r=Qy(e,o);if(r===0)return null;const a=qn(e,o),s=Tn(e,o),c=d=>d.reduce((f,y,h)=>h?f+Math.abs(y.x-d[h-1].x)+Math.abs(y.y-d[h-1].y):0,0),l=2;let u;const p=[...hl(e,n),...Bd(e,n),...pP(e,n),...Id(e,n)];for(const{pts:d,cost:f}of p){const y={...e,waypoints:d};if(Tt(y,i).length>0)continue;const h=Qy(y,o);if(h>=r)continue;const m=qn(y,o);if(m-h>a-r)continue;const w=Tn(y,o);if(w-s>(r-h)*l)continue;const g=c(d);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(f<u.cost||f===u.cost&&g<u.length))))&&(u={pts:d,fake:h,unreadable:m,cross:w,cost:f,length:g})}return(u==null?void 0:u.pts)??null}function ev(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=dt(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=mP(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function tv(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 nv(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=tr(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:tv(e,n)&&tv(t,n)}function iv(e,t,n){let i=0;for(const o of t)o.id!==e.id&&nv(e,o,n)&&i++;return i}function yP(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=fn(t),o=t.edges.filter(d=>d.id!==e.id),r=iv(e,o,n);if(r===0)return null;const a=qn(e,o),s=Tn(e,o),c=d=>d.reduce((f,y,h)=>h?f+Math.abs(y.x-d[h-1].x)+Math.abs(y.y-d[h-1].y):0,0),l=2;let u;const p=[...hl(e,n),...Bd(e,n),...Id(e,n)];for(const{pts:d,cost:f}of p){const y={...e,waypoints:d};if(Tt(y,i).length>0)continue;const h=iv(y,o,n);if(h>=r)continue;const m=qn(y,o);if(m-h>a-r)continue;const w=Tn(y,o);if(w-s>(r-h)*l)continue;const g=c(d);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(f<u.cost||f===u.cost&&g<u.length))))&&(u={pts:d,chain:h,unreadable:m,cross:w,cost:f,length:g})}return(u==null?void 0:u.pts)??null}function vP(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=dt(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||!nv(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(y=>y.id===l);if(!p)continue;const d=yP(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function ov(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=Ge(o),c=dt(s).filter(d=>vd(d)&&!t.has(ct(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(vd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(y=>y.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const y=u(d)==="bpmn:SequenceFlow"?0:1,h=u(f)==="bpmn:SequenceFlow"?0:1;return y!==h?y-h:d.localeCompare(f)});for(const d of p){const f=Ge(o),y=f.edges.find(w=>w.id===d);if(!y)continue;const h=Jy(y,f,{sideEntry:i.has(d)});if(!h)continue;const m=o.get(d);m&&(r.updateWaypoints(m,h),a.add(d))}return a}const xP=20;function bP(e,t){var l;const{elementRegistry:n}=e,i=e.modeling,o=new Set;let r=Ge(n),a=new Set(dt(r).map(ct));const s=new Map(r.shapes.map(u=>[u.id,u])),c=r.edges.filter(u=>u.type==="bpmn:MessageFlow"&&u.waypoints.length===2&&u.endpoints.length===2).map(u=>u.id);for(let u=0;u<c.length;u++)for(let p=u+1;p<c.length;p++){const d=r.edges.find(se=>se.id===c[u]),f=r.edges.find(se=>se.id===c[p]);if(d.endpoints[0]!==f.endpoints[1]||d.endpoints[1]!==f.endpoints[0]||t.has(d.id)&&t.has(f.id)||((l=tr(d,f))==null?void 0:l.kind)!=="opposite")continue;const y=d.endpoints.map(se=>s.get(se)).filter(se=>!!se);if(y.length!==2)continue;const[h,m]=d.waypoints,w=He(h.x,m.x),g=y.filter(se=>se.type!=="bpmn:Participant"),v=[...g.length?g:y].sort((se,Ae)=>w?se.y-Ae.y:se.x-Ae.x)[0],b=d.endpoints[0]===v.id?d:f,E=b===d?f:d,M=w?h.x:h.y,B=se=>y.every(Ae=>w?se>Ae.x+5&&se<Ae.x+Ae.width-5:se>Ae.y+5&&se<Ae.y+Ae.height-5),A=n.get(b.id),L=n.get(E.id);if(!A||!L)continue;const H=!t.has(b.id),V=!t.has(E.id),G=fn(r),ie=new Set([b,E].flatMap(se=>Tt(se,G).map(Ae=>Ae.id))),pe=new Set(Si(r).map(([se,Ae])=>`${se}|${Ae}`)),q=(se,Ae,j)=>{if(!Ae)return se;const C=M+Ae,R=se.waypoints.map(ge=>w?{x:C,y:ge.y}:{x:ge.x,y:C});if(!se.label)return{...se,waypoints:R};const Z=se.label,ne=w?{...Z,x:j<0?C-hn-Z.width:C+hn}:{...Z,y:j<0?C-hn-Z.height:C+hn};return{...se,waypoints:R,label:ne}},Pe=xP,Te=H?V?-Pe:-2*Pe:0,ke=V?H?Pe:2*Pe:0;if(Te&&!B(M+Te)||ke&&!B(M+ke))continue;const ve=q(b,Te,-1),U=q(E,ke,1);if([ve,U].some(se=>Tt(se,G).some(Ae=>!ie.has(Ae.id))))continue;const de={...r,edges:r.edges.map(se=>se.id===b.id?ve:se.id===E.id?U:se)};if(Si(de).some(([se,Ae])=>!pe.has(`${se}|${Ae}`)))continue;const z=dt(de),Q=new Set([Te?b.id:"",ke?E.id:""].filter(Boolean)),he=se=>/^(L|ls|l)\|/.test(se)&&Q.has(se.split("|")[1]);if(!z.some(se=>!a.has(ct(se))&&!he(ct(se)))){for(const[se,Ae,j]of[[A,b,ve],[L,E,U]])j!==Ae&&(i.updateWaypoints(se,j.waypoints.map(C=>({...C}))),se.label&&j.label&&i.moveElements([se.label],{x:j.label.x-se.label.x,y:j.label.y-se.label.y}),o.add(se.id));r=de,a=new Set(z.map(ct))}}return o}const wP=10,_P=(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 rv(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ma(e,i))return null;const o=fn(t),r=i.flatMap(dn);for(const a of dn(e)){let s=[[a.lo,a.hi]];for(const[f,y]of sl(a,r))s=s.flatMap(([h,m])=>{const w=[];return f>h&&w.push([h,Math.min(m,f)]),y<m&&w.push([Math.max(h,y),m]),w.filter(([g,v])=>v>g)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,y])=>y-f>=c+wP*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-py}:{x:a.at+hn+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(!Ma({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&_P(d,f)))return d}return null}const hn=8;function $d(e,t){const n=e.label;if(!n)return null;const i=dn(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,y=d.axis==="h"?r-d.at:o-d.at,h=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(y,h)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(dn),...t.shapes.filter(d=>d.container).flatMap(Aa)],l=d=>!c.some(f=>Wi(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+hn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+hn,s.at-hn-n.width])for(const f of p){const y=n.y+f;if(y<s.lo||y+n.height>s.hi)continue;const h={...n,x:d,y};if(l(h))return h}else for(const d of[s.at-hn-n.height,s.at+hn])for(const f of p){const y=n.x+f;if(y<s.lo||y+n.width>s.hi)continue;const h={...n,x:y,y:d};if(l(h))return h}return null}const av=30,Fd=(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},sv=(e,t)=>Fd({x:e.x+e.width/2,y:e.y+e.height/2},t);function cv(e,t){const n=e.label;if(!n)return null;const i=dn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(dn),...t.shapes.filter(c=>c.container).flatMap(Aa)],r=nr(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=>Wi(c,l))&&!Ta(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+hn,c.at-hn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+hn,c.at-hn-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 lv(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=Ge(i),a=new Set(dt(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 y=d.waypoints[0].x-p[0].x,h=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((B,A)=>B.x-p[A].x===y&&B.y-p[A].y===h))){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(G=>G.id===l);if(!(B!=null&&B.label)||!Ta(B.label,r).length&&!n.has(l))continue;let A={...B.label,x:u.label.x,y:u.label.y};if((Ta(A,r).length||sv(A,B.waypoints)>av)&&(A=null),!A&&sv(B.label,B.waypoints)>av&&(A=cv(B,r)),!A)continue;const L=A;if(L.x===f.x&&L.y===f.y)continue;const H={...r,edges:r.edges.map(G=>G.id===l?{...G,label:L}:G)},V=dt(H);if(V.some(G=>!a.has(ct(G))))continue;o.moveElements([f],{x:L.x-f.x,y:L.y-f.y}),r=H,a=new Set(V.map(ct));continue}const w=u.label.x+y-f.x,g=u.label.y+h-f.y;if(w===0&&g===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+w,y:v.label.y+g},E={...r,edges:r.edges.map(B=>B.id===l?{...B,label:b}:B)},M=dt(E);M.some(B=>!a.has(ct(B)))||(o.moveElements([f],{x:w,y:g}),r=E,a=new Set(M.map(ct)))}}function uv(e,t,n=new Set,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o);for(const s of a.edges){if(!s.label||t.has(s.id)&&!n.has(s.id))continue;const c=$d(s,a),l=i.has(s.id)&&Ta(c??s.label,a).length?cv(s,a)??c:c;if(!l)continue;const u=o.get(s.id),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function pv(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=dt(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=rv(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 jd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(dn),...t.shapes.filter(d=>d.container).flatMap(Aa)],o=i.filter(d=>Wi(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=nr(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=>Wi(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-hn-n.height},{...n,y:d.at+hn}):l.push({...n,x:d.at-hn-n.width},{...n,x:d.at+hn});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+hn},{...n,x:u-n.width/2,y:e.y-hn-n.height},{...n,x:e.x+e.width+hn,y:p-n.height/2},{...n,x:e.x-hn-n.width,y:p-n.height/2}),l.find(c)??null}function dv(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=jd(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 EP(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 fv(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(dt(o).map(ct));const a=[...new Set(dt(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,m]of u){const w=h?o.shapes.find(v=>v.id===h):void 0;if(!w)continue;const g=EP(w,l[m]);g.x===l[m].x&&g.y===l[m].y||(l[m]=g,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},f=dt(d);if(f.some(h=>!r.has(ct(h))))continue;const y=n.get(s);y&&(i.updateWaypoints(y,l),o=d,r=new Set(f.map(ct)))}}const Hd=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function hv(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 SP(e,t,n){const i=[],o=n?xs(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 hv(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(!Hd(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,y]of Object.entries(u))typeof y!="string"||y===""?(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 Mi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function RP(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(Hd(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=hv(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=Mi(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,y)=>Mi(f,"name",a(p[y])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=Mi(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,y)=>Mi(f,"name",a(p[y])))),s.push(d);break}case"node.add":s.push({...c,node:Mi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:Mi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:Mi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:Mi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:Mi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:Mi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(Mi(c,"text",a(l[0])));break;default:s.push(Hd(l[0].map)?Mi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const MP=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,gv=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),mv={"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}]},Cs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ml=e=>typeof e=="string"&&e!=="";function CP(e){const t=[];function n(i,o,r,a){if(a===null){ml(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!Cs(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)ml(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!Cs(i)||!ml(i.kind)||!(i.kind in mv)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of mv[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const y of p.slice(0,-1)){if(!Cs(d))break;d=d[y]}if(!Cs(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((y,h)=>n(o,`${u}[${h}]`,y,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;Cs(c)&&!ml(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"&&!Rm(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&&!Mm(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 yv(e,t,n={}){const i=CP(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,w){if(!MP.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{...w,opIndex:h})}e.forEach((h,m)=>{var w;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(g=>g.id)});for(const g of h.participant.lanes??[])s(m,g.id,{category:"lane"});break;case"node.add":s(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(m,h.dataStore.id,{category:"dataStore"});for(const g of h.associations??[])g.id&&s(m,g.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(w=h.association)!=null&&w.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(g=>g.id));for(const g of h.lanes)t.categoryOf(g.id)===void 0&&s(m,g.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,w,g){const v=c(m);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:w});return}if(g&&!g.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:m,role:w,expected:g.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),d=new Map;for(const h of e)h.kind==="node.add"?d.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&d.set(h.id,h.eventDefinition);const f=h=>d.has(h)?d.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,m)=>{var w,g;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=h.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,v,"participant",["participant"])===void 0)break;b!==void 0&&((((w=r.get(v))==null?void 0:w.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:m,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:E,name:M,condition:B}=h.flow,A=u(m,b,"source",["flowNode"]),L=u(m,E,"target",["flowNode"]);A&&L&&l(b)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:m,id:v}),M!==void 0&&B!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:E}=h.flow,M=u(m,b,"source",["flowNode","participant"]),B=u(m,E,"target",["flowNode","participant"]);if(M&&B){const A=l(b),L=l(E);A!==void 0&&A===L&&o.push({kind:"message-flow-same-pool",opIndex:m,id:v})}for(const A of[b,E])f(A)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:v,ref:A});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(M=>M===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:v.source,target:v.target});continue}const E=v.source===h.dataStore.id?v.target:v.source;u(m,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=h.association,E=u(m,v,"source"),M=u(m,b,"target");if(E&&M){const B=new Set([E,M]);B.has("dataStore")&&B.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:E}=h.association,M=u(m,b,"source"),B=u(m,E,"target");M&&B&&M!=="annotation"&&B!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:v??`${b}->${E}`});break}case"annotation.add":{if(h.association){const{source:v,target:b}=h.association;if(v!==h.annotation.id&&b!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const E=v===h.annotation.id?b:v;u(m,E,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const b=u(m,v,"member");b&&gv.has(b)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(y(m,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),b=h.lanes.map(A=>A.id);for(const A of v)b.includes(A)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:A});for(const A of b)t.categoryOf(A)!==void 0&&!v.includes(A)&&o.push({kind:"id-duplicate",opIndex:m,id:A});const E=b.filter(A=>v.includes(A)),M=A=>E.every((L,H)=>L===A[H]),B=(((g=t.laneDeclarationOrderOf)==null?void 0:g.call(t,h.id))??v).filter(A=>v.includes(A));E.length===v.length&&!M(v)&&!M(B)&&o.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(y(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(y(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,b=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),M=h.source??(E==null?void 0:E.source),B=h.target??(E==null?void 0:E.target);v&&b&&M!==void 0&&B!==void 0&&new Set([l(M),l(B),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":y(m,h.id,"messageFlow");break;case"dataStore.update":y(m,h.id,"dataStore");break;case"annotation.update":{if(y(m,h.id,"annotation")===void 0)break;h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.update":{if(y(m,h.id,"group")===void 0)break;for(const v of h.members??[]){const b=u(m,v,"member");b&&gv.has(b)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":y(m,h.id);break;case"element.remove":{y(m,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...SP(e,t,n.i18n)),o;function y(h,m,w){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const g=t.categoryOf(m);if(g===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(w&&g!==w){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:w,actual:g});return}return g}}const Gd=12,vv=14,AP=15,PP=100,TP=300,kP=30,OP=/[㐀-鿿]/,DP=1.1;function xv(e){let t=0;for(const n of e)OP.test(n)?t+=Gd:qC(n)?t+=Vr(n,Gd):t+=Vr(n,Gd)*DP;return t}const bv="­";function LP(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===bv)&&i.pop();break}return i[i.length-1]===bv&&(i[i.length-1]="-"),i.join("")}function IP(e,t,n){const i=Math.max(e.length*(n/t),1);return LP(e,i)||e.slice(0,Math.max(Math.round(i-1),1))}const wv=(e,t)=>e?t(e.replace(/\s+$/,"")):0;function BP(e,t,n=xv){const i=e.split(/­?\r?\n/),o=[];for(;i.length;){const r=i.shift();let a=r;for(;;){const s=wv(a,n);if(a===" "||a===""||s<Math.round(t)||a.length<2)break;a=IP(a,s,t)}a.length<r.length&&i.unshift(r.slice(a.length).trim()),o.push(a)}return o}function _v(e){const t=e.length?e:[""],n=Math.max(0,...t.flatMap(r=>r.split(/­?\r?\n/).map(a=>wv(a,xv)))),i=Math.max(PP,Math.min(TP,Math.floor(n)+1+vv)),o=Math.max(...t.map(r=>BP(r,i-vv).length));return{width:i,height:Math.max(kP,o*AP+10)}}const Ev="bwlExactAnnotationBounds",NP=500;class Sv{constructor(t){t.on("commandStack.shape.resize.preExecute",NP,({context:n})=>{var o,r;const i=(o=n==null?void 0:n.hints)==null?void 0:o[Ev];!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})})}}pn(Sv,"$inject",["eventBus"]);const Rv={__init__:["annotationExactResize"],annotationExactResize:["type",Sv]};function Mv(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 yl(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const vl={"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]},Ki=10,$P=300,FP=160,Cv=20,zd=100,Av=40,jP=10,HP=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Pv(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 xl=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function bl(e,t,n,i,o){const r=n,a=Pv(e,t,i),s=a??i,c=(ie,pe,q=s)=>{const[Pe,Te]=vl[ie];let ke={x:t.x+t.width/2+Pe*(t.width/2+r.width/2+pe),y:t.y+t.height/2+Te*(t.height/2+r.height/2+pe)};const ve=q.x+Ki+r.width/2,U=q.x+q.width-Ki-r.width/2,de=q.y+Ki+r.height/2,z=q.y+q.height-Ki-r.height/2,Q={x:Math.min(U,Math.max(ve,ke.x)),y:Math.min(z,Math.max(de,ke.y))};return(Q.x!==ke.x||Q.y!==ke.y)&&(ke=Math.abs(Q.x-(t.x+t.width/2))<(t.width+r.width)/2+Ki&&Math.abs(Q.y-(t.y+t.height/2))<(t.height+r.height)/2+Ki?{x:t.x+t.width+Ki+r.width/2,y:Q.y}:Q),ke},l=(i.children??[]).filter(ie=>!("waypoints"in ie&&ie.waypoints)&&ie.type!=="bpmn:Lane"&&ie.type!=="label"&&typeof ie.x=="number"&&ie.id!==o.selfId),u=Ge(e),p=ie=>{var q,Pe;if(!o.selfId)return!1;const pe=e.get(ie);return!!pe&&(((q=pe.source)==null?void 0:q.id)===o.selfId||((Pe=pe.target)==null?void 0:Pe.id)===o.selfId)},d=u.edges.filter(ie=>!p(ie.id)).flatMap(dn),f=nr(u).filter(ie=>ie.owner!==o.selfId).map(ie=>ie.rect),y=ie=>({x0:ie.x-r.width/2-Ki,x1:ie.x+r.width/2+Ki,y0:ie.y-r.height/2-Ki,y1:ie.y+r.height/2+Ki}),h=ie=>{const pe=y(ie);return l.some(q=>pe.x0<q.x+q.width&&pe.x1>q.x&&pe.y0<q.y+q.height&&pe.y1>q.y)},m=ie=>{const pe=y(ie);return d.some(q=>q.axis==="h"?q.at>pe.y0&&q.at<pe.y1&&q.lo<pe.x1&&q.hi>pe.x0:q.at>pe.x0&&q.at<pe.x1&&q.lo<pe.y1&&q.hi>pe.y0)},w=ie=>{const pe=y(ie);return f.some(q=>pe.x0<q.x+q.width&&pe.x1>q.x&&pe.y0<q.y+q.height&&pe.y1>q.y)},g=u.shapes.filter(ie=>ie.type==="bpmn:Group").flatMap(ie=>[{axis:"h",at:ie.y,lo:ie.x,hi:ie.x+ie.width},{axis:"h",at:ie.y+ie.height,lo:ie.x,hi:ie.x+ie.width},{axis:"v",at:ie.x,lo:ie.y,hi:ie.y+ie.height},{axis:"v",at:ie.x+ie.width,lo:ie.y,hi:ie.y+ie.height}]),v=ie=>{const pe=y(ie);return g.some(q=>q.axis==="h"?q.at>pe.y0&&q.at<pe.y1&&q.lo<pe.x1&&q.hi>pe.x0:q.at>pe.x0&&q.at<pe.x1&&q.lo<pe.y1&&q.hi>pe.y0)},b=ie=>h(ie)||m(ie)||w(ie)||v(ie),E=ie=>ie.x-r.width/2>=i.x&&ie.x+r.width/2<=i.x+i.width&&ie.y-r.height/2>=i.y&&ie.y+r.height/2<=i.y+i.height,M=ie=>E(ie)&&(!a||xl(ie,r,a)),B=ie=>ie.startsWith("top")?ie.replace(/^top/,"bottom"):ie.replace(/^bottom/,"top"),A=ie=>ie.endsWith("left")?ie.replace(/left$/,"right"):ie.replace(/right$/,"left"),L=o.placement.side,H=[L,B(L),A(L),B(A(L)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],V=o.placement.offset??50;let G=c(L,V);if(b(G)||a&&!xl(G,r,a)){const ie=(pe,q)=>{const Pe=new Set;for(const Te of H){if(Pe.has(Te))continue;Pe.add(Te);const ke=c(Te,V,pe);if(q(ke)&&!b(ke))return G=ke,!0}return!1};!ie(s,M)&&a&&ie(i,E)}return G}function Vt(e,t){return e.filter(n=>n.kind===t)}function Tv(e,t){const n=new Map,i=new Set(Vt(e,"node.add").map(s=>s.node.id)),o=Vt(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&&Vt(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 GP(e,t,n){const i=new Map,o=new Set;for(const g of e){const v=i.get(g.source)??[];v.push(g.target),i.set(g.source,v),o.add(g.target)}const r=[...e.map(g=>g.source).filter(g=>!o.has(g)),...t,...e.map(g=>g.source)],a=new Map,s=new Set,c=g=>{a.set(g,"open");for(const v of i.get(g)??[]){const b=a.get(v);b==="open"?s.add(`${g}>${v}`):b||c(v)}a.set(g,"done")};for(const g of r)a.has(g)||c(g);const l=(g,v)=>!s.has(`${g}>${v}`),u=[],p=new Set,d=g=>{p.add(g);for(const v of i.get(g)??[])l(g,v)&&!p.has(v)&&d(v);u.push(g)};for(const g of r)p.has(g)||d(g);const f=new Map;for(const g of u.reverse()){const v=f.get(g)??0;f.set(g,v);for(const b of i.get(g)??[])l(g,b)&&(f.get(b)??-1)<v+1&&f.set(b,v+1)}const y=new Map;for(const g of e){if(!l(g.source,g.target)||!n(g.target))continue;const v=y.get(g.target)??[];v.includes(g.source)||v.push(g.source),y.set(g.target,v)}const h=new Map,m=(g,v)=>{let b=h.get(g);if(!b){b=new Set([g]);const E=[g];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))}h.set(g,b)}return b.has(v)},w=new Set;for(const g of e){const v=y.get(g.target);if(!v||v.length<2||!v.includes(g.source))continue;const b=f.get(g.source)??0;v.some(E=>E!==g.source&&(f.get(E)??0)>=b+2&&m(g.source,E))&&w.add(g.id)}return w}class kv extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const Ov=new WeakMap;function zP(e){return Ov.get(e)??new Set}const Dv=new WeakMap;function VP(e,t){Dv.set(e,t)}const Lv=new WeakMap;function WP(e){return Lv.get(e)??[]}const Iv=new WeakMap;function UP(e){return Iv.get(e)??new Set}const Bv=new WeakMap;function qP(e){return Bv.get(e)??new Set}function Nv(e,t){var gR,mR,yR,vR,xR,bR,wR,_R,ER,SR,RR,MR,CR,AR,PR,TR,kR,OR,DR,LR,IR,BR,NR,$R,FR,jR,HR,GR,zR,VR,WR,UR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;Ov.set(t,u);const p=[];Lv.set(t,p);const d=new Set;Iv.set(t,d);const f=new Set;Bv.set(t,f);const y=()=>a.getRootElement(),h=x=>r.get(x),m=x=>{const _=h(x);if(!_)throw new Error(`하강 참조 해소 실패: ${x}`);return _},w=x=>{let _=x.parent;for(;_;){if(_.type==="bpmn:Participant")return _;_=_.parent}},g=(x,_)=>{if(!x)return;const S=_.x+_.width/2,k=_.y+_.height/2;let I;const T=$=>{for(const D of $.children??[])if(D.type==="bpmn:Lane"){const O=D;S>=O.x&&S<=O.x+O.width&&k>=O.y&&k<=O.y+O.height&&(I=O,T(O))}};return T(x),I},v=new Map;for(const x of r.filter(_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number"))v.set(x.id,{x:x.x,y:x.y});const b=Vt(e,"participant.add"),E=Vt(e,"node.add"),M=Vt(e,"sequenceFlow.add"),B=Vt(e,"messageFlow.add"),A=Vt(e,"dataStore.add"),L=Vt(e,"dataAssociation.add"),H=Vt(e,"annotation.add"),V=Vt(e,"group.add"),G=new Map(E.map(x=>[x.node.id,x])),ie=Tv(e,x=>{var _,S;return(S=(_=h(x))==null?void 0:_.source)==null?void 0:S.id}),pe=new Set([...ie.values()].map(x=>x.flow.id)),q=M.filter(x=>!pe.has(x.flow.id)),Pe=new Set([...ie.values()].map(x=>x.flow.target)),Te=x=>Vt(e,"sequenceFlow.update").filter(_=>_.target===x).length+(Pe.has(x)?1:0),ke=(x,_,S)=>{var D;const k=x.businessObject,I=(((D=k.extensionElements)==null?void 0:D.values)??[]).filter(O=>O.$type!==_),T=S?[...I,i.create(_,S)]:I;if(!T.length){k.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const $=i.create("bpmn:ExtensionElements",{values:T});T.forEach(O=>{O.$parent=$}),n.updateProperties(x,{extensionElements:$})},ve=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Vt(e,"element.remove")){const _=h(x.id);if(!_)continue;const S="waypoints"in _?[]:[..._.incoming??[],..._.outgoing??[]];n.removeElements([...S,_])}const U=x=>r.filter(_=>{var S;return _.type==="bpmn:Lane"&&((S=w(_))==null?void 0:S.id)===x}).sort((_,S)=>_.y-S.y),de=[];for(const x of Vt(e,"participant.update")){const _=m(x.id);if(x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),!x.lanes)continue;const S=U(x.id);if(!S.length){n.splitLane(_,x.lanes.length),U(x.id).forEach((T,$)=>{const D=x.lanes[$];D&&n.updateProperties(T,{id:D.id,name:D.name})}),de.push({pool:x.id,lanes:new Set(x.lanes.map(T=>T.id))});continue}const k=new Set(S.map(T=>T.id)),I=x.lanes.reduce((T,$,D)=>k.has($.id)?D:T,-1);x.lanes.forEach((T,$)=>{if(k.has(T.id)){n.updateProperties(m(T.id),{name:T.name});return}const D=$===I+1&&I>=0,O=$===0?n.addLane(U(x.id)[0],"top"):D?n.addLane(U(x.id).at(-1),"bottom"):n.addLane(m(x.lanes[$-1].id),"bottom");n.updateProperties(O,{id:T.id,name:T.name})})}const z=150,Q=130,he=80,se=90,Ae=180,j=30,C=30,R=10,Z=300,ne=5,ge=(x,_,S,k,I)=>{const T=S-_.width/2,$=k-_.height/2;return(x.children??[]).find(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="bpmn:Lane"&&D.type!=="label"&&!(I!=null&&I.has(D.id))&&typeof D.x=="number"&&T<D.x+D.width+C&&T+_.width+C>D.x&&$<D.y+D.height&&$+_.height>D.y)},$e=new Set;for(const x of b){$e.add(`pool:${x.participant.id}`);for(const _ of x.participant.lanes??[])$e.add(_.id)}const rt=new Map;for(const x of E){const _=x.node.lane??`pool:${x.node.participant??""}`;let S=rt.get(_);S||rt.set(_,S=new Set([0])),x.band!==void 0&&S.add(x.band)}const ut=new Map;for(const[x,_]of rt){if(!$e.has(x))continue;const S=[..._].sort((T,$)=>T-$),k=S.map((T,$)=>$===0?0:$%2===1?Math.ceil($/2):-($/2)),I=Math.min(...k);ut.set(x,new Map(S.map((T,$)=>[T,k[$]-I])))}{const x=new Map;for(const _ of b)(_.participant.lanes??[]).forEach((S,k)=>x.set(S.id,k));for(const[_,S]of ut){if(!x.has(_)||S.size<2)continue;const k=x.get(_),I=S.get(0)??0,T=new Set;for(const Y of E){if(Y.node.lane!==_||(Y.band??0)!==0||!Y.node.type.endsWith("Gateway"))continue;const re={in:new Set,out:new Set,cross:new Set};for(const J of q){const ee=J.flow.source===Y.node.id;if(!ee&&J.flow.target!==Y.node.id)continue;const ue=G.get(ee?J.flow.target:J.flow.source);if(!ue||ue.node.participant!==Y.node.participant||!ue.node.lane)continue;let ae,X=!1;if(ue.node.lane!==_){const fe=x.get(ue.node.lane);if(fe===void 0)continue;ae=fe>k?"down":"up",X=!0}else{const fe=S.get(ue.band??0)??I;ae=fe>I?"down":fe<I?"up":void 0}ae&&(re[ee?"out":"in"].add(ae),X&&re.cross.add(ae))}for(const J of["up","down"])re.in.has(J)&&re.out.has(J)&&re.cross.has(J)&&T.add(J)}if(T.size!==1)continue;const[$]=T,D=Math.max(...S.values()),O=$==="down"?D:0;if(I===O)continue;const F=[...S.entries()].filter(([Y])=>Y!==0).sort((Y,re)=>Y[1]-re[1]),N=[...Array(D+1).keys()].filter(Y=>Y!==O),W=new Map([[0,O]]);F.forEach(([Y],re)=>W.set(Y,N[re])),ut.set(_,W)}}const ln=x=>{var _;return(((_=rt.get(x))==null?void 0:_.size)??0)>1},bt=x=>x.band??(x.node.lane||!ln(`pool:${x.node.participant??""}`)?void 0:0),qt=new Map,Kt=x=>qt.get(x.node.id)??bt(x),Dn=new Set,Bt=new Set,an=new Set,zn=new Set,pa=new Set,ii=x=>H.some(_=>{var S,k;return(((S=_.placement)==null?void 0:S.anchor)??(_.association?_.association.source===_.annotation.id?_.association.target:_.association.source:void 0))===x&&((k=_.placement)==null?void 0:k.side.startsWith("bottom"))});{const x=new Map;for(const k of q)x.set(k.flow.target,(x.get(k.flow.target)??0)+1);const _=k=>{const I=[],T=new Set([k]),$=[k];for(;$.length;){const D=$.shift();I.push(D);for(const O of q)O.flow.source!==D||T.has(O.flow.target)||(x.get(O.flow.target)??0)!==1||(T.add(O.flow.target),$.push(O.flow.target))}return I},S=(k,I)=>{var T;return((T=ut.get(k))==null?void 0:T.get(I))??I};for(const k of E){if(!k.node.type.endsWith("Gateway"))continue;const I=k.node.lane??`pool:${k.node.participant??""}`,T=ut.get(I);if(!T||T.size<2)continue;const $=Kt(k);if($===void 0||S(I,$)!==S(I,0))continue;const D=S(I,$),O=q.filter(J=>J.flow.source===k.node.id).map(J=>G.get(J.flow.target)).filter(J=>!!J&&(J.node.lane??`pool:${J.node.participant??""}`)===I),F=O.filter(J=>{const ee=Kt(J);return ee!==void 0&&S(I,ee)===D&&(x.get(J.node.id)??0)===1}),N=O.some(J=>{const ee=Kt(J);return ee!==void 0&&S(I,ee)>D});if(F.length!==1||!N)continue;const W=new Set(O.flatMap(J=>_(J.node.id)));if(!q.some(J=>J.flow.target===k.node.id&&W.has(J.flow.source)))continue;const re=new Map;for(const[J,ee]of T)re.set(J,ee+1);re.set(-1,0),ut.set(I,re);for(const J of _(F[0].node.id))G.has(J)&&(qt.set(J,-1),Bt.add(J));Dn.add(k.node.id)}}{const x=N=>N.node.lane??`pool:${N.node.participant??""}`,_=N=>Kt(N)??0,S=new Map(b.map((N,W)=>({id:N.participant.id,order:N.order??Number.POSITIVE_INFINITY,declared:W})).sort((N,W)=>N.order!==W.order?N.order-W.order:N.declared-W.declared).map((N,W)=>[N.id,W])),k=N=>N===void 0?void 0:S.get(N)??-1,I=N=>{var re;const W=G.get(N);if(W)return W.node.participant;if(S.has(N))return N;const Y=h(N);if(Y)return Y.type==="bpmn:Participant"?Y.id:(re=w(Y))==null?void 0:re.id},T=new Map;for(const N of q)T.set(N.flow.target,(T.get(N.flow.target)??0)+1);const $=N=>{const W=[N],Y=new Set([N.node.id]);for(let re=0;re<W.length;re++)for(const J of q){if(J.flow.source!==W[re].node.id||Y.has(J.flow.target)||(T.get(J.flow.target)??0)!==1)continue;const ee=G.get(J.flow.target);!ee||ee.node.participant!==N.node.participant||(Y.add(ee.node.id),W.push(ee))}return W},D=N=>{const W=new Set(N.map(J=>J.node.id)),Y=k(N[0].node.participant);if(Y===void 0)return;const re=new Set;for(const J of B){const ee=W.has(J.flow.source)?J.flow.target:W.has(J.flow.target)?J.flow.source:void 0;if(ee===void 0)continue;const ue=k(I(ee));ue===void 0||ue===Y||re.add(ue<Y?"up":"down")}return re.size===1?[...re][0]:void 0},O=new Map;{const N=new Map;for(const ee of q){if(!G.has(ee.flow.source)||!G.has(ee.flow.target))continue;const ue=N.get(ee.flow.source)??[];ue.push(ee.flow.target),N.set(ee.flow.source,ue)}const W=new Map,Y=[],re=new Set,J=ee=>{W.set(ee,"open");for(const ue of N.get(ee)??[]){const ae=W.get(ue);ae==="open"?re.add(`${ee}>${ue}`):ae||J(ue)}W.set(ee,"done"),Y.push(ee)};for(const ee of E)W.has(ee.node.id)||J(ee.node.id);for(const ee of Y.reverse()){const ue=O.get(ee)??0;O.set(ee,ue);for(const ae of N.get(ee)??[])!re.has(`${ee}>${ae}`)&&(O.get(ae)??-1)<ue+1&&O.set(ae,ue+1)}}let F=-1e3;for(const N of E){if(!N.node.type.endsWith("Gateway"))continue;const W=x(N),Y=ut.get(W);if(!Y)continue;const re=Y.get(_(N))??0,J=X=>(Y.get(_(X))??0)-re,ee=q.filter(X=>X.flow.source===N.node.id).map(X=>G.get(X.flow.target)).filter(X=>!!X&&x(X)===W&&(T.get(X.node.id)??0)===1&&!Bt.has(X.node.id)).map(X=>{const fe=$(X);return{root:X,subtree:fe,dir:D(fe)}});if(ee.some(X=>X.dir==="up")&&ee.some(X=>X.dir==="down"))continue;const ue=q.some(X=>{const fe=X.flow.source===N.node.id?G.get(X.flow.target):void 0;return!!fe&&x(fe)===W&&J(fe)===0});let ae=!1;if(!ue){const X=q.filter(xe=>xe.flow.source===N.node.id).map(xe=>G.get(xe.flow.target)).filter(xe=>!!xe&&x(xe)===W&&(!!xe.node.lane||bt(xe)!==void 0)&&J(xe)<0),fe=X.length?Math.max(...X.map(J)):void 0,ye=X.filter(xe=>J(xe)===fe);if(!ii(N.node.id)&&ye.length===1&&(T.get(ye[0].node.id)??0)===1&&!Dn.has(N.node.id))continue;ae=!0}for(const X of ee){const fe=X.dir;if(!fe||ee.some(Re=>Re!==X&&Re.dir===fe))continue;const ye=J(X.root);if(ye===0||(fe==="up"?ye<0:ye>0)||q.some(Re=>{const Me=Re.flow.target===N.node.id?G.get(Re.flow.source):void 0;if(!Me||x(Me)!==W)return!1;const Ye=J(Me);return fe==="up"?Ye<0:Ye>0}))continue;const xe=[...Y].map(([Re,Me])=>({band:Re,rel:Me-re})).filter(Re=>fe==="up"?Re.rel<0:Re.rel>0).sort((Re,Me)=>Math.abs(Me.rel)-Math.abs(Re.rel));if(!xe.length&&fe==="down")continue;const me=_(X.root),_e=X.subtree.filter(Re=>x(Re)===W&&_(Re)===me),De=new Set(X.subtree.map(Re=>Re.node.id)),Fe=_e.map(Re=>O.get(Re.node.id)??0),Ie=Math.min(...Fe)-1,Ve=Math.max(...Fe)+1,Se=Re=>!E.some(Me=>{if(De.has(Me.node.id)||x(Me)!==W||_(Me)!==Re)return!1;if(!an.has(Re))return!0;const Ye=O.get(Me.node.id)??0;return Ye>=Ie&&Ye<=Ve});let ce=ae?_(N):(gR=xe.find(Re=>Se(Re.band)))==null?void 0:gR.band;if(ce===void 0){if(ce=F--,an.add(ce),fe==="up"){const Re=new Map;for(const[Me,Ye]of Y)Re.set(Me,Ye+1);Re.set(ce,0),ut.set(W,Re)}else Y.set(ce,Math.max(...Y.values())+1);(mR=rt.get(W))==null||mR.add(ce)}for(const Re of _e)qt.set(Re.node.id,ce)}}{const N=ee=>{const ue=q.find(ae=>ae.flow.target===ee.node.id);return ue?G.get(ue.flow.source):void 0},W=ee=>{const ue=N(ee);if(!ue||!ue.node.type.endsWith("Gateway")||x(ue)!==x(ee))return!1;const ae=ut.get(x(ue));if(!ae)return!1;const X=ae.get(_(ue))??0,fe=_e=>x(_e)===x(ue)?(ae.get(_(_e))??0)-X:Number.NaN,ye=q.filter(_e=>_e.flow.source===ue.node.id).map(_e=>G.get(_e.flow.target)).filter(_e=>!!_e&&(!!_e.node.lane||bt(_e)!==void 0));if(ye.some(_e=>fe(_e)===0))return!1;const oe=ye.filter(_e=>_e.node.lane===ue.node.lane&&fe(_e)<0);if(!oe.length)return!1;const xe=Math.max(...oe.map(fe)),me=oe.filter(_e=>fe(_e)===xe);return me.length===1&&me[0]===ee&&(T.get(ee.node.id)??0)===1&&!ii(ue.node.id)&&!Dn.has(ue.node.id)},Y=new Set;for(const ee of E){if(!ee.node.type.endsWith("Gateway")||ii(ee.node.id))continue;const ue=ut.get(x(ee));if(!ue)continue;const ae=ue.get(_(ee))??0;let X;for(const fe of q){if(fe.flow.source!==ee.node.id)continue;const ye=G.get(fe.flow.target);if(!ye||x(ye)!==x(ee)||!ye.node.lane&&bt(ye)===void 0)continue;const oe=ue.get(_(ye))??0;oe<=ae||(!X||oe>X.row?X={id:ye.node.id,row:oe,count:1}:oe===X.row&&X.count++)}X&&X.count===1&&(T.get(X.id)??0)===1&&Y.add(X.id)}const re=new Set,J=[...E].sort((ee,ue)=>Number(Y.has(ee.node.id))-Number(Y.has(ue.node.id)));for(const ee of J){const ue=x(ee),ae=ut.get(ue);if(!ae)continue;const X=ee.node.id,fe=B.filter(Ue=>Ue.flow.target===X);if(fe.length!==1||!(T.get(X)??0)||!ee.node.lane&&bt(ee)===void 0||Bt.has(X)||zn.has(X))continue;const ye=(yR=G.get(fe[0].flow.source))==null?void 0:yR.node.participant;if(!ye||ye===ee.node.participant)continue;const oe=k(ee.node.participant),xe=k(ye);if(oe===void 0||xe===void 0||oe===xe)continue;const me=xe<oe,_e=ae.get(0)??0,De=(ae.get(_(ee))??_e)-_e;if(De===0||(me?De<0:De>0)||W(ee))continue;let Fe;for(const[Ue,at]of ae){if(an.has(Ue))continue;const Be=at-_e;(me?Be<0&&(!Fe||Be<Fe.row):Be>0&&(!Fe||Be>Fe.row))&&(Fe={band:Ue,row:Be})}if(!Fe)continue;const Ie=_(ee),Ve=$(ee).filter(Ue=>x(Ue)===ue&&_(Ue)===Ie&&!Bt.has(Ue.node.id)),Se=N(ee),ce=Se!=null&&Se.node.type.endsWith("Gateway")?`${Se.node.id}|${ue}|${Fe.band}`:void 0,Re=Fe,Me=!!ce&&Y.has(X)&&q.some(Ue=>{if(Ue.flow.source!==Se.node.id||Ue.flow.target===X)return!1;const at=G.get(Ue.flow.target);return!!at&&x(at)===ue&&!Ve.includes(at)&&_(at)===Re.band});let Ye=Fe.band;if(ce&&(re.has(ce)||Me)){if(Ye=F--,an.add(Ye),me){const Ue=new Map;for(const[at,Be]of ae)Ue.set(at,Be+1);Ue.set(Ye,0),ut.set(ue,Ue)}else ae.set(Ye,Math.max(...ae.values())+1);(vR=rt.get(ue))==null||vR.add(Ye)}ce&&re.add(ce);for(const Ue of Ve)qt.set(Ue.node.id,Ye),zn.add(Ue.node.id);me&&Y.has(X)&&pa.add(X)}}}const Ln=(x,_)=>{var S;return((S=ut.get(x))==null?void 0:S.get(_))??_},In=(x,_,S,k)=>{const I=x?h(x):_?h(_):void 0;if(!I)return!1;const T=x?I.y+Math.min(I.height/2,se):I.y+he;return Math.abs(T+Ln(x??`pool:${_??""}`,S)*z-k)<=z/2},un=new Map;for(const[x,_]of rt){let S=0;for(const k of _)S=Math.max(S,Ln(x,k));un.set(x,S)}const bo=x=>Ae+z*x,Fi=(x,_,S,k)=>{const I=y().children.filter(T=>!("waypoints"in T&&T.waypoints)&&T.type!=="label"&&T.id!==_&&!(k!=null&&k.has(T.id))&&typeof T.y=="number"&&T.y>=x);I.length&&n.moveElements(I,{x:0,y:S})},mi=(x,_,S)=>{const k=x.type==="bpmn:Participant"?x:void 0;if(!k||k.children.some(D=>D.type==="bpmn:Lane"))return;const I=S+_.height/2+j-k.y;if(k.height>=I)return;const T=I-k.height,$=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:I}),Fi($,k.id,T)},St=(x,_,S)=>{const k=_-x.height;if(k<=0)return new Set;const I=w(x)??x,T=[],$=F=>{if(!(S!=null&&S.has(F.id))){T.push(F);for(const N of F.children??[])$(N)}};$(I);const D=x.y+x.height-10,O=l.calculateAdjustments(T,"y",k,D);return l.makeSpace(O.movingShapes,O.resizingShapes,{x:0,y:k},"s",D),new Set(O.movingShapes.map(F=>F.id))},Pt=(x,_,S)=>{if(x){const $=m(x),D=bo(_);if($.height>=D)return;const O=D-$.height,F=w($),N=F?F.y+F.height:$.y+$.height,W=St($,D);Fi(N,F==null?void 0:F.id,O,W);return}if(!S)return;const k=z*(_+1);if(S.height>=k)return;const I=k-S.height,T=S.y+S.height;n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:k}),Fi(T,S.id,I)},em=new Map;for(const x of q)em.set(x.flow.target,(em.get(x.flow.target)??0)+1);const I1=x=>(em.get(x)??0)<=1,g6=new Set(E.map(x=>x.node.id).filter(x=>Te(x)===1&&!q.some(_=>_.flow.target===x||_.flow.source===x&&G.has(_.flow.target)))),tm=new Map,nm=(x,_)=>{if(!x)return;const S=h(x);if(!S||S.height>=bo(_))return;const k=S.y+S.height-10,I=w(S);if(I)return new Set((I.children??[]).filter(T=>T.type!=="bpmn:Lane"&&typeof T.y=="number"&&T.y>k).map(T=>T.id))},Lp=(x,_,S)=>{if(!x)return!0;const k=h(x);return k?S-_.height/2>=k.y&&S+_.height/2<=k.y+k.height:!0},m6=10,y6=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:_}of de){const S=h(x),k=U(x);if(!S||k.length<2)continue;const I=bo(0),T=m6,$=new Set(Vt(e,"node.update").filter(oe=>oe.lane!==void 0&&_.has(oe.lane)).map(oe=>oe.id)),D=S.children??[],O=D.filter(oe=>!("waypoints"in oe&&oe.waypoints)&&oe.type!=="bpmn:Lane"&&oe.type!=="label"&&typeof oe.y=="number"),F=[];for(const oe of O){F.push([oe.y,oe.y+oe.height]);const xe=oe.label;xe&&F.push([xe.y,xe.y+xe.height])}for(const oe of D){const xe="waypoints"in oe&&oe.waypoints?oe.label:void 0;xe&&xe.y+xe.height>S.y&&xe.y<S.y+S.height&&F.push([xe.y,xe.y+xe.height])}for(const oe of y().children){if(oe.type!=="bpmn:TextAnnotation")continue;const xe=oe;xe.x<S.x+S.width&&xe.x+xe.width>S.x&&xe.y<S.y+S.height&&xe.y+xe.height>S.y&&F.push([xe.y,xe.y+xe.height])}F.sort((oe,xe)=>oe[0]-xe[0]);const N=S.y,W=S.y+S.height,Y=[];let re=N;for(const[oe,xe]of F)oe>re&&Y.push([re,oe]),re=Math.max(re,xe);const J=O.filter(oe=>y6.test(oe.type)&&!$.has(oe.id)),ee=(oe,xe)=>J.some(me=>me.y+me.height/2>=oe&&me.y+me.height/2<=xe),ue=oe=>F.some(([xe,me])=>xe<oe-.5&&oe+.5<me),ae=[];let X=N;for(const oe of k.slice(1).map(xe=>xe.y)){const xe=X+2*T,me=!ue(oe)&&oe>=xe&&oe<=W-2*T?[oe]:[];for(const[De,Fe]of Y){const Ie=Math.max(De+T,xe),Ve=Math.min(Fe-T,W-2*T);Ie<=Ve&&me.push(Math.min(Math.max(oe,Ie),Ve))}me.push(Math.max(re+T,xe));let _e;for(const De of me){const Fe=!ee(X,De)&&De-X<I?O.filter(Se=>Se.y>=De).length:0,Ie=Math.abs(De-oe),Ve=_e?Math.abs(_e.y-oe):0;(!_e||Fe<_e.cost||Fe===_e.cost&&(Ie<Ve||Ie===Ve&&De>_e.y))&&(_e={y:De,cost:Fe})}ae.push(_e.y),X=_e.y}const fe=ae[ae.length-1]+2*T-W;fe>0&&(n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+fe}),Fi(W,S.id,fe));const ye=[N,...ae,S.y+S.height];k.forEach((oe,xe)=>{const me=ye[xe],_e=ye[xe+1]-me;(oe.y!==me||oe.height!==_e)&&n.resizeShape(oe,{x:oe.x,y:me,width:oe.width,height:_e})});for(const oe of k){if(oe.height>=I||ee(oe.y,oe.y+oe.height))continue;const xe=I-oe.height,me=S.y+S.height,_e=St(oe,I);Fi(me,S.id,xe,_e)}}const Ip=b.map((x,_)=>({op:x,declared:_}));Ip.sort((x,_)=>{const S=x.op.order??Number.POSITIVE_INFINITY,k=_.op.order??Number.POSITIVE_INFINITY;return S!==k?S-k:x.declared-_.declared});let Bc=80;for(const x of r.getAll())x.parent===y()&&"height"in x&&typeof x.y=="number"&&(Bc=Math.max(Bc,x.y+x.height+60));const im=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===y()),v6=(()=>{if(!im.length)return;const x=im.filter(I=>!Vd(I)),_=x.length?x:im,S=Math.min(..._.map(I=>I.x)),k=Math.max(..._.map(I=>I.x+I.width));return k>S?{x:S,width:k-S}:void 0})();for(const{op:x}of Ip){const _=x.participant,S=E.filter(ee=>ee.node.participant===_.id).length,k=((xR=_.lanes)==null?void 0:xR.length)??0,I=Math.max($v,S*160+300),T=(_.lanes??[]).map(ee=>bo(un.get(ee.id)??0)),$=T.reduce((ee,ue)=>ee+ue,0);k&&$<300&&(T[k-1]+=300-$);const D=Math.max(300,z*((un.get(`pool:${_.id}`)??0)+1)),O=_.blackBox||S+k===0?120:k?Math.max(300,$):D,F=_.blackBox?v6:void 0,N=(F==null?void 0:F.x)??100,W=(F==null?void 0:F.width)??I,Y=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:_.id,name:_.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},..._.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:W,height:O,isExpanded:!0}),re=n.createShape(Y,{x:N+W/2,y:Bc+O/2},y()),J=_.lanes??[];if(J.length&&n.splitLane(re,J.length),J.length){const ee=r.filter(ue=>{var ae;return ue.type==="bpmn:Lane"&&((ae=w(ue))==null?void 0:ae.id)===_.id}).sort((ue,ae)=>ue.y-ae.y);if(ee.forEach((ue,ae)=>{const X=J[ae];X&&n.updateProperties(ue,{id:X.id,name:X.name})}),T.some(ue=>ue!==re.height/k)){let ue=re.y;ee.forEach((ae,X)=>{const fe=T[X];n.resizeShape(ae,{x:ae.x,y:ue,width:ae.width,height:fe}),ue+=fe})}}Bc=re.y+re.height+60}const x6=x=>{var k;const _=G.get(x);if(_)return _.node.participant??"";const S=h(x);return S?S.type==="bpmn:Participant"?S.id:((k=w(S))==null?void 0:k.id)??"":""},Nc=new Map,B1=x=>{let _=Nc.get(x);return _||Nc.set(x,_={nodes:[],flows:[]}),_};for(const x of E)B1(x.node.participant??"").nodes.push(x);for(const x of q)B1(x6(x.flow.source)).flows.push(x);const Bp=x=>{var _;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((_=x.condition)==null?void 0:_.label)})},om=(x,_,S)=>o.createShape({type:yl(x.type),...x.eventDefinition?{eventDefinitionType:Uc[x.eventDefinition]}:{},businessObject:i.create(yl(x.type),{id:x.id,name:x.name,..._!==void 0?{"bwl:band":_}:{},...S!==void 0?{"bwl:afterColumn":S}:{}})}),b6=[...Ip.map(({op:x})=>x.participant.id).filter(x=>Nc.has(x)),...[...Nc.keys()].filter(x=>!b.some(_=>_.participant.id===x))],rm=x=>x.endsWith("Gateway");for(const x of b6){const _=Nc.get(x),S=x?m(x):void 0,k=S?S.x+150:250;let I=S?S.y+80:120;const T=(me,_e,De)=>{if(me){const Fe=m(me);return Fe.y+Math.min(Fe.height/2,se)+Ln(me,_e??0)*z}return _e!==void 0&&S?S.y+he+Ln(`pool:${x}`,_e)*z:De},$=(me,_e,De)=>{if(me){const Fe=m(me);return Fe.y+Math.min(Fe.height/2,se)+_e*z}return S?S.y+he+_e*z:De},D=me=>me.participant?m(me.participant):y(),O=new Set,F=(me,_e,De,Fe,Ie,Ve,Se,ce,Re)=>{const Me=De!==void 0||Fe!==void 0,Ye=Je=>{const mt=()=>Pt(De,Je,S);ce?ce(mt):mt()},Ue=Ln(De??`pool:${x}`,Fe??0);if((Fe===void 0||Re||In(De,x,Fe,Se??Number.NaN))&&Se!==void 0&&Lp(De,_e,Se)&&!ge(me,_e,Ie,Se))return Re&&Fe!==void 0&&!In(De,x,Fe,Se)&&O.add(_e.id),{x:Ie,y:Se};if(Me)for(let Je=0;Je<4;Je++){const mt=$(De,Ue+Je,Ve);if(!ge(me,_e,Ie,mt,nm(De,Ue+Je)))return Ye(Ue+Je),Je>0&&O.add(_e.id),{x:Ie,y:mt}}const at=T(De,Fe,Ve);Me?Ye(Ue):ce?ce(()=>mi(me,_e,_e.y+_e.height/2)):mi(me,_e,at);let Be=Ie;for(let Je=0;Je<64;Je++){const mt=ge(me,_e,Be,at);if(!mt)break;Be=mt.x+mt.width+Q+_e.width/2}return{x:Be,y:at}},N=(me,_e,De)=>{const Fe=r.getAll().filter(Ve=>{var Se;return/Association$/.test(Ve.type)&&(((Se=Ve.waypoints)==null?void 0:Se.length)??0)>=2});if(!Fe.length)return De;const Ie=Ve=>{const Se={id:_e.id,type:_e.type,x:Ve-_e.width/2,y:De.y-_e.height/2,width:_e.width,height:_e.height};return Fe.some(ce=>ce.waypoints.some((Re,Me)=>!!ce.waypoints[Me+1]&&Ao(Re,ce.waypoints[Me+1],Se)<=R))};if(!Ie(De.x))return De;for(let Ve=ne;Ve<=Z;Ve+=ne){const Se=De.x+Ve;if(!Ie(Se)&&!ge(me,_e,Se,De.y))return{x:Se,y:De.y}}return De},W=(me,_e,De,Fe,Ie)=>{var Be;const Ve=Ln(Fe??`pool:${x}`,Ie??0),Se=$(Fe,Ve,Number.NaN);if(Number.isNaN(Se))return;const ce=ge(me,_e,De,Se,nm(Fe,Ve));if(!ce||!G.has(ce.id)||ce.type!=="bpmn:EndEvent")return;const Re=Je=>(Je??[]).filter(mt=>mt.type==="bpmn:SequenceFlow"),Me=Re(ce.incoming);if(Re(ce.outgoing).length||Me.length>1)return;const Ye=ce.y+ce.height/2;if(Math.abs(Ye-Se)>1)return;const Ue=(Be=Me[0])==null?void 0:Be.source;if(!Ue||typeof Ue.x!="number"||ce.x-(Ue.x+Ue.width)>Q)return;const at=$(Fe,Ve+1,Number.NaN);Number.isNaN(at)||ge(me,ce,ce.x+ce.width/2,at,new Set([ce.id]))||(Pt(Fe,Ve+1,S),n.moveShape(ce,{x:0,y:at-Ye}))},Y=new Set(_.flows.map(me=>me.flow.target)),re=new Map,J=me=>{if(me===void 0)return;const _e=r.get(me);if(!(!_e||typeof _e.x!="number"||typeof _e.width!="number"))return _e.x+_e.width+Q},ee=me=>{if(Te(me)>0)return;const _e=_.flows.filter(Fe=>Fe.flow.source===me);if(_e.length!==1)return;const De=r.get(_e[0].flow.target);return De&&typeof De.y=="number"&&typeof De.height=="number"?De.y+De.height/2:void 0};for(const me of _.nodes){if(Y.has(me.node.id))continue;const _e=om(me.node,me.band,me.afterColumn),De=bt(me),Fe=me.node.lane?`${me.node.lane}|${De??""}`:De!==void 0?`band:${De}`:"",Ie=D(me.node),Ve=re.get(Fe)??k,Se=J(me.afterColumn),ce=Se===void 0?Ve:Math.max(Ve,Se);let Re;const Me=F(Ie,_e,me.node.lane,De,ce,I,ee(me.node.id),g6.has(me.node.id)&&me.node.participant!==void 0?Ye=>Re=Ye:void 0);if(Re?n.createShape(_e,Me,Ie,{autoResize:!1}):n.createShape(_e,Me,Ie),Re){const Ye=me.node.lane?m(me.node.lane):Ie;tm.set(me.node.id,{container:Ye,relCy:Me.y-Ye.y,grow:Re})}re.set(Fe,Me.x+_e.width+Q),!me.node.lane&&De===void 0&&(I+=160)}const ue=new Set,ae=new Map,X=new Map;if(x&&$e.has(`pool:${x}`)){const me=new Map;for(const ce of _.flows)me.set(ce.flow.target,(me.get(ce.flow.target)??0)+1);const _e=ce=>T(ce.node.lane,Kt(ce),Number.NaN),De=new Set,Fe=ce=>{var Ye;const Re=(Ye=G.get(ce))==null?void 0:Ye.node.participant;if(Re)return h(Re);const Me=h(ce);if(Me)return Me.type==="bpmn:Participant"?Me:w(Me)},Ie=ce=>{const Re=[],Me=new Set([ce]),Ye=[ce];for(;Ye.length;){const Ue=Ye.shift(),at=G.get(Ue);at&&Re.push(at);for(const Be of _.flows)Be.flow.source!==Ue||Me.has(Be.flow.target)||(me.get(Be.flow.target)??0)!==1||(Me.add(Be.flow.target),Ye.push(Be.flow.target))}return Re},Ve=ce=>{if(!S)return;const Re=new Set(ce.map(Ue=>Ue.node.id));let Me=!1,Ye=!1;for(const Ue of B){if(!Re.has(Ue.flow.source))continue;const at=Fe(Ue.flow.target);!at||at.id===S.id||(at.y<S.y?Me=!0:Ye=!0)}return Me&&!Ye?"up":Ye&&!Me?"down":void 0};for(const ce of _.nodes){if(!rm(ce.node.type))continue;const Re=T(ce.node.lane,bt(ce),Number.NaN);if(Number.isNaN(Re))continue;const Me=[];for(const Be of _.flows){if(Be.flow.source!==ce.node.id)continue;const Je=G.get(Be.flow.target);if(!Je||Je.node.lane!==ce.node.lane||(me.get(Je.node.id)??0)!==1)continue;const mt=bt(Je);if(mt===void 0)continue;const Lt=T(Je.node.lane,mt,Number.NaN);if(Number.isNaN(Lt))continue;const zi=Ie(Je.node.id),sn=Ve(zi);sn&&Me.push({subtree:zi,band:mt,row:Lt,dir:sn})}if(!Me.some(Be=>Be.dir==="up")||!Me.some(Be=>Be.dir==="down")||!Me.some(Be=>Be.dir==="up"&&Me.some(Je=>Je.dir==="down"&&Je.row<Be.row)))continue;const Ue=[...Me].sort((Be,Je)=>Be.row-Je.row);[...Me.filter(Be=>Be.dir==="up"),...Me.filter(Be=>Be.dir==="down")].sort((Be,Je)=>Be.dir===Je.dir?Be.row-Je.row:Be.dir==="up"?-1:1).forEach((Be,Je)=>{const mt=Ue[Je].band;if(mt!==Be.band){De.add(ce.node.id);for(const Lt of Be.subtree)bt(Lt)===Be.band&&qt.set(Lt.node.id,mt)}})}const Se=ce=>{if(!S)return;const Re=new Set(ce.map(Ue=>Ue.node.id));let Me=!1,Ye=!1;for(const Ue of B){if(!Re.has(Ue.flow.target))continue;const at=Fe(Ue.flow.source);!at||at.id===S.id||(at.y<S.y?Me=!0:Ye=!0)}return Me&&!Ye?"up":Ye&&!Me?"down":void 0};for(const ce of _.nodes){if(!rm(ce.node.type))continue;const Re=ce.node.lane??`pool:${x}`,Me=ut.get(Re);if(!Me||Me.size<2)continue;const Ye=Me.get(0);if(Ye===void 0)continue;const Ue=Math.max(...Me.values()),at=Ye===Ue&&Ye!==0?"down":void 0;if(!at)continue;const Be=[];for(const sn of _.flows){if(sn.flow.source!==ce.node.id)continue;const Eo=G.get(sn.flow.target);if(!Eo||Eo.node.lane!==ce.node.lane||(me.get(Eo.node.id)??0)!==1)continue;const Vn=Kt(Eo);Vn!==void 0&&Be.push({t:Eo,subtree:Ie(Eo.node.id),band:Vn})}const Je=Be.find(sn=>(Me.get(sn.band)??sn.band)===Ye);if(!Je||Se(Je.subtree)===at||Ve(Je.subtree)===at)continue;const mt=Be.find(sn=>sn!==Je&&Se(sn.subtree)===at);if(!mt)continue;const Lt=Je.band,zi=mt.band;for(const sn of Je.subtree)Kt(sn)===Lt&&qt.set(sn.node.id,zi);for(const sn of mt.subtree)Kt(sn)===zi&&qt.set(sn.node.id,Lt);De.add(ce.node.id)}for(const ce of _.nodes){if(!rm(ce.node.type))continue;const Re=_e(ce);if(Number.isNaN(Re)||ii(ce.node.id))continue;let Me,Ye=!1,Ue;for(const at of _.flows){if(at.flow.source!==ce.node.id)continue;const Be=G.get(at.flow.target);if(!Be||!Be.node.lane&&bt(Be)===void 0)continue;const Je=_e(Be);Number.isNaN(Je)||(Math.abs(Je-Re)<.5&&(Ye=!0),Je>Re?!Me||Je>Me.row?Me={id:Be.node.id,row:Je,count:1}:Je===Me.row&&Me.count++:Je<Re&&Be.node.lane===ce.node.lane&&!zn.has(Be.node.id)&&(!Ue||Je>Ue.row?Ue={op:Be,row:Je,count:1}:Je===Ue.row&&Ue.count++))}Me&&Me.count===1&&(me.get(Me.id)??0)===1&&!De.has(ce.node.id)&&ue.add(Me.id),!Ye&&Ue&&Ue.count===1&&(me.get(Ue.op.node.id)??0)===1&&!Dn.has(ce.node.id)&&ae.set(Ue.op.node.id,{lane:ce.node.lane,band:Kt(ce)})}for(const ce of pa){const Re=(bR=_.flows.find(Me=>Me.flow.target===ce))==null?void 0:bR.flow.source;Re&&!De.has(Re)&&ue.add(ce)}}const fe=GP(_.flows.map(me=>me.flow),_.nodes.map(me=>me.node.id),me=>G.has(me));let ye=!1;const oe=new Set;let xe=0;for(;xe++<_.nodes.length+2;){for(let De=0;De<_.nodes.length+_.flows.length+2;De++){let Fe=!1,Ie=!1;for(const Ve of _.flows){const Se=Ve.flow;if(oe.has(Se.id))continue;const ce=h(Se.source);if(!ce)continue;const Re=h(Se.target),Me=G.get(Se.target);if(!Re&&Me&&!ye&&fe.has(Se.id)){Ie=!0;continue}if(!Re&&Me){const Ye=om(Me.node,Me.band),Ue=Kt(Me);if(Me.node.lane||Ue!==void 0){const at=D(Me.node),Be=ce,Je=Be.x+(X.get(Se.source)??0)+Be.width+Q,mt=ae.get(Se.target),Lt=G.get(Se.source),zi=!mt&&!!Lt&&Y.has(Se.source)&&Ue!==void 0&&Lt.band!==void 0&&Lt.band===Me.band&&Lt.node.lane===Me.node.lane&&Lt.node.participant===Me.node.participant&&O.has(Se.source)&&!In(Me.node.lane,Me.node.participant,Ue,Be.y+Be.height/2);ue.has(Se.target)&&W(at,Ye,Be.x+Be.width/2,mt?mt.lane:Me.node.lane,mt?mt.band:Ue);const sn=F(at,Ye,mt?mt.lane:Me.node.lane,mt?mt.band:Ue,ue.has(Se.target)?Be.x+Be.width/2:Je,Number.NaN,mt||!I1(Se.target)?void 0:Be.y+Be.height/2,void 0,zi),Eo=G.has(Se.source)?sn:N(at,Ye,sn),Vn=n.createShape(Ye,Eo,at);ue.has(Se.target)&&X.set(Se.target,Je-(Vn.x+Vn.width/2)),n.connect(ce,Vn,{type:"bpmn:SequenceFlow",businessObject:Bp(Se)})}else{const at=w(ce),Be=at?at.y+at.height:0;s.append(ce,Ye,{connection:{type:"bpmn:SequenceFlow",businessObject:Bp(Se)}}),at&&at.y+at.height-Be>.5&&Fi(Be,at.id,at.y+at.height-Be)}}else if(Re)n.connect(ce,Re,{type:"bpmn:SequenceFlow",businessObject:Bp(Se)});else continue;oe.add(Se.id),Fe=!0}if(!Fe){if(Ie&&!ye){ye=!0;continue}break}ye=!1}const me=_.nodes.filter(De=>!h(De.node.id));if(!me.length)break;const _e=me[0];{const De=om(_e.node,_e.band),Fe=D(_e.node),Ie=bt(_e);n.createShape(De,F(Fe,De,_e.node.lane,Ie,k,I),Fe),!_e.node.lane&&Ie===void 0&&(I+=160)}}}const N1=new Map;for(const[x,_]of ie){const S=h(x),k=h(_.flow.target);if(!(S!=null&&S.target)||!k)continue;const I=S.label&&{x:S.label.x,y:S.label.y,width:S.label.width,height:S.label.height};N1.set(x,{waypoints:S.waypoints.map(D=>({x:D.x,y:D.y})),label:I});const T=S.target,$=D=>({x:D.x+D.width/2,y:D.y+D.height/2});n.reconnect(S,k,T,[$(k),$(T)]),n.layoutConnection(S,{waypoints:[]})}const $1=new Set;{const x=T=>T.endsWith("Task")||T==="bpmn:CallActivity"||T==="bpmn:SubProcess",_=T=>x(T)||T==="bpmn:EndEvent"||T==="bpmn:IntermediateThrowEvent"||T==="bpmn:IntermediateCatchEvent",S=T=>(T??[]).filter($=>$.type==="bpmn:SequenceFlow"),k=Vt(e,"sequenceFlow.update"),I=(T,$)=>{var D;return(D=g(T,$))==null?void 0:D.id};for(const T of k){if(T.source===void 0&&T.target===void 0||ie.has(T.id))continue;const $=h(T.id);if(!$)continue;const D=T.source!==void 0?h(T.source):$.source,O=T.target!==void 0?h(T.target):$.target;if(!D||!O||D.id===O.id||G.has(D.id)||G.has(O.id)||!x(D.type)||!_(O.type)||D.parent!==O.parent||S(O.incoming).some(X=>X.id!==$.id)||S(O.outgoing).some(X=>X.id!==$.id)||k.some(X=>X!==T&&(X.target===O.id||X.source===O.id))||O.x>=D.x+D.width)continue;const F=D.parent,N=w(D),W=D.x+D.width+Q,Y=D.y+D.height/2,re=O.y+O.height/2,J=I(N,D)===I(N,O),ee=new Set([O.id]),ue=[J?Y:re,re].find(X=>!ge(F,O,W,X,ee));if(ue===void 0)continue;if(n.moveElements([O],{x:W-(O.x+O.width/2),y:ue-re}),N){const X=O.x+O.width+wl-(N.x+N.width);X>0&&Ps(n,N,N.width+X)}const ae=X=>({x:X.x+X.width/2,y:X.y+X.height/2});n.reconnect($,D,O,[ae(D),ae(O)]),Math.abs(ae(D).y-ae(O).y)>1&&n.layoutConnection($,{waypoints:[]}),$1.add(T.id)}}const Dr=40,w6=10,$c=x=>{const _=N=>N.kind==="label-over-line"||N.kind==="label-over-shape"||N.kind==="label-on-shared-segment"?N.edge===x.id:N.kind==="annotation-over-label"||N.kind==="pool-name-over-label"?N.label===x.id:!1,S=()=>new Map(dt(Ge(r)).filter(N=>!_(N)).map(N=>[ct(N),N])),k=S(),I=N=>[...N].filter(([W])=>!k.has(W)).map(([,W])=>W),T=N=>I(N).length<=[...k.keys()].filter(W=>!N.has(W)).length,$=x.waypoints.map(N=>({x:N.x,y:N.y})),D=x.label,O=D&&{x:D.x,y:D.y};n.layoutConnection(x,{waypoints:[]});const F=S();if(!T(F)){if(I(F).every(N=>N.kind==="edge-crosses-shape"&&N.edge===x.id)){const N=Ge(r),W=N.edges.find(ee=>ee.id===x.id),Y=fn(N),re=W?Tt(W,Y):[],J=W&&re.length&&!re.every(ee=>ee.type==="bpmn:TextAnnotation")?pl(W,Y,Rs(x),N.edges):null;if(J&&(n.updateWaypoints(x,J),T(S())))return}n.updateWaypoints(x,$),D&&O&&(D.x!==O.x||D.y!==O.y)&&n.moveElements([D],{x:O.x-D.x,y:O.y-D.y})}},am=5,ji=10,F1=200,Fc=new Set([...q.map(x=>x.flow.id),...B.map(x=>x.flow.id),...Vt(e,"sequenceFlow.update").map(x=>x.id),...Vt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),_6=(x,_,S,k,I,T)=>{const $=new Set(x.map(X=>X.id)),D=Math.min(...x.map(X=>X.x))+_-ji,O=Math.max(...x.map(X=>X.x+X.width))+_+F1+ji,F=Math.min(...x.map(X=>X.y+Math.min(0,...S)))-ji,N=Math.max(...x.map(X=>X.y+X.height+Math.max(0,...S)))+ji,W=r.getAll().filter(X=>{if(X.type!=="bpmn:SequenceFlow"&&X.type!=="bpmn:MessageFlow")return!1;const fe=X;return Fc.has(fe.id)||!fe.waypoints||fe.waypoints.length<2||[fe.source,fe.target].some(oe=>!oe||$.has(oe.id)||oe.x>=k)?!1:fe.waypoints.some((oe,xe)=>{const me=fe.waypoints[xe+1];return!!me&&Math.max(oe.x,me.x)>=D&&Math.min(oe.x,me.x)<=O&&Math.max(oe.y,me.y)>=F&&Math.min(oe.y,me.y)<=N})});if(!W.length)return 0;const Y=X=>{const fe=new Map;for(const ye of x)for(const oe of S){const xe={id:ye.id,type:ye.type,x:ye.x+_+X,y:ye.y+oe,width:ye.width,height:ye.height};for(const me of W){let _e=1/0;for(let Fe=0;Fe+1<me.waypoints.length;Fe++)_e=Math.min(_e,Ao(me.waypoints[Fe],me.waypoints[Fe+1],xe));const De=`${me.id}|${ye.id}`;fe.set(De,Math.min(fe.get(De)??1/0,_e))}}return fe},re=[...Y(0)].filter(([,X])=>X<=am).map(([X])=>X);if(!re.length)return 0;let J=0;for(let X=1;X<=F1;X++){const fe=Y(X);if([...fe.values()].every(ye=>ye>am)&&re.every(ye=>(fe.get(ye)??1/0)>=ji)){J=X;break}}if(!J)return 0;const ee=Math.min(...x.map(X=>X.x))+_+J,ue=new Set(re.map(X=>X.slice(0,X.indexOf("|"))));return W.some(X=>X.type==="bpmn:SequenceFlow"&&ue.has(X.id)&&X.waypoints.some((fe,ye)=>{const oe=X.waypoints[ye+1];if(!oe||Math.min(fe.y,oe.y)>T||Math.max(fe.y,oe.y)<T||fe.y===oe.y)return!1;const xe=fe.x+(T-fe.y)*(oe.x-fe.x)/(oe.y-fe.y);return xe>I&&xe<ee}))?0:J},Qi=(x,_=()=>!0)=>{const S=h(x);if(!S)return[];const k=[S],I=new Set([x]);for(let T=0;T<k.length;T++){const $=k[T].id;for(const D of q){const O=D.flow.target;if(D.flow.source!==$||I.has(O)||!G.has(O))continue;I.add(O);const F=h(O);F&&_(F)&&k.push(F)}}return k},E6=(x,_=()=>!0)=>{const S=h(x);if(!S)return[];const k=[S],I=new Set([x]);for(let T=0;T<k.length;T++){const $=k[T].id;for(const D of q){const O=D.flow.source;if(D.flow.target!==$||I.has(O)||!G.has(O))continue;I.add(O);const F=h(O);F&&_(F)&&k.push(F)}}return k},Hi=30,_i=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",ps=(x,_)=>Ps(n,x,_),wo=(x,_,S=!1)=>{const k=new Set(x.flatMap(O=>O.subtree.map(F=>F.id)));for(const O of x){const F=(O.pool.children??[]).filter(_i).filter(W=>!k.has(W.id));if(O.subtree.some(W=>F.some(Y=>W.x+_<Y.x+Y.width+Hi&&W.x+_+W.width+Hi>Y.x&&W.y<Y.y+Y.height&&W.y+W.height>Y.y)))return null}const I=x.map(O=>O.pool.width),T=S?r.filter(O=>Array.isArray(O.waypoints)).map(O=>({c:O,wps:O.waypoints.map(F=>({x:F.x,y:F.y}))})):[],$=r.filter(O=>O.type==="label").map(O=>({label:O,x:O.x,y:O.y}));n.moveElements(x.flatMap(O=>O.subtree),{x:_,y:0});const D=x.map(O=>{const N=Math.max(...O.subtree.map(W=>W.x+W.width))+wl-(O.pool.x+O.pool.width);return N>0&&ps(O.pool,O.pool.width+N),N});return()=>{n.moveElements(x.flatMap(O=>O.subtree),{x:-_,y:0}),x.forEach((O,F)=>{D[F]>0&&ps(O.pool,I[F])});for(const{c:O,wps:F}of T){const N=O.waypoints??[];N.length===F.length&&N.every((Y,re)=>Math.abs(Y.x-F[re].x)<=.5&&Math.abs(Y.y-F[re].y)<=.5)||n.updateWaypoints(O,F.map(Y=>({x:Y.x,y:Y.y})))}for(let O=0;O<3;O++){let F=0;for(const N of $){const W=N.x-N.label.x,Y=N.y-N.label.y;Math.abs(W)<=.5&&Math.abs(Y)<=.5||(n.moveElements([N.label],{x:W,y:Y}),F++)}if(!F)break}}},sm=x=>{var I,T;const _=new Map,S=new Map;for(const $ of r.getAll()){if($.type!=="bpmn:Participant")continue;const D=$;(D.children??[]).length||(_.set(D.id,D),S.set(D.id,[]))}for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const D=$,O=(I=D.source)==null?void 0:I.id,F=(T=D.target)==null?void 0:T.id;O&&F&&S.has(O)&&S.get(O).push(F),O&&F&&S.has(F)&&S.get(F).push(O)}const k=[];for(const[$,D]of S)D.length&&D.every(O=>x.has(O))&&k.push(_.get($));return k},j1=(x,_)=>{if(!x.length)return null;const S=new Set(x.map(N=>N.id)),k=r.getAll().filter(N=>N.type==="bpmn:Participant"&&!S.has(N.id)),I=Math.min(...k.filter(N=>(N.children??[]).length>0).map(N=>N.x)),T=new Set(x.filter(N=>Math.abs(N.x-I)<=2).map(N=>N.id));if(x.some(N=>{const W=T.has(N.id)?N.x:N.x+_,Y=T.has(N.id)?N.width+_:N.width;return k.some(re=>W<re.x+re.width+Hi&&W+Y+Hi>re.x&&N.y<re.y+re.height&&N.y+N.height>re.y)}))return null;const D=r.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y})),O=x.filter(N=>!T.has(N.id)),F=x.filter(N=>T.has(N.id)).map(N=>({pool:N,was:{x:N.x,y:N.y,width:N.width,height:N.height}}));O.length&&n.moveElements(O,{x:_,y:0});for(const{pool:N,was:W}of F)n.resizeShape(N,{...W,width:W.width+_});return()=>{for(const{pool:N,was:W}of F)n.resizeShape(N,W);O.length&&n.moveElements(O,{x:-_,y:0});for(let N=0;N<3;N++){let W=0;for(const Y of D){const re=Y.x-Y.label.x,J=Y.y-Y.label.y;Math.abs(re)<=.5&&Math.abs(J)<=.5||(n.moveElements([Y.label],{x:re,y:J}),W++)}if(!W)break}}},H1=(x,_,S)=>{const k=S.x+S.width/2,I=_.y>S.y,T=I?S.y+S.height:S.y,$=I?_.y:_.y+_.height,D=x.source===_?[{x:k,y:$},{x:k,y:T}]:[{x:k,y:T},{x:k,y:$}],O=Ge(r),F={...O.edges.find(N=>N.id===x.id),waypoints:D};return Tt(F,fn(O)).length?!1:(n.updateWaypoints(x,D),!0)},S6=()=>{const x=r.filter($=>$.type==="bpmn:Participant"),_=Math.min(...x.filter($=>($.children??[]).length>0).map($=>$.x)),S=$=>b.some(D=>D.participant.id===$.id),k=$=>!!$&&$.type==="bpmn:Participant"&&!($.children??[]).length&&Math.abs($.x-_)<=2&&!S($),I=$=>!!$&&$.type==="bpmn:Participant"&&($.children??[]).length>0&&!S($),T=new Set;for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const D=$;if((D.waypoints??[]).length!==2)continue;const O=[D.source,D.target].find(W=>k(W)||I(W)),F=O===D.source?D.target:D.source;if(!O||!F||F.type==="bpmn:Participant")continue;const N=F.x+F.width/2;I(O)&&(N<O.x||N>O.x+O.width)||T.add(D.id)}return T},R6=x=>{var S;const _=new Map;for(const k of x){const I=r.get(k);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 D=_.get(T.id)??{pool:T,msgs:[]};D.msgs.push({conn:I,other:$}),_.set(T.id,D)}for(const{pool:k,msgs:I}of _.values()){const T=Math.max(...I.map(({other:J})=>J.x+J.width/2))+zd;if(r.getAll().some(J=>{if(J.type!=="bpmn:Participant"||J.id===k.id)return!1;const ee=J;return k.x<ee.x+ee.width+Hi&&T+Hi>ee.x&&k.y<ee.y+ee.height&&k.y+k.height>ee.y}))continue;const D={x:k.x,y:k.y,width:k.width,height:k.height},O=[...k.incoming??[],...k.outgoing??[]],F=O.map(J=>({c:J,wps:(J.waypoints??[]).map(ee=>({x:ee.x,y:ee.y}))})),N=O.flatMap(J=>{const ee=J.label;return ee?[{label:ee,x:ee.x,y:ee.y}]:[]}),W=Lr();ps(k,T-k.x);const Y=I.filter(({conn:J,other:ee})=>H1(J,k,ee)).length,re=Lr();if(!(Y>0&&re.messages>W.messages&&re.lines>=W.lines)){ps(k,D.width);for(const{c:J,wps:ee}of F){const ue=J.waypoints??[];ue.length===ee.length&&ue.every((X,fe)=>Math.abs(X.x-ee[fe].x)<=.5&&Math.abs(X.y-ee[fe].y)<=.5)||n.updateWaypoints(J,ee.map(X=>({x:X.x,y:X.y})))}for(let J=0;J<3;J++){let ee=0;for(const ue of N){const ae=ue.x-ue.label.x,X=ue.y-ue.label.y;Math.abs(ae)<=.5&&Math.abs(X)<=.5||(n.moveElements([ue.label],{x:ae,y:X}),ee++)}if(!ee)break}}}},G1=()=>{let x=0;for(const _ of r.getAll()){if(_.type!=="bpmn:DataInputAssociation"&&_.type!=="bpmn:DataOutputAssociation")continue;const S=_.waypoints??[];for(let k=1;k<S.length;k++)x+=Math.hypot(S[k].x-S[k-1].x,S[k].y-S[k-1].y)}return x},z1=()=>{let x=0;for(const _ of r.getAll()){if(_.type!=="bpmn:Association")continue;const S=_.waypoints??[];for(let k=1;k<S.length;k++)x+=Math.hypot(S[k].x-S[k-1].x,S[k].y-S[k-1].y)}return x},M6=x=>{const _=[];for(const S of r.getAll()){if(S.type!=="bpmn:TextAnnotation")continue;const k=S;if(x.has(k.id))continue;const T=[...k.incoming??[],...k.outgoing??[]].filter(O=>O.type==="bpmn:Association").map(O=>O.source===k?O.target:O.source);if(!T.length||T.some(O=>O===void 0))continue;const $=O=>{if(!("waypoints"in O&&O.waypoints))return[O.id];const F=O,N=[F.source,F.target];return N.some(W=>!W)?[]:N.map(W=>W.id)},D=T.flatMap(O=>$(O));D.length&&D.every(O=>x.has(O))&&_.push(k)}return _},V1=()=>dt(Ge(r)).filter(x=>x.kind==="edge-crosses-shape").length,W1=x=>{const _=(x.children??[]).filter(_i);let S=0;for(let k=0;k<_.length;k++)for(let I=k+1;I<_.length;I++){const T=_[k],$=_[I];T.x<$.x+$.width&&T.x+T.width>$.x&&T.y<$.y+$.height&&T.y+T.height>$.y&&S++}return S},Lr=()=>{const x=Ge(r),_=S=>S.length>=2&&(S.every(k=>Math.abs(k.x-S[0].x)<.01)||S.every(k=>Math.abs(k.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=>_(S.waypoints)).length}},U1=x=>{const _=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const I=k;if(!I.waypoints||I.waypoints.length!==2)continue;const T=I.source,$=I.target;if(!T||!$)continue;const D=x.has(T.id);if(D===x.has($.id))continue;const O=D?$:T,F=w(O);if(!F||x.has(O.id))continue;const N=_.get(F.id);N?O.x<N.minX&&(N.minX=O.x):_.set(F.id,{pool:F,minX:O.x})}const S=[];for(const{pool:k,minX:I}of _.values()){const T=(k.children??[]).filter($=>_i($)&&!x.has($.id)&&$.x>=I);T.length&&S.push({subtree:T,pool:k})}return S},C6=(x,_,S)=>{const k=new Map(_.map($=>[$.pool.id,{subtree:[...$.subtree],pool:$.pool}])),I=new Set(x);for(const $ of _)for(const D of $.subtree)I.add(D.id);let T=!1;for(;;){let $=0;for(const D of U1(I)){if(D.pool===S)continue;const O=k.get(D.pool.id);O?O.subtree.push(...D.subtree):k.set(D.pool.id,{subtree:[...D.subtree],pool:D.pool});for(const F of D.subtree)I.add(F.id);$+=D.subtree.length}if(!$)break;T=!0}return T?[...k.values()]:null},A6=(x,_)=>{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(re=>Math.abs(re.x-$[0].x)<1))continue;const D=T.source,O=T.target;if(!D||!O)continue;const F=x.has(D.id);if(F===x.has(O.id))continue;const N=F?O:D,W=w(N);if(!W||W===_||W===w(F?D:O))continue;const Y=S.get(W.id);Y?N.x<Y.minX&&(Y.minX=N.x):S.set(W.id,{pool:W,minX:N.x})}const k=[];for(const{pool:I,minX:T}of S.values()){const $=(I.children??[]).filter(D=>_i(D)&&!x.has(D.id)&&D.x>=T);$.length&&k.push({subtree:$,pool:I})}return k},q1=x=>{const _=Ge(r),S=_.shapes.filter(I=>x.has(I.id)),k=new Set;for(const I of _.edges)if(!(I.type!=="bpmn:SequenceFlow"&&I.type!=="bpmn:MessageFlow"))for(const T of Tt(I,S))k.add(`${I.id}|${T.id}`);return k},cm=new Map,P6=Vt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const _=ie.get(x.id);return _?[{id:x.id,target:_.flow.target,source:_.flow.source}]:[]});for(const x of P6){if(x.target===void 0)continue;const _=G.get(x.target);if(!_)continue;const S=h(x.target),k=h(x.id);if(!S||!k)continue;const I=x.source!==void 0?h(x.source):k.source,T=k.target;if(!I||!T||T.id===S.id)continue;const $=N1.get(k.id)??{waypoints:k.waypoints,label:k.label},D=$.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,O=D?$.waypoints[1].y:void 0,F=D&&$.label?{x:$.label.x,y:$.label.y}:void 0,N=F&&$.label&&Math.abs(F.y+$.label.height/2-O)<=z/5&&F.x+$.label.width>D.x?F.x+$.label.width+6:void 0,W=(I.outgoing??[]).filter(Oe=>Oe.type==="bpmn:SequenceFlow"&&Oe.id!==k.id&&Oe.target&&!Fc.has(Oe.id)),Y=new Set(W.map(Oe=>Oe.target.id)),re=Oe=>{const Ot={type:"bpmn:Task",x:Oe.x+2,y:Oe.y+2,width:Oe.width-4,height:Oe.height-4};return W.find(Rt=>(Rt.waypoints??[]).some((en,ze)=>!!Rt.waypoints[ze+1]&&Ao(en,Rt.waypoints[ze+1],Ot)===0))},J=Qi(x.target),ee=new Set(J.map(Oe=>Oe.id)),ue=tm.has(x.target)?{autoResize:!1}:void 0,ae=Math.min(...J.map(Oe=>Oe.x)),X=Math.max(...J.map(Oe=>Oe.x+Oe.width)),fe=I.x+I.width,ye=T.x+T.width<=I.x,oe=(()=>{if(!ye)return;const Oe=w(S),Ot=((Oe==null?void 0:Oe.children)??[]).filter(qe=>_i(qe)&&!ee.has(qe.id)&&qe.type!=="bpmn:Group"&&qe.type!=="bpmn:Participant"),Rt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],en=r.getAll().filter(qe=>{if(!Rt.includes(qe.type))return!1;const Gt=qe;return Gt.id===k.id||Fc.has(Gt.id)||!Gt.waypoints||Gt.waypoints.length<2?!1:![Gt.source,Gt.target].some(Nt=>!Nt||ee.has(Nt.id))}),ze=(qe,Gt)=>J.every(Nt=>{var ha;const Ct={id:Nt.id,type:Nt.type,x:Nt.x+qe,y:Nt.y+Gt,width:Nt.width,height:Nt.height};return Oe&&(Ct.x<Oe.x||Ct.x+Ct.width>Oe.x+Oe.width||Ct.y<Oe.y||Ct.y+Ct.height>Oe.y+Oe.height)||!Lp((ha=G.get(Nt.id))==null?void 0:ha.node.lane,Nt,Nt.y+Gt+Nt.height/2)||Ot.some(Qn=>Ct.x<Qn.x+Qn.width+ji&&Ct.x+Ct.width+ji>Qn.x&&Ct.y<Qn.y+Qn.height+ji&&Ct.y+Ct.height+ji>Qn.y)?!1:en.every(Qn=>{for(let Ro=0;Ro+1<Qn.waypoints.length;Ro++)if(Ao(Qn.waypoints[Ro],Qn.waypoints[Ro+1],Ct)<ji)return!1;return!0})}),Qe=I.x+I.width/2,_t=I.y+I.height/2,st=$.waypoints??[],It=st.length>=2&&Math.abs(st[0].y-st[1].y)<1&&st[1].x<st[0].x;return[...O!==void 0?[{cx:Qe,cy:O}]:[],...It?[{cx:I.x-Dr-S.width/2,cy:st[0].y}]:[],{cx:Qe,cy:_t+z},{cx:Qe,cy:_t-z}].find(qe=>ze(qe.cx-(S.x+S.width/2),qe.cy-(S.y+S.height/2)))})(),xe=ye&&!oe?fe:T.x,me=(()=>{var _t;if(D||ye)return 0;const Oe=$.label,Ot=((_t=k.businessObject)==null?void 0:_t.name)??"";if(!Oe||Oe.width==null||!Ot.trim())return 0;const Rt=fe+Dr,en=I.y+I.height/2-S.height/2;if(Math.min(Oe.y+Oe.height,en+S.height)-Math.max(Oe.y,en)<3||Oe.x+Oe.width-Rt<3)return 0;const Qe=Oe.x+Oe.width+w6-Rt;return Qe<=S.width?Qe:0})();me>0&&u.add(k.id);const _e=S.y+S.height/2,De=_6(J,fe+Dr+me-ae,[0,I.y+I.height/2-_e,T.y+T.height/2-_e],xe,fe,I.y+I.height/2),Fe=fe+Dr+me+De,Ie=(()=>{if(N===void 0)return 0;const Oe=fe+Dr,Ot=I.y+I.height/2-S.height/2,Rt={x:Oe,y:Ot,width:X-ae,height:S.height},en=w(I);return((en==null?void 0:en.children)??[]).some(Qe=>_i(Qe)&&!ee.has(Qe.id)&&Qe.id!==I.id&&Qe.id!==T.id&&Qe.type!=="bpmn:Group"&&Qe.type!=="bpmn:Participant"&&Qe.x<Rt.x+Rt.width&&Qe.x+Qe.width>Rt.x&&Qe.y<Rt.y+Rt.height&&Qe.y+Qe.height>Rt.y)||re(Rt)?Math.max(0,N-Oe):0})(),Ve=oe?0:X-ae+Dr*2+De+Ie+me-(ye?0:T.x-fe);let Se=[];if(Ve>0){const Oe=w(S),Ot=(Oe==null?void 0:Oe.children)??[],Rt=st=>st.type==="bpmn:Lane";Se=(()=>{const st=new Set;for(const Xe of Ot)_i(Xe)&&!ee.has(Xe.id)&&Xe.id!==I.id&&Xe.x>=xe&&st.add(Xe.id);const It=[];for(const Xe of Ot){if(Xe.type!=="bpmn:DataStoreReference"&&Xe.type!=="bpmn:DataObjectReference")continue;const qe=Xe,Nt=[...qe.incoming??[],...qe.outgoing??[]].filter(Ct=>Ct.type==="bpmn:DataInputAssociation"||Ct.type==="bpmn:DataOutputAssociation").map(Ct=>Ct.source===qe?Ct.target:Ct.source);Nt.length&&Nt.every(Ct=>Ct!==void 0&&st.has(Ct.id))&&It.push(qe)}return It})();const ze=Ot.filter(st=>!("waypoints"in st&&st.waypoints)&&!Rt(st)&&st.type!=="label"&&!ee.has(st.id)&&st.id!==I.id&&st.x>=xe),Qe=ze.flatMap(st=>st.labels??[]),_t=Oe?[Oe,...Ot.filter(st=>Rt(st))]:[];if(ze.length){const st=new Set(ze.map(pt=>pt.id)),It=U1(st),Xe=It.length?C6(st,It,Oe):null,qe=pt=>{const At=new Set(st);for(const zt of pt)for(const Uo of zt.subtree)At.add(Uo.id);return M6(At)},Gt=qe(It),Nt=Xe?qe(Xe):Gt,Ct=sm(st),ha=new Set(st);for(const pt of It)for(const At of pt.subtree)ha.add(At.id);const Qn=It.length?sm(ha):Ct,Ro=(()=>{if(!Xe)return[];const pt=new Set(st);for(const At of Xe)for(const zt of At.subtree)pt.add(zt.id);return sm(pt)})(),ms=Xe??It,ga=(()=>{const pt=new Set(st);for(const At of ms)for(const zt of At.subtree)pt.add(zt.id);return A6(pt,Oe)})(),Em=ga.length?qe([...ms,...ga]):Gt,eo=new Set([...ze,..._t].map(pt=>pt.id)),Mt=Ot.filter(pt=>{const At=pt.labelTarget;return pt.type==="label"&&!!At&&"waypoints"in At&&!!At.source&&!!At.target&&eo.has(At.source.id)&&eo.has(At.target.id)}),Pn=S6();n.createSpace([...ze,...Qe,...Mt],_t,{x:Ve,y:0},"e",xe-1);const tn=(pt,At,zt)=>{const Uo=Lr(),Fp=zt?q1(zt):null,jp=wo(pt,Ve,!!zt);if(!jp)return!1;const Gc=At.length?j1(At,Ve):null,Hp=Lr(),nn=!!zt&&!!Fp&&[...q1(zt)].some(ya=>!Fp.has(ya));return Hp.messages>Uo.messages&&Hp.lines>=Uo.lines&&!nn?!0:(Gc==null||Gc(),jp(),!1)},vi=ga.length>0&&tn([...ms,...ga],Xe?Ro:Qn,new Set(ga.flatMap(pt=>pt.subtree.map(At=>At.id)))),ma=!vi&&Xe?tn(Xe,Ro):!1;let Mo=vi||ma;!Mo&&It.length&&(Mo=tn(It,Qn));const ys=vi?Em:ma?Nt:Gt;if(!Mo){for(const pt of It){const At=Lr(),zt=wo([pt],Ve);if(!zt)continue;const Uo=Lr();(Uo.messages<=At.messages||Uo.lines<At.lines)&&zt()}if(Ct.length){const pt=Lr(),At=j1(Ct,Ve);if(At){const zt=Lr();(zt.messages<=pt.messages||zt.lines<pt.lines)&&At()}}}if(R6(Pn),ys.length){const pt=()=>new Set(dt(Ge(r)).map(zt=>ct(zt))),At=zt=>{const Uo=z1(),Fp=pt(),jp=zt.map(nn=>({a:nn,x:nn.x,y:nn.y})),Gc=r.filter(nn=>nn.type==="label").map(nn=>({label:nn,x:nn.x,y:nn.y}));n.moveElements(zt,{x:Ve,y:0});const Hp=[...pt()].filter(nn=>!Fp.has(nn));if(z1()<Uo&&Hp.length===0)return!0;for(const{a:nn,x:ya,y:zc}of jp)(nn.x!==ya||nn.y!==zc)&&n.moveElements([nn],{x:ya-nn.x,y:zc-nn.y});for(const nn of Gc){const ya=nn.x-nn.label.x,zc=nn.y-nn.label.y;(ya!==0||zc!==0)&&n.moveElements([nn.label],{x:ya,y:zc})}return!1};if(!At(ys)&&ys.length>1)for(const zt of ys)At([zt])}}}const ce=_.node.lane!==void 0?h(_.node.lane):_.node.participant!==void 0?h(_.node.participant):void 0,Re=Oe=>{if(!ce)return!0;const Ot=Oe.y+Oe.height/2;return Ot>=ce.y&&Ot<=ce.y+ce.height},Me=!Re(I)&&Re(T),Ye=Oe=>Oe.y+Oe.height/2,Ue=()=>{const Oe=I.x+I.width,Ot=T.x,Rt=Ye(T)-S.height/2,en=Ye(T)+S.height/2;return!r.getAll().some(ze=>_i(ze)&&ze.type!=="bpmn:Participant"&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:TextAnnotation"&&ze.id!==I.id&&ze.id!==T.id&&ze.id!==S.id&&ze.x<Ot&&ze.x+ze.width>Oe&&ze.y<en&&ze.y+ze.height>Rt)},at=!Me&&_.band!==void 0&&Re(T)&&!In(_.node.lane,_.node.participant,_.band,Ye(I))&&In(_.node.lane,_.node.participant,_.band,Ye(T))&&T.x>=I.x+I.width&&Ue(),Be=Me||at?T:I,Je=Be.y+Be.height/2,mt=Je-(S.y+S.height/2),Lt=_.band!==void 0,zi=Lt?[S]:J,sn=(_.band===void 0||In(_.node.lane,_.node.participant,_.band,Je))&&I1(x.target)&&zi.every(Oe=>{var Ot;return Lp((Ot=G.get(Oe.id))==null?void 0:Ot.node.lane,Oe,Oe.y+Oe.height/2+mt)}),Eo=Oe=>Math.abs(Oe.y+Oe.height/2-(S.y+S.height/2))<=z/2;if(sn&&Lt){const Oe=Math.abs(mt)<=z/2?J.filter(ze=>ze.id!==S.id&&Eo(ze)):[],Ot=S.y+S.height/2,en=_.band!==void 0&&!In(_.node.lane,_.node.participant,_.band,Ot)?J.filter(ze=>{var Qe,_t;return ze.id!==S.id&&!Oe.includes(ze)&&((Qe=G.get(ze.id))==null?void 0:Qe.band)===_.band&&((_t=G.get(ze.id))==null?void 0:_t.node.lane)===_.node.lane&&(Math.abs(ze.y+ze.height/2-Ot)<=z/2||In(_.node.lane,_.node.participant,_.band,ze.y+ze.height/2))}).map(ze=>({t:ze,dy:Je-(ze.y+ze.height/2)})).filter(({dy:ze})=>ze!==0):[];if(n.moveElements(J,{x:Fe-ae,y:0},void 0,ue),n.moveElements([S],{x:0,y:mt},void 0,ue),Oe.length){const ze=()=>new Set(dt(Ge(r)).map(qe=>ct(qe))),Qe=ze(),_t=r.filter(qe=>qe.type==="label").map(qe=>({label:qe,x:qe.x,y:qe.y}));n.moveElements(Oe,{x:0,y:mt});const st=ze(),It=[...st].filter(qe=>!Qe.has(qe)).length,Xe=[...Qe].filter(qe=>!st.has(qe)).length;if(It>Xe){n.moveElements(Oe,{x:0,y:-mt});for(const qe of _t){const Gt=qe.x-qe.label.x,Nt=qe.y-qe.label.y;(Gt!==0||Nt!==0)&&n.moveElements([qe.label],{x:Gt,y:Nt})}}}if(en.length){const ze=new Set(J.map(Qe=>Qe.id));for(const{t:Qe,dy:_t}of en)ge(Qe.parent,Qe,Qe.x+Qe.width/2,Qe.y+Qe.height/2+_t,ze)||n.moveElements([Qe],{x:0,y:_t})}}else n.moveElements(J,{x:Fe-ae,y:sn?mt:0},void 0,ue);const Vn=w(S);if(!sn&&_.node.lane===void 0&&_.band!==void 0&&Vn){const Oe=Vn.y+he+Ln(`pool:${_.node.participant??""}`,_.band)*z,Ot=Oe-(S.y+S.height/2);Ot!==0&&!ge(Vn,S,S.x+S.width/2,Oe,ee)&&n.moveElements([S],{x:0,y:Ot},void 0,ue)}if(oe)n.moveElements(J,{x:oe.cx-(S.x+S.width/2),y:oe.cy-(S.y+S.height/2)},void 0,ue);else if(Vn){const Oe=(Vn.children??[]).filter(ze=>_i(ze)&&!ee.has(ze.id)&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:Participant"),Ot=(ze,Qe,_t,st,It)=>ze.x+Qe<It.x+It.width+st&&ze.x+Qe+ze.width+st>It.x&&ze.y+_t<It.y+It.height+st&&ze.y+_t+ze.height+st>It.y,Rt=Oe.find(ze=>Ot(S,0,0,0,ze)),en=Rt?void 0:re(S);if(Rt||en){const ze=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Qe=r.getAll().filter(Mt=>{if(!ze.includes(Mt.type))return!1;const Pn=Mt;return Fc.has(Pn.id)||!Pn.waypoints||Pn.waypoints.length<2?!1:![Pn.source,Pn.target].some(tn=>!tn||ee.has(tn.id))}),_t=(Mt,Pn,tn)=>{var vi;return Lp((vi=G.get(Mt.id))==null?void 0:vi.node.lane,Mt,Mt.y+tn+Mt.height/2)&&Mt.x+Pn>=Vn.x&&Mt.x+Pn+Mt.width<=Vn.x+Vn.width&&Mt.y+tn>=Vn.y&&Mt.y+tn+Mt.height<=Vn.y+Vn.height},st=(Mt,Pn)=>J.every(tn=>_t(tn,Mt,Pn)&&!Oe.some(vi=>Ot(tn,Mt,Pn,ji,vi))&&Qe.every(vi=>{const ma={id:tn.id,type:tn.type,x:tn.x+Mt,y:tn.y+Pn,width:tn.width,height:tn.height};for(let Mo=0;Mo+1<vi.waypoints.length;Mo++)if(Ao(vi.waypoints[Mo],vi.waypoints[Mo+1],ma)<ji)return!1;return!0})),It=S.y+S.height/2,Xe=[O,T.y+T.height/2].filter(Mt=>Mt!==void 0&&Math.abs(Mt-It)>=1),qe=Rt&&Y.has(Rt.id)?Rt:en==null?void 0:en.target,Gt=qe?qe.x-S.x:0,Nt=Math.max(...J.map(Mt=>Mt.x+Mt.width)),Ct=[...Gt!==0?[Gt]:[],...De!==0?[-De]:[],0],ha=N===void 0?[]:Ct.map(Mt=>Math.max(Mt,N-S.x)),Qn=Mt=>Nt+Mt+Dr<=T.x,Ro=[...new Set([...ha,...Ct])].filter(Qn),ms=Rt&&Y.has(Rt.id)?[Rt.x+Rt.width+Dr-S.x]:[],ga=N===void 0?[]:ms.map(Mt=>Math.max(Mt,N-S.x)),Em=[...new Set([...ga,...ms])].filter(Mt=>Qn(Mt)&&!Ro.includes(Mt));let eo;for(const Mt of[Ro,Em]){for(const Pn of Xe){for(const tn of Mt)if(st(tn,Pn-It)){eo={dx:tn,dy:Pn-It};break}if(eo)break}if(eo)break}if(eo){const Mt=pt=>{const At=pt;return[At.edge,At.other,...Array.isArray(At.edges)?At.edges:[]].some(zt=>typeof zt=="string"&&Fc.has(zt))},Pn=()=>new Set(dt(Ge(r)).filter(pt=>!Mt(pt)).map(pt=>ct(pt))),tn=Pn(),vi=r.filter(pt=>pt.type==="label").map(pt=>({label:pt,x:pt.x,y:pt.y}));n.moveElements(J,{x:eo.dx,y:eo.dy},void 0,ue);const ma=Pn(),Mo=[...ma].filter(pt=>!tn.has(pt)).length,ys=[...tn].filter(pt=>!ma.has(pt)).length;if(Mo>ys){n.moveElements(J,{x:-eo.dx,y:-eo.dy},void 0,ue);for(const pt of vi){const At=pt.x-pt.label.x,zt=pt.y-pt.label.y;(At!==0||zt!==0)&&n.moveElements([pt.label],{x:At,y:zt})}}else D&&cm.set(k.id,{exit:D,channelY:O,label:F})}}}{const Oe=new Set(J.map(Qe=>Qe.id)),Ot=new Set(q.map(Qe=>Qe.flow.id)),Rt=20,en=Qe=>{const _t=Qe.source,st=Qe.target,It=Math.min(_t.x,st.x)-Rt,Xe=Math.max(_t.x+_t.width,st.x+st.width)+Rt,qe=Math.min(_t.y,st.y)-Rt,Gt=Math.max(_t.y+_t.height,st.y+st.height)+Rt;return Qe.waypoints.some(Nt=>Nt.x<It||Nt.x>Xe||Nt.y<qe||Nt.y>Gt)},ze=new Map;for(const Qe of J)for(const _t of[...Qe.incoming??[],...Qe.outgoing??[]])(ie.has(_t.id)||_t.id!==x.id&&Ot.has(_t.id))&&!(Oe.has(_t.source.id)&&Oe.has(_t.target.id))&&ze.set(_t.id,_t);for(const Qe of ze.values())en(Qe)&&$c(Qe)}const So=Se.length?w(Se[0]):void 0;if(So){const Oe={assoc:G1(),overlaps:W1(So),crosses:V1()},Ot=Se.map(Xe=>({st:Xe,x:Xe.x})),Rt=r.filter(Xe=>Xe.type==="label").map(Xe=>({label:Xe,x:Xe.x,y:Xe.y})),en=Math.min(...Se.flatMap(Xe=>[...Xe.incoming??[],...Xe.outgoing??[]].filter(qe=>qe.type==="bpmn:DataInputAssociation"||qe.type==="bpmn:DataOutputAssociation").map(qe=>(qe.source===Xe?qe.target:qe.source).x))),ze=new Set(Se.map(Xe=>Xe.id)),Qe=(So.children??[]).filter(_i).filter(Xe=>!ze.has(Xe.id));let _t=en;for(const Xe of[...Se].sort((qe,Gt)=>qe.x-Gt.x)){let qe=_t;for(let Gt=0;Gt<100;Gt++){const Nt=Qe.find(Ct=>qe<Ct.x+Ct.width+Hi&&qe+Xe.width+Hi>Ct.x&&Xe.y<Ct.y+Ct.height&&Xe.y+Xe.height>Ct.y);if(!Nt)break;qe=Nt.x+Nt.width+Hi}qe!==Xe.x&&n.moveElements([Xe],{x:qe-Xe.x,y:0}),_t=qe+Xe.width+Hi}const st=_t+150-(So.x+So.width);st>0&&ps(So,So.width+st);const It={assoc:G1(),overlaps:W1(So),crosses:V1()};if(It.assoc>=Oe.assoc||It.overlaps>Oe.overlaps||It.crosses>Oe.crosses){for(const{st:Xe,x:qe}of Ot)Xe.x!==qe&&n.moveElements([Xe],{x:qe-Xe.x,y:0});st>0&&ps(So,So.width-st);for(const Xe of Rt){const qe=Xe.x-Xe.label.x,Gt=Xe.y-Xe.label.y;(qe!==0||Gt!==0)&&n.moveElements([Xe.label],{x:qe,y:Gt})}}}}for(const[x,_]of tm){const S=h(x);if(!S)continue;const k=_.container,I=Math.abs(S.y+S.height/2-k.y-_.relCy)>=.5,T=S.label,$=Math.min(S.y,T&&!T.hidden?T.y:S.y),D=Math.max(S.y+S.height,T&&!T.hidden?T.y+T.height:0);if(I&&$>=k.y&&D<=k.y+k.height)continue;const O=S.y;_.grow(),S.y!==O&&n.moveElements([S],{x:0,y:O-S.y},void 0,{autoResize:!1})}const Y1=(x,_)=>{const S=_.target===x,k=m(_.source),I=m(_.target),T=S?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,I,_.id?{type:T,businessObject:i.create(T,{id:_.id})}:{type:T})},lm=x=>{for(const _ of b){if(!_.participant.blackBox)continue;const S=h(_.participant.id);if(!S)continue;const k=[];for(const T of B){const $=T.flow.source===_.participant.id?T.flow.target:T.flow.target===_.participant.id?T.flow.source:void 0,D=$?h($):void 0;D&&typeof D.x=="number"&&D.type!=="bpmn:Participant"&&k.push(D)}if(!k.length)continue;if(!x&&_.order===void 0){const T=(()=>{var D;const $=new Map;for(const O of k){const F=w(O);if(!F)continue;const N=$.get(F.id);N?N.n+=1:$.set(F.id,{shape:F,n:1})}return(D=[...$.values()].sort((O,F)=>F.n-O.n)[0])==null?void 0:D.shape})();if(T){const $=F=>F.reduce((N,W)=>N+W,0)/F.length,D=$(k.map(F=>F.y+F.height/2))<T.y+T.height/2,O=r.filter(F=>F.type==="bpmn:Participant"&&F.id!==_.participant.id&&F.id!==T.id).filter(F=>D?F.y+F.height<=T.y+5:F.y>=T.y+T.height-5);if(O.length){const F=[...O.reduce((ye,oe)=>ye.set(oe.y,(ye.get(oe.y)??0)+1),new Map)].sort((ye,oe)=>oe[1]-ye[1]||(D?oe[0]-ye[0]:ye[0]-oe[0]))[0][0],N=Math.min(S.width,$P),W=FP,Y=k.map(ye=>ye.x+ye.width/2),re=Math.round($(Y)-N/2),J=Math.max(...Y)+zd,ee=ye=>({x:ye,width:Math.max(N,J-ye)}),ue=O.filter(ye=>Math.min(ye.y+ye.height,F+W)-Math.max(ye.y,F)>0),ae=ye=>{const oe=ee(ye);return ue.some(xe=>xe.x<oe.x+oe.width&&oe.x<xe.x+xe.width)},X=ye=>{const oe=ee(ye);return Y.filter(xe=>xe>=oe.x+10&&xe<=oe.x+oe.width-10).length},fe=(()=>{if(!ae(re))return re;const ye=X(re);return ue.flatMap(oe=>[oe.x+oe.width+Cv,oe.x-Cv-N]).map(oe=>Math.round(oe)).filter(oe=>!ae(oe)&&X(oe)>=ye).sort((oe,xe)=>Math.abs(oe-re)-Math.abs(xe-re))[0]??re})();if(fe!==S.x||F!==S.y||N!==S.width||W!==S.height){const ye=()=>new Set(dt(Ge(r)).map(Fe=>ct(Fe))),oe=ye(),xe={x:S.x,y:S.y,width:S.width,height:S.height};n.resizeShape(S,{x:fe,y:F,width:N,height:W});const me=ye(),_e=[...me].filter(Fe=>!oe.has(Fe)).length,De=[...oe].filter(Fe=>!me.has(Fe)).length;_e>De&&n.resizeShape(S,xe)}}}}const I=Math.max(...k.map(T=>T.x+T.width/2))+zd;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 B){const $=h(T.flow.id),D=T.flow.source===_.participant.id?T.flow.target:T.flow.target===_.participant.id?T.flow.source:void 0,O=D?h(D):void 0;if(!$||!O||O.type==="bpmn:Participant")continue;const F=O.x+O.width/2;F<S.x+10||F>S.x+S.width-10||H1($,S,O)}}};lm(!1);for(const x of B){const _=x.flow;n.connect(m(_.source),m(_.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:_.id,name:_.name})})}{const S=new Set([...q.map(O=>O.flow.id),...B.map(O=>O.flow.id)].filter(O=>!!O)),k=r.filter(O=>!!O.waypoints),I=(O,F)=>Math.abs(F.x-O.x)<2?"L":Math.abs(F.x-(O.x+O.width))<2?"R":Math.abs(F.y-O.y)<2?"T":Math.abs(F.y-(O.y+O.height))<2?"B":void 0,T=new Map,$=(O,F,N)=>{if(!O||!F||typeof O.x!="number")return;const W=I(O,F);if(!W)return;let Y=T.get(O.id);Y||T.set(O.id,Y=new Map),Y.set(W,[...Y.get(W)??[],N])};for(const O of k){const F=O.waypoints;!F||F.length<2||($(O.source,F[0],{id:O.id,dir:"out"}),$(O.target,F[F.length-1],{id:O.id,dir:"in"}))}const D=new Set;for(const[O,F]of T){const N=h(O);if(!N||typeof N.x!="number")continue;const W=X=>{var ye;const fe=(ye=h(X.id))==null?void 0:ye.source;return!!fe&&typeof fe.x=="number"&&fe.x+fe.width/2>N.x+N.width/2};if(![...F.values()].some(X=>X.length>=3&&X.some(fe=>fe.dir==="out")&&X.some(fe=>fe.dir==="in"&&S.has(fe.id)&&W(fe))))continue;const re=w(N);if(!re||D.has(re.id)||(re.children??[]).some(X=>X.type==="bpmn:Lane"))continue;const J=(wR=F.get("T"))!=null&&wR.length?(_R=F.get("B"))!=null&&_R.length?void 0:"B":"T";if(!J||(J==="T"?N.y-re.y:re.y+re.height-(N.y+N.height))>=z)continue;const ue=(re.children??[]).filter(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="label"&&typeof X.x=="number"),ae=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+z}),Fi(ae,re.id,z),J==="T"&&ue.length&&n.moveElements(ue,{x:0,y:z}),D.add(re.id)}}const um=20,pm=4,T6=3,k6=2,K1=2,dm=[10,30,80],yi=()=>{const x=Ge(r);return{bad:dt(x).filter(_=>_.kind==="edge-crosses-shape"||_.kind==="edge-overlap-opposite"||_.kind==="edge-overlap-mixed").length,crossings:yy(x),straight:x.edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.waypoints.length===2).length}},_o=x=>{const _=Ge(r),S=_.edges.find(k=>k.id===x);return S?Tt(S,fn(_)).length:0},da=x=>_o(x)>0,ds=x=>Ge(r).edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.id!==x&&_.waypoints.length===2).length,X1=(x,_,S)=>wo([{subtree:x,pool:_}],S),Z1=(x,_)=>_.bad>x.bad||_.crossings>x.crossings&&_.straight<=x.straight&&_.bad>=x.bad,Ir=(x,_)=>Z1(x,_)||_.straight<x.straight,Br=(x,_,S=()=>!0,k=Z1,I=!1)=>{const T=yi(),$=wo(x,_,I);if(!$)return!1;const D=yi();return k(T,D)||!S()?($(),!1):!0},J1=(x,_,S,k=()=>!0)=>Br([{subtree:x,pool:_}],S,k),Wo=x=>{var _;return!!((_=G.get(x))!=null&&_.node.participant)},fs=new Map;for(const x of B){if(!Wo(x.flow.target))continue;const _=fs.get(x.flow.target)??[];_.push(x),fs.set(x.flow.target,_)}const jc=[...fs.keys()],fm=new Set(q.map(x=>x.flow.target)),Q1=x=>Ip.findIndex(({op:_})=>_.participant.id===x);jc.sort((x,_)=>{var I,T;const S=fm.has(x)?1:0,k=fm.has(_)?1:0;return S!==k?S-k:Q1((I=G.get(x))==null?void 0:I.node.participant)-Q1((T=G.get(_))==null?void 0:T.node.participant)});const Gi=x=>x.x+x.width/2,O6=x=>{const _=new Map;for(const I of r.getAll()){const T=I;if(!T.waypoints||!T.source||!T.target)continue;(_.get(T.source.id)??_.set(T.source.id,[]).get(T.source.id)).push(T.target.id)}const S=new Set([x]),k=[x];for(let I=0;I<k.length;I++)for(const T of _.get(k[I])??[])S.has(T)||(S.add(T),k.push(T));return S},D6=(x,_)=>{const S=O6(_);let k;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 D=Gi($);(k===void 0||D>k)&&(k=D)}return k},hm=(x,_)=>{const S=h(x.flow.source);if(S)return S.type==="bpmn:Participant"?D6(S.id,_):Gi(S)},eR=x=>{let _;for(const S of fs.get(x)??[]){const k=hm(S,x);k!==void 0&&(!_||k>_.cx)&&(_={op:S,cx:k})}return _==null?void 0:_.op},L6=x=>{const _=eR(x),S=h(x),k=_?hm(_,x):void 0;return S&&k!==void 0?k-Gi(S):void 0},tR=x=>{const _=L6(x);return _!==void 0&&Math.abs(_)<um},Hc=(x,_,S,k,I)=>{var T;for(let $=!0;$;){$=!1;for(const D of B){if(D.flow.id===S)continue;const O=_.has(D.flow.source),F=_.has(D.flow.target);if(O===F||k(O?D.flow.source:D.flow.target))continue;const N=O?D.flow.target:D.flow.source;if(I(N)||!Wo(N))continue;const W=h(D.flow.id);if(!(W!=null&&W.waypoints)||W.waypoints.length!==2)continue;const Y=h(N),re=(T=G.get(N))==null?void 0:T.node.participant;if(!Y||!re)continue;const J=Qi(N,ee=>ee.x>=Y.x).filter(ee=>!_.has(ee.id));if(!(!J.length||J.some(ee=>I(ee.id)))){for(const ee of J)_.add(ee.id);x.set(re,[...x.get(re)??[],...J]),$=!0}}}return[...x].map(([$,D])=>({subtree:D,pool:m($)}))},gm=(x,_,S,k,I)=>Hc(new Map([[_,[...x]]]),new Set(x.map(T=>T.id)),k,T=>T===S,T=>T===I),mm=x=>{const _=eR(x);if(!_)return null;const S=h(x),k=h(_.flow.source),I=hm(_,x);if(!S||!k||I===void 0)return null;const T=I-Gi(S);if(T>=um){const $=G.get(x).node.participant,D=Qi(x,F=>F.x>=S.x),O=Qi(x,F=>F.x>=S.x&&!tR(F.id));return{groups:gm(D,$,x,_.flow.id,_.flow.source),dx:T,cut:O.length<D.length?gm(O,$,x,_.flow.id,_.flow.source):void 0}}if(-T>=um&&Wo(_.flow.source)){const $=G.get(_.flow.source).node.participant,D=Qi(_.flow.source,O=>O.x>=k.x&&!tR(O.id));return{groups:gm(D,$,_.flow.source,_.flow.id,x),dx:-T}}return null},nR=()=>jc.map(x=>({id:x,plan:mm(x)})).filter(x=>!!x.plan).sort((x,_)=>Math.min(...x.plan.groups.flatMap(S=>S.subtree.map(k=>k.x)))-Math.min(..._.plan.groups.flatMap(S=>S.subtree.map(k=>k.x)))).map(x=>x.id),iR=()=>{var k;const x=r.getAll().filter(_i).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 _=((k=x[0])==null?void 0:k[1])??0,S=0;for(const[I,T]of x.slice(1))I>_&&(S=Math.max(S,I-_)),_=Math.max(_,T);return S},oR=x=>{if(!x.cut)return wo(x.groups,x.dx);const _=wo(x.groups,x.dx,!0);if(!_)return null;const S=yi(),k=iR();_();const I=wo(x.cut,x.dx,!0);if(I){const T=yi();if(T.bad<=S.bad&&T.crossings<=S.crossings&&T.straight>=S.straight&&iR()<k)return I;I()}return wo(x.groups,x.dx)};for(let x=0;x<3;x++){const _=yi(),S=[];for(const I of nR()){const T=mm(I);if(!T)continue;const $=oR(T);$&&S.push($)}if(!S.length)break;if(!Ir(_,yi()))continue;for(const I of S.reverse())I();let k=!1;for(const I of nR()){const T=mm(I);if(!T)continue;const $=yi(),D=oR(T);D&&(Ir($,yi())?D():k=!0)}if(!k)break}for(const x of jc){if(fm.has(x))continue;const _=G.get(x);if(!_||_.node.lane!==void 0)continue;const S=bt(_);if(S===void 0)continue;const k=h(x),I=k?w(k):void 0;if(!k||!I)continue;const T=I.y+he+Ln(`pool:${_.node.participant??""}`,S)*z,$=T-(k.y+k.height/2);$!==0&&!ge(I,k,k.x+k.width/2,T)&&n.moveElements([k],{x:0,y:$})}const Np=()=>{const x=r.filter(k=>k.type==="bpmn:Participant"),_=new Map(x.map(k=>[k.id,k]));let S=0;for(const{pools:[k,I]}of Ed(x)){const T=_.get(k),$=_.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},ym=new Set,rR=new Set;for(let x=0,_=!0;_&&x<T6;x++){_=!1;for(const S of jc.flatMap(k=>fs.get(k)??[])){if(ym.has(S.flow.id)||!da(S.flow.id))continue;const k=h(S.flow.target);if(!k)continue;const I=m(G.get(S.flow.target).node.participant),T=Qi(S.flow.target,N=>N.x>=k.x),$=k.width+Q,D=_o(S.flow.id),O=ds(S.flow.id),F=Np();for(let N=1;N<=pm;N++){const W=()=>_o(S.flow.id)>=D||Np()>F?!1:ds(S.flow.id)>=O?!0:(rR.add(S.flow.id),!1);if(J1(T,I,$*N,W)){ym.add(S.flow.id),_=!0;break}}}}const aR=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const _=x.source,S=x.target;return!!_&&!!S&&S.x+S.width<_.x}).length;for(const x of jc.flatMap(_=>fs.get(_)??[])){if(ym.has(x.flow.id)||!rR.has(x.flow.id)||!da(x.flow.id))continue;const _=h(x.flow.target);if(!_)continue;const S=m(G.get(x.flow.target).node.participant),k=Qi(x.flow.target,Y=>Y.x>=_.x),I=new Set(k.map(Y=>Y.id)),T=new Map;for(const Y of r.filter(re=>re.type==="bpmn:MessageFlow")){if(((ER=Y.waypoints)==null?void 0:ER.length)!==2||!Y.source||!Y.target)continue;const re=I.has(Y.source.id);if(re===I.has(Y.target.id))continue;const J=re?Y.target:Y.source,ee=(SR=G.get(J.id))==null?void 0:SR.node.participant;!ee||T.has(J.id)||T.set(J.id,{subtree:[J],pool:m(ee)})}if(!T.size)continue;const $=_.width+Q,D=_o(x.flow.id),O=ds(x.flow.id),F=Np(),N=aR(),W=()=>_o(x.flow.id)<D&&ds(x.flow.id)>=O&&Np()<=F&&aR()<=N;for(let Y=1;Y<=k6&&!Br([{subtree:k,pool:S},...T.values()],$*Y,W);Y++);}const vm=B.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),sR=new Set(vm.map(x=>x.id));for(const x of r.filter(_=>_.type==="bpmn:MessageFlow"))sR.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&vm.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of vm){if(!da(x.id))continue;const _=h(x.source),S=h(x.target);if(!_||!S)continue;let k,I,T,$;const D=_.type==="bpmn:Participant",O=S.type==="bpmn:Participant";if(D!==O){const[N,W]=D?[S,_]:[_,S];if(k=Gi(N),k<W.x||k>W.x+W.width)continue;if([I,T]=N.y<W.y?[N.y+N.height,W.y]:[W.y+W.height,N.y],!x.preexisting){const Y=w(N);if(!Y)continue;$=[Math.min(Y.y,W.y),Math.max(Y.y,W.y)]}}else{if(D||(k=_.x+_.width/2,Math.abs(k-(S.x+S.width/2))>15))continue;[I,T]=_.y<S.y?[_.y+_.height,S.y]:[S.y+S.height,_.y]}const F=[...G.values()].map(N=>h(N.node.id)).filter(N=>!!N&&N.id!==_.id&&N.id!==S.id).filter(N=>N.x<=k&&k<=N.x+N.width&&N.y+N.height>I&&N.y<T).sort((N,W)=>N.x-W.x);for(const N of F){const W=(RR=G.get(N.id))==null?void 0:RR.node.participant,Y=W?h(W):void 0;if(!W||!Y||$&&!(Y.y>$[0]&&Y.y<$[1]))continue;const re=[...G.values()].filter(xe=>xe.node.participant===W).map(xe=>xe.node.id),J=xe=>xe.map(me=>h(me)).filter(me=>!!me),ue=[E6(N.id,xe=>{var me;return((me=G.get(xe.id))==null?void 0:me.node.participant)===W}),J(re)].filter(xe=>xe.length).map(xe=>[{subtree:xe,pool:Y}]);if(x.preexisting||$){const xe=J(re);xe.length&&ue.push(Hc(new Map([[W,[...xe]]]),new Set(xe.map(me=>me.id)),x.id,()=>!1,me=>me===_.id||me===S.id))}const ae=N.width+Q,X=_o(x.id),fe=ds(x.id),ye=()=>_o(x.id)<X&&ds(x.id)>=fe;let oe=!1;for(const xe of ue){for(let me=1;me<=pm;me++)if(Br(xe,ae*me,ye)){oe=!0;break}if(oe)break}if(!da(x.id))break}}const hs=()=>{var _;const x=new Set;for(const S of dt(Ge(r)))S.kind!=="edge-crosses-shape"||sR.has(S.edge)||((_=h(S.edge))==null?void 0:_.type)==="bpmn:MessageFlow"&&x.add(`${S.edge}>${S.shape}`);return x},xm=(x,_)=>yi().bad>=x&&[...hs()].some(S=>!_.has(S)),bm=x=>{var _,S;return _o(x)===0&&((S=(_=h(x))==null?void 0:_.waypoints)==null?void 0:S.length)===2},I6=(x,_,S)=>{const k=new Set(x.flatMap(T=>T.subtree.map($=>$.id))),I=[...hs()].filter(T=>!S.has(T)).map(T=>T.split(">")[1]);return[...new Set(I)].filter(T=>k.has(T)&&T!==_.source&&T!==_.target)},B6=(x,_,S,k,I)=>{const T=x.map(F=>({...F,subtree:F.subtree.filter(N=>!I.includes(N.id))})).filter(F=>F.subtree.length),$=new Set(T.flatMap(F=>F.subtree.map(N=>N.id))),D=()=>I.every(F=>{const N=h(F);return!!N&&q.filter(W=>W.flow.target===F&&$.has(W.flow.source)).every(W=>{const Y=h(W.flow.source);return!!Y&&Y.x+Y.width<=N.x})});return Br(T,_,()=>bm(S.id)&&[...hs()].every(F=>k.has(F))&&D(),Ir,!0)},$p=(x,_,S,k)=>{let I=0;for(const T of x){const $=h(T.id);for(const D of[...($==null?void 0:$.incoming)??[],...($==null?void 0:$.outgoing)??[]]){if(D.type!=="bpmn:SequenceFlow")continue;const O=D.waypoints??[];for(let F=0;F+1<O.length;F++){const N=O[F],W=O[F+1];if(Math.abs(N.y-W.y)<.5)Math.min(N.x,W.x)<_&&_<Math.max(N.x,W.x)&&S<N.y&&N.y<k&&I++;else if(Math.abs(N.x-W.x)>=.5){const Y=(_-N.x)/(W.x-N.x);if(Y<=0||Y>=1)continue;const re=N.y+Y*(W.y-N.y);S<re&&re<k&&I++}}}}return I};for(const x of B){if(!da(x.flow.id))continue;const _=h(x.flow.id);if(((MR=_==null?void 0:_.waypoints)==null?void 0:MR.length)!==2)continue;const S=h(x.flow.source),k=h(x.flow.target);if(!S||!k||S.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!Wo(x.flow.source)||!Wo(x.flow.target)||Math.abs(Gi(S)-Gi(k))>K1)continue;const I=Gi(S),T=_.waypoints.map(ae=>ae.y),[$,D]=[Math.min(...T),Math.max(...T)],O=fn(Ge(r)).filter(ae=>ae.id!==S.id&&ae.id!==k.id&&ae.x<I&&I<ae.x+ae.width&&$<ae.y+ae.height&&ae.y<D);if(!O.length)continue;const F=(CR=G.get(x.flow.source))==null?void 0:CR.node.participant,N=(AR=G.get(x.flow.target))==null?void 0:AR.node.participant;if(!F||!N)continue;const W=new Map;for(const[ae,X,fe]of[[x.flow.source,S,F],[x.flow.target,k,N]]){const ye=W.get(fe)??[],oe=Qi(ae,xe=>xe.x>=X.x).filter(xe=>!ye.some(me=>me.id===xe.id));W.set(fe,[...ye,...oe])}const Y=new Set([...W.values()].flat().map(ae=>ae.id)),re=Hc(W,Y,x.flow.id,ae=>ae===x.flow.source||ae===x.flow.target,()=>!1),J=Math.max(...O.map(ae=>ae.x+ae.width)),ee=Math.min(...O.map(ae=>ae.x)),ue=dm[0];if($p(O,J+ue,$,D)>0&&$p(O,ee-ue,$,D)===0){let ae=!1;for(const X of dm){const fe=ee-X-I;if(fe>=0)continue;const ye=yi().bad,oe=hs();if(ae=Br(re,fe,()=>bm(x.flow.id)&&!xm(ye,oe),Ir),ae)break}if(ae){f.add(x.flow.id);continue}}for(const ae of dm){const X=J+ae-I;if(X<=0)continue;const fe=yi().bad,ye=hs();let oe=[],xe=!0;const me=()=>!bm(x.flow.id)||xe&&(oe=I6(re,x.flow,ye),oe.length)?!1:!xm(fe,ye);if(Br(re,X,me,Ir))break;if(oe.length&&(B6(re,X,x.flow,ye,oe)||(xe=!1,Br(re,X,me,Ir))))break}}{const x=T=>T.y+T.height/2,_=/(Task|Event|Gateway|CallActivity|SubProcess)$/,S=()=>{const T=Ge(r),$=new Set(dt(T).flatMap(F=>F.kind==="edge-crosses-shape"?[`${F.edge}|${F.shape}`]:[])),D=T.shapes.filter(F=>!F.container&&_.test(F.type)),O=new Set;for(const F of T.edges){if(F.type!=="bpmn:SequenceFlow"&&F.type!=="bpmn:MessageFlow")continue;const N=new Set(F.endpoints);for(const W of[F.waypoints[0],F.waypoints[F.waypoints.length-1]])for(const Y of D)Y.x-4<=W.x&&W.x<=Y.x+Y.width+4&&Y.y-4<=W.y&&W.y<=Y.y+Y.height+4&&N.add(Y.id);for(const W of D)if(!(N.has(W.id)||$.has(`${F.id}|${W.id}`))){for(let Y=0;Y+1<F.waypoints.length;Y++)if(Ao(F.waypoints[Y],F.waypoints[Y+1],W)<=am){O.add(`${F.id}|${W.id}`);break}}}return O},k=()=>({...yi(),grazes:S()}),I=[];for(const T of G.keys()){if(!Wo(T))continue;const $=q.filter(F=>F.flow.target===T);if($.length!==1)continue;const D=h($[0].flow.source),O=h(T);!D||!O||!G.has(D.id)||Math.abs(x(D)-x(O))>1||O.x-(D.x+D.width)<=Q+1||I.push({id:T,pred:D,node:O})}I.sort((T,$)=>T.node.x-$.node.x);for(const{id:T}of I){const $=G.get(T),D=h(T),O=h(q.find(fe=>fe.flow.target===T).flow.source);if(!D||!O)continue;const F=D.x-(O.x+O.width);if(F<=Q+1)continue;const N=m($.node.participant),W=Qi(T,fe=>fe.x>=D.x),Y=-(F-Q),re=(fe,ye)=>ye.bad>fe.bad||ye.crossings>fe.crossings||ye.crossings===fe.crossings&&ye.bad===fe.bad||ye.straight<fe.straight||[...ye.grazes].some(oe=>!fe.grazes.has(oe)),J=Hc(new Map([[$.node.participant,[...W]]]),new Set(W.map(fe=>fe.id)),"",()=>!1,()=>!1),ee=J.some(fe=>fe.pool!==N)||J.reduce((fe,ye)=>fe+ye.subtree.length,0)>W.length,ue=k(),ae=X1(W,N,Y);if(!ae)continue;const X=k();if(ee&&!re(ue,X)){ae();const fe=wo(J,Y);if(fe){const ye=k();if(!re(ue,ye)&&ye.bad<=X.bad&&ye.crossings<=X.crossings)continue;fe()}X1(W,N,Y);continue}re(ue,X)&&ae()}}lm(!0);const N6=new Set(b.filter(x=>x.participant.blackBox).map(x=>x.participant.id)),cR=x=>{const _=Ge(r),S=fn(_);return _.edges.filter(k=>{if(k.type!=="bpmn:MessageFlow"||k.id===x)return!1;if(k.waypoints.length===2)return!0;const I=h(k.id),[T,$]=[I==null?void 0:I.source,I==null?void 0:I.target];if(!T||!$||T.type==="bpmn:Participant"==($.type==="bpmn:Participant"))return!1;const[D,O]=T.type==="bpmn:Participant"?[T,$]:[$,T];if(!N6.has(D.id))return!1;const F=Gi(O);if(F<=D.x+D.width-10)return!1;const N=D.y>O.y,W=[{x:F,y:N?O.y+O.height:O.y},{x:F,y:N?D.y:D.y+D.height}];return!Tt({...k,waypoints:W},S).length}).length};let lR=!1;for(const x of B){if(!da(x.flow.id))continue;const _=h(x.flow.source),S=h(x.flow.target);if(!_||!S)continue;const k=_.type==="bpmn:Participant";if(k===(S.type==="bpmn:Participant"))continue;const[I,T]=k?[S,_]:[_,S],$=Gi(I);if($<T.x+10||$>T.x+T.width-10)continue;const D=(PR=G.get(I.id))==null?void 0:PR.node.participant;if(!D)continue;const[O,F]=I.y<T.y?[I.y+I.height,T.y]:[T.y+T.height,I.y],N=[...G.values()].filter(J=>J.node.participant===D&&J.node.id!==I.id).map(J=>h(J.node.id)).filter(J=>!!J&&J.x<$&&$<J.x+J.width&&J.y+J.height>O&&J.y<F).sort((J,ee)=>J.x-ee.x);if(!N.length)continue;const W=fn(Ge(r)).filter(J=>J.id!==I.id&&J.id!==T.id);let Y=!1;for(let J=I.x+10;J<=I.x+I.width-10&&!Y;J+=5)Y=!W.some(ee=>ee.x<J&&J<ee.x+ee.width&&ee.y<F&&ee.y+ee.height>O);if(Y)continue;const re=m(D);for(const J of N){const ee=Qi(J.id,ye=>ye.x>=J.x);if(ee.some(ye=>ye.id===I.id))continue;const ue=J.width+Q,ae=_o(x.flow.id),X=cR(x.flow.id),fe=()=>_o(x.flow.id)<ae&&cR(x.flow.id)>=X;for(let ye=1;ye<=pm;ye++)if(J1(ee,re,ue*ye,fe)){lR=!0;break}if(!da(x.flow.id))break}}lR&&lm(!0);const gs=40;{const S=/(Task|Event|Gateway|CallActivity|SubProcess)$/,k=D=>{var J,ee;const O=h(D),F=O==null?void 0:O.waypoints;if(!O||!F||F.length!==2||Math.abs(F[0].x-F[1].x)>.5)return[];const N=F[0].x,W=Math.min(F[0].y,F[1].y),Y=Math.max(F[0].y,F[1].y),re=[];for(const ue of fn(Ge(r))){if(!S.test(ue.type)||ue.id===((J=O.source)==null?void 0:J.id)||ue.id===((ee=O.target)==null?void 0:ee.id))continue;const ae=ue.y+ue.height/2;if(!(W<ae&&ae<Y))continue;let X,fe;if(N<=ue.x)X="L",fe=ue.x-N;else if(N>=ue.x+ue.width)X="R",fe=N-ue.x-ue.width;else continue;if(fe>80||!$p([ue],N,W,Y))continue;const ye=X==="R"?ue.x-fe:ue.x+ue.width+fe;$p([ue],ye,W,Y)===0&&re.push({id:ue.id,side:X,d:fe,x:ue.x,width:ue.width,col:N})}return re.sort((ue,ae)=>ue.d-ae.d)},I=()=>B.reduce((D,O)=>D+k(O.flow.id).length,0),T=D=>{const O=Ge(r),F=O.edges.find(N=>N.id===D);return F?Pa(F,O.edges.filter(N=>N.type==="bpmn:SequenceFlow")):0},$=()=>{var re,J;const D=Ge(r),O=ee=>ee.map(h).filter(ue=>!!ue&&typeof ue.x=="number"),F=(ee,ue)=>{const ae=Math.min(...ue.map(oe=>oe.x))-gs,X=Math.min(...ue.map(oe=>oe.y))-gs,fe=Math.max(...ue.map(oe=>oe.x+oe.width))+gs,ye=Math.max(...ue.map(oe=>oe.y+oe.height))+gs;return{id:ee,type:"bpmn:Group",x:ae,y:X,width:fe-ae,height:ye-X,container:!0,attached:!1}},N=[];for(const ee of V){const ue=O(ee.group.members??[]);ue.length&&N.push(F(ee.group.id,ue))}const W=new Map(Vt(e,"group.update").map(ee=>[ee.id,ee]));for(const ee of r.filter(ue=>ue.type==="bpmn:Group")){const ue=(re=W.get(ee.id))==null?void 0:re.members;if(ue){const oe=O(ue);oe.length&&N.push(F(ee.id,oe));continue}const X=(((J=ee.businessObject.extensionElements)==null?void 0:J.values)??[]).find(oe=>oe.$type==="bwl:Members"),fe=O(((X==null?void 0:X.refs)??"").split(" ").filter(Boolean)),ye=fe.some(oe=>oe.x<ee.x||oe.y<ee.y||oe.x+oe.width>ee.x+ee.width||oe.y+oe.height>ee.y+ee.height);N.push(fe.length&&ye?F(ee.id,fe):{id:ee.id,type:"bpmn:Group",x:ee.x,y:ee.y,width:ee.width,height:ee.height,container:!0,attached:!1})}const Y=dt({...D,shapes:[...D.shapes.filter(ee=>ee.type!=="bpmn:Group"),...N]},{includeObservationOnly:!0});return{cuts:Y.filter(ee=>ee.kind==="group-cuts-shape").length,along:Y.filter(ee=>ee.kind==="edge-along-group-boundary").length}};for(const D of B)for(let O=0;O<3;O++){const F=k(D.flow.id).filter(X=>X.d>10);if(!F.length)break;const N=h(D.flow.source),W=h(D.flow.target);if(!N||!W||N.type==="bpmn:Participant"||W.type==="bpmn:Participant"||!Wo(D.flow.source)||!Wo(D.flow.target)||Math.abs(Gi(N)-Gi(W))>K1)break;const Y=(TR=G.get(D.flow.source))==null?void 0:TR.node.participant,re=(kR=G.get(D.flow.target))==null?void 0:kR.node.participant;if(!Y||!re)break;const J=new Map;for(const[X,fe,ye]of[[D.flow.source,N,Y],[D.flow.target,W,re]]){const oe=J.get(ye)??[],xe=Qi(X,me=>me.x>=fe.x).filter(me=>!oe.some(_e=>_e.id===me.id));J.set(ye,[...oe,...xe])}const ee=new Set([...J.values()].flat().map(X=>X.id)),ue=Hc(J,ee,D.flow.id,X=>X===D.flow.source||X===D.flow.target,()=>!1);let ae=!1;for(const X of F)if(!ee.has(X.id)){for(const fe of[...new Set([Math.max(10,Math.round(X.d)),30,80])].sort((ye,oe)=>ye-oe)){const ye=X.side==="L"?X.x+X.width+fe-X.col:X.x-fe-X.col,oe=yi(),xe=hs(),me=I(),_e=T(D.flow.id),De=$(),Fe=wo(ue,ye,!0);if(!Fe)continue;if((()=>{if(Ir(oe,yi())||k(D.flow.id).some(Se=>Se.id===X.id)||I()>=me||T(D.flow.id)>=_e||xm(oe.bad,xe))return!0;const Ve=$();return Ve.cuts>De.cuts||Ve.along>De.along})()){Fe();continue}ae=!0;break}if(ae)break}if(!ae)break}}{const x=D=>!("waypoints"in D&&D.waypoints)&&/(Task|Event|Gateway)$/.test(D.type)&&typeof D.x=="number",_=D=>(D??[]).filter(O=>O.type==="bpmn:SequenceFlow"),S=(D,O)=>D.y+(O.get(D.id)??0),k=(D,O,F)=>{var re;const N=D.x+D.width/2,W=S(D,F),Y=S(O,F);return Y<=W?[]:(((re=O.parent)==null?void 0:re.children)??[]).filter(J=>{if(!x(J)||J.id===D.id||J.id===O.id||!(J.x<N&&N<J.x+J.width))return!1;const ee=S(J,F);return ee>=W+D.height&&ee+J.height<=Y})},I=()=>{const D=[];for(const O of q){const F=G.get(O.flow.target);if(!F||!G.has(O.flow.source)||!$e.has(`pool:${F.node.participant??""}`))continue;const N=h(O.flow.source),W=h(O.flow.target);!N||!W||!W.parent||W.parent!==N.parent||!/Gateway$/.test(N.type)||_(W.incoming).length!==1||Math.abs(N.x+N.width/2-(W.x+W.width/2))>1||W.y<=N.y+N.height||D.push([N,W])}return D},T=D=>I().reduce((O,[F,N])=>O+k(F,N,D).length,0),$=D=>{const O=D.y+D.height/2,F=new Map([[D.id,D]]),N=[D];for(;N.length;){const W=N.shift();for(const Y of[..._(W.incoming),..._(W.outgoing)]){const re=Y.source===W?Y.target:Y.source;!re||F.has(re.id)||!G.has(re.id)||!x(re)||Math.abs(re.y+re.height/2-O)>1||(F.set(re.id,re),N.push(re))}}return F};for(const[D,O]of I()){const F=k(D,O,new Map);if(F.length!==1||!G.has(F[0].id))continue;const N=F[0],W=$(N),Y=$(O);if(W.has(D.id)||Y.has(D.id)||[...Y.keys()].some(ae=>W.has(ae)))continue;const re=O.y+O.height/2-(N.y+N.height/2),J=new Map([...[...Y.keys()].map(ae=>[ae,-re]),...[...W.keys()].map(ae=>[ae,re])]),ee=new Set([...Y.keys(),...W.keys()]),ue=O.parent;[...Y.values(),...W.values()].some(ae=>ge(ue,ae,ae.x+ae.width/2,S(ae,J)+ae.height/2,ee))||T(J)>=T(new Map)||(n.moveElements([...W.values()],{x:0,y:re}),n.moveElements([...Y.values()],{x:0,y:-re}))}}const $6=10,F6=400,j6=x=>[...x.incoming??[],...x.outgoing??[]].filter(_=>_.type==="bpmn:DataInputAssociation"||_.type==="bpmn:DataOutputAssociation").map(_=>_.source===x?_.target:_.source).filter(_=>!!_&&typeof _.y=="number"),H6=r.filter(x=>x.type==="bpmn:DataStoreReference"&&v.has(x.id)),G6=(x,_)=>{const S=x.x+x.width/2,k=x.y+x.height/2;let I;for(const T of H6){if((w(T)??y())!==_||T.y<x.y+x.height)continue;const $=Math.abs(T.x+T.width/2-S);$>F6||$<T.width||!j6(T).some(O=>O.height===x.height&&Math.abs(O.y+O.height/2-k)<=$6&&T.y>=O.y+O.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},z6=50,V6=(x,_)=>{const S=w(_);if(!S||x.y<_.y+_.height)return;const k=g(S,_),I=k??S,T=x.label,$=Math.max(x.y+x.height,T?T.y+T.height:0),D=I.y+I.height;if($<=D)return;const O=Math.ceil($+z6-D),F=S.y+S.height;if(k){const N=St(k,k.height+O,new Set([x.id]));Fi(F,S.id,O,N)}else n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+O}),Fi(F,S.id,O)};for(const x of A){const _=x.associations??[],S=_.map($=>$.source===x.dataStore.id?$.target:$.source).map(h).find(Boolean),k=S?w(S)??y():y(),I=S?{x:S.x+S.width/2,y:G6(S,k)??S.y+S.height+110}:{x:200,y:Bc+60},T=n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},I,k);S&&V6(T,S);for(const $ of _)Y1(x.dataStore.id,$)}for(const x of L){const S=m(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;Y1(S,x.association)}let uR=0;const fa=10,W6=(x,_)=>{const S=_.map(O=>w(O)).filter(O=>!!O);for(const O of S){const F=fa,N=O.y,W=O.y+O.height,Y=O.x,re=O.x+O.width;if(Math.abs(x.y-N)<F){const J=N+F-x.y;x.y+=J,x.height-=J}if(Math.abs(x.y+x.height-W)<F&&(x.height=W-F-x.y),Math.abs(x.x-Y)<F){const J=Y+F-x.x;x.x+=J,x.width-=J}Math.abs(x.x+x.width-re)<F&&(x.width=re-F-x.x)}if(!S.length)return;const k=Math.min(...S.map(O=>O.y)),I=Math.max(...S.map(O=>O.y+O.height)),T=k-x.y,$=x.y+x.height-I,D=gs-fa;if(T>0!=$>0)if(T>0&&T<D){const O=T+fa;x.y+=O,x.height-=O}else $>0&&$<D&&(x.height-=$+fa)},U6=(x,_)=>{const S=fa,k=30,I=r.filter(T=>T.type==="bpmn:Group"&&T.id!==_);for(const T of I){const $=T.x,D=T.x+T.width,O=T.y,F=T.y+T.height,N=x.y<F&&O<x.y+x.height,W=x.x<D&&$<x.x+x.width;if(N){if(Math.abs(x.x-D)<S){const Y=Math.min(D+S-x.x,k);Y>0&&x.width-Y>0&&(x.x+=Y,x.width-=Y)}if(Math.abs(x.x+x.width-$)<S){const Y=Math.min(x.x+x.width-($-S),k);Y>0&&x.width-Y>0&&(x.width-=Y)}}if(W){if(Math.abs(x.y-F)<S){const Y=Math.min(F+S-x.y,k);Y>0&&x.height-Y>0&&(x.y+=Y,x.height-=Y)}if(Math.abs(x.y+x.height-O)<S){const Y=Math.min(x.y+x.height-(O-S),k);Y>0&&x.height-Y>0&&(x.height-=Y)}}}},wm=(x,_)=>{const S=gs,k=Math.min(...x.map(O=>O.x))-S,I=Math.min(...x.map(O=>O.y))-S,T=Math.max(...x.map(O=>O.x+O.width))+S,$=Math.max(...x.map(O=>O.y+O.height))+S,D={x:k,y:I,width:T-k,height:$-I};return W6(D,x),U6(D,_),D};for(const x of V){const _=(x.group.members??[]).map(h).filter(I=>!!I);let S;_.length?S=wm(_,x.group.id):(S={x:300+uR*350,y:40,width:300,height:200},uR++);const k=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},y());x.group.name&&n.updateLabel(k,x.group.name),(OR=x.group.members)!=null&&OR.length&&ke(k,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(I=>!!I.waypoints),_=new Map,S=(I,T)=>{!I||!T||(_.has(I)||_.set(I,new Set),_.get(I).add(T))};for(const I of x){const T=(DR=I.source)==null?void 0:DR.id,$=(LR=I.target)==null?void 0:LR.id;S(T,$),((IR=I.type)!=null&&IR.includes("DataOutputAssociation")||(BR=I.type)!=null&&BR.includes("DataInputAssociation")||I.type==="bpmn:Association")&&S($,T)}const k=r.filter(I=>I.type==="bpmn:Group");for(const I of k){const $=(((NR=I.businessObject.extensionElements)==null?void 0:NR.values)??[]).find(ae=>ae.$type==="bwl:Members"),D=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean);if(!D.length)continue;const O=new Set(D),F=[...D];for(;F.length;){const ae=F.shift();for(const X of _.get(ae)??[])O.has(X)||(O.add(X),F.push(X))}const N=I.x,W=I.x+I.width,Y=I.y,re=I.y+I.height,J=ae=>q.filter(X=>X.flow.target===ae).length,ee=ae=>{var fe;const X=((fe=h(ae))==null?void 0:fe.type)??"";if(X==="bpmn:StartEvent"&&J(ae)===0)return!1;if(X.endsWith("Gateway")){const ye=q.filter(oe=>oe.flow.target===ae).map(oe=>oe.flow.source);if(ye.length&&ye.every(oe=>{var xe;return((xe=h(oe))==null?void 0:xe.type)==="bpmn:StartEvent"&&J(oe)===0}))return!1}return!0},ue=r.filter(ae=>_i(ae)).filter(ae=>ae.type!=="bpmn:Group"&&ae.type!=="bpmn:Participant"&&ae.type!=="bpmn:TextAnnotation"&&!O.has(ae.id)&&Wo(ae.id)&&ee(ae.id)&&ae.x<W&&ae.x+ae.width>N&&ae.y<re&&ae.y+ae.height>Y);if(ue.length)for(const ae of[-1,1]){const X=ue.filter(Ie=>(Ie.x+Ie.width-N<=W-Ie.x?-1:1)===ae);if(!X.length)continue;const fe=[];for(const Ie of X){const Ve=fe.find(Se=>Se.some(ce=>Ie.y<ce.y+ce.height&&Ie.y+Ie.height>ce.y));Ve?Ve.push(Ie):fe.push([Ie])}const ye=new Map;for(const Ie of fe){let Ve=ae<0?N-fa:W+fa;for(const Se of[...Ie].sort((ce,Re)=>ae<0?Re.x-ce.x:ce.x-Re.x)){const ce=ae<0?Math.min(Se.x,Ve-Se.width):Math.max(Se.x,Ve);Ve=ae<0?ce-Hi:ce+Se.width+Hi,ce!==Se.x&&Math.sign(ce-Se.x)===ae&&ye.set(Se.id,ce-Se.x)}}const oe=new Map,xe=Ie=>oe.get(Ie)===Ie||!oe.get(Ie)?Ie:xe(oe.get(Ie));for(const Ie of X)oe.set(Ie.id,Ie.id);for(const Ie of B){const Ve=ye.has(Ie.flow.source)?Ie.flow.source:void 0,Se=ye.has(Ie.flow.target)?Ie.flow.target:void 0;if(!Ve||!Se)continue;const ce=h(Ie.flow.id);(($R=ce==null?void 0:ce.waypoints)==null?void 0:$R.length)===2&&oe.set(xe(Ve),xe(Se))}const me=new Map;for(const Ie of X){if(!ye.has(Ie.id))continue;const Ve=xe(Ie.id);me.set(Ve,[...me.get(Ve)??[],Ie])}const _e=[...me.values()].sort((Ie,Ve)=>ae<0?Math.min(...Ie.map(Se=>Se.x))-Math.min(...Ve.map(Se=>Se.x)):Math.max(...Ve.map(Se=>Se.x))-Math.max(...Ie.map(Se=>Se.x))),De=[];let Fe=!0;for(const Ie of _e){const Ve=Ie.map(Re=>ye.get(Re.id)??0).reduce((Re,Me)=>Math.abs(Me)>Math.abs(Re)?Me:Re,0),Se=new Map;let ce=!0;for(const Re of Ie){const Me=w(Re);if(!Me){ce=!1;break}Se.has(Me.id)||Se.set(Me.id,{subtree:[],pool:Me}),Se.get(Me.id).subtree.push(Re)}ce&&Br([...Se.values()],Ve,()=>!0,Ir)?De.push({shapes:Ie,dx:Ve}):Fe=!1}if(!Fe)for(const Ie of De.reverse())n.moveElements(Ie.shapes,{x:-Ie.dx,y:0})}}}{const x=new Set([...V.map(_=>_.group.id),...Vt(e,"group.update").map(_=>_.id)]);for(const _ of r.filter(S=>S.type==="bpmn:Group")){if(x.has(_.id))continue;const k=(((FR=_.businessObject.extensionElements)==null?void 0:FR.values)??[]).find(D=>D.$type==="bwl:Members"),I=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(h).filter(D=>!!D);!I.length||!I.some(D=>{const O=v.get(D.id);return!O||O.x!==D.x||O.y!==D.y})||!I.some(D=>D.x<_.x||D.y<_.y||D.x+D.width>_.x+_.width||D.y+D.height>_.y+_.height)||n.resizeShape(_,wm(I,_.id))}}{const _=new Map(nr(Ge(r)).map(D=>[D.owner,D.rect])),S=r.filter(D=>!!D.waypoints),k=new Map,I=(D,O)=>{!D||!O||(k.has(D)||k.set(D,new Set),k.get(D).add(O))};for(const D of S){const O=(jR=D.source)==null?void 0:jR.id,F=(HR=D.target)==null?void 0:HR.id;I(O,F),((GR=D.type)!=null&&GR.includes("DataOutputAssociation")||(zR=D.type)!=null&&zR.includes("DataInputAssociation")||D.type==="bpmn:Association")&&I(F,O)}const T=D=>q.filter(O=>O.flow.target===D).length,$=D=>{var F;const O=((F=h(D))==null?void 0:F.type)??"";if(O==="bpmn:StartEvent"&&T(D)===0)return!1;if(O.endsWith("Gateway")){const N=q.filter(W=>W.flow.target===D).map(W=>W.flow.source);if(N.length&&N.every(W=>{var Y;return((Y=h(W))==null?void 0:Y.type)==="bpmn:StartEvent"&&T(W)===0}))return!1}return!0};for(const D of r.filter(O=>O.type==="bpmn:Group")){const F=(((VR=D.businessObject.extensionElements)==null?void 0:VR.values)??[]).find(ce=>ce.$type==="bwl:Members"),N=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean);if(!N.length)continue;const W=N.map(h).filter(ce=>!!ce);if(!W.length||!(V.some(ce=>ce.group.id===D.id)||Vt(e,"group.update").some(ce=>ce.id===D.id)||W.some(ce=>{const Re=v.get(ce.id);return!Re||Re.x!==ce.x||Re.y!==ce.y})))continue;const re=new Set(N),J=[...N];for(;J.length;){const ce=J.shift();for(const Re of k.get(ce)??[])re.has(Re)||(re.add(Re),J.push(Re))}const ee=D.x,ue=D.x+D.width,ae=D.y,X=D.y+D.height,fe=ce=>{const Re=_.get(ce.id),Me={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return Re?[Me,{x:Re.x,y:Re.y,width:Re.width,height:Re.height}]:[Me]},ye=W.flatMap(fe),oe=Math.min(...ye.map(ce=>ce.x)),xe=Math.max(...ye.map(ce=>ce.x+ce.width)),me=Math.min(...ye.map(ce=>ce.y)),_e=Math.max(...ye.map(ce=>ce.y+ce.height)),De={L:oe-ee,R:ue-xe,T:me-ae,B:X-_e},Fe=new Set(N),Ie=ce=>ce.x>=ee&&ce.x+ce.width<=ue&&ce.y>=ae&&ce.y+ce.height<=X,Ve=r.filter(ce=>_i(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!Fe.has(ce.id)&&(!re.has(ce.id)||!Ie(ce))&&$(ce.id)&&ce.x<ue&&ce.x+ce.width>ee&&ce.y<X&&ce.y+ce.height>ae);if(!Ve.length)continue;const Se={L:0,R:0,T:0,B:0};for(const ce of Ve){const Re=fe(ce),Me=Math.min(...Re.map(Lt=>Lt.x)),Ye=Math.max(...Re.map(Lt=>Lt.x+Lt.width)),Ue=Math.min(...Re.map(Lt=>Lt.y)),at=Math.max(...Re.map(Lt=>Lt.y+Lt.height)),Be={L:Ye-ee,R:ue-Me,T:at-ae,B:X-Ue},Je=["L","R","T","B"].filter(Lt=>Be[Lt]<=De[Lt]+.001);if(!Je.length)continue;const mt=Je.reduce((Lt,zi)=>Be[zi]<Be[Lt]?zi:Lt,Je[0]);Se[mt]=Math.max(Se[mt],Math.min(Be[mt]+10,De[mt]))}!Se.L&&!Se.R&&!Se.T&&!Se.B||n.resizeShape(D,{x:D.x+Se.L,y:D.y+Se.T,width:D.width-Se.L-Se.R,height:D.height-Se.T-Se.B})}}const pR=x=>{const _=x.waypoints;if(_!=null&&_.length){const k=_[Math.floor((_.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const S=x;return{x:S.x,y:S.y,width:S.width,height:S.height}};let dR=0;const _m=Dv.get(t),fR=(x,_)=>{var k;const S=(k=_m==null?void 0:_m.get(x))==null?void 0:k.texts;return S?[...new Set([_,...Object.values(S)])]:[_]};for(const x of H){const _=x.association,S=((WR=x.placement)==null?void 0:WR.anchor)??(_?_.source===x.annotation.id?_.target:_.source:void 0),k=S?h(S):void 0,I=k?pR(k):void 0,T=_v(fR(x.annotation.id,x.annotation.text??"")),$=x.placement??(I&&S?{anchor:S,side:"top"}:void 0);let D;if(I&&$){const[W,Y]=vl[$.side],re=$.offset??50;D={x:I.x+I.width/2+W*(I.width/2+T.width/2+re),y:I.y+I.height/2+Y*(I.height/2+T.height/2+re)}}else D={x:300+dR*260,y:60},dR++;const O=k?w(k)??y():y(),F=O;I&&$&&typeof F.x=="number"&&typeof F.width=="number"&&F.type==="bpmn:Participant"&&(D=bl(r,I,T,F,{placement:$}));const N=n.createShape({type:"bpmn:TextAnnotation",width:T.width,height:T.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},D,O);if(_){const W=Y=>Y===x.annotation.id?N:m(Y);n.connect(W(_.source),W(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}x.placement&&ke(N,"bwl:Placement",ve(x.placement))}for(const x of Vt(e,"association.add")){const _=x.association;n.connect(m(_.source),m(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}const q6=(x,_,S,k)=>{const I=x.parent;if(!I)return k;const T=x.x+x.width/2,$=new Set([x.id]);if(!ge(I,x,T,k,$))return k;const D=_?_.y+Math.min(_.height/2,se):S?S.y+he:void 0;if(D===void 0)return k;const O=Math.floor((k-D)/z+1e-6);for(let F=1;F<=3;F++){const N=O+F,W=D+N*z,Y=nm(_==null?void 0:_.id,N);if(!ge(I,x,T,W,Y?new Set([...$,...Y]):$))return Pt(_==null?void 0:_.id,N,S),W}return k},hR=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of Vt(e,"node.update")){let _=m(x.id);if(x.type&&yl(x.type)!==_.type){const S=_.x+_.width/2,k=_.y+_.height/2,I=hR();_=c.replaceElement(_,{type:yl(x.type),...x.eventDefinition?{eventDefinitionType:Uc[x.eventDefinition]}:{}});const T=hR(),$=[...I].filter(F=>F!==x.id&&!T.has(F));if($.length)throw new kv({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:$});const D=Math.round(S-(_.x+_.width/2)),O=Math.round(k-(_.y+_.height/2));if(D!==0||O!==0){n.moveShape(_,{x:D,y:O});for(const F of[..._.incoming??[],..._.outgoing??[]])$c(F)}}if(x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(_,{"bwl:band":x.band});const S=_.y+_.height/2,k=w(_),I=x.lane?m(x.lane):((k==null?void 0:k.children)??[]).find($=>$.type==="bpmn:Lane"&&S>=$.y&&S<=$.y+$.height);x.band!==void 0&&Pt(I==null?void 0:I.id,x.band,k);const T=I?I.y+(x.band===void 0?I.height/2:Math.min(I.height/2,se)+Ln(I.id,x.band)*z):x.band!==void 0&&k?k.y+he+Ln(`pool:${k.id}`,x.band)*z:void 0;if(T!==void 0){const $=q6(_,I,k,T),D=$===T?T-S:$-(_.y+_.height/2);if(D!==0){p.push({id:_.id,x:_.x,y:_.y,width:_.width,height:_.height}),n.moveElements([_],{x:0,y:D});for(const O of[..._.incoming??[],..._.outgoing??[]])O.type!=="bpmn:SequenceFlow"&&O.type!=="bpmn:MessageFlow"||wd(O.waypoints??[],[O.source,O.target])&&($c(O),d.add(O.id))}}}}for(const x of Vt(e,"sequenceFlow.update")){const _=m(x.id),S=ie.get(x.id);if(S){const k=F=>({x:F.x+F.width/2,y:F.y+F.height/2}),I=m(S.flow.source),T=m(S.flow.target),$=n.connect(I,T,{type:"bpmn:SequenceFlow",businessObject:Bp(S.flow)}),D=cm.get(x.id),O=T.y+T.height/2;D&&T.x>D.exit.x&&Math.abs(O-D.exit.y)>1?n.updateWaypoints($,[D.exit,{x:D.exit.x,y:O},{x:T.x,y:O}]):(n.reconnect($,I,T,[k(I),k(T)]),Math.abs(O-(I.y+I.height/2))>1&&$c($))}else if((x.source!==void 0||x.target!==void 0)&&!$1.has(x.id)){const k=_,I=x.source!==void 0?m(x.source):k.source,T=x.target!==void 0?m(x.target):k.target,$=F=>({x:F.x+F.width/2,y:F.y+F.height/2});n.reconnect(k,I,T,[$(I),$(T)]);const D=cm.get(k.id),O=T.y+T.height/2;if(D&&T.x>D.exit.x&&Math.abs(O-D.exit.y)>1){n.updateWaypoints(k,[D.exit,{x:D.exit.x,y:O},{x:T.x,y:O}]);const F=k.label;if(F&&D.label){const W=Math.abs(D.label.y+F.height/2-D.channelY)<=z/5&&D.label.x+F.width>D.exit.x,Y=D.exit.x+6,re=T.x-6-F.width,J=W?re>=Y?{x:Math.max(Y,Math.min(D.label.x,re)),y:D.label.y+(O-D.channelY)}:void 0:D.label;J&&(J.x!==F.x||J.y!==F.y)&&n.moveElements([F],{x:J.x-F.x,y:J.y-F.y})}}else Math.abs(O-(I.y+I.height/2))>1&&$c(k)}x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(_,{name:((UR=x.condition)==null?void 0:UR.label)??void 0})}for(const x of Vt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Vt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Vt(e,"annotation.update")){const _=m(x.id);if(x.text!==void 0){n.updateProperties(_,{text:x.text});const S=_v(fR(x.id,x.text));if(S.width!==_.width||S.height!==_.height){const k={x:_.x,y:_.y,width:S.width,height:S.height};n.resizeShape(_,k,void 0,{[Ev]:k})}}if(x.placement===null)ke(_,"bwl:Placement",null);else if(x.placement){const S=m(x.placement.anchor),k=pR(S),I=w(S)??y(),T=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[$,D]=vl[x.placement.side],O=x.placement.offset??50,F={x:k.x+k.width/2+$*(k.width/2+_.width/2+O),y:k.y+k.height/2+D*(k.height/2+_.height/2+O)},N=T?bl(r,k,{width:_.width,height:_.height},I,{placement:x.placement,selfId:x.id}):F;n.moveElements([_],{x:N.x-(_.x+_.width/2),y:N.y-(_.y+_.height/2)}),ke(_,"bwl:Placement",ve(x.placement))}}for(const x of Vt(e,"group.update")){const _=m(x.id);if(x.name!==void 0&&n.updateLabel(_,x.name??""),x.members){const S=x.members.map(h).filter(k=>!!k);S.length&&n.resizeShape(_,wm(S,x.id)),ke(_,"bwl:Members",{refs:x.members.join(" ")})}}}function As(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 YP(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 KP(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(y=>y.original?{x:y.x,y:y.y,original:{x:y.original.x,y:y.original.y}}:{x:y.x,y:y.y}),c=(f,y)=>f.length===y.length&&f.every((h,m)=>{var w,g,v,b;return h.x===y[m].x&&h.y===y[m].y&&((w=h.original)==null?void 0:w.x)===((g=y[m].original)==null?void 0:g.x)&&((v=h.original)==null?void 0:v.y)===((b=y[m].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=[...Si(p),...Ri(p)].filter(([f,y])=>u.has(f)!==u.has(y)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,y)=>{c(f.waypoints,l[y])||r.updateWaypoints(f,l[y])}),d}function XP(e,t,n,i=new Set,o=new Set){var h,m;const{elementRegistry:r}=e,a=e.modeling,s=w=>dt(w).filter(g=>!t.has(ct(g))),c=w=>{var g;return((g=r.get(w))==null?void 0:g.type)==="bpmn:TextAnnotation"},l=Ge(r),u=s(l),p=w=>!n.has(w),d=w=>u.some(g=>g.kind==="edge-crosses-shape"&&g.shape===w&&i.has(g.edge)||g.kind==="shape-overlap"&&g.shapes.includes(w)&&g.shapes.every(c)),f=[...new Set(u.flatMap(As))].filter(w=>c(w)&&(!p(w)||d(w))),y=[...f.filter(w=>!p(w)),...f.filter(p)];if(y.length)for(const w of y){const g=r.get(w);if(!g||typeof g.x!="number"||typeof g.width!="number")continue;let v=g.parent,b;for(;v;){if(v.type==="bpmn:Participant"){b=v;break}v=v.parent}if(!b){const z=g.x+g.width/2,Q=g.y+g.height/2;b=r.getAll().find(he=>{if(he.type!=="bpmn:Participant")return!1;const se=he;return typeof se.x=="number"&&typeof se.width=="number"&&z>=se.x&&z<=se.x+se.width&&Q>=se.y&&Q<=se.y+se.height})}if(!b||typeof b.x!="number"||typeof b.width!="number")continue;const M=(((h=g.businessObject.extensionElements)==null?void 0:h.values)??[]).find(z=>z.$type==="bwl:Placement"),B=[...g.incoming??[],...g.outgoing??[]].find(z=>z.type==="bpmn:Association"),A=(M!=null&&M.anchor?r.get(M.anchor):void 0)??(B?((m=B.source)==null?void 0:m.id)===w?B.target:B.source:void 0);if(!A)continue;const L=A.waypoints,H=L!=null&&L.length?{x:L[Math.floor((L.length-1)/2)].x,y:L[Math.floor((L.length-1)/2)].y,width:0,height:0}:{x:A.x,y:A.y,width:A.width,height:A.height},V={width:g.width,height:g.height},G={x:g.x+g.width/2,y:g.y+g.height/2},ie=M==null?void 0:M.side,pe=Pv(r,H,b),q=[];if(ie&&ie in vl&&q.push(bl(r,H,V,b,{placement:{side:ie,offset:(M==null?void 0:M.offset)??null},selfId:w})),pe&&!xl(G,V,pe))for(const z of HP)q.push(bl(r,H,V,b,{placement:{side:z,offset:null},selfId:w}));for(const[z,Q]of[[-1,0],[1,0],[0,-1],[0,1]])for(let he=1;he<=jP;he++)q.push({x:G.x+z*Av*he,y:G.y+Q*Av*he});const Pe=p(w)?Ge(r):l,Te={...Pe,edges:Pe.edges.filter(z=>z.id!==(B==null?void 0:B.id))},ke=s(Te),ve=ke.filter(z=>As(z).includes(w)).length;if(!ve)continue;let U,de=!1;for(const z of q){const Q=z.x-G.x,he=z.y-G.y;if(!Q&&!he||z.x-V.width/2<b.x||z.x+V.width/2>b.x+b.width||z.y-V.height/2<b.y||z.y+V.height/2>b.y+b.height||pe&&!xl(z,V,pe))continue;const se={...Te,shapes:Te.shapes.map(R=>R.id===w?{...R,x:R.x+Q,y:R.y+he}:R)},Ae=o.has(w)?s(se):dt(se).filter(R=>!t.has(ct(R))||As(R).includes(w)),j=Ae.filter(R=>As(R).includes(w)).length;if(j>=ve||Ae.length>ke.length)continue;const C=Math.abs(Q)+Math.abs(he);if(de||((!U||j<U.mine||j===U.mine&&(Ae.length<U.all||Ae.length===U.all&&C<U.dist))&&(U={x:z.x,y:z.y,mine:j,all:Ae.length,dist:C}),U.mine===0&&U.all<ke.length&&(de=!0)),j===0&&Ae.length<ke.length&&KP(e,g,Q,he)===0){U={x:z.x,y:z.y,mine:j,all:Ae.length,dist:C};break}}U&&a.moveElements([g],{x:U.x-G.x,y:U.y-G.y})}}const ZP=60;function Ps(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 JP(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=w=>dt(w).filter(g=>!t.has(ct(g))),a=w=>w.filter(g=>g.kind==="pool-overlap"),s=new Map(n.shapes.map(w=>[w.id,w])),c=(w,g)=>g.x>=w.x&&g.y>=w.y&&g.x+g.width<=w.x+w.width&&g.y+g.height<=w.y+w.height,l=w=>{if(!s.get(w))return[w];const v=new Set,b=new Set([w]);for(let M=0;M<4;M++){let B=!1;for(const A of n.shapes)A.type!=="bpmn:Group"||v.has(A.id)||[...b].some(L=>{const H=s.get(L);return H&&c(A,H)})&&(v.add(A.id),B=!0);for(const A of n.shapes)A.type!=="bpmn:Participant"||b.has(A.id)||[...v].some(L=>{const H=s.get(L);return H&&c(H,A)})&&(b.add(A.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 A=s.get(B);return A&&c(A,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 y=0,h=p,m=d;for(let w=0;w<6;w++){const g=Ge(i),v=a(r(g));if(!v.length)break;const b=new Map(g.shapes.map(L=>[L.id,L]));let E=null;for(const L of v){if(L.kind!=="pool-overlap")continue;const[H,V]=L.pools,G=b.get(H),ie=b.get(V);if(!G||!ie)continue;const[pe,q]=G.x<=ie.x?[G,ie]:[ie,G];if(L.contained)continue;const Pe=s.get(pe.id),Te=s.get(q.id),ke=Pe&&Te?Math.max(Te.x-(Pe.x+Pe.width),0):ZP,ve=pe.x+pe.width+ke-q.x;if(ve<=0)continue;const U=l(q.id).filter(de=>i.get(de));U.length&&(!E||ve>E.dx)&&(E={movers:U,dx:ve})}if(!E)break;const M=E.movers.map(L=>i.get(L)).filter(L=>!!L&&typeof L.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)),A=a(B).length;A<p&&B.length<=d&&(A<h||A===h&&B.length<m||y===0)&&(y=f.length,h=A,m=B.length)}for(const{els:w,dx:g}of f.slice(y).reverse())o.moveElements(w,{x:-g,y:0})}const Ts=.5,wl=150,$v=1200;function QP(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of tT(n))i.length<n.length&&i.some(r=>Vd(e.elementRegistry.get(r.id)))||nT(e,i)}function eT(e,t){const n=e.modeling,i=new Set(t.shapes.map(r=>r.id)),o=e.elementRegistry.getAll().filter(r=>r.type==="bpmn:Participant"&&!i.has(r.id)&&!Vd(r));for(const r of o){let a=-1/0;const s=d=>{d&&typeof d.x=="number"&&typeof d.width=="number"&&(a=Math.max(a,d.x+d.width))},c=d=>{for(const f of d.children??[]){if("waypoints"in f&&f.waypoints){for(const y of f.waypoints)a=Math.max(a,y.x);s(f.label);continue}f.type!=="label"&&(f.type!=="bpmn:Lane"&&(s(f),s(f.label)),c(f))}};if(c(r),!Number.isFinite(a))continue;const l=d=>d.x<r.x+r.width&&d.x+d.width>r.x&&d.y<r.y+r.height&&d.y+d.height>r.y;for(const d of e.elementRegistry.getAll()){if(d.type==="bpmn:Participant"||d.type==="bpmn:Lane"||d.type==="label")continue;const f="waypoints"in d&&d.waypoints?[d.label]:[d,d.label];for(const y of f)y&&typeof y.x=="number"&&typeof y.width=="number"&&l(y)&&s(y)}const u=Math.max($v,Math.round(a+wl-r.x));u>=r.width-1||[...r.incoming??[],...r.outgoing??[]].flatMap(d=>d.waypoints??[]).some(d=>d.x>=r.x+u-1)||Ps(n,r,u,{layout:!1})}}function tT(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)<=Ts?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function Vd(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 nT(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(g=>g.x+g.width),r=Math.max(...o);if(r-Math.min(...o)>Ts)return;const a=t.map(g=>n.get(g.id)).filter(g=>!!g&&typeof g.x=="number");if(a.length<2)return;const s=new Map(t.map(g=>[g.id,g.x]));if(a.some(g=>Math.abs(g.x-s.get(g.id))>Ts))return;const c=a.map(g=>g.x+g.width);if(Math.max(...c)-Math.min(...c)<=Ts)return;const l=g=>g.x+g.width,u=g=>!!g&&typeof g.width=="number",p=g=>{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(g),v},d=new Map(a.map(g=>[g.id,p(g)]));let f=r;for(const g of a){const{shapes:v}=d.get(g.id),b=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+wl))}const y=a.filter(g=>Math.abs(l(g)-f)>Ts);if(!y.length)return;for(const g of y){const v=l(g),{shapes:b,edges:E,lanes:M}=d.get(g.id);if([...b.flatMap(L=>[l(L),...u(L.label)?[l(L.label)]:[]]),...E.flatMap(L=>[...L.waypoints.map(H=>H.x),...u(L.label)?[l(L.label)]:[]])].some(L=>L>f)||[...(g.incoming??[]).map(L=>L.waypoints[L.waypoints.length-1]),...(g.outgoing??[]).map(L=>L.waypoints[0])].some(L=>!L||L.x>f||Math.abs(L.x-v)<1))return;if(f>v){const L={x:v,y:g.y,width:f-v,height:g.height},H=new Set([g.id,...b.map(G=>G.id),...E.map(G=>G.id),...M.map(G=>G.id)]);if(n.getAll().some(G=>{var q;if("waypoints"in G&&G.waypoints||G.type==="bpmn:Group"||!u(G))return!1;const ie=G.type==="label"?(q=G.labelTarget)==null?void 0:q.id:G.id;if(!ie||H.has(ie)||H.has(G.id))return!1;const pe=G;return pe.x<L.x+L.width&&pe.x+pe.width>L.x&&pe.y<L.y+L.height&&pe.y+pe.height>L.y}))return}}const h=()=>new Set(dt(Ge(n)).map(ct)),m=h(),w=y.map(g=>g.width);for(const g of y)Ps(i,g,f-g.x,{layout:!1});[...h()].every(g=>m.has(g))||y.forEach((g,v)=>Ps(i,g,w[v],{layout:!1}))}function iT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>dt(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),y=s(d),h=y.l+(l.x-f.l),m=y.t+(l.y-f.t),w=y.r+(l.x+l.width-f.r),g=y.b+(l.y+l.height-f.b),v={x:h,y:m,width:w-h,height:g-m};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 _l=20,El=10;function oT(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(dt(f,{includeObservationOnly:!0}).filter(y=>y.kind==="edge-along-group-boundary").map(ct)),s=Ge(o),c=dt(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,y]of u){const h=s.shapes.find(Ae=>Ae.id===f);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const m=l.get(f);if(!(!m||Math.abs(m.x-h.x)>=.5||Math.abs(m.y-h.y)>=.5||Math.abs(m.width-h.width)>=.5||Math.abs(m.height-h.height)>=.5))continue;const g=h.members.map(Ae=>o.get(Ae)).filter(Ae=>!!Ae&&typeof Ae.x=="number");if(!g.length)continue;const v=Math.min(...g.map(Ae=>Ae.x)),b=Math.min(...g.map(Ae=>Ae.y)),E=Math.max(...g.map(Ae=>Ae.x+Ae.width)),M=Math.max(...g.map(Ae=>Ae.y+Ae.height)),B=h.x,A=h.y,L=h.x+h.width,H=h.y+h.height;let V=B,G=A,ie=L,pe=H;for(const Ae of y){const j=s.edges.find(R=>R.id===Ae.edge);if(!j)continue;const C=j.endpoints.some(R=>{const Z=s.shapes.find($e=>$e.id===R);if(!Z||Z.container)return!1;const ne=Z.x+Z.width/2,ge=Z.y+Z.height/2;return B<ne&&ne<L&&A<ge&&ge<H});for(const R of dn(j)){const Z=R.axis==="v"?[A,H]:[B,L];Math.min(R.hi,Z[1])-Math.max(R.lo,Z[0])<md||(R.axis==="v"?B<R.at&&R.at<L:A<R.at&&R.at<H)&&C||(R.axis==="v"?(Math.abs(R.at-B)<=Ra&&(V=Math.max(V,R.at+_l)),Math.abs(R.at-L)<=Ra&&(ie=Math.min(ie,R.at-_l))):(Math.abs(R.at-A)<=Ra&&(G=Math.max(G,R.at+_l)),Math.abs(R.at-H)<=Ra&&(pe=Math.min(pe,R.at-_l))))}}if(V>v-El&&(V=B),G>b-El&&(G=A),ie<E+El&&(ie=L),pe<M+El&&(pe=H),V===B&&G===A&&ie===L&&pe===H)continue;const q=o.get(f),Pe={x:q.x,y:q.y,width:q.width,height:q.height},Te=Ge(o),ke=new Set(dt(Te).map(ct)),ve=a(Te);r.resizeShape(q,{x:V,y:G,width:ie-V,height:pe-G});let U=Ge(o),de=dt(U).filter(Ae=>!ke.has(ct(Ae)));const z=[];if(de.length>0&&de.every(Ae=>Ae.kind==="label-over-line"&&!i.has(Ae.edge)&&U.edges.some(j=>j.id===Ae.edge))){for(const Ae of de){if(Ae.kind!=="label-over-line")continue;const j=U.edges.find(ge=>ge.id===Ae.edge),C=j&&$d(j,U),R=(d=o.get(Ae.edge))==null?void 0:d.label;if(!C||!R)continue;const Z=C.x-R.x,ne=C.y-R.y;r.moveElements([R],{x:Z,y:ne}),z.push({label:R,dx:Z,dy:ne})}U=Ge(o),de=dt(U).filter(Ae=>!ke.has(ct(Ae)))}const he=a(U),se=[...he].some(Ae=>!ve.has(Ae));if(de.length||se||he.size>=ve.size){for(const Ae of z.reverse())r.moveElements([Ae.label],{x:-Ae.dx,y:-Ae.dy});r.resizeShape(q,Pe)}}}function rT(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Kp((o==null?void 0:o.$parent)??o),a=xs(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:Xp(u,i,r),requests:ed(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 Wd(e,t,n={}){var Te,ke;const{i18n:i,lower:o=Nv}=n,r=Mv(e),a=Ay(r.elementRegistry),s=yv(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=RP(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(dt(p).map(ct)),f=new Set(dt(p,{includeObservationOnly:!0}).map(ct)),y=new Set(Tv(l.ops,ve=>{var U,de;return(de=(U=r.elementRegistry.get(ve))==null?void 0:U.source)==null?void 0:de.id}).keys()),h=new Set(p.edges.map(ve=>ve.id).filter(ve=>!y.has(ve))),m=new Set(t.flatMap(ve=>ve.kind==="sequenceFlow.update"&&(ve.source!==void 0||ve.target!==void 0)?[ve.id]:[])),w=()=>new Set(p.edges.filter(ve=>{var de;const U=(de=r.elementRegistry.get(ve.id))==null?void 0:de.waypoints;return U?!(U.length===ve.waypoints.length&&ve.waypoints.every((z,Q)=>Math.round(z.x)===Math.round(U[Q].x)&&Math.round(z.y)===Math.round(U[Q].y))):!1}).map(ve=>ve.id)),g=(ve,U)=>new Set([...ve].filter(de=>!U.has(de))),v=new Set(p.shapes.map(ve=>ve.id)),b=new Set(t.flatMap(ve=>ve.kind==="annotation.update"&&ve.placement?[ve.id]:[])),E=Si(p),M=E.length,B=new Set(E.map(([ve,U])=>`${ve}|${U}`)),A=Ri(p),L=new Set(A.map(([ve,U])=>`${ve}|${U}`)),H=new Map;for(const ve of r.elementRegistry.filter(U=>"waypoints"in U&&!!U.waypoints))ve.label&&H.set(ve.id,{wps:ve.waypoints.map(U=>({x:U.x,y:U.y})),label:{x:ve.label.x,y:ve.label.y},source:(Te=ve.source)==null?void 0:Te.id,target:(ke=ve.target)==null?void 0:ke.id});const V=e.get("commandStack");try{VP(r,l.writes),Tm(V,()=>{o(l.ops,r);for(const he of(u==null?void 0:u.contexts())??[])V.execute(Jp,he);JP(r,d,p),QP(r,p),iT(r,d,p),XA(r,p,m),qA(r,h,v),Gy(r,h);const ve=Cd(r,d,v),U=NA(r,WP(r),h,m);By(r,B,h);const de=bP(r,h),z=w(),Q=ov(r,d,g(h,z),z);Yy(r,h),lP(r,h,m,v),ev(r,d,h),vP(r,d,h),VA(r,L,h),nP(r,h,p),pv(r,d,g(h,w())),uv(r,h,new Set([...m,...Q,...de,...U,...UP(r)]),qP(r)),dv(r,v),XP(r,d,v,ve,b),Cd(r,d,v,ve),oT(r,f,p,h),fv(r,d),lv(r,H,zP(r)),eT(r,p)})}catch(ve){return{ok:!1,issues:[ve instanceof kv?ve.issue:{kind:"lower-failed",message:ve instanceof Error?ve.message:String(ve)}],findings:[],stats:c}}const G=Ge(r.elementRegistry),ie=YP(p,G,ve=>{var z,Q,he;const U=r.elementRegistry.get(ve),de=[...(U==null?void 0:U.incoming)??[],...(U==null?void 0:U.outgoing)??[]].find(se=>se.type==="bpmn:Association");return de&&(((z=de.source)==null?void 0:z.id)===ve?(Q=de.target)==null?void 0:Q.id:(he=de.source)==null?void 0:he.id)}),pe=dt(G,{includeObservationOnly:!0}).filter(ve=>!f.has(ct(ve))||As(ve).some(U=>ie.has(U))),q=vy(G),Pe=Ri(G);return{ok:!0,issues:[],findings:pe,stats:{edgeCrossings:{before:M,after:q.pairs.length,pairs:q.pairs,solidPairs:q.solidPairs,dashedPairs:q.dashedPairs,mixedPairs:q.mixedPairs,crossPoolMessages:q.crossPoolMessages},sharedEndpointCrossings:{before:A.length,after:Pe.length,pairs:Pe}}}}function aT(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Fv(e,t){return typeof e.get=="function"?e.get(t):e[t]}function jv(e,t){const n=Fv(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Hv(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function sT(e){return typeof e=="string"&&Vp.includes(e)}function Xi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Gv(e,t={}){const n=e.rootElements??[],i=n.find(U=>U.$type==="bpmn:Collaboration"),o=new Map(n.filter(U=>U.$type==="bpmn:Process").map(U=>[U.id,U])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},d=[],f=[],y=[],h=[],m=[],w=[],g=[],v=new Map,b=new Set,E=new Set,M=U=>{U&&b.add(U)},B=U=>{b.add(U),E.add(U)},A=U=>{const de=Hv(U,"bwl:Placement");if(!de)return;const z=typeof de.anchor=="string"?de.anchor:void 0;if(!z||!sT(de.side))return;const Q=typeof de.offset=="number"?de.offset:void 0;m.push({owner:U.id,anchor:z,side:de.side,...Q!==void 0?{offset:Q}:{}})},L=U=>{const de=Hv(U,"bwl:Members"),z=typeof(de==null?void 0:de.refs)=="string"?de.refs.split(/\s+/).filter(Boolean):[];z.length&&g.push({owner:U.id,refs:z})},H=U=>{var de;for(const z of U)switch(M(z.id),z.$type){case"bpmn:TextAnnotation":B(z.id),v.set(z.id,z),c.push({id:z.id,text:typeof z.text=="string"?z.text:""}),A(z);break;case"bpmn:Association":y.push({id:z.id,type:z.$type,source:Xi(z.sourceRef),target:Xi(z.targetRef)});break;case"bpmn:Group":{B(z.id),v.set(z.id,z);const Q=(de=z.categoryValueRef)==null?void 0:de.value;l.push({id:z.id,...typeof Q=="string"&&Q?{name:Q}:{}}),L(z);break}default:u.push({id:z.id,type:z.$type,reason:"type-outside-mvp"})}},V=U=>{for(const de of U.flowElements??[])M(de.id),u.push({id:de.id,type:de.$type,reason:"inside-container"}),(de.flowElements??[]).length&&V(de);for(const de of U.artifacts??[])M(de.id),u.push({id:de.id,type:de.$type,reason:"inside-container"})},G=(U,de)=>{const z=U.flowElements??[],Q=(U.laneSets??[]).flatMap(se=>se.lanes??[]),he=new Map;for(const se of Q){M(se.id),v.set(se.id,se);for(const Ae of se.flowNodeRef??[]){const j=Xi(Ae);j&&he.set(j,se.id)}}for(const se of z){if(M(se.id),v.set(se.id,se),se.$type==="bpmn:SequenceFlow"){d.push({id:se.id,source:Xi(se.sourceRef),target:Xi(se.targetRef),...typeof se.name=="string"&&se.name?{name:se.name}:{}});continue}if(se.$type==="bpmn:DataStoreReference"){B(se.id),s.push({id:se.id,...se.name?{name:se.name}:{}});continue}const Ae=aT(se.$type),j=Ae==="intermediateCatchEvent"?Gp((se.eventDefinitions??[]).map(ne=>ne.$type)):void 0;if(!Sm(Ae)||Ae==="intermediateCatchEvent"&&!j){u.push({id:se.id,type:se.$type,reason:"type-outside-mvp"});continue}B(se.id);const C=Ae==="boundaryEvent"?Xi(se.attachedToRef):void 0;a.push({id:se.id,type:Ae,...se.name?{name:se.name}:{},...de?{participant:de}:{},...he.has(se.id)?{lane:he.get(se.id)}:{},...C?{attachedTo:C}:{},...j?{eventDefinition:j}:{}}),Ae==="subProcess"&&V(se);const R=jv(se,"bwl:band");R!==void 0&&(p.bands[se.id]=R);const Z=Fv(se,"bwl:afterColumn");typeof Z=="string"&&Z!==""&&w.push([se.id,Z]);for(const ne of se.dataOutputAssociations??[])M(ne.id),h.push({id:ne.id,type:ne.$type,source:se.id,target:Xi(ne.targetRef)});for(const ne of se.dataInputAssociations??[])M(ne.id),h.push({id:ne.id,type:ne.$type,source:Xi((ne.sourceRef??[])[0]),target:se.id})}H(U.artifacts??[])};if(i){const U=new Set;for(const de of i.participants??[]){B(de.id),v.set(de.id,de);const z=Xi(de.processRef);z&&U.add(z);const Q=z?o.get(z):void 0,he=((Q==null?void 0:Q.laneSets)??[]).flatMap(C=>C.lanes??[]),se=he.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of se)B(C.id);const Ae=!Q||(Q.flowElements??[]).length===0&&he.length===0&&(Q.artifacts??[]).length===0;r.push({id:de.id,...de.name?{name:de.name}:{},...Ae?{blackBox:!0}:{},...se.length?{lanes:se}:{}});const j=jv(de,"bwl:poolOrder");j!==void 0&&(p.poolOrders[de.id]=j),Q&&G(Q,de.id)}for(const de of i.messageFlows??[])M(de.id),v.set(de.id,de),f.push({id:de.id,source:Xi(de.sourceRef),target:Xi(de.targetRef),...typeof de.name=="string"&&de.name?{name:de.name}:{}});H(i.artifacts??[]);for(const[de,z]of o)!U.has(de)&&(z.flowElements??[]).length>0&&u.push({id:de,type:z.$type,reason:"unreachable-process"})}else for(const U of o.values())G(U);const ie=[],pe=[],q=[],Pe=[],Te=(U,de)=>!!U&&!!de&&E.has(U)&&E.has(de);for(const U of d){if(!Te(U.source,U.target)){u.push({id:U.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}ie.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),E.add(U.id)}for(const U of f){if(!Te(U.source,U.target)){u.push({id:U.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}pe.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),E.add(U.id)}for(const U of h){if(!Te(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}Pe.push({...U.id?{id:U.id}:{},source:U.source,target:U.target}),U.id&&E.add(U.id)}for(const U of y){if(!Te(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}q.push({...U.id?{id:U.id}:{},source:U.source,target:U.target})}const ke=new Map(l.map(U=>[U.id,U]));for(const{owner:U,refs:de}of g){const z=de.filter(he=>b.has(he)),Q=ke.get(U);Q&&z.length&&(Q.members=z)}for(const U of m)b.has(U.anchor)&&(p.placements[U.owner]={anchor:U.anchor,side:U.side,...U.offset!==void 0?{offset:U.offset}:{}});for(const[U,de]of w)b.has(de)&&(p.afterColumns[U]=de);const ve={...r.length?{participants:r}:{},nodes:a,sequenceFlows:ie,...pe.length?{messageFlows:pe}:{},...s.length?{dataStores:s}:{},...Pe.length?{dataAssociations:Pe}:{},...c.length?{annotations:c}:{},...q.length?{associations:q}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:ve,hints:p,omitted:u,i18n:cT(ve,v,e,t.i18n)}:{definition:ve,hints:p,omitted:u}}function cT(e,t,n,i){const o=Kp(n),r=xs(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Xp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of ed(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 lT(e,t={}){const{definitions:n,warnings:i}=await Sa(e);return{...Gv(n,t),warnings:i}}const uT=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Ud(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function pT(e){return Ud(e.processRef)!==void 0}function dT(e){const t=new Set,n=o=>{const r=Ud(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 fT(e){const t=[],n=i=>{for(const o of i.flowElements??[])uT.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 hT(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 qd(e){const t=[],n=e.rootElements??[],i=dT(e);for(const r of fT(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??[])pT(s)&&hT(r.get(Ud(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 gT(e){const{definitions:t,warnings:n}=await Sa(e);return{issues:qd(t),warnings:n}}const mT=.5,yT=8,vT=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Oa=e=>typeof e=="number"?e:Number(e??NaN),Sl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function xT(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}=${Sl(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=>`${Sl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Sl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function bT(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?[Oa(s.x),Oa(s.y),Oa(s.width),Oa(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=Sl(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=>[Oa(d.x),Oa(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 zv(e){const t=bT(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:")&&!vT.has(s)&&n.set(c,{type:s,props:xT(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 Vv(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 Wv(e,t,n={}){const i=n.moveTolerance??mT,o=zv(e),r=zv(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||Vv(p.geometry,u.geometry,i)||Vv(p.label,u.label,n.labelTolerance??yT))&&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 wT(e,t,n={}){const[i,o]=await Promise.all([Sa(e),Sa(t)]);return{...Wv(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function _T(e){return new Set([...e.added,...e.modified])}function Uv(e){return e.get("moddle").ids}function qv(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 Yv(e,t){const n=Uv(e),i=n.nextPrefixed,o=[];return{value:qv(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=Uv(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:qv(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 ET(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Xv(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>Wd(e,t.ops,{i18n:i}),{value:a,generatedIds:s}=o?Yv(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 ks=()=>typeof performance>"u"?Date.now():performance.now();function ST(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class Yd extends Error{constructor(t,n){super(n),this.reason=t}}async function Zv(e,t,{expectedXml:n,i18n:i}){const o=ks(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(ks()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(ks()-o)};const a=e.get("commandStack"),s=km(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 y=Wd(e,d.ops,{...i?{i18n:i}:{}});if(!y.ok)throw new Yd("rejected",`배치 ${f+1}/${t.length} — ${ST(y.issues)}`)})});if(p.missed||p.remaining)throw new Yd("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof Yd?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=Om(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(ks()-o)}):{status:"replayed",ms:Math.round(ks()-o)}}const RT=new Set(["lasso","lasso.selection","hand","hand.move"]),Jv=1e4,MT="bwl-edit-locked",Qv=new WeakMap;function CT(e){const t=Qv.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",Jv,()=>{var s;if(o)return RT.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"],Jv,()=>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(MT,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 Qv.set(e,a),a}const AT=Symbol("bpmn-editor"),Kd={geometry:[],semantic:[]};function PT(){const e=Ce.ref(!1),t=Ce.ref(!0),n=Ce.ref(!1),i=Ce.shallowRef(Kd),o=Ce.shallowRef(void 0),r=Ce.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=Kd;return}const g=dt(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:g,semantic:v?qd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const g=p();if(!g||!a){r.value=void 0;return}const v=g.locales(),b={};for(const E of v)b[E]={untranslated:g.untranslatedCount(E),reviewRequested:g.reviewRequestedCount(E)};r.value={designLocale:a.designLocale,locales:v,displayLocale:g.getDisplayLocale()??a.designLocale,counts:b}}function f(){const g=p();g&&(g.configure(a),a&&s&&(s=g.setDisplayLocale(s)))}const y=()=>{l||(e.value=!0,u())};function h(g,v){CT(g).set(!v)}function m(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function w(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:o,i18n:r,configureI18n(g){a=g,f(),d()},setDisplayLocale(g){var b;s=g;const v=(b=p())==null?void 0:b.setDisplayLocale(g);v&&(s=v),d()},setChangeScope(g){o.value=g===void 0?void 0:new Set(g)},requestFocus(g){if(!c)return;const v=c.get("elementRegistry").get(g);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(g){const v=c==null?void 0:c.get("elementRegistry").get(g),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(g){c&&this.detach(),c=g,c.get("eventBus").on("commandStack.changed",y),t.value||h(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",y),c&&!t.value&&h(c,!0),c=void 0,i.value=Kd,o.value=void 0,r.value=void 0},setEditable(g){t.value=g,c&&h(c,g)},async applyAgentBatch(g,v){const b=m();n.value=!0;try{const E=await Xv(b,g,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return E.status==="applied"&&(e.value=!1),E}finally{n.value=!1}},async replayAgentTurn(g,v){const b=m(),E=e.value;n.value=!0,l=!0;try{const M=await Zv(b,g,{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(g){const{warnings:v}=await m().importXML(g);return e.value=!1,o.value=void 0,u(),{warnings:gd(v)}},async saveXml(){const{xml:g}=await m().saveXML({format:!0});return e.value=!1,g??""},undo:()=>{var g;return(g=w())==null?void 0:g.undo()},redo:()=>{var g;return(g=w())==null?void 0:g.redo()},canUndo:()=>{var g;return((g=w())==null?void 0:g.canUndo())??!1},canRedo:()=>{var g;return((g=w())==null?void 0:g.canRedo())??!1}}}const TT=new RegExp("\\p{Script=Hangul}","u"),kT=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,OT=new RegExp("\\p{Script=Han}","u");function Rl(e){const t=TT.test(e),n=kT.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:OT.test(e)?"han":"other"}}function ex(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 tx(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=jr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Ko(a).filter(l=>Bn(l))})}return n}const Os=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function DT(e,t={}){const n=ex(e),i=tx(e);let o;const r={},a=[],s=[],c=[];for(const h of i){const m=h.trs.filter(w=>(w.body??"")===h.name).map(Bn);if(m.length){const w=[...m].sort().join("+");r[w]=(r[w]??0)+1,o=o?new Set([...o].filter(g=>m.includes(g))):new Set(m)}else h.trs.some(w=>w.body)?a.push(Os(h)):c.push({e:h,inference:Rl(h.name)});for(const w of h.trs){const g=Bn(w),v=w.body??"",b=Rl(v);b.locale&&b.locale!==g?s.push({...Os(h),locale:g,script:b.script}):g==="ko"&&b.script==="han"&&h.trs.some(E=>E!==w&&E.body===v)&&s.push({...Os(h),locale:g,script:"han"})}}const l=new Set(c.map(h=>h.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 h=l.size===1?[...l][0]:void 0;h&&o.has(h)?[u,p]=[h,"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=[],y=[];for(const{e:h,inference:m}of c)m.locale?m.locale!==d&&f.push({...Os(h),locale:m.locale}):y.push({...Os(h),script:m.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:y,drift:a,matchedBy:r,scriptMismatch:s}}function LT(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!ex(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(tx(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=>Bn(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(Fr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function nx(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 Xd=e=>Bn(e)||void 0,ix=e=>e.body??"";function ox(e){const t=new Map;for(const n of nx(e)){const i=Ko(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Xd(o),body:ix(o)}))})}return t}const rx=e=>JSON.stringify(e.map(t=>t.body).sort());class IT{constructor(){pn(this,"byId",new Map);pn(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};ax(this.byId,o,a),ax(this.byBodies,rx(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(rx(t))??[]}}function ax(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function BT(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 Zd(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 NT(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 $T=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function FT(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=ox(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=BT(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(m=>m.doc===t.doc&&Zd(m.state,c)).sort((m,w)=>w.version-m.version).slice(0,1).map(m=>m.state)],["lineage",t.index.sameId(a).filter(m=>m.doc!==t.doc&&Zd(m.state,c)).map(m=>m.state)],["bodies",t.index.sameBodies(s.cells).filter(m=>!(m.doc===t.doc&&m.id===a)&&Zd(m.state,c)).map(m=>m.state)]].find(([,m])=>m.length);if(!p){if(!r(s))continue;for(const[m,w]of c)for(let g=0;g<w;g++)n.unresolved.push({...l,body:m,script:Rl(m).script});continue}const[d,f]=p,y=f.map(m=>NT(s,m,c));if(y.some(m=>m.overflow)||new Set(y.map($T)).size>1){n.ambiguous.push({...l,source:d});continue}const[h]=y;for(const m of h.stale)n.stale.push({...l,...m});h.cells.length&&n.restores.push({...l,source:d,cells:h.cells})}return n}function jT(e,t){if(!t.restores.length)return 0;const n=new Map(nx(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=Ko(r),s=new Set(a.map(Xd).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Xd(p)&&ix(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function je(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function HT(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jd={exports:{}},sx;function GT(){if(sx)return Jd.exports;sx=1;var e=Jd.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},Jd.exports}var zT=GT(),VT=HT(zT);function ro(e){if(!(this instanceof ro))return new ro(e);e=e||[128,36,1],this._seed=e.length?VT.rack(e[0],e[1],e[2]):e}ro.prototype.next=function(e){return this._seed(e||!0)},ro.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ro.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ro.prototype.assigned=function(e){return this._seed.get(e)||!1},ro.prototype.unclaim=function(e){delete this._seed.hats[e]},ro.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Sn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Sn.td=Sn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Sn.option=Sn.optgroup=[1,'<select multiple="multiple">',"</select>"],Sn.thead=Sn.tbody=Sn.colgroup=Sn.caption=Sn.tfoot=[1,"<table>","</table>"],Sn.polyline=Sn.ellipse=Sn.polygon=Sn.circle=Sn.text=Sn.line=Sn.path=Sn.rect=Sn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Wt(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(Sn,i)?Sn[i]:Sn._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 WT(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function Zn(e,...t){const n=e.style;return K(t,function(i){i&&K(i,function(o,r){n[r]=o})}),e}function kn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const UT=Object.prototype.toString;function Dt(e){return new or(e)}function or(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}or.prototype.add=function(e){return this.list.add(e),this},or.prototype.remove=function(e){return UT.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},or.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},or.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},or.prototype.array=function(){return Array.from(this.list)},or.prototype.has=or.prototype.contains=function(e){return this.list.contains(e)};function Ml(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ur(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function qT(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cl={},cx;function YT(){if(cx)return Cl;cx=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Cl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},Cl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},Cl}var lx=YT(),KT=qT(lx),Ke=WT({__proto__:null,default:KT},[lx]),ux=["focus","blur"];function XT(e,t,n,i,o){return ux.indexOf(n)!==-1&&(o=!0),Ke.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Ur(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function ZT(e,t,n,i){return ux.indexOf(t)!==-1&&(i=!0),Ke.unbind(e,t,n,i)}var si={bind:XT,unbind:ZT};function Qd(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function kt(e,t){return t=t||document,t.querySelector(e)}function Ds(e,t){return t=t||document,t.querySelectorAll(e)}function ao(e){e.parentNode&&e.parentNode.removeChild(e)}function JT(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function QT(e,t){return t.appendChild(JT(e,t))}function ot(e,t){return QT(t,e),e}var ef=2,px={"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":ef,"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":ef,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function ek(e,t){return px[t]?e.style[t]:e.getAttributeNS(null,t)}function dx(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=px[i];o?(o===ef&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function tk(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)dx(e,o,t[o])}function Le(e,t,n){if(typeof t=="string")if(n!==void 0)dx(e,t,n);else return ek(e,t);else tk(e,t);return e}const nk=Object.prototype.toString;function vt(e){return new rr(e)}function rr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}rr.prototype.add=function(e){return this.list.add(e),this},rr.prototype.remove=function(e){return nk.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},rr.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},rr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},rr.prototype.array=function(){return Array.from(this.list)},rr.prototype.has=rr.prototype.contains=function(e){return this.list.contains(e)};function Ls(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function tf(e){return e.cloneNode(!0)}var nf={svg:"http://www.w3.org/2000/svg"},fx='<svg xmlns="'+nf.svg+'"';function ik(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(nf.svg)===-1&&(e=fx+e.substring(4)):(e=fx+">"+e+"</svg>",t=!0);var n=ok(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function ok(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function We(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=ik(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(nf.svg,e),t&&Le(n,t),n}var of=null;function hx(){return of===null&&(of=We("svg")),of}function gx(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function rk(e,t,n,i,o,r){var a=hx().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return gx(a,e);case 6:return gx(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function Is(e){return hx().createSVGTransform()}var mx=/([&<>]{1})/g,ak=/([&<>\n\r"]{1})/g,sk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function rf(e,t){function n(i,o){return sk[o]||o}return e.replace(t,n)}function yx(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(rf(e.textContent,mx));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,'="',rf(r.value,ak),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)yx(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",rf(e.nodeValue,mx),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function ck(e){for(var t=e.firstChild,n=[];t;)yx(t,n),t=t.nextSibling;return n.join("")}function vx(e,t){return ck(e)}function gn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function lk(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function uk(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(lk(e,i))}function Bs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),uk(n,t)),n.consolidate()}const pk=/^class[ {]/;function dk(e){return pk.test(e.toString())}function af(e){return Array.isArray(e)}function sf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Al(...e){e.length===1&&af(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const fk=/constructor\s*[^(]*\(\s*([^)]*)\)/m,hk=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,gk=/\/\*([^*]*)\*\//m;function mk(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(dk(e)?fk:hk);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(gk);return(o&&o[1]||i).trim()})||[]}function xx(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(sf(r,v))return r[v];if(sf(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(af(v))v=Al(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const M=(v.$inject||mk(v)).map(B=>sf(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 Al(b=>v.get(b))}function f(v,b){if(b&&b.length){const E=Object.create(null),M=Object.create(null),B=[],A=[],L=[];let H,V,G,ie;for(let pe in o)H=o[pe],b.indexOf(pe)!==-1&&(H[2]==="private"?(V=B.indexOf(H[3]),V===-1?(G=H[3].createChild([],b),ie=d(G),B.push(H[3]),A.push(G),L.push(ie),E[pe]=[ie,pe,"private",G]):E[pe]=[L[V],pe,"private",A[V]]):E[pe]=[H[2],H[1]],M[pe]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(q=>{H[1].$scope.indexOf(q)!==-1&&(E[pe]=[H[2],H[1]],M[q]=!0)});b.forEach(pe=>{if(!M[pe])throw new Error('No provider for "'+pe+'". Cannot use provider from the parent!')}),v.unshift(E)}return new xx(v,a)}const y={factory:p,type:u,value:function(v){return v}};function h(v,b){const E=v.__init__||[];return function(){E.forEach(M=>{typeof M=="string"?b.get(M):b.invoke(M)})}}function m(v){const b=v.__exports__;if(b){const E=v.__modules__,M=Object.keys(v).reduce((V,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(V[G]=v[G]),V),Object.create(null)),B=(E||[]).concat(M),A=f(B),L=Al(function(V){return A.get(V)});b.forEach(function(V){o[V]=[L,V,"private",A]});const H=(v.__init__||[]).slice();return H.unshift(function(){A.init()}),v=Object.assign({},v,{__init__:H}),h(v,A)}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],A=M[1];o[E]=[y[B],yk(B,A),B]}),h(v,a)}function w(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(w,v),v.indexOf(b)!==-1)?v:v.concat(b)}function g(v){const b=v.reduce(w,[]).map(m);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=g(e)}function yk(e,t){return e!=="value"&&af(t)&&(t=Al(t.slice())),t}var vk=1e3;function Po(e,t){var n=this;t=t||vk,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)})}Po.prototype.canRender=function(e){},Po.prototype.drawShape=function(e,t){},Po.prototype.drawConnection=function(e,t){},Po.prototype.getShapePath=function(e){},Po.prototype.getConnectionPath=function(e){};function qr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function xk(e){return["M",e.x,e.y]}function cf(e){return["L",e.x,e.y]}function bk(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function wk(e,t){const n=e.length,i=[xk(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(cf(a));continue}const c=Math.min(t,lf(a.x-r.x,a.y-r.y),lf(s.x-a.x,s.y-a.y));if(!c){i.push(cf(a));continue}const l=Pl(a,r,c),u=Pl(a,r,c*.5),p=Pl(a,s,c),d=Pl(a,s,c*.5);i.push(cf(l)),i.push(bk(u,d,p))}return i}function Pl(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=lf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function lf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ns(e,t,n){tt(t)&&(n=t,t=null),t||(t={});const i=We("path",t);return tt(n)&&(i.dataset.cornerRadius=String(n)),uf(i,e)}function uf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Le(e,{d:qr(wk(t,n))}),e}function Tl(e){var t=new Set(e);return gt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Yr(e,t,n){n=n||0,et(e)||(e=[e]),K(e,function(i,o){var r=t(i,o,n);et(r)&&r.length&&Yr(r,t,n+1)})}function pf(e,t,n){var i=new Set,o=new Set;return Yr(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 $s(e,t){return pf(e)}function _k(e,t,n){$r(t)&&(t=!0),En(t)&&(n=t,t=!0),n=n||{};var i=Fs(n.allShapes),o=Fs(n.allConnections),r=Fs(n.enclosedElements),a=Fs(n.enclosedConnections),s=Fs(n.topLevel,t&&ba(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,K(u.incoming,c),K(u.outgoing,c),u.children}return Yr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function mn(e,t){t=!!t,et(e)||(e=[e]);var n,i,o,r;return K(e,function(a){var s=a;a.waypoints&&!t&&(s=mn(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 Da(e,t){var n={};return K(e,function(i){var o=i;o.waypoints&&(o=mn(o)),!tt(t.y)&&o.x>t.x&&(n[i.id]=i),!tt(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(tt(t.width)&&tt(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!tt(t.width)||!tt(t.height))&&(n[i.id]=i)}),n}function bx(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function wx(e){return!!(e&&e.isFrame)}function Fs(e,t){return te({},e||{},t||{})}var Ek=1;function ar(e,t){Po.call(this,e,Ek),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})}je(ar,Po),ar.prototype.canRender=function(){return!0},ar.prototype.drawShape=function(t,n,i){var o=We("rect");return Le(o,{x:0,y:0,width:n.width||0,height:n.height||0}),wx(n)?Le(o,te({},this.FRAME_STYLE,i||{})):Le(o,te({},this.SHAPE_STYLE,i||{})),ot(t,o),o},ar.prototype.drawConnection=function(t,n,i){var o=Ns(n.waypoints,te({},this.CONNECTION_STYLE,i||{}));return ot(t,o),o},ar.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 qr(a)},ar.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 qr(r)},ar.$inject=["eventBus","styles"];function Sk(){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 te(r,{class:n})},this.style=function(n,i){!et(n)&&!i&&(i=n,n=[]);var o=ai(n,function(r,a){return te(r,e[a]||{})},{});return i?te(o,i):o},this.computeStyle=function(n,i,o){return et(i)||(o=i,i=[]),t.style(i||[],te({},o,n||{}))}}const Rk={__init__:["defaultRenderer"],defaultRenderer:["type",ar],styles:["type",Sk]};function rn(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function cn(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 df(e,t){return!e||!t?-1:e.indexOf(t)}function js(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ff(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=js(e,t);return Math.abs(o/r)<=i}var Mk=2;function To(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(Ck(o,n))return r;return!1}function Ck(e,t){const n=t[0];return qo(t,function(i){return Math.abs(n[e]-i[e])<=Mk})}function _x(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 hf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Ak=/,?([a-z]),?/gi,Ex=parseFloat,yn=Math,sr=yn.PI,so=yn.min,co=yn.max,Sx=yn.pow,cr=yn.abs,Pk=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Tk=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Rx=Array.isArray||function(e){return e instanceof Array};function kk(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ok(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 Dk(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 kk(o,i)?(Ok(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function Lk(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(Pk,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(Tk,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([o,...a.splice(0,2)]),s="l",o=o=="m"?"l":"L");a.length>=t[s]&&(n.push([o,...a.splice(0,t[s])]),!!t[s]););}),n.toString=mf,n}function Ik(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 Bk(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 gf(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function mf(){return this.join(",").replace(Ak,"$1")}function Nk(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var o=e[n],r=t[n]=new Array(o.length),a=0,s=o.length;a<s;a++)r[a]=o[a];return t.toString=mf,t}function Mx(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,y=u*e+p*3*c*n+l*3*c*c*o+f*a,h=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:kl(y),y:kl(h)}}function Cx(e){var t=zk(...e);return gf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function lr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function $k(e,t){return e=gf(e),t=gf(t),lr(t,e.x,e.y)||lr(t,e.x2,e.y)||lr(t,e.x,e.y2)||lr(t,e.x2,e.y2)||lr(e,t.x,t.y)||lr(e,t.x2,t.y)||lr(e,t.x,t.y2)||lr(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 Ax(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,y=0;y<u;y++){var h=l*p[y]+l,m=Ax(h,e,n,o,a),w=Ax(h,t,i,r,s),g=m*m+w*w;f+=d[y]*yn.sqrt(g)}return l*f}function Fk(e,t,n,i,o,r,a,s){if(!(co(e,n)<so(o,a)||so(e,n)>co(o,a)||co(t,i)<so(r,s)||so(t,i)>co(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=kl(c/u),d=kl(l/u),f=+p.toFixed(2),y=+d.toFixed(2);if(!(f<+so(e,n).toFixed(2)||f>+co(e,n).toFixed(2)||f<+so(o,a).toFixed(2)||f>+co(o,a).toFixed(2)||y<+so(t,i).toFixed(2)||y>+co(t,i).toFixed(2)||y<+so(r,s).toFixed(2)||y>+co(r,s).toFixed(2)))return{x:p,y:d}}}}function kl(e){return Math.round(e*1e11)/1e11}function jk(e,t,n){var i=Cx(e),o=Cx(t);if(!$k(i,o))return[];var r=Px(...e),a=Px(...t),s=kx(e)?1:~~(r/5)||1,c=kx(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,y;for(f=0;f<s+1;f++){var h=Mx(...e,f/s);l[f]={x:h.x,y:h.y,t:f/s}}for(f=0;f<c+1;f++)h=Mx(...t,f/c),u[f]={x:h.x,y:h.y,t:f/c};for(f=0;f<s;f++)for(y=0;y<c;y++){var m=l[f],w=l[f+1],g=u[y],v=u[y+1],b=cr(w.x-m.x)<.01?"y":"x",E=cr(v.x-g.x)<.01?"y":"x",M=Fk(m.x,m.y,w.x,w.y,g.x,g.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 A=m.t+cr((M[b]-m[b])/(w[b]-m[b]))*(w.t-m.t),L=g.t+cr((M[E]-g[E])/(v[E]-g[E]))*(v.t-g.t);A>=0&&A<=1&&L>=0&&L<=1&&d.push({x:M.x,y:M.y,t1:A,t2:L})}}return d}function Tx(e,t,n){e=Lx(e),t=Lx(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],y=0,h=e.length;y<h;y++){var m=e[y];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var w=0,g=t.length;w<g;w++){var v=t[w];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=jk(p,d);{for(var E=0,M=b.length;E<M;E++)b[E].segment1=y,b[E].segment2=w,b[E].bez1=p,b[E].bez2=d;f=f.concat(b)}}}}}return f}function Hk(e){return Rx(e)&&Rx(e[0])}function Gk(e){if(Ik(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 y=0,h=l.length;y<h;y++)c[y]=l[y];switch(s=s.toUpperCase(),c[0]){case"Z":n=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=mf,t}function kx(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ol(e,t,n,i){return[e,t,n,i,n,i]}function Ox(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 Dx(e,t,n,i,o,r,a,s,c,l){var u=sr*120/180,p=sr/180*(+o||0),d=[],f,y=Dk(function(j,C,R){var Z=j*yn.cos(R)-C*yn.sin(R),ne=j*yn.sin(R)+C*yn.cos(R);return{x:Z,y:ne}});if(l)B=l[0],A=l[1],E=l[2],M=l[3];else{f=y(e,t,-p),e=f.x,t=f.y,f=y(s,c,-p),s=f.x,c=f.y;var h=(e-s)/2,m=(t-c)/2,w=h*h/(n*n)+m*m/(i*i);w>1&&(w=yn.sqrt(w),n=w*n,i=w*i);var g=n*n,v=i*i,b=(r==a?-1:1)*yn.sqrt(cr((g*v-g*m*m-v*h*h)/(g*m*m+v*h*h))),E=b*n*m/i+(e+s)/2,M=b*-i*h/n+(t+c)/2,B=yn.asin(((t-M)/i).toFixed(9)),A=yn.asin(((c-M)/i).toFixed(9));B=e<E?sr-B:B,A=s<E?sr-A:A,B<0&&(B=sr*2+B),A<0&&(A=sr*2+A),a&&B>A&&(B=B-sr*2),!a&&A>B&&(A=A-sr*2)}var L=A-B;if(cr(L)>u){var H=A,V=s,G=c;A=B+u*(a&&A>B?1:-1),s=E+n*yn.cos(A),c=M+i*yn.sin(A),d=Dx(s,c,n,i,o,0,a,V,G,[A,H,E,M])}L=A-B;var ie=yn.cos(B),pe=yn.sin(B),q=yn.cos(A),Pe=yn.sin(A),Te=yn.tan(L/4),ke=4/3*n*Te,ve=4/3*i*Te,U=[e,t],de=[e+ke*pe,t-ve*ie],z=[s+ke*Pe,c-ve*q],Q=[s,c];if(de[0]=2*U[0]-de[0],de[1]=2*U[1]-de[1],l)return[de,z,Q].concat(d);d=[de,z,Q].concat(d).join().split(",");for(var he=[],se=0,Ae=d.length;se<Ae;se++)he[se]=se%2?y(d[se-1],d[se],p).y:y(d[se],d[se+1],p).x;return he}function zk(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,y,h,m,w,g=0;g<2;++g){if(g==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),cr(u)<1e-12){if(cr(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}m=p*p-4*d*u,w=yn.sqrt(m),!(m<0)&&(y=(-p+w)/(2*u),0<y&&y<1&&c.push(y),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}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:so(...l[0]),y0:so(...l[1]),x1:co(...l[0]),y1:co(...l[1])}}function Lx(e){if(Hk(e)||(e=Lk(e)),Bk(e))return e;for(var t=Nk(Gk(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,y){var h,m;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",...Dx(f.x,f.y,...d.slice(1))];break;case"S":y=="C"||y=="S"?(h=f.x*2-f.bx,m=f.y*2-f.by):(h=f.x,m=f.y),d=["C",h,m,...d.slice(1)];break;case"T":y=="Q"||y=="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",...Ox(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",...Ox(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",...Ol(f.x,f.y,d[1],d[2])];break;case"H":d=["C",...Ol(f.x,f.y,d[1],f.y)];break;case"V":d=["C",...Ol(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",...Ol(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 y=d[f];y.length;)r[f]="A",d.splice(f++,0,["C",...y.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=Ex(u[p-4])||n.x,n.by=Ex(u[p-3])||n.y}return t}function $t(e){return En(e)&&ri(e,"waypoints")}function ft(e){return En(e)&&ri(e,"labelTarget")}function Vk(e){return En(e)&&va(e.parent)}function Ix(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ko(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ze(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Dl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Wk(e){return ko({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Uk(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],y=f&&f.endLength||0,h=Kk(d,u);l.push({start:d,end:u,startLength:y,endLength:y+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),o=i/2,r=0,a=n[r];a.endLength<o;)a=n[++r];var s=(o-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function nt(e){return $t(e)?Uk(e):Wk(e)}function $n(e,t,n){n=n||0,En(n)||(n={x:n,y:n});var i=Ze(e),o=Ze(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 Hs(e,t,n){var i=qk(e,t);return i.length===1||i.length===2&&js(i[0],i[1])<1?ko(i[0]):i.length>1?(i=to(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),ko(i[n?0:i.length-1])):null}function qk(e,t){return Tx(e,t)}function Yk(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],js(n,o)===0||ff(i,o,n)?e.splice(t,1):t++;return e}function Kk(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ll(e,t){return Math.round(e*t)/t}function Bx(e){return tt(e)?e+"px":e}function Xk(e){for(;e.parent;)e=e.parent;return e}function Zk(e){e=te({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Zn(n,{position:"relative",overflow:"hidden",width:Bx(e.width),height:Bx(e.height)}),t.appendChild(n),n}function Nx(e,t,n){const i=We("g");vt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const Jk="base",$x=0,Qk=1,e2={shape:["x","y","width","height"],connection:["waypoints"]};function it(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||{})}it.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],it.prototype._init=function(e){const t=this._eventBus,n=this._container=Zk(e),i=this._svg=We("svg");Le(i,{width:"100%",height:"100%"}),kn(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")}),ot(n,i);const o=this._viewport=Nx(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Yp(this._viewboxChanged,300)),this._restoreFocus=Yp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:o})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},it.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},it.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},it.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=bx(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},it.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},it.prototype.restoreFocus=function(){this._restoreFocus()},it.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},it.prototype.isFocused=function(){return this._focused},it.prototype.getDefaultLayer=function(){return this.getLayer(Jk,$x)},it.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},it.prototype._getChildIndex=function(e){return ai(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},it.prototype._createLayer=function(e,t){typeof t>"u"&&(t=Qk);const n=this._getChildIndex(t);return{group:Nx(this._viewport,"layer-"+e,n),index:t,visible:!0}},it.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},it.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&&(gn(n),t.visible=!1),n},it.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],gn(t.group))},it.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},it.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(Xk(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},it.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},it.prototype._findPlaneForRoot=function(e){return Ht(this._planes,function(t){return t.rootElement===e})},it.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},it.prototype._resolveElements=function(e){return et(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},it.prototype.getContainer=function(){return this._container},it.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(K([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),vt(o).add(t)):(e.markers.delete(t),vt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},it.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},it.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},it.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},it.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},it.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},it.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,$x);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},it.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},it.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},it.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)},it.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})},it.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})},it.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=e2[e];if(!qo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},it.prototype._setParent=function(e,t,n){cn(t.children,e,n),e.parent=t},it.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},it.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},it.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},it.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),rn(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},it.prototype.removeShape=function(e){return this._removeElement(e,"shape")},it.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},it.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},it.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},it.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},it.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);Bs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Bs(t),o=a?a.matrix:rk(),s=Ll(o.a,1e3),c=Ll(-o.e||0,1e3),l=Ll(-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},it.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=te({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Fx(t,n)}),{x:n.e,y:n.f}},it.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(y=>y!=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=mn(r),s=Ze(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=Ze(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const y=Math.max(0,s.right-d.right),h=Math.min(0,s.left-d.left),m=Math.max(0,s.bottom-d.bottom),w=Math.min(0,s.top-d.top);u=y||h,p=m||w}this.scroll({dx:-u*l,dy:-p*l})},it.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)}),Ll(i.a,1e3)};function Fx(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}it.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},it.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=te(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),Fx(this._viewport,u),u},it.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},it.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}},it.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var La="data-element-id";function bi(e){this._elements={},this._eventBus=e}bi.$inject=["eventBus"],bi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Le(t,La,i),n&&Le(n,La,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},bi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Le(i.gfx,La,""),i.secondaryGfx&&Le(i.secondaryGfx,La,""),delete t[n])},bi.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)},bi.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,La,i),t},bi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Le(e,La);var n=this._elements[t];return n&&n.element},bi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},bi.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}},bi.prototype.getAll=function(){return this.filter(function(e){return e})},bi.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)})},bi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},bi.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 t2(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 n2(e){return e.__refs_collection===!0}function i2(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function jx(e,t,n){var i=t2(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 o2(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 Ci(e,t){if(!(this instanceof Ci))return new Ci(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ci.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?jx(this,t,e):o2(this,t,e)},Ci.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return n2(n)||jx(this,t,e),n},Ci.prototype.ensureBound=function(e,t){i2(e,t)||this.bind(e,t)},Ci.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ci.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var yf=new Ci({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Hx=new Ci({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Gx=new Ci({name:"attachers",collection:!0},{name:"host"}),zx=new Ci({name:"outgoing",collection:!0},{name:"source"}),Vx=new Ci({name:"incoming",collection:!0},{name:"target"});function Ia(){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)}}),yf.bind(this,"parent"),Hx.bind(this,"labels"),zx.bind(this,"outgoing"),Vx.bind(this,"incoming")}function Gs(){Ia.call(this),yf.bind(this,"children"),Gx.bind(this,"host"),Gx.bind(this,"attachers")}je(Gs,Ia);function Wx(){Ia.call(this),yf.bind(this,"children")}je(Wx,Gs);function Ux(){Gs.call(this),Hx.bind(this,"labelTarget")}je(Ux,Gs);function qx(){Ia.call(this),zx.bind(this,"source"),Vx.bind(this,"target")}je(qx,Ia);var r2={connection:qx,shape:Gs,label:Ux,root:Wx};function a2(e,t){var n=r2[e];if(!n)throw new Error("unknown type: <"+e+">");return te(new n,t)}function s2(e){return e instanceof Ia}function Oo(){this._uid=12}Oo.prototype.createRoot=function(e){return this.create("root",e)},Oo.prototype.createLabel=function(e){return this.create("label",e)},Oo.prototype.createShape=function(e){return this.create("shape",e)},Oo.prototype.createConnection=function(e){return this.create("connection",e)},Oo.prototype.create=function(e,t){return t=te({},t||{}),t.id||(t.id=e+"_"+this._uid++),a2(e,t)};var Il="__fn",Yx=1e3,c2=Array.prototype.slice;function ci(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ci.prototype.on=function(e,t,n,i){if(e=et(e)?e:[e],Cn(t)&&(i=n,n=t,t=Yx),!tt(t))throw new Error("priority must be a number");var o=n;i&&(o=ei(n,i),o[Il]=n[Il]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ci.prototype.once=function(e,t,n,i){var o=this;if(Cn(t)&&(i=n,n=t,t=Yx),!tt(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[Il]=n,this.on(e,t,r)},ci.prototype.off=function(e,t){e=et(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ci.prototype.createEvent=function(e){var t=new zs;return t.init(e),t},ci.prototype.fire=function(e,t){var n,i,o,r;if(r=c2.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 zs?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}},ci.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ci.prototype._destroy=function(){this._listeners={}},ci.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ci.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=l2(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},ci.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},ci.prototype._getListeners=function(e){return this._listeners[e]},ci.prototype._setListeners=function(e,t){this._listeners[e]=t},ci.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[Il]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function zs(){}zs.prototype.stopPropagation=function(){this.cancelBubble=!0},zs.prototype.preventDefault=function(){this.defaultPrevented=!0},zs.prototype.init=function(e){te(this,e||{})};function l2(e,t){return e.apply(null,t)}function ur(e){return e.childNodes[0]}function u2(e){return e.parentNode.childNodes[1]}function Bl(e,t,n,i,o){var r=Is();r.setTranslate(t,n);var a=Is();a.setRotate(i||0,0,0);var s=Is();s.setScale(1,1),Bs(e,[r,a,s])}function Fn(e,t,n){var i=Is();i.setTranslate(t,n),Bs(e,i)}function Kx(e,t){var n=Is();n.setRotate(t,0,0),Bs(e,n)}function wi(e,t){this._eventBus=e,this._elementRegistry=t}wi.$inject=["eventBus","elementRegistry"],wi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=u2(t),n||(n=We("g"),vt(n).add("djs-children"),ot(t.parentNode,n))):n=t,n},wi.prototype._clear=function(e){var t=ur(e);return Ml(t),t},wi.prototype._createContainer=function(e,t,n,i){var o=We("g");vt(o).add("djs-group"),typeof n<"u"?p2(o,t,t.childNodes[n]):ot(t,o);var r=We("g");vt(r).add("djs-element"),vt(r).add("djs-"+e),i&&vt(r).add("djs-frame"),ot(o,r);var a=We("g");return vt(a).add("djs-visual"),ot(r,a),r},wi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,wx(t))},wi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ai(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),K(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;K(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},wi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},wi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},wi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},wi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},wi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Fn(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")}},wi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);gn(t.parentNode)};function p2(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const d2={__depends__:[Rk],__init__:["canvas"],canvas:["type",it],elementRegistry:["type",bi],elementFactory:["type",Oo],eventBus:["type",ci],graphicsFactory:["type",wi]};function f2(e){var t=new xx(e);return t.init(),t}function h2(e){e=e||{};var t={config:["value",e]},n=[t,d2].concat(e.modules||[]);return f2(n)}function pr(e,t){this._injector=t||h2(e),this.get("eventBus").fire("diagram.init")}pr.prototype.get=function(e,t){return this._injector.get(e,t)},pr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},pr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},pr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Yn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function ti(e,t){return e.$instanceOf(t)}function g2(e){return Ht(e.rootElements,function(t){return ti(t,"bpmn:Process")||ti(t,"bpmn:Collaboration")})}function m2(e){var t={},n=[],i={};function o(z,Q){return function(he){z(he,Q)}}function r(z){t[z.id]=z}function a(z){return t[z.id]}function s(z,Q){var he=z.gfx;if(he)throw new Error(`already rendered ${Yn(z)}`);return e.element(z,i[z.id],Q)}function c(z,Q){return e.root(z,i[z.id],Q)}function l(z,Q){try{var he=i[z.id]&&s(z,Q);return r(z),he}catch(se){u(se.message,{element:z,error:se}),console.error(`failed to import ${Yn(z)}`,se)}}function u(z,Q){e.error(z,Q)}var p=this.registerDi=function(Q){var he=Q.bpmnElement;he?i[he.id]?u(`multiple DI elements defined for ${Yn(he)}`,{element:he}):i[he.id]=Q:u(`no bpmnElement referenced in ${Yn(Q)}`,{element:Q})};function d(z){f(z.plane)}function f(z){p(z),K(z.planeElement,y)}function y(z){p(z)}this.handleDefinitions=function(Q,he){var se=Q.diagrams;if(he&&se.indexOf(he)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!he&&se&&se.length&&(he=se[0]),!he)throw new Error("no diagram to display");i={},d(he);var Ae=he.plane;if(!Ae)throw new Error(`no plane for ${Yn(he)}`);var j=Ae.bpmnElement;if(!j)if(j=g2(Q),j)u(`correcting missing bpmnElement on ${Yn(Ae)} to ${Yn(j)}`),Ae.bpmnElement=j,p(Ae);else throw new Error("no process or collaboration to display");var C=c(j,Ae);if(ti(j,"bpmn:Process")||ti(j,"bpmn:SubProcess"))m(j,C);else if(ti(j,"bpmn:Collaboration"))U(j,C),w(Q.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Yn(Ae)}: ${Yn(j)}`);h(n)};var h=this.handleDeferred=function(){for(var Q;n.length;)Q=n.shift(),Q()};function m(z,Q){Te(z,Q),L(z.ioSpecification,Q),A(z.artifacts,Q),r(z)}function w(z,Q){var he=gt(z,function(se){return!a(se)&&ti(se,"bpmn:Process")&&se.laneSets});he.forEach(o(m,Q))}function g(z,Q){l(z,Q)}function v(z,Q){K(z,o(g,Q))}function b(z,Q){l(z,Q)}function E(z,Q){l(z,Q)}function M(z,Q){l(z,Q)}function B(z,Q){l(z,Q)}function A(z,Q){K(z,function(he){ti(he,"bpmn:Association")?n.push(function(){B(he,Q)}):B(he,Q)})}function L(z,Q){z&&(K(z.dataInputs,o(E,Q)),K(z.dataOutputs,o(M,Q)))}var H=this.handleSubProcess=function(Q,he){Te(Q,he),A(Q.artifacts,he)};function V(z,Q){var he=l(z,Q);ti(z,"bpmn:SubProcess")&&H(z,he||Q),ti(z,"bpmn:Activity")&&L(z.ioSpecification,Q),n.push(function(){K(z.dataInputAssociations,o(b,Q)),K(z.dataOutputAssociations,o(b,Q))})}function G(z,Q){l(z,Q)}function ie(z,Q){l(z,Q)}function pe(z,Q){n.push(function(){var he=l(z,Q);z.childLaneSet&&q(z.childLaneSet,he||Q),de(z)})}function q(z,Q){K(z.lanes,o(pe,Q))}function Pe(z,Q){K(z,o(q,Q))}function Te(z,Q){ke(z.flowElements,Q),z.laneSets&&Pe(z.laneSets,Q)}function ke(z,Q){K(z,function(he){ti(he,"bpmn:SequenceFlow")?n.push(function(){G(he,Q)}):ti(he,"bpmn:BoundaryEvent")?n.unshift(function(){V(he,Q)}):ti(he,"bpmn:FlowNode")?V(he,Q):ti(he,"bpmn:DataObject")||(ti(he,"bpmn:DataStoreReference")||ti(he,"bpmn:DataObjectReference")?ie(he,Q):u(`unrecognized flowElement ${Yn(he)} in context ${Yn(Q&&Q.businessObject)}`,{element:he,context:Q}))})}function ve(z,Q){var he=l(z,Q),se=z.processRef;se&&m(se,he||Q)}function U(z,Q){K(z.participants,o(ve,Q)),n.push(function(){v(z.messageFlows,Q)}),A(z.artifacts,Q)}function de(z){K(z.flowNodeRef,function(Q){var he=Q.get("lanes");he&&he.push(z)})}}function Xx(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,w){return i.add(h,m,w)},error:function(h,m){s.push({message:h,context:m})}},d=new m2(p);u=u||l.diagrams&&l.diagrams[0];var f=y2(l,u);if(!f)throw new Error("no diagram to display");K(f,function(h){d.handleDefinitions(l,h)});var y=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(y+"_plane")||r.findRoot(y))}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 y2(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!P(n,"bpmn:Process")&&!P(n,"bpmn:Collaboration")&&(i=v2(n));var o;P(i,"bpmn:Collaboration")?o=i:o=Ht(e.rootElements,function(l){if(P(l,"bpmn:Collaboration"))return Ht(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Wn(o.participants,function(l){return l.processRef}),r.push(o));var a=Zx(r),s=[t],c=[n];return K(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 Zx(e){var t=[];return K(e,function(n){n&&(t.push(n),t=t.concat(Zx(n.flowElements)))}),t}function v2(e){for(var t=e;t;){if(P(t,"bpmn:Process"))return t;t=t.$parent}}var x2='<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>',Jx=x2,Qx={verticalAlign:"middle"},eb={color:"#404040"},b2={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},w2={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},_2={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"},E2='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Jx+'</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>',lo;function S2(){lo=Wt(E2),Zn(lo,b2),Zn(kt("svg",lo),Qx),Zn(kt(".backdrop",lo),w2),Zn(kt(".notice",lo),_2),Zn(kt(".link",lo),eb,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function R2(){lo||(S2(),si.bind(lo,".backdrop","click",function(e){document.body.removeChild(lo)})),document.body.appendChild(lo)}const Nl=5,tb="djs-outline-hidden";function Xt(e){e=te({},C2,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),P2(this._container)}je(Xt,pr),Xt.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||[]),$l(s,r),s=M2(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw $l(r,[]),r}if(typeof t=="string"&&(i=A2(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw $l(r,[]),r}try{this.clear()}catch(r){throw $l(r,[]),r}const{warnings:o}=await Xx(this,n,i);return{warnings:o}},Xt.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},Xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=kt(":scope > defs",i._svg),a=vx(o),s=r?"<defs>"+vx(r)+"</defs>":"",c=i.getContainer();Dt(c).add(tb);let l;try{l=o.getBBox()}finally{Dt(c).remove(tb)}const u=l.x-Nl,p=l.y-Nl,d=l.width+Nl*2,f=l.height+Nl*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+E.message;if(B)return a.addWarning({message:G,error:E}),!0;throw tr(G)}function u(E,M){return l(E,M,!0)}function p(){var E=a.elementsById,M=a.references,B,A;for(B=0;A=M[B];B++){var L=A.element,H=E[A.id],V=To(L).propertiesByName[A.property];if(H||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),V.isMany){var G=L.get(V.name),ie=G.indexOf(A);ie===-1&&(ie=G.length),H?G[ie]=H:G.splice(ie,1)}else L.set(V.name,H)}}function d(){c.pop().handleEnd()}var f=/^<\?xml /i,y=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(E){if(f.test(E)){var M=y.exec(E),B=M&&M[1];!B||h.test(B)||a.addWarning({message:"unsupported document encoding <"+B+">, falling back to UTF-8"})}}function w(E,M){var B=c.peek();try{c.push(B.handleNode(E))}catch(A){l(A,M,r)&&c.push(new ld)}}function g(E,M){try{c.peek().handleText(E)}catch(B){u(B,M)}}function v(E,M){E.trim()&&g(E,M)}var b=o.getPackages().reduce(function(E,M){return E[M.uri]=M.prefix,E},Object.entries(cd).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,A){var L=E.attrs||{},H=Object.keys(L).reduce(function(G,ie){var pe=M(L[ie]);return G[ie]=pe,G},{}),V={name:E.name,originalName:E.originalName,attributes:H,ns:E.ns};w(V,A)}).on("question",m).on("closeTag",d).on("cdata",g).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(G){B=G}var A=i.element;!B&&!A&&(B=tr("failed to parse document as <"+i.type.$descriptor.name+">"));var L=a.warnings,H=a.references,V=a.elementsById;return B?(B.warnings=L,M(B)):E({rootElement:A,elementsById:V,references:H,warnings:L})})},dd.prototype.handler=function(e){return new pd(this.model,e)};function NM(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var $M=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,FM=/<|>|'|"|&|\n\r|\n/g,Jm=/<|>|&/g;function oo(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}oo.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},oo.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},oo.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},oo.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)},oo.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},oo.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},oo.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},oo.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},oo.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 jM(e){return e.charAt(0).toLowerCase()+e.slice(1)}function HM(e,t){return Ym(t)?jM(e):e}function Qm(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ey(e){return ri(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function GM(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 zM(e,t){return t.isGeneric?te({localName:t.ns.localName},e):te({localName:HM(t.ns.localName,t.$pkg)},e)}function VM(e,t){return te({localName:t.ns.localName},e)}function WM(e){var t=e.$descriptor;return gt(t.properties,function(n){var i=n.name;if(n.isVirtual||!ai(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var UM={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},qM={"<":"lt",">":"gt","&":"amp"};function ty(e,t,n){return e=ri(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function YM(e){return ty(e,FM,UM)}function KM(e){return ty(e,Jm,qM)}function XM(e){return gt(e,function(t){return t.isAttr})}function ZM(e){return gt(e,function(t){return!t.isAttr})}function fd(e){this.tagName=e}fd.prototype.build=function(e){return this.element=e,this},fd.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function zr(){}zr.prototype.serializeValue=zr.prototype.serializeTo=function(e){e.append(this.escape?KM(this.value):this.value)},zr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Jm)!==-1&&(this.escape=!0),this};function hd(e){this.tagName=e}Qm(hd,zr),hd.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Yt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Yt.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=WM(e),this.parseAttributes(XM(o)),this.parseContainments(ZM(o))),this.parseGenericAttributes(e,i),this},Yt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return zM(t,e)},Yt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return VM(t,e)},Yt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Yt.prototype.nsAttributeName=function(e){var t;if(ri(e)?t=Un(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}:te({localName:t.localName},n)},Yt.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}))},Yt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new zr().build({type:"String"},t));var n=e.$children;n&&K(n,i=>{this.body.push(new Yt(this).build(i))})},Yt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=Un(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)}},Yt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return K(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Yt.prototype.parseGenericAttributes=function(e,t){var n=this;K(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)}})},Yt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;K(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new zr().build(o,r[0]));else if(Hm(o.type))K(r,function(l){n.push(new hd(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)K(r,function(l){n.push(new fd(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Xm(o);K(r,function(l){var u;c?c===Km?u=new Yt(t,o):u=new il(t,o,c):u=new Yt(t),n.push(u.build(l))})}})},Yt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new oo(i):t=i),t},Yt.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},Yt.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},Yt.prototype.parseAttributes=function(e){var t=this,n=this.element;K(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];K(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Yt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ey(e)},Yt.prototype.addAttribute=function(e,t){var n=this.attrs;ri(t)&&(t=YM(t));var i=Lm(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)},Yt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=GM(n).concat(t)),K(t,function(i){e.append(" ").append(ey(i.name)).append('="').append(i.value).append('"')})},Yt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==zr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),K(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function il(e,t,n){Yt.call(this,e,t),this.serialization=n}Qm(il,Yt),il.prototype.parseNsAttributes=function(e){var t=Yt.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},il.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function JM(){this.value="",this.write=function(e){this.value+=e}}function QM(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 eC(e){e=te({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new JM,r=new QM(o,e.format);e.preamble&&r.append($M);var a=new Yt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(tC(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function tC(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in cd)n[i]=cd[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 ol(e,t){Ei.call(this,e,t)}ol.prototype=Object.create(Ei.prototype),ol.prototype.fromXML=function(e,t,n){ri(t)||(n=t,t="bpmn:Definitions");var i=new dd(te({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},ol.prototype.toXML=function(e,t){var n=new eC(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var nC="BPMN20",iC="http://www.omg.org/spec/BPMN/20100524/MODEL",oC="bpmn",rC=[],aC=[{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"}]}],sC=[{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"}]}],cC={tagAlias:"lowerCase",typePrefix:"t"},lC={name:nC,uri:iC,prefix:oC,associations:rC,types:aC,enumerations:sC,xml:cC},uC="BPMNDI",pC="http://www.omg.org/spec/BPMN/20100524/DI",dC="bpmndi",fC=[{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"]}],hC=[{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"}]}],gC=[],mC={name:uC,uri:pC,prefix:dC,types:fC,enumerations:hC,associations:gC},yC="DC",vC="http://www.omg.org/spec/DD/20100524/DC",xC="dc",bC=[{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}]}],wC=[],_C={name:yC,uri:vC,prefix:xC,types:bC,associations:wC},EC="DI",SC="http://www.omg.org/spec/DD/20100524/DI",RC="di",MC=[{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"}]}],CC=[],AC={tagAlias:"lowerCase"},TC={name:EC,uri:SC,prefix:RC,types:MC,associations:CC,xml:AC},PC="bpmn.io colors for BPMN",kC="http://bpmn.io/schema/bpmn/biocolor/1.0",OC="bioc",DC=[{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"}]}],LC=[],IC=[],BC={name:PC,uri:kC,prefix:OC,types:DC,enumerations:LC,associations:IC},NC="BPMN in Color",$C="http://www.omg.org/spec/BPMN/non-normative/color/1.0",FC="color",jC=[{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"}]}],HC=[],GC=[],zC={name:NC,uri:$C,prefix:FC,types:jC,enumerations:HC,associations:GC};const VC={bpmn:lC,bpmndi:mC,dc:_C,di:TC,bioc:BC,color:zC};function ny(e,t){const n=te({},VC,e);return new ol(n,t)}const WC={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"}},Ss={[Bm]:WC,[Vp]:Tm};function iy(){return ny(Ss)}const oy=iy();async function Sa(e){const{rootElement:t,warnings:n}=await oy.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function UC(e){const{xml:t}=await oy.toXML(e,{format:!0});return t}function gd(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ro={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},ry=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function qC(e){return ry.test(e)}function YC(e){const t=ro;return ry.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 Vr(e,t){let n=0;for(const i of e)n+=t*YC(i);return n}function ay(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&KC(e),XC(e),ZC(e),JC(e)}function KC(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:Vr(o,r),fontBoundingBoxAscent:r*ro.ascentEm,fontBoundingBoxDescent:r*ro.descentEm,actualBoundingBoxAscent:r*ro.ascentEm,actualBoundingBoxDescent:r*ro.descentEm}}};t.getContext=()=>n}function XC(e){if(e.SVGMatrix)return;class t{constructor(){on(this,"a",1);on(this,"b",0);on(this,"c",0);on(this,"d",1);on(this,"e",0);on(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 ZC(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 JC(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:Vr(n,12),height:14}})}const rl=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),QC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),eA=1,al=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),nr=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}`;case"edge-crosses-own-endpoint":return`xo|${e.edge}|${e.shape}`;case"message-detours-own-pool-shape":return`md|${e.edge}|${e.shape}`}}const sy=20,sl=5,cy=3,tA=8,Ra=15,md=50,ly=12,nA=ly*1.2;function yd(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Vr(r,ly))),o=n.length*nA;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const uy=1;function fn(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 ir(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 fn(e))for(const s of fn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>uy)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>=sy&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function vd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function py(e,t){const n=ir(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function iA(e,t){let n=0;for(const i of t)i.id!==e.id&&py(e,i)&&n++;return n}function qn(e,t){let n=0;for(const i of t)i.id!==e.id&&ir(e,i)&&n++;return n}const dy=15,fy=20;function oA(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-fy||t.at>n[1]+fy)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 xd=20;function cl(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>uy)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<sy||n.push([o-xd,r+xd])}return n}function Ma(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of fn(e)){const r=oA(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of cl(o,fn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const rA=10,aA=1,sA=(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 cA(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,y)=>{if(y===0)return f<=0;const h=f/y;if(y>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}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 bd(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 lA=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Ca=1;function Ui(e,t){const n=e.x+Ca,i=e.x+e.width-Ca,o=e.y+Ca,r=e.y+e.height-Ca;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 Aa(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function hy(e,t){const n=e.label;if(!n)return null;if(fn(e).some(i=>Ui(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(fn(i).some(o=>Ui(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(Aa(i).some(o=>Ui(n,o)))return i.id;return null}function Pt(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(cA(e.waypoints[r],e.waypoints[r+1],o,nr)){i.push(o);break}}return i}const uA=/Participant|Lane|SubProcess|TextAnnotation|Group/;function wd(e,t){for(const n of t){if(!n||uA.test(n.type))continue;const i=n.x+n.width/2,o=n.y+n.height/2,r=(a,s)=>{if(/Gateway$/.test(n.type)){const c=n.width/2-nr,l=n.height/2-nr;return c>0&&l>0&&Math.abs(a-i)/c+Math.abs(s-o)/l<1}return/Event$/.test(n.type)?Math.hypot(a-i,s-o)<Math.min(n.width,n.height)/2-nr:a>n.x+nr&&a<n.x+n.width-nr&&s>n.y+nr&&s<n.y+n.height-nr};for(let a=0;a+1<e.length;a++){const s=e[a],c=e[a+1],l=Math.max(1,Math.ceil(Math.hypot(c.x-s.x,c.y-s.y)/2));for(let u=0;u<=l;u++)if(r(s.x+(c.x-s.x)*u/l,s.y+(c.y-s.y)*u/l))return!0}}return!1}const Rs=(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))},pA=(e,t,n,i)=>my(e,t,n,i)?0:Math.min(Rs(e,n,i),Rs(t,n,i),Rs(n,e,t),Rs(i,e,t)),gy=(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 Po(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,Rs({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(gy(e,s)||gy(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,pA(e,t,s[l],s[(l+1)%s.length]));return c}function my(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 _d=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function yy(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(my(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function Ta(e,t){let n=0;for(const i of t)i.id===e.id||_d(e,i)||yy(e,i)&&n++;return n}function kn(e,t){let n=0;for(const i of t)i.id===e.id||_d(e,i)||Ta(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function vy(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++)Ta(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function Si(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Ta(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 Ri(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(_d(n[i],n[o])&&yy(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 xy(e){const t=Si(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:dA(e)}}function dA(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 by(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!al.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 wy(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 _y=e=>e?{members:e}:{},hn=e=>e.shapes.filter(t=>!t.container);function fA(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 hA(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 Ey(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(fn(i).some(o=>Ui(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(Aa(i).some(o=>Ui(n,o)))return i.id;return null}function or(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 Sy=3;function Ry(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 Pa(e,t){const n=[];for(const i of t.shapes){if(i.container||al.has(i.type))continue;const o=Ry(e,i);o>=Sy&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function Ed(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 gA(e){const t=new Map,n=new Set;for(const d of e)t.set(d.source,[...t.get(d.source)??[],d.target]),n.add(d.target);const i=[...e.map(d=>d.source).filter(d=>!n.has(d)),...e.map(d=>d.source)],o=new Map,r=new Set,a=d=>{o.set(d,"open");for(const f of t.get(d)??[]){const y=o.get(f);y==="open"?r.add(`${d}>${f}`):y||a(f)}o.set(d,"done")};for(const d of i)o.has(d)||a(d);const s=(d,f)=>!r.has(`${d}>${f}`),c=[],l=new Set,u=d=>{l.add(d);for(const f of t.get(d)??[])s(d,f)&&!l.has(f)&&u(f);c.push(d)};for(const d of i)l.has(d)||u(d);const p=new Map;for(const d of c.reverse()){const f=p.get(d)??0;p.set(d,f);for(const y of t.get(d)??[])s(d,y)&&(p.get(y)??-1)<f+1&&p.set(y,f+1)}return p}function mA(e){const t=e.edges.filter(l=>l.type==="bpmn:SequenceFlow"&&!!l.source&&!!l.target),n=new Map,i=new Map;for(const l of t)n.set(l.source,[...n.get(l.source)??[],l.target]),i.set(l.target,[...i.get(l.target)??[],l.source]);const o=new Map(n);for(const l of e.shapes)l.host!==void 0&&o.set(l.host,[...o.get(l.host)??[],l.id]);const r=(l,u)=>{const p=new Set([l]),d=[l];for(;d.length;)for(const f of u.get(d.pop())??[])p.has(f)||(p.add(f),d.push(f));return p},a=gA(t),s=new Map(e.shapes.map(l=>[l.id,l])),c=[];for(const[l,u]of i){const p=s.get(l);if(!p)continue;const d=r(l,o),f=[...new Set(u)].filter(m=>!d.has(m)&&s.has(m));if(f.length<2)continue;const y=f.map(m=>r(m,i)),h=[...y[0]].some(m=>y.every(w=>w.has(m)));for(const m of f){if(p.x+p.width/2>=s.get(m).x)continue;const w=a.get(m)??0;if(!(!h&&!f.some(g=>g!==m&&w>=(a.get(g)??0)+2)))for(const g of t)g.source===m&&g.target===l&&c.push({kind:"merge-before-predecessor",merge:l,edge:g.id})}}return c}function yA(e){const t=new Map(e.shapes.map(i=>[i.id,i])),n=[];for(const i of e.edges)if(!(i.type!=="bpmn:SequenceFlow"&&i.type!=="bpmn:MessageFlow"))for(const o of new Set(i.endpoints)){const r=t.get(o);r&&!r.container&&wd(i.waypoints,[r])&&n.push({kind:"edge-crosses-own-endpoint",edge:i.id,shape:o})}return n}function vA(e){const t=new Map(e.shapes.map(o=>[o.id,o])),n=o=>{for(let r=t.get(o);r;r=r.parent?t.get(r.parent):void 0)if(r.type==="bpmn:Participant")return r.id},i=[];for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.waypoints.length<4)continue;const[r,a]=[o.source??o.endpoints[0],o.target??o.endpoints[1]].map(h=>h?t.get(h):void 0);if(!r||!a||r.type==="bpmn:Participant"==(a.type==="bpmn:Participant"))continue;const[s,c]=r.type==="bpmn:Participant"?[r,a]:[a,r];if(c.container)continue;const l=c.x+c.width/2;if(l<s.x+10||l>s.x+s.width-10)continue;const u=n(c.id);if(!u)continue;const p=s.y>c.y,[d,f]=p?[c.y+c.height,s.y]:[s.y+s.height,c.y],y=e.shapes.filter(h=>h.id!==c.id&&!h.container&&!h.attached&&h.type!=="bpmn:TextAnnotation"&&h.x<l&&l<h.x+h.width&&h.y<f&&h.y+h.height>d&&n(h.id)===u).sort((h,m)=>p?h.y-m.y:m.y-h.y);y.length&&i.push({kind:"message-detours-own-pool-shape",edge:o.id,shape:y[0].id})}return i}function dt(e,t={}){const n=[],i=e.shapes.filter(g=>!g.container);for(const g of e.edges)for(const v of Pt(g,i))n.push({kind:"edge-crosses-shape",edge:g.id,shape:v.id});const o=e.shapes.filter(g=>g.container&&QC.has(g.type));if(o.length){const g=(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 Pt(v,o))v.endpoints.includes(b.id)||v.endpoints.some(E=>g(b,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}for(const g of e.edges){if(g.waypoints.length<2)continue;const v=[[g.source,g.waypoints[0]],[g.target,g.waypoints[g.waypoints.length-1]]];for(const[b,E]of v){if(!b)continue;const M=e.shapes.find(H=>H.id===b);if(!M||M.container)continue;const B=Math.max(M.x-E.x,E.x-(M.x+M.width),0),A=Math.max(M.y-E.y,E.y-(M.y+M.height),0),L=Math.hypot(B,A);L>rA&&n.push({kind:"edge-endpoint-detached",edge:g.id,shape:b,distance:Math.round(L)})}}for(const g of Ed(e.shapes))n.push({kind:"pool-overlap",...g});const r=i.filter(g=>!g.attached);for(let g=0;g<r.length;g++)for(let v=g+1;v<r.length;v++){const b=r[g],E=r[v];if(!bd(b,E,eA))continue;const M=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:"shape-overlap",shapes:M,identical:lA(b,E)})}const a=e.shapes.filter(g=>g.type==="bpmn:Group"&&Array.isArray(g.members)&&g.members.length>0);for(let g=0;g<a.length;g++)for(let v=g+1;v<a.length;v++){const b=a[g],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<=sl||B<=sl)continue;const A=b.id<E.id?[b.id,E.id]:[E.id,b.id],L=new Set(E.members);if(b.members.some(V=>L.has(V))){const V=by(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)});V.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:A,shapes:V});continue}const H=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:A,...H?{container:H}:{}})}const s=new Set(a.flatMap(g=>[...g.members])),c=g=>e.shapes.filter(v=>!v.container&&!al.has(v.type)&&v.x>=g.x&&v.y>=g.y&&v.x+v.width<=g.x+g.width&&v.y+v.height<=g.y+g.height);for(const g of a){const v=c(g);if(!v.length)continue;const b=new Set(g.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:g.id,shapes:E.map(M=>M.id).sort()}))}for(const g of a){const v=new Set(c(g).map(L=>L.id)),b=new Set(g.members),E=new Set([...v].filter(L=>!b.has(L)&&s.has(L)));if(!E.size)continue;let M=!1,B=!1,A=!1;for(const L of e.edges){if(L.type!=="bpmn:SequenceFlow"||!L.source||!L.target)continue;const H=E.has(L.source),V=E.has(L.target);!H&&V&&!v.has(L.source)?M=!0:H&&!V&&!v.has(L.target)?B=!0:H&&V&&(A=!0)}M&&B&&A&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:g.id,shapes:[...E].sort()})}const l=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<l.length;g++)for(let v=g+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const E=[l[g],l[v],l[b]],M={x:Math.max(...E.map(L=>L.x)),y:Math.max(...E.map(L=>L.y)),right:Math.min(...E.map(L=>L.x+L.width)),bottom:Math.min(...E.map(L=>L.y+L.height))};if(M.right-M.x<=sl||M.bottom-M.y<=sl)continue;const B=by(e,[],M);if(!B.length)continue;const A=E.map(L=>L.id).sort();n.push({kind:"group-stack-unreadable",groups:A,shapes:B})}for(const g of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||al.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",g.y,"h",g.x,g.x+g.width],["bottom",g.y+g.height,"h",g.x,g.x+g.width],["left",g.x,"v",g.y,g.y+g.height],["right",g.x+g.width,"v",g.y,g.y+g.height]];for(const[E,M,B,A,L]of b){const H=B==="h"?v.x:v.y,V=B==="h"?v.x+v.width:v.y+v.height;if(!(H<L&&A<V))continue;const G=B==="h"?v.y:v.x,ie=B==="h"?v.y+v.height:v.x+v.width;if(!(G<M&&M<ie))continue;const pe=Math.min(M-G,ie-M);pe<tA||n.push({kind:"group-cuts-shape",group:g.id,shape:v.id,side:E,depth:pe})}}const u=t.includeObservationOnly?e.shapes.filter(g=>g.type==="bpmn:Group"&&g.width>0&&g.height>0):[];if(u.length){const g=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=fn(v);if(b.length)for(const E of u){const M=E.x+E.width,B=E.y+E.height,A=v.endpoints.some(H=>{const V=g.get(H);return!!V&&E.x<V.x&&V.x<M&&E.y<V.y&&V.y<B});let L=null;for(const H of b){const[V,G,ie]=H.axis==="v"?[E.y,B,[["left",E.x],["right",M]]]:[E.x,M,[["top",E.y],["bottom",B]]],pe=Math.min(H.hi,G)-Math.max(H.lo,V);if(pe<md)continue;const q=H.axis==="v"?E.x<H.at&&H.at<M:E.y<H.at&&H.at<B;if(!(q&&A))for(const[Te,Pe]of ie){const ke=Math.abs(H.at-Pe);ke<=Ra&&(!L||ke<L.distance)&&(L={side:Te,inside:q,distance:ke,length:pe})}}L&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:L.side,inside:L.inside,distance:Math.round(L.distance),length:Math.round(L.length)})}}}const p=e.shapes.filter(g=>g.container&&g.type!=="bpmn:Group"&&g.type!=="bpmn:Lane");for(const g of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const b=g.x<v.x+v.width&&v.x<g.x+g.width,E=g.y<v.y+v.height&&v.y<g.y+g.height,M=[["top",g.y,v.y,b],["bottom",g.y+g.height,v.y+v.height,b],["left",g.x,v.x,E],["right",g.x+g.width,v.x+v.width,E]];for(const[B,A,L,H]of M)H&&Math.abs(A-L)<=cy&&n.push({kind:"group-on-container-boundary",group:g.id,container:v.id,side:B})}const d=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<d.length;g++)for(let v=g+1;v<d.length;v++){const b=d[g],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,A=[["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[L,H,V,G]of A)if(G&&Math.abs(H-V)<=cy){n.push({kind:"group-on-group-boundary",groups:b.id<E.id?[b.id,E.id]:[E.id,b.id],axis:L});break}}for(let g=0;g<e.edges.length;g++)for(let v=g+1;v<e.edges.length;v++){const b=e.edges[g],E=e.edges[v],M=ir(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 g of e.edges){if(!g.label)continue;const v=Ma(g,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:g.id,other:v.other,axis:v.axis})}for(const g of e.edges){if(!g.label)continue;const v=hy(g,e);v&&n.push({kind:"label-over-line",edge:g.id,line:v})}if(t.includeObservationOnly){for(const g of e.edges)if(!(!g.label||g.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:b}of Pa(g.label,e))n.push({kind:"label-over-shape",edge:g.id,shape:v,depth:Math.round(b)})}t.includeObservationOnly&&n.push(...mA(e)),t.includeObservationOnly&&n.push(...yA(e)),t.includeObservationOnly&&n.push(...vA(e));const f=new Set(i.map(g=>g.id)),y=e.shapes.filter(g=>g.type==="bpmn:Participant"&&g.label);for(const g of[...i,...y.filter(v=>!f.has(v.id))]){if(!g.label)continue;const v=Ey(g,e);v&&n.push({kind:"label-over-line",edge:g.id,line:v})}const h=new Set(e.shapes.filter(g=>g.type==="bpmn:TextAnnotation").map(g=>g.id));for(const g of y)for(const{owner:v,rect:b}of or(e))v===g.id||h.has(v)||bd(g.label,b,Ca)&&n.push({kind:"pool-name-over-label",pool:g.id,label:v});const m=or(e);for(const g of i)if(g.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of m)v!==g.id&&bd(g,b,Ca)&&n.push({kind:"annotation-over-label",annotation:g.id,label:v});const w=new Map(e.shapes.map(g=>[g.id,g]));for(const g of i){const v=g.parent??fA(g,e,w);if(!v)continue;const b=w.get(v);!b||!b.container||sA(b,g,aA)||g.type==="bpmn:TextAnnotation"&&!hA(g,b,e)||n.push({kind:"shape-outside-container",shape:g.id,container:b.id})}return n.sort((g,v)=>ct(g).localeCompare(ct(v)))}const Ut=e=>typeof e=="object"&&e!==null?e:void 0,rn=e=>typeof e=="number"?e:0,qi=e=>{const t=Ut(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function xA(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=qi(r);a&&n.push(a)}}return n}function bA(e){const t=Ut(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:qi(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:qi(t.targetRef);return n&&i?{source:n,target:i}:{}}function wA(e,t){const n=Ut(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=qi(n);return o?t.get(o):void 0}if(rl.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return qi(n)}function My(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 y=Ut(f),h=qi(y),m=qi(y==null?void 0:y.processRef);h&&m?o.set(m,h):h&&r.add(h)}}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 y of f){const h=Ut(y);if(!h)continue;const m=Ut(h.bpmnElement),w=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!w)continue;const g=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",v=Ut(h.bounds);if(v){const E=h.isExpanded===!1&&g!=="bpmn:Participant",M=Ut((l=Ut(h.label))==null?void 0:l.bounds),B=qi(m==null?void 0:m.attachedToRef),A={id:w,type:g,x:rn(v.x),y:rn(v.y),width:rn(v.width),height:rn(v.height),container:rl.has(g)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...B!==void 0?{host:B}:{},...m?{parent:wA(m,o)}:{},...M?{label:{x:rn(M.x),y:rn(M.y),width:rn(M.width),height:rn(M.height)}}:{},...g==="bpmn:Group"?_y(wy(m)):{}},L=h.isHorizontal!==!1,H=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(w)&&L&&H&&(A.label=yd(A,H)),t.push(A);continue}const b=h.waypoint;if(Array.isArray(b)){const E=Ut((u=Ut(h.label))==null?void 0:u.bounds);n.push({id:w,type:g,waypoints:b.map(M=>{var B,A;return{x:rn((B=Ut(M))==null?void 0:B.x),y:rn((A=Ut(M))==null?void 0:A.y)}}),endpoints:xA(m),...bA(m),...E?{label:{x:rn(E.x),y:rn(E.y),width:rn(E.width),height:rn(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Cy(e){return dt(My(e),{includeObservationOnly:!0})}async function _A(e){const{definitions:t,warnings:n}=await Sa(e);return{findings:Cy(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 m=Ut(r.label),w=qi(r.source),g=qi(r.target);n.push({id:r.id,type:a,waypoints:s.map(v=>({x:rn(v.x),y:rn(v.y)})),endpoints:[w,g].filter(v=>!!v),...w&&g?{source:w,target:g}:{},...m&&typeof m.x=="number"?{label:{x:m.x,y:rn(m.y),width:rn(m.width),height:rn(m.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ut(r.businessObject),l=qi(c==null?void 0:c.attachedToRef),u=Ut(r.label);let p=Ut(r.parent);for(;p&&p.type==="bpmn:Lane";)p=Ut(p.parent);const d=typeof(p==null?void 0:p.type)=="string"?p.type:"",f=p&&rl.has(d)&&d!=="bpmn:Group"&&typeof p.id=="string"?p.id:void 0,y={id:r.id,type:a,x:r.x,y:r.y,width:rn(r.width),height:rn(r.height),container:rl.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...l!==void 0?{host:l}:{},...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:rn(u.y),width:rn(u.width),height:rn(u.height)}}:{},...a==="bpmn:Group"?_y(wy(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=Ut(r.di))==null?void 0:i.isHorizontal)!==!1&&(y.label=yd(y,h)),t.push(y)}return{shapes:t,edges:n}}const EA={"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 SA(e,t){const n=EA[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Ay(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ty(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 SA(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Ay(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?Ay(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 zp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Jo(i.businessObject).map(o=>o.locale)}}}const Wr=20,RA=4,He=(e,t)=>Math.abs(e-t)<.5,MA=15;function Sd(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,Po(e[r-1],e[r],o));return i}function CA(e,t,n=MA){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=He(i.x,o.x)&&!He(i.y,o.y),a=He(i.y,o.y)&&!He(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=w=>{const g=w?t.find(v=>v.id===w):void 0;return g?r?[g.x+10,g.x+g.width-10]:[g.y+10,g.y+g.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),y=Math.min(u,d);if(!(y>=f))return[];const h=r?i.x:i.y,m=[];for(let w=5;w<=400;w+=5)for(const g of[-1,1]){const v=h+g*w;if(v<f||v>y)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Pt({...e,waypoints:b},t).length||Sd(b,t,s)<n||m.push(b)}return m}function Rd(e,t,n,i,o){const r=e.edges.filter(m=>m.id!==t.id),a={...t,waypoints:n},s={...t,waypoints:[...i]};if(kn(a,r)>kn(s,r)||qn(a,r)>qn(s,r))return!1;const c=`L|${t.id}|${t.id}`,l=m=>({...e,edges:e.edges.map(w=>w.id===t.id?{...w,waypoints:m}:w)}),u=m=>dt(m).filter(w=>ct(w)!==c),p=l(n);let d=u(p);const f=o?AA(p,d,t,o):null;f&&(d=u(f));const y=`"${t.id}"`;if(d.some(m=>JSON.stringify(m).includes(y)))return!1;const h=new Set(u(l([...i])).map(ct));return d.every(m=>h.has(ct(m)))}function AA(e,t,n,i){const o=t.filter(s=>s.kind==="label-over-line"&&s.line===n.id&&n.endpoints.includes(s.edge)&&!i.has(s.edge));if(o.length!==1)return null;const r=e.shapes.find(s=>s.id===o[0].edge);if(!r||!/Gateway$|Event$/.test(r.type))return null;const a=jd(r,e);return a?{...e,shapes:e.shapes.map(s=>s.id===r.id?{...s,label:a}:s)}:null}function Py(e,t,n,i){for(const o of CA(t,n))if(Rd(e,t,o,i))return o;return null}const TA=120;function ky(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=Wr;u<=TA;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,y=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,h=r.x+r.width/2+c,m=a.x+a.width/2+l,w=[{x:h,y:d},{x:h,y},{x:m,y},{x:m,y:f}];if(!fl(w,i)||Pt({...e,waypoints:w},t).length||Pt({...e,endpoints:[],waypoints:w},[r,a]).length||Sd(w,t,e.endpoints)<Wr)continue;const g=Ld(w,n);(o===void 0?g<Dd:g>=Dd||g<o)||s.push(w)}return s}function Oy(e,t,n,i,o,r){const a=e.shapes.filter(u=>u.type==="bpmn:Participant"||u.type==="bpmn:Lane"),s=ky(t,n,a,o),c=Dy(e,t,i,s,r);if(c)return c;const l=Math.max(Ld(i,a),Wr);return Dy(e,t,i,ky(t,n,a,o,l),r)}function Dy(e,t,n,i,o){const r=new Map;for(const l of i){const u=l[1].y<l[0].y?"top":"bottom";if(!r.has(u)&&(Rd(e,t,l,n,o)&&r.set(u,l),r.size===2))break}const a=e.edges.filter(l=>l.id!==t.id);let s=null,c=1/0;for(const l of["top","bottom"]){const u=r.get(l);if(!u)continue;const p=kn({...t,waypoints:u},a);p<c&&(s=u,c=p)}return s}function ll(e,t,n,i=Wr){if(He(e.y,t.y)&&!He(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(He(e.x,t.x)&&!He(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 Ly(e,t,n,i=Wr){if(n.length<2)return null;if(He(e.y,t.y)&&!He(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(He(e.x,t.x)&&!He(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 Iy(e,t,n=Wr){if(e.length!==4)return null;const[i,o,r,a]=e;if(He(i.y,o.y)&&He(o.x,r.x)&&He(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(He(i.x,o.x)&&He(o.y,r.y)&&He(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 ul(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 pl=30,PA=[0,-25,25,-40,40];function kA(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+pl:s-pl,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return PA.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Pt({...e,endpoints:[],waypoints:d},[n]).length===0)}const Md=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],rr=(e,t,n)=>Pt({...e,waypoints:t},n).length,OA=25;function By(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 DA(e,t,n,i){const r=(d,f,y)=>(f.x-d.x)*(y.y-d.y)-(f.y-d.y)*(y.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=By(i,e,t),f=By(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 LA(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=DA(e[s],e[s+1],a,r);if(c&&Math.hypot(c.x-r.x,c.y-r.y)<=OA){i++;break}}}return i}function dl(e,t,n,i){let o=[...e.waypoints],r=rr(e,o,t);if(r===0)return null;let a=!1;for(const p of ul(e,t))if(rr(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(fn),c=p=>fn({...e,waypoints:p}).some(d=>cl(d,s).length>0),l=kA(e,t).filter(p=>rr(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&&He(p.y+p.height/2,d.y+d.height/2)){const f=[o[0],o[o.length-1]];if(He(f[0].y,f[1].y)&&!He(f[0].x,f[1].x)){const y=t.filter(g=>!e.endpoints.includes(g.id)&&Pt({...e,waypoints:f},[g]).length>0),h=y.length>=2?Ly(f[0],f[1],y):null,w=(h?h.map(g=>[f[0],...g,f[1]]):y.length===1?(ll(f[0],f[1],y[0])??[]).map(g=>[f[0],...g,f[1]]):y.length===0?[f]:[]).filter(g=>rr(e,g,t)===0&&g.length<=o.length).sort((g,v)=>Number(u(v))-Number(u(g)));if(w.length)return w.find(g=>!c(g))??w[0]}}}for(let p=0;p+1<o.length;p++){const d=o[p],f=o[p+1],y=t.filter(w=>!e.endpoints.includes(w.id)&&Pt({...e,waypoints:[d,f]},[w]).length>0);if(y.length<2)continue;const h=Ly(d,f,y);if(!h)continue;const m=h.map(w=>Md(o,p,w)).filter(w=>rr(e,w,t)===0).sort((w,g)=>Number(u(g))-Number(u(w)));if(m.length)return m.find(w=>!c(w))??m[0]}for(let p=0;p<RA&&r>0;p++){let d=!1;for(let f=0;f+1<o.length&&!d;f++){const y=o[f],h=o[f+1];for(const m of t){if(e.endpoints.includes(m.id)||Pt({...e,waypoints:[y,h]},[m]).length===0)continue;const w=ll(y,h,m),v=[...(Iy(o,m)??[]).map((E,M)=>({pts:E,k:M,cross:rr(e,E,t),tip:LA(E,e,i??[])})).sort((E,M)=>E.cross-M.cross||E.tip-M.tip||E.k-M.k).map(E=>E.pts),...w?w.map(E=>Md(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=rr(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}const IA=40;function BA(e,t,n,i){if(t.length!==4||!e.target||e.label)return null;const[o,r,a,s]=t,c=He(o.y,r.y)&&He(r.x,a.x)&&He(a.y,s.y)&&!He(r.y,a.y),l=He(o.x,r.x)&&He(r.y,a.y)&&He(a.x,s.x)&&!He(r.x,a.x);if(!c&&!l)return null;const u=b=>c?b.x:b.y,p=b=>c?b.y:b.x,d=u(r),f=Math.sign(p(a)-p(r)),y=Math.min(u(o),u(s)),h=Math.max(u(o),u(s)),m=n.filter(b=>b.id!==e.id);let w=null;for(const b of m){if(b.type!==e.type||b.target!==e.target||b.waypoints.length<3)continue;const[E,M,B]=b.waypoints.slice(-3);if(!He(B.x,s.x)||!He(B.y,s.y)||!He(p(M),p(B))||!He(u(E),u(M))||Math.sign(p(M)-p(E))!==f)continue;const A=u(M),L=Math.abs(A-d);if(L<1||L>IA||A<=y||A>=h)continue;const H=c?[o,{x:A,y:o.y},{x:A,y:s.y},s]:[o,{x:o.x,y:A},{x:s.x,y:A},s];rr(e,H,i)===0&&(!w||L<w.gap)&&(w={pts:H,gap:L})}if(!w)return null;const g={...e,waypoints:[...t]},v={...e,waypoints:w.pts};if(qn(v,m)>qn(g,m)||kn(v,m)>kn(g,m))return null;for(const b of m){if(!b.label||b.target!==e.target)continue;const E=m.filter(M=>M.id!==b.id);if(!Ma(b,[...E,g])&&Ma(b,[...E,v]))return null}return w.pts}function Cd(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o),s=hn(a),c=new Set,l=dt(a).filter(p=>p.kind==="edge-crosses-shape"&&!t.has(ct(p)));if(!l.length)return c;const u=new Map;for(const p of l){if(p.kind!=="edge-crosses-shape"||u.has(p.edge))continue;const d=a.edges.find(f=>f.id===p.edge);d&&u.set(p.edge,d)}for(const[p,d]of u){if(i&&!i.has(p))continue;const f=o.get(p);if(!f)continue;const y=f.parent,h=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,m=Pt(d,s);if(!i&&m.length&&m.every(A=>A.type==="bpmn:TextAnnotation")){c.add(p);continue}let w=dl(d,s,h,a.edges);const g=Py(a,d,s,w??d.waypoints);g&&(w=g);const v=Oy(a,d,s,w??d.waypoints,h,n);if(v&&kn({...d,waypoints:v},a.edges.filter(A=>A.id!==p))===0&&(w=v),!w){m.some(A=>A.type==="bpmn:TextAnnotation")&&c.add(p);continue}const b=BA(d,w,a.edges,s);b&&(w=b);const E=a.edges.filter(A=>A.id!==p),M=qn(d,E);qn({...d,waypoints:w},E)>M||r.updateWaypoints(f,w)}return c}function NA(e,t,n,i){var f,y;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=h=>{const m=Ge(r);return[...Si(m),...Ri(m)].filter(([w,g])=>w===h||g===h).length},c=(h,m)=>h.kind==="label-over-line"||h.kind==="label-over-shape"||h.kind==="label-on-shared-segment"?h.edge===m:h.kind==="annotation-over-label"||h.kind==="pool-name-over-label"?h.label===m:!1,l=h=>new Set(dt(Ge(r)).filter(m=>!c(m,h)).map(ct)),u=(h,m)=>Math.abs(h-m)<=1,p=(h,m,w,g,v)=>{const b=hn(Ge(r));for(let E=0;E+3<h.length;E++){const[M,B,A,L]=[h[E],h[E+1],h[E+2],h[E+3]],H=u(M.y,L.y)&&u(M.x,B.x)&&u(A.x,L.x)&&u(B.y,A.y)&&Math.abs(B.y-M.y)>=5,V=u(M.x,L.x)&&u(M.y,B.y)&&u(A.y,L.y)&&u(B.x,A.x)&&Math.abs(B.x-M.x)>=5;if(!H&&!V)continue;const G={waypoints:[M,L],endpoints:w};if(Pt(G,[m]).length&&!Pt(G,b).length)return E}return-1},d=(h,m)=>[...h.slice(0,m+1),...h.slice(m+3)].filter((w,g,v)=>g===0||g===v.length-1||!(u(v[g-1].x,w.x)&&u(v[g+1].x,w.x)||u(v[g-1].y,w.y)&&u(v[g+1].y,w.y)));for(const h of t){const m=r.get(h.id);if(!m)continue;const w=new Set([...m.incoming??[],...m.outgoing??[]].map(b=>b.id)),g={...h,type:m.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)&&!w.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,(y=b.target)==null?void 0:y.id].filter(M=>!!M);for(;;){const M=b.waypoints.map(q=>({x:q.x,y:q.y})),B=p(M,g,E,b.id,b.type);if(B<0)break;const A=b.label,L=A&&{x:A.x,y:A.y},H=l(b.id),V=s(b.id);if(a.updateWaypoints(b,d(M,B)),A&&L){const q={x:L.x+A.width/2,y:L.y+A.height/2},Te=(ke,ve)=>{const U=ve.x-ke.x,de=ve.y-ke.y,z=U*U+de*de,Q=z===0?0:Math.max(0,Math.min(1,((q.x-ke.x)*U+(q.y-ke.y)*de)/z));return Math.hypot(q.x-(ke.x+Q*U),q.y-(ke.y+Q*de))};let Pe=0;for(let ke=1;ke+1<M.length;ke++)Te(M[ke],M[ke+1])<Te(M[Pe],M[Pe+1])&&(Pe=ke);(Pe<B||Pe>B+2)&&(A.x!==L.x||A.y!==L.y)&&a.moveElements([A],{x:L.x-A.x,y:L.y-A.y})}const G=l(b.id),ie=[...G].filter(q=>!H.has(q)).length,pe=[...H].filter(q=>!G.has(q)).length;if(ie<=pe&&s(b.id)<=V){o.add(b.id);continue}a.updateWaypoints(b,M),A&&L&&(A.x!==L.x||A.y!==L.y)&&a.moveElements([A],{x:L.x-A.x,y:L.y-A.y});break}}}return o}const $A=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 Ms(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 fl=(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),Ad=(e,t)=>Ta(e,[t])>0;function Ny(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=hn(r);let s=r;const c=new Set(dt(r).map(ct));for(const[l,u]of Si(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),y=s.edges.find(B=>B.id===d);if(!f||!y)continue;const h=i.get(p);if(!h)continue;const m=Ms(h),w=$A(y),g=[...ul(f,a)??[]],v=dl(f,[...a,...w],m,r.edges);v&&g.push(v);for(let B=0;B+1<f.waypoints.length;B++)for(const A of w)for(const L of ll(f.waypoints[B],f.waypoints[B+1],A)??[])g.push(Md(f.waypoints,B,L));const b=s.edges.filter(B=>B.id!==p),E=B=>({...s,edges:s.edges.map(A=>A.id===p?{...A,waypoints:B}:A)}),M=g.find(B=>{const A={...f,waypoints:B};return Ad(A,y)||!fl(B,m)||b.some(L=>L.id!==d&&!Ad(f,L)&&Ad(A,L))?!1:dt(E(B)).every(L=>c.has(ct(L)))});if(M){o.updateWaypoints(h,M),s=E(M);break}}}const FA=["top","bottom","left","right"],$y={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},Cs=20,jA=20;function HA(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&&He(e.y,t.y)&&o.push("top"),n&&He(e.y,t.y+t.height)&&o.push("bottom"),i&&He(e.x,t.x)&&o.push("left"),i&&He(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const GA=(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 Fy(e,t,n,i){const o=$y[t],r=$y[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],y=r[p];if(He(e[d],n[d]))return f===-y&&f*(n[p]-e[p])>=Cs?[e,n]:null;let h;if(f===-y){const w=e[p]+f*Cs,g=n[p]-f*Cs;if(f*(g-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=f>0?Math.max(e[p],n[p])+pl:Math.min(e[p],n[p])-pl;const m=(w,g)=>a?{x:g,y:w}:{x:w,y:g};return[e,m(h,e[d]),m(h,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>=Cs&&u>=Cs?[e,c,n]:null}function zA(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?HA(a,r):null;if(!s)return[];const c=[];for(const l of FA){const u=GA(t,l),p=o?Fy(u,l,a,s):Fy(a,s,u,l);p&&c.push(p)}return c}const jy=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 VA(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(dt(r).map(ct));let c=r;for(const[l,u]of Ri(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(L=>L.id===l),d=c.edges.find(L=>L.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Ri({edges:[p,d]}).length)continue;const f=p.endpoints.find(L=>d.endpoints.includes(L)),y=f?a.get(f):void 0;if(!y||y.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const w=L=>n.has(L.id)?[L.waypoints]:[L.waypoints,...zA(L,y,a)],g=L=>L.length-2,v=w(p).flatMap(L=>w(d).map(H=>({pa:L,pb:H}))).filter(({pa:L,pb:H})=>L!==p.waypoints||H!==d.waypoints).map(L=>({...L,cost:jy(L.pa)+jy(L.pb)+jA*(g(L.pa)+g(L.pb))})).sort((L,H)=>L.cost-H.cost),b=Ms(h),E=Ms(m),M=Ri(c).length,B=new Set(Si(c).map(([L,H])=>`${L}|${H}`)),A=v.find(({pa:L,pb:H})=>{const V={...p,waypoints:L},G={...d,waypoints:H};if(Ri({edges:[V,G]}).length||ir(V,G)||!fl(L,b)||!fl(H,E))return!1;const ie={...c,edges:c.edges.map(pe=>pe.id===l?V:pe.id===u?G:pe)};return Ri(ie).length>=M||Si(ie).some(([pe,q])=>!B.has(`${pe}|${q}`))?!1:dt(ie).every(pe=>s.has(ct(pe)))});A&&(A.pa!==p.waypoints&&o.updateWaypoints(h,A.pa),A.pb!==d.waypoints&&o.updateWaypoints(m,A.pb),c={...c,edges:c.edges.map(L=>L.id===l?{...p,waypoints:A.pa}:L.id===u?{...d,waypoints:A.pb}:L)})}}const WA=40,UA=20;function qA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=Ri(u);return{keys:new Set(dt(u).map(ct)),crossings:Si(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(Pt({...d,waypoints:u},hn(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 y=f.x+f.width/2;if(y>=d.x+10&&y<=d.x+d.width-10)continue;const h=y>d.x+d.width,m=d.y>f.y,w=m?f.y+f.height:f.y,g=m?d.y:d.y+d.height,v=Math.round((w+g)/2),b=H=>d===u?[...H].reverse():H,E=(l.waypoints??[]).map(H=>({x:H.x,y:H.y})),M=r(l.id),B=a(l.id,E)??new Set,A=h?d.x+d.width:d.x,L=d.x+d.width/2;for(let H=Math.min(WA,d.width/4);h?A-H>L:A+H<L;H+=UA){const V=Math.round(h?A-H:A+H),G=b([{x:y,y:w},{x:y,y:v},{x:V,y:v},{x:V,y:g}]),ie=a(l.id,G);if(!ie||[...ie].some(q=>!B.has(q)))continue;o.updateWaypoints(l,G);const pe=r(l.id);if(pe.crossings<=M.crossings&&pe.shared<=M.shared&&pe.mine<=M.mine&&[...pe.keys].every(q=>M.keys.has(q)))break;o.updateWaypoints(l,E)}}}const YA=10;function Hy(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 Gy(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(pe=>pe.type==="bpmn:Participant"&&pe.container),i=t.shapes.find(pe=>pe.id===e.endpoints[0]),o=t.shapes.find(pe=>pe.id===e.endpoints[1]);if(!i||!o)return null;const r=Hy(i,n),a=Hy(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(pe=>pe.id!==r.id&&pe.id!==a.id&&pe.y>=c.y+c.height&&pe.y+pe.height<=l.y).sort((pe,q)=>pe.y-q.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,y=(d.y+d.height+l.y)/2,h=s?f:y,m=s?y:f,w=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],v=hn(t),b=t.edges.filter(pe=>pe.id!==e.id),E=kn(e,b),M=Pt(e,v).length;if(E===0&&M===0||M===0&&e.waypoints.length===2)return null;const B=Math.min(...u.map(pe=>pe.x)),A=Math.max(...u.map(pe=>pe.x+pe.width)),L=(w.x+g.x)/2,H=pe=>pe.filter((q,Te)=>Te===0||!(He(q.x,pe[Te-1].x)&&He(q.y,pe[Te-1].y)));let V,G;for(let pe=B;pe<=A;pe+=YA){const q=H([w,{x:w.x,y:h},{x:pe,y:h},{x:pe,y:m},{x:g.x,y:m},g]),Te={...e,waypoints:q};if(Pt(Te,v).length>0)continue;const Pe=kn(Te,b),ke=Math.abs(pe-L);(!V||Pe<V.cross||Pe===V.cross&&ke<V.detour)&&(V={pts:q,cross:Pe,detour:ke}),Sd(q,v,e.endpoints)>=Wr&&(!G||Pe<G.cross||Pe===G.cross&&ke<G.detour)&&(G={pts:q,cross:Pe,detour:ke})}G&&V&&G!==V&&Rd(t,e,G.pts,V.pts)&&(V=G);const ie=V&&(M>0?V.cross<=E:V.cross<E)?V.pts:null;if(M>0){const pe=Py(t,e,v,ie??e.waypoints);if(pe)return pe}return ie}const KA=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function XA(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=hn(a);for(const p of t.edges){if(!KA.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),y=r.get(p.target),h=s.get(p.source),m=s.get(p.target);if(!f||!y||!h||!m||!He(f.width,h.width)||!He(f.height,h.height)||!He(y.width,m.width)||!He(y.height,m.height))continue;const w=h.x-f.x,g=h.y-f.y;if(He(w,0)&&He(g,0)||!He(m.x-y.x,w)||!He(m.y-y.y,g))continue;const v=p.waypoints.map(M=>({x:M.x+w,y:M.y+g})),b=d.waypoints.map(M=>({x:M.x,y:M.y}));b.length===v.length&&b.every((M,B)=>He(M.x,v[B].x)&&He(M.y,v[B].y))||b.length===2&&(He(b[0].x,b[1].x)||He(b[0].y,b[1].y))&&Pt({...p,waypoints:b},c).length===0||Pt({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function zy(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=Gy(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Td=20,Vy=10,Yi=10,Pd=40,ZA=6,JA=40,Wy=50;function QA(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<=ZA})}function kd(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(He(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 eT(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 Od(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Vy;o<=n-t;o+=Vy)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function tT(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=(q,Te)=>Te>q.x+Yi&&Te<q.x+q.width-Yi,y=(q,Te)=>q.width<=2*Pd?q.x+q.width/2:Math.min(Math.max(Te,q.x+Pd),q.x+q.width-Pd),h=Math.max(e.x,t.x)+Yi,m=Math.min(e.x+e.width,t.x+t.width)-Yi;if(h<=m){const q=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((h+m)/2);r.push([{x:q,y:l},{x:q,y:u}])}const w=s?y(t,p):d,g=a?y(e,d):p;if(!a&&!f(e,w)){const q=w<e.x?e.x:e.x+e.width;for(const Te of Od(e.y+e.height/2,e.y+Yi,e.y+e.height-Yi))r.push([{x:q,y:Te},{x:w,y:Te},{x:w,y:u}])}if(!s&&!f(t,g)){const q=g<t.x?t.x:t.x+t.width;for(const Te of Od(t.y+t.height/2,t.y+Yi,t.y+t.height-Yi))r.push([{x:g,y:l},{x:g,y:Te},{x:q,y:Te}])}const v=(q,Te)=>{if(Math.abs(Te-q)<2*Yi)return[];const Pe=Math.min(q,Te)+Yi,ke=Math.max(q,Te)-Yi;return Od(Math.round((q+Te)/2),Pe,ke)};if(!a&&n)for(const q of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:q},{x:w,y:q},{x:w,y:u}]);if(!s&&i)for(const q of v(u,c?i.y:i.y+i.height))r.push([{x:g,y:l},{x:g,y:q},{x:d,y:q},{x:d,y:u}]);const b=Math.min(g,w),E=Math.max(g,w),M=[];for(const[q,Te]of o.filter(Pe=>Pe.x<E&&Pe.x+Pe.width>b).map(Pe=>[Pe.y,Pe.y+Pe.height]).sort((Pe,ke)=>Pe[0]-ke[0])){const Pe=M[M.length-1];Pe&&q<=Pe[1]?Pe[1]=Math.max(Pe[1],Te):M.push([q,Te])}const B=[];for(let q=1;q<M.length;q++)M[q][0]-M[q-1][1]>=JA&&B.push(Math.round((M[q-1][1]+M[q][0])/2));M.length&&B.push(M[0][0]-Wy,M[M.length-1][1]+Wy);const A=(q,Te)=>Te<q.y?q.y:Te>q.y+q.height?q.y+q.height:void 0,L=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(q=>!!q)),H=e.y+e.height/2,V=t.y+t.height/2,G=V>H?1:-1,ie=(q,Te,Pe)=>o.some(ke=>!L.has(ke.id)&&ke.x<q&&q<ke.x+ke.width&&ke.y<Math.max(Te,Pe)-1&&ke.y+ke.height>Math.min(Te,Pe)+1),pe=[];for(const q of B){const Te=A(e,q),Pe=A(t,q);Te===void 0||Pe===void 0||(q-H)*G<0&&ie(g,Te,q)||(q-V)*G>0&&ie(w,Pe,q)||pe.push({pts:[{x:g,y:Te},{x:g,y:q},{x:w,y:q},{x:w,y:Pe}],len:Math.abs(q-Te)+(E-b)+Math.abs(Pe-q)})}return{inPools:r,outside:pe.sort((q,Te)=>q.len-Te.len).map(q=>q.pts)}}function nT(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 y=f;for(;y&&y.type!=="bpmn:Participant";)y=y.parent;return y==null?void 0:y.id},c=()=>{const f=Ge(i);return{keys:new Set(dt(f).map(ct)),crossings:Si(f).length,shared:Ri(f).length}},l=(f,y)=>f.length===y.length&&f.every((h,m)=>He(h.x,y[m].x)&&He(h.y,y[m].y)),u=f=>{const y=f.source,h=f.target;if(!y||!h)return"skip";const m=Ge(i),w=new Map(m.shapes.map(U=>[U.id,U])),g=s(y),v=s(h),b=new Set([g,v].filter(U=>!!U)),E=m.shapes.filter(U=>U.type==="bpmn:Participant"),M=(f.waypoints??[]).map(U=>({x:U.x,y:U.y})),B=kd(M,b,E);if(B<Td)return"skip";if(t.has(f.id)){const U=r.get(f.id);if(U&&l(U,M)||B-(U?kd(U,b,a):0)<Td)return"skip"}const A=w.get(y.id),L=w.get(h.id),H=m.edges.find(U=>U.id===f.id);if(!A||!L||!H)return"skip";const V=hn(m),G=new Set(Pt(H,V).map(U=>U.id)),ie=or(m).filter(U=>U.owner!==f.id&&U.owner!==A.id&&U.owner!==L.id),pe=[...m.shapes.filter(U=>!U.container&&U.id!==A.id&&U.id!==L.id),...ie.map(U=>U.rect)],q=U=>fn({...H,waypoints:U}).some(de=>QA(de,pe)),Te=tT(A,L,g?w.get(g):void 0,v?w.get(v):void 0,E),Pe=U=>U.map((de,z)=>({pts:de,i:z,key:de.length*2+(q(de)?1:0)})).sort((de,z)=>de.key-z.key||de.i-z.i).map(de=>de.pts),ke=[...Pe(Te.inPools),...Pe(Te.outside)],ve=c();for(const U of ke){if(kd(U,b,E)>=Td)continue;const de={...H,waypoints:U};if(Pt(de,V).some(he=>!G.has(he.id))||fn(de).some(he=>eT(he,m.shapes)||ie.some(se=>Ui(se.rect,he))))continue;o.updateWaypoints(f,U);const Q=c();if(Q.crossings<=ve.crossings&&Q.shared<=ve.shared&&[...Q.keys].every(he=>ve.keys.has(he)))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 Ki=[25,-25,40,-40],ka=35;function iT(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)-ka:Math.max(e.y+e.height,t.y+t.height)+ka,p=rT(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,oT]];for(const[f,y]of d)for(const h of[0,...Ki])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...Ki]){if(Math.abs(m)>=t.width/2-5)continue;const w=i+h,g=o+m,v=[{x:w,y:c},{x:w,y:f},{x:g,y:f},{x:g,y:l}];y&&Pt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:y+Math.abs(m)+Math.abs(h)})}}return r}const oT=45,hl=20;function rT(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(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,w)=>m.width*m.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),d=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...d.map(g=>g.y));for(let g=!0;g;){g=!1;for(const v of f)v.y<m&&v.y<l&&v.y+v.height>m-hl&&(m=v.y,g=!0)}const w=Math.max(u.y,...f.filter(g=>g.y+g.height<=m).map(g=>g.y+g.height));return m-w>=hl?Math.round((m+w)/2):null}let y=Math.max(...d.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const w of f)w.y+w.height>y&&w.y+w.height>l&&w.y<y+hl&&(y=w.y+w.height,m=!0)}const h=Math.min(u.y+u.height,...f.filter(m=>m.y>=y).map(m=>m.y));return h-y>=hl?Math.round((y+h)/2):null}function gl(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 iT(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-ka:n.y+n.height+ka,p=[];for(const g of[0,...Ki]){if(Math.abs(g)>=i.width/2-5)continue;const v=r+g;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(g)});for(const b of[0,...Ki]){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(g)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,y=s?n.y+n.height:n.y;for(const g of[0,...Ki]){if(Math.abs(g)>=n.width/2-5)continue;const v=a+g;p.push({pts:[{x:v,y},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(g)})}const h=60,m=s?i.y+i.height:i.y,w=s?i.y+i.height+ka:i.y-ka;for(const g of[0,...Ki]){if(Math.abs(g)>=i.width/2-5)continue;const v=r+g;for(const b of[0,...Ki]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y},{x:E,y:w},{x:v,y:w},{x:v,y:m}],cost:h+Math.abs(g)+Math.abs(b)})}}return p}const Dd=30;function Uy(e,t){return Ld(e,t)<Dd}function Ld(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=He(o.y,r.y)&&!He(o.x,r.x),s=He(o.x,r.x)&&!He(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 ml=40;function aT(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-ml,a=o.x+o.width+ml,s=o.y-ml,c=o.y+o.height+ml;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 qy(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=hn(t),r=t.edges.filter(M=>M.id!==e.id),a=qn(e,r),s=kn(e,r),c=M=>aT(M,t.shapes,e.endpoints)+(Uy(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const B=M.x+M.width/2,A=M.y+M.height/2;return n.find(L=>L.type==="bpmn:Lane"&&B>=L.x&&B<=L.x+L.width&&A>=L.y&&A<=L.y+L.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,y=M=>{if(!f||!d)return!1;for(let B=1;B<M.length-2;B++){const A=M[B],L=M[B+1];if(He(A.y,L.y)&&!He(A.x,L.x)&&A.y>d.y&&A.y<d.y+d.height)return!0}return!1},h=y(e.waypoints),w=(M=>{if(!M)return;const B=M.x+M.width/2,A=M.y+M.height/2;return n.filter(L=>L.type==="bpmn:Participant"&&B>=L.x&&B<=L.x+L.width&&A>=L.y&&A<=L.y+L.height).sort((L,H)=>L.width*L.height-H.width*H.height)[0]})(i.get(e.endpoints[0]??"")),g=M=>{if(!w)return 0;let B=0;for(let A=1;A<M.length-1;A++){const L=M[A];(L.x<w.x||L.x>w.x+w.width||L.y<w.y||L.y>w.y+w.height)&&B++}return B},v=g(e.waypoints);if(!Uy(e.waypoints,n)&&!(f&&!h)&&v===0)return null;const b=M=>M.reduce((B,A,L)=>L?B+Math.abs(A.x-M[L-1].x)+Math.abs(A.y-M[L-1].y):0,0);let E;for(const{pts:M,cost:B}of gl(e,i)){const A={...e,waypoints:M};if(Pt(A,o).length>0||Jy(M,e,t))continue;const L=qn(A,r);if(L>a)continue;const H=g(M);if(H>v)continue;const V=H<v&&L===0;if(!V&&kn(A,r)>s)continue;const G=c(M),ie=y(M);if(!V&&!(ie&&!h)&&G>=l)continue;const q=ie?0:1,Te=b(M);(!E||H<E.out||H===E.out&&(q<E.lane||q===E.lane&&(L<E.opp||L===E.opp&&(G<E.sc||G===E.sc&&(B<E.cost||B===E.cost&&Te<E.len)))))&&(E={pts:M,out:H,sc:G,lane:q,opp:L,cost:B,len:Te})}return(E==null?void 0:E.pts)??null}function sT(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}const cT=1;function Yy(e,t,n){if(t.type!=="bpmn:SequenceFlow"||e.length<3||!t.source)return null;const i=n.shapes.find(l=>l.id===t.source);if(!i||!i.type.endsWith("Gateway"))return null;const[o,r]=e,a=(l,u)=>Math.abs(l-u)<=cT,s=a(o.y,r.y)&&!a(o.x,r.x),c=a(o.x,r.x)&&!a(o.y,r.y);if(!s&&!c)return null;for(const l of n.edges){if(l.id===t.id||l.type!=="bpmn:SequenceFlow"||l.source!==t.source||l.waypoints.length!==2)continue;const[u,p]=l.waypoints;if(!(!a(u.x,o.x)||!a(u.y,o.y))&&(s&&a(u.y,p.y)&&Math.sign(p.x-u.x)===Math.sign(r.x-o.x)||c&&a(u.x,p.x)&&Math.sign(p.y-u.y)===Math.sign(r.y-o.y)))return l.id}return null}function lT(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o).edges.filter(s=>(!t.has(s.id)||n.has(s.id))&&s.waypoints.length>=4).map(s=>s.id).sort();for(const s of a){const c=Ge(o),l=c.edges.find(g=>g.id===s);if(!l||l.waypoints.length<4)continue;const u=hn(c),p=c.edges.filter(g=>g.id!==s),d=Pt(l,u).length,f=qn(l,p),y=kn(l,p),h=n.has(s)?new Set(dt(c).map(ct)):null;if(l.waypoints.length>4){const g=o.get(s),v=g?Oy(c,l,u,l.waypoints,Ms(g),i):null;if(g&&v&&v.length<l.waypoints.length){r.updateWaypoints(g,v);continue}}const m=ul(l,c.shapes);m.length===2&&sT(l,c)&&m.reverse();const w=[...m.filter(g=>!Yy(g,l,c)),...m.filter(g=>Yy(g,l,c))];for(const g of w){if(g.length>=l.waypoints.length)continue;const v={...l,waypoints:g};if(Pt(v,u).length>d||qn(v,p)>f||kn(v,p)>y)continue;if(h){const E=new Set(dt({...c,edges:c.edges.map(A=>A.id===s?v:A)}).map(ct)),M=[...E].filter(A=>!h.has(A)).length,B=[...h].filter(A=>!E.has(A)).length;if(M>B)continue}const b=o.get(s);b&&r.updateWaypoints(b,g);break}}}function Ky(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=qy(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Id(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=He(n[0].x,n[1].x)&&!He(n[0].y,n[1].y),s=He(n[n.length-1].x,n[n.length-2].x)&&!He(n[n.length-1].y,n[n.length-2].y);for(const c of Ki){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 Xy=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function uT(e,t,n){const i=e.waypoints;if(i.length<2||!Xy(e.type))return[];const o=i[0],r=i[1],a=He(o.y,r.y)&&!He(o.x,r.x),s=He(o.x,r.x)&&!He(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(y=>{if(!Xy(y.type)||y.type===e.type||y.waypoints.length<2)return!1;const h=y.waypoints[0],m=y.waypoints[1];return!He(h.x,o.x)||!He(h.y,o.y)?!1:a?He(h.y,m.y)&&Math.sign(m.x-h.x)===c:He(h.x,m.x)&&Math.sign(m.y-h.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(y,h)=>a?h>y.y+5&&h<y.y+y.height-5:h>y.x+5&&h<y.x+y.width-5,f=[];for(const y of Ki){const h=(a?o.y:o.x)+y;if(!d(u,h)||i.length===2&&(!p||!d(p,h)))continue;const m=i.map(w=>({...w}));for(const w of[m[0],m[1]])a?w.y=h:w.x=h;f.push({pts:m,cost:Math.abs(y)})}return f}function pT(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,y=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const w of[0,...Ki])Math.abs(w)<i.width/2-5&&m.push({pts:[{x:d,y:l},{x:u+w,y:l},{x:u+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&m.push({pts:[{x:c,y:f},{x:c,y:p+w},{x:y,y:p+w}],cost:Math.abs(w)});return m}const dT=[[1/2,0],[1/3,25],[2/3,25]],Zy=20;function fT(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 dT){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+Zy<=i.x&&s(n.x+n.width,i.x),i.x+i.width+Zy<=n.x&&s(n.x,i.x+i.width),a}const hT=1e3;function Bd(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=[],d=[n,i].filter(m=>/Gateway$/.test(m.type)),f=d.length?d[0].x+d[0].width/2:void 0,y=f!==void 0&&d.every(m=>Math.abs(m.x+m.width/2-f)<=.5)&&f>o&&f<r;y&&p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:0});const h=d.length?hT:0;for(const m of[0,...Ki]){const w=u+m;w<=o||w>=r||y&&Math.abs(w-f)<.5||p.push({pts:[{x:w,y:c},{x:w,y:l}],cost:Math.abs(m)+h})}return p}const Nd=2,gT=3;function Jy(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,Po(e[a-1],e[a],i));if(o>Nd)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=>Fd(a,e)<=Nd);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)<=gT)&&Fd(c,e)<=Nd))return!0}}return!1}function Qy(e,t,n={}){const i=new Map(t.shapes.map(y=>[y.id,y])),o=hn(t),r=t.edges.filter(y=>y.id!==e.id),a=qn(e,r);if(a===0)return null;const s=kn(e,r);let c;const l=y=>y.reduce((h,m,w)=>w?h+Math.abs(m.x-y[w-1].x)+Math.abs(m.y-y[w-1].y):0,0),u=3,p=y=>{const h=y[0],m=y[y.length-1],w=Math.hypot(m.x-h.x,m.y-h.y);return w>=1&&l(y)/w>=u?1:0},d=p(e.waypoints),f=[...gl(e,i),...Bd(e,i),...Id(e,i),...uT(e,r,i),...n.sideEntry?fT(e,i):[]];for(const{pts:y,cost:h}of f){const m={...e,waypoints:y};if(Pt(m,o).length>0||Jy(y,e,t))continue;const w=qn(m,r),g=kn(m,r),v=a-w+(d-p(y));if(w>=a||g-s>v)continue;const b=l(y);(!c||w<c.opposite||w===c.opposite&&(g<c.cross||g===c.cross&&(h<c.cost||h===c.cost&&b<c.len)))&&(c={pts:y,opposite:w,cross:g,cost:h,len:b})}return(c==null?void 0:c.pts)??null}function ev(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=ir(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function mT(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=hn(t),o=t.edges.filter(d=>d.id!==e.id),r=ev(e,o);if(r===0)return null;const a=qn(e,o),s=kn(e,o),c=d=>d.reduce((f,y,h)=>h?f+Math.abs(y.x-d[h-1].x)+Math.abs(y.y-d[h-1].y):0,0),l=2;let u;const p=[...gl(e,n),...Bd(e,n),...pT(e,n),...Id(e,n)];for(const{pts:d,cost:f}of p){const y={...e,waypoints:d};if(Pt(y,i).length>0)continue;const h=ev(y,o);if(h>=r)continue;const m=qn(y,o);if(m-h>a-r)continue;const w=kn(y,o);if(w-s>(r-h)*l)continue;const g=c(d);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(f<u.cost||f===u.cost&&g<u.length))))&&(u={pts:d,fake:h,unreadable:m,cross:w,cost:f,length:g})}return(u==null?void 0:u.pts)??null}function tv(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=dt(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=mT(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function nv(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 iv(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=ir(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:nv(e,n)&&nv(t,n)}function ov(e,t,n){let i=0;for(const o of t)o.id!==e.id&&iv(e,o,n)&&i++;return i}function yT(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=hn(t),o=t.edges.filter(d=>d.id!==e.id),r=ov(e,o,n);if(r===0)return null;const a=qn(e,o),s=kn(e,o),c=d=>d.reduce((f,y,h)=>h?f+Math.abs(y.x-d[h-1].x)+Math.abs(y.y-d[h-1].y):0,0),l=2;let u;const p=[...gl(e,n),...Bd(e,n),...Id(e,n)];for(const{pts:d,cost:f}of p){const y={...e,waypoints:d};if(Pt(y,i).length>0)continue;const h=ov(y,o,n);if(h>=r)continue;const m=qn(y,o);if(m-h>a-r)continue;const w=kn(y,o);if(w-s>(r-h)*l)continue;const g=c(d);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(w<u.cross||w===u.cross&&(f<u.cost||f===u.cost&&g<u.length))))&&(u={pts:d,chain:h,unreadable:m,cross:w,cost:f,length:g})}return(u==null?void 0:u.pts)??null}function vT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=dt(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||!iv(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(y=>y.id===l);if(!p)continue;const d=yT(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function rv(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=Ge(o),c=dt(s).filter(d=>vd(d)&&!t.has(ct(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(vd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(y=>y.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const y=u(d)==="bpmn:SequenceFlow"?0:1,h=u(f)==="bpmn:SequenceFlow"?0:1;return y!==h?y-h:d.localeCompare(f)});for(const d of p){const f=Ge(o),y=f.edges.find(w=>w.id===d);if(!y)continue;const h=Qy(y,f,{sideEntry:i.has(d)});if(!h)continue;const m=o.get(d);m&&(r.updateWaypoints(m,h),a.add(d))}return a}const xT=20;function bT(e,t){var l;const{elementRegistry:n}=e,i=e.modeling,o=new Set;let r=Ge(n),a=new Set(dt(r).map(ct));const s=new Map(r.shapes.map(u=>[u.id,u])),c=r.edges.filter(u=>u.type==="bpmn:MessageFlow"&&u.waypoints.length===2&&u.endpoints.length===2).map(u=>u.id);for(let u=0;u<c.length;u++)for(let p=u+1;p<c.length;p++){const d=r.edges.find(se=>se.id===c[u]),f=r.edges.find(se=>se.id===c[p]);if(d.endpoints[0]!==f.endpoints[1]||d.endpoints[1]!==f.endpoints[0]||t.has(d.id)&&t.has(f.id)||((l=ir(d,f))==null?void 0:l.kind)!=="opposite")continue;const y=d.endpoints.map(se=>s.get(se)).filter(se=>!!se);if(y.length!==2)continue;const[h,m]=d.waypoints,w=He(h.x,m.x),g=y.filter(se=>se.type!=="bpmn:Participant"),v=[...g.length?g:y].sort((se,Ae)=>w?se.y-Ae.y:se.x-Ae.x)[0],b=d.endpoints[0]===v.id?d:f,E=b===d?f:d,M=w?h.x:h.y,B=se=>y.every(Ae=>w?se>Ae.x+5&&se<Ae.x+Ae.width-5:se>Ae.y+5&&se<Ae.y+Ae.height-5),A=n.get(b.id),L=n.get(E.id);if(!A||!L)continue;const H=!t.has(b.id),V=!t.has(E.id),G=hn(r),ie=new Set([b,E].flatMap(se=>Pt(se,G).map(Ae=>Ae.id))),pe=new Set(Si(r).map(([se,Ae])=>`${se}|${Ae}`)),q=(se,Ae,j)=>{if(!Ae)return se;const C=M+Ae,R=se.waypoints.map(ge=>w?{x:C,y:ge.y}:{x:ge.x,y:C});if(!se.label)return{...se,waypoints:R};const Z=se.label,ne=w?{...Z,x:j<0?C-gn-Z.width:C+gn}:{...Z,y:j<0?C-gn-Z.height:C+gn};return{...se,waypoints:R,label:ne}},Te=xT,Pe=H?V?-Te:-2*Te:0,ke=V?H?Te:2*Te:0;if(Pe&&!B(M+Pe)||ke&&!B(M+ke))continue;const ve=q(b,Pe,-1),U=q(E,ke,1);if([ve,U].some(se=>Pt(se,G).some(Ae=>!ie.has(Ae.id))))continue;const de={...r,edges:r.edges.map(se=>se.id===b.id?ve:se.id===E.id?U:se)};if(Si(de).some(([se,Ae])=>!pe.has(`${se}|${Ae}`)))continue;const z=dt(de),Q=new Set([Pe?b.id:"",ke?E.id:""].filter(Boolean)),he=se=>/^(L|ls|l)\|/.test(se)&&Q.has(se.split("|")[1]);if(!z.some(se=>!a.has(ct(se))&&!he(ct(se)))){for(const[se,Ae,j]of[[A,b,ve],[L,E,U]])j!==Ae&&(i.updateWaypoints(se,j.waypoints.map(C=>({...C}))),se.label&&j.label&&i.moveElements([se.label],{x:j.label.x-se.label.x,y:j.label.y-se.label.y}),o.add(se.id));r=de,a=new Set(z.map(ct))}}return o}const wT=10,_T=(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 av(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ma(e,i))return null;const o=hn(t),r=i.flatMap(fn);for(const a of fn(e)){let s=[[a.lo,a.hi]];for(const[f,y]of cl(a,r))s=s.flatMap(([h,m])=>{const w=[];return f>h&&w.push([h,Math.min(m,f)]),y<m&&w.push([Math.max(h,y),m]),w.filter(([g,v])=>v>g)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,y])=>y-f>=c+wT*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-dy}:{x:a.at+gn+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(!Ma({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&_T(d,f)))return d}return null}const gn=8;function $d(e,t){const n=e.label;if(!n)return null;const i=fn(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,y=d.axis==="h"?r-d.at:o-d.at,h=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(y,h)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(fn),...t.shapes.filter(d=>d.container).flatMap(Aa)],l=d=>!c.some(f=>Ui(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+gn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+gn,s.at-gn-n.width])for(const f of p){const y=n.y+f;if(y<s.lo||y+n.height>s.hi)continue;const h={...n,x:d,y};if(l(h))return h}else for(const d of[s.at-gn-n.height,s.at+gn])for(const f of p){const y=n.x+f;if(y<s.lo||y+n.width>s.hi)continue;const h={...n,x:y,y:d};if(l(h))return h}return null}const sv=30,Fd=(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},cv=(e,t)=>Fd({x:e.x+e.width/2,y:e.y+e.height/2},t);function lv(e,t){const n=e.label;if(!n)return null;const i=fn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(fn),...t.shapes.filter(c=>c.container).flatMap(Aa)],r=or(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=>Ui(c,l))&&!Pa(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+gn,c.at-gn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+gn,c.at-gn-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 uv(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=Ge(i),a=new Set(dt(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 y=d.waypoints[0].x-p[0].x,h=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((B,A)=>B.x-p[A].x===y&&B.y-p[A].y===h))){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(G=>G.id===l);if(!(B!=null&&B.label)||!Pa(B.label,r).length&&!n.has(l))continue;let A={...B.label,x:u.label.x,y:u.label.y};if((Pa(A,r).length||cv(A,B.waypoints)>sv)&&(A=null),!A&&cv(B.label,B.waypoints)>sv&&(A=lv(B,r)),!A)continue;const L=A;if(L.x===f.x&&L.y===f.y)continue;const H={...r,edges:r.edges.map(G=>G.id===l?{...G,label:L}:G)},V=dt(H);if(V.some(G=>!a.has(ct(G))))continue;o.moveElements([f],{x:L.x-f.x,y:L.y-f.y}),r=H,a=new Set(V.map(ct));continue}const w=u.label.x+y-f.x,g=u.label.y+h-f.y;if(w===0&&g===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+w,y:v.label.y+g},E={...r,edges:r.edges.map(B=>B.id===l?{...B,label:b}:B)},M=dt(E);M.some(B=>!a.has(ct(B)))||(o.moveElements([f],{x:w,y:g}),r=E,a=new Set(M.map(ct)))}}function pv(e,t,n=new Set,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o);for(const s of a.edges){if(!s.label||t.has(s.id)&&!n.has(s.id))continue;const c=$d(s,a),l=i.has(s.id)&&Pa(c??s.label,a).length?lv(s,a)??c:c;if(!l)continue;const u=o.get(s.id),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function dv(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=dt(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=av(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 jd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(d=>d.container).flatMap(Aa)],o=i.filter(d=>Ui(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=or(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=>Ui(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-gn-n.height},{...n,y:d.at+gn}):l.push({...n,x:d.at-gn-n.width},{...n,x:d.at+gn});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+gn},{...n,x:u-n.width/2,y:e.y-gn-n.height},{...n,x:e.x+e.width+gn,y:p-n.height/2},{...n,x:e.x-gn-n.width,y:p-n.height/2}),l.find(c)??null}function fv(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=jd(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 ET(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 hv(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(dt(o).map(ct));const a=[...new Set(dt(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,m]of u){const w=h?o.shapes.find(v=>v.id===h):void 0;if(!w)continue;const g=ET(w,l[m]);g.x===l[m].x&&g.y===l[m].y||(l[m]=g,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},f=dt(d);if(f.some(h=>!r.has(ct(h))))continue;const y=n.get(s);y&&(i.updateWaypoints(y,l),o=d,r=new Set(f.map(ct)))}}const Hd=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function gv(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 ST(e,t,n){const i=[],o=n?xs(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 gv(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(!Hd(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,y]of Object.entries(u))typeof y!="string"||y===""?(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 Mi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function RT(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(Hd(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=gv(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=Mi(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,y)=>Mi(f,"name",a(p[y])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=Mi(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,y)=>Mi(f,"name",a(p[y])))),s.push(d);break}case"node.add":s.push({...c,node:Mi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:Mi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:Mi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:Mi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:Mi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:Mi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(Mi(c,"text",a(l[0])));break;default:s.push(Hd(l[0].map)?Mi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const MT=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,mv=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),yv={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"translation.confirm":[{path:"id",shape:null},{path:"locale",shape:null}],"element.remove":[{path:"id",shape:null}]},As=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),yl=e=>typeof e=="string"&&e!=="";function CT(e){const t=[];function n(i,o,r,a){if(a===null){yl(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!As(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)yl(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!As(i)||!yl(i.kind)||!(i.kind in yv)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of yv[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const y of p.slice(0,-1)){if(!As(d))break;d=d[y]}if(!As(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((y,h)=>n(o,`${u}[${h}]`,y,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;As(c)&&!yl(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"&&!Mm(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&&!Cm(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 vv(e,t,n={}){const i=CT(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,w){if(!MT.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{...w,opIndex:h})}e.forEach((h,m)=>{var w;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(g=>g.id)});for(const g of h.participant.lanes??[])s(m,g.id,{category:"lane"});break;case"node.add":s(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(m,h.dataStore.id,{category:"dataStore"});for(const g of h.associations??[])g.id&&s(m,g.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(w=h.association)!=null&&w.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(g=>g.id));for(const g of h.lanes)t.categoryOf(g.id)===void 0&&s(m,g.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,w,g){const v=c(m);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:w});return}if(g&&!g.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:m,role:w,expected:g.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),d=new Map;for(const h of e)h.kind==="node.add"?d.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&d.set(h.id,h.eventDefinition);const f=h=>d.has(h)?d.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,m)=>{var w,g;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=h.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,v,"participant",["participant"])===void 0)break;b!==void 0&&((((w=r.get(v))==null?void 0:w.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:m,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:E,name:M,condition:B}=h.flow,A=u(m,b,"source",["flowNode"]),L=u(m,E,"target",["flowNode"]);A&&L&&l(b)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:m,id:v}),M!==void 0&&B!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:E}=h.flow,M=u(m,b,"source",["flowNode","participant"]),B=u(m,E,"target",["flowNode","participant"]);if(M&&B){const A=l(b),L=l(E);A!==void 0&&A===L&&o.push({kind:"message-flow-same-pool",opIndex:m,id:v})}for(const A of[b,E])f(A)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:v,ref:A});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(M=>M===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:v.source,target:v.target});continue}const E=v.source===h.dataStore.id?v.target:v.source;u(m,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=h.association,E=u(m,v,"source"),M=u(m,b,"target");if(E&&M){const B=new Set([E,M]);B.has("dataStore")&&B.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:E}=h.association,M=u(m,b,"source"),B=u(m,E,"target");M&&B&&M!=="annotation"&&B!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:v??`${b}->${E}`});break}case"annotation.add":{if(h.association){const{source:v,target:b}=h.association;if(v!==h.annotation.id&&b!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const E=v===h.annotation.id?b:v;u(m,E,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const b=u(m,v,"member");b&&mv.has(b)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(y(m,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),b=h.lanes.map(A=>A.id);for(const A of v)b.includes(A)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:A});for(const A of b)t.categoryOf(A)!==void 0&&!v.includes(A)&&o.push({kind:"id-duplicate",opIndex:m,id:A});const E=b.filter(A=>v.includes(A)),M=A=>E.every((L,H)=>L===A[H]),B=(((g=t.laneDeclarationOrderOf)==null?void 0:g.call(t,h.id))??v).filter(A=>v.includes(A));E.length===v.length&&!M(v)&&!M(B)&&o.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(y(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(y(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,b=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),M=h.source??(E==null?void 0:E.source),B=h.target??(E==null?void 0:E.target);v&&b&&M!==void 0&&B!==void 0&&new Set([l(M),l(B),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":y(m,h.id,"messageFlow");break;case"dataStore.update":y(m,h.id,"dataStore");break;case"annotation.update":{if(y(m,h.id,"annotation")===void 0)break;h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.update":{if(y(m,h.id,"group")===void 0)break;for(const v of h.members??[]){const b=u(m,v,"member");b&&mv.has(b)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":y(m,h.id);break;case"element.remove":{y(m,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...ST(e,t,n.i18n)),o;function y(h,m,w){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const g=t.categoryOf(m);if(g===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(w&&g!==w){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:w,actual:g});return}return g}}const Gd=12,xv=14,AT=15,TT=100,PT=300,kT=30,OT=/[㐀-鿿]/,DT=1.1;function bv(e){let t=0;for(const n of e)OT.test(n)?t+=Gd:qC(n)?t+=Vr(n,Gd):t+=Vr(n,Gd)*DT;return t}const wv="­";function LT(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===wv)&&i.pop();break}return i[i.length-1]===wv&&(i[i.length-1]="-"),i.join("")}function IT(e,t,n){const i=Math.max(e.length*(n/t),1);return LT(e,i)||e.slice(0,Math.max(Math.round(i-1),1))}const _v=(e,t)=>e?t(e.replace(/\s+$/,"")):0;function BT(e,t,n=bv){const i=e.split(/­?\r?\n/),o=[];for(;i.length;){const r=i.shift();let a=r;for(;;){const s=_v(a,n);if(a===" "||a===""||s<Math.round(t)||a.length<2)break;a=IT(a,s,t)}a.length<r.length&&i.unshift(r.slice(a.length).trim()),o.push(a)}return o}function Ev(e){const t=e.length?e:[""],n=Math.max(0,...t.flatMap(r=>r.split(/­?\r?\n/).map(a=>_v(a,bv)))),i=Math.max(TT,Math.min(PT,Math.floor(n)+1+xv)),o=Math.max(...t.map(r=>BT(r,i-xv).length));return{width:i,height:Math.max(kT,o*AT+10)}}const Sv="bwlExactAnnotationBounds",NT=500;class Rv{constructor(t){t.on("commandStack.shape.resize.preExecute",NT,({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})})}}on(Rv,"$inject",["eventBus"]);const Mv={__init__:["annotationExactResize"],annotationExactResize:["type",Rv]};function Cv(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 vl(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const xl={"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]},Xi=10,$T=300,FT=160,Av=20,zd=100,Tv=40,jT=10,HT=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Pv(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 bl=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function wl(e,t,n,i,o){const r=n,a=Pv(e,t,i),s=a??i,c=(ie,pe,q=s)=>{const[Te,Pe]=xl[ie];let ke={x:t.x+t.width/2+Te*(t.width/2+r.width/2+pe),y:t.y+t.height/2+Pe*(t.height/2+r.height/2+pe)};const ve=q.x+Xi+r.width/2,U=q.x+q.width-Xi-r.width/2,de=q.y+Xi+r.height/2,z=q.y+q.height-Xi-r.height/2,Q={x:Math.min(U,Math.max(ve,ke.x)),y:Math.min(z,Math.max(de,ke.y))};return(Q.x!==ke.x||Q.y!==ke.y)&&(ke=Math.abs(Q.x-(t.x+t.width/2))<(t.width+r.width)/2+Xi&&Math.abs(Q.y-(t.y+t.height/2))<(t.height+r.height)/2+Xi?{x:t.x+t.width+Xi+r.width/2,y:Q.y}:Q),ke},l=(i.children??[]).filter(ie=>!("waypoints"in ie&&ie.waypoints)&&ie.type!=="bpmn:Lane"&&ie.type!=="label"&&typeof ie.x=="number"&&ie.id!==o.selfId),u=Ge(e),p=ie=>{var q,Te;if(!o.selfId)return!1;const pe=e.get(ie);return!!pe&&(((q=pe.source)==null?void 0:q.id)===o.selfId||((Te=pe.target)==null?void 0:Te.id)===o.selfId)},d=u.edges.filter(ie=>!p(ie.id)).flatMap(fn),f=or(u).filter(ie=>ie.owner!==o.selfId).map(ie=>ie.rect),y=ie=>({x0:ie.x-r.width/2-Xi,x1:ie.x+r.width/2+Xi,y0:ie.y-r.height/2-Xi,y1:ie.y+r.height/2+Xi}),h=ie=>{const pe=y(ie);return l.some(q=>pe.x0<q.x+q.width&&pe.x1>q.x&&pe.y0<q.y+q.height&&pe.y1>q.y)},m=ie=>{const pe=y(ie);return d.some(q=>q.axis==="h"?q.at>pe.y0&&q.at<pe.y1&&q.lo<pe.x1&&q.hi>pe.x0:q.at>pe.x0&&q.at<pe.x1&&q.lo<pe.y1&&q.hi>pe.y0)},w=ie=>{const pe=y(ie);return f.some(q=>pe.x0<q.x+q.width&&pe.x1>q.x&&pe.y0<q.y+q.height&&pe.y1>q.y)},g=u.shapes.filter(ie=>ie.type==="bpmn:Group").flatMap(ie=>[{axis:"h",at:ie.y,lo:ie.x,hi:ie.x+ie.width},{axis:"h",at:ie.y+ie.height,lo:ie.x,hi:ie.x+ie.width},{axis:"v",at:ie.x,lo:ie.y,hi:ie.y+ie.height},{axis:"v",at:ie.x+ie.width,lo:ie.y,hi:ie.y+ie.height}]),v=ie=>{const pe=y(ie);return g.some(q=>q.axis==="h"?q.at>pe.y0&&q.at<pe.y1&&q.lo<pe.x1&&q.hi>pe.x0:q.at>pe.x0&&q.at<pe.x1&&q.lo<pe.y1&&q.hi>pe.y0)},b=ie=>h(ie)||m(ie)||w(ie)||v(ie),E=ie=>ie.x-r.width/2>=i.x&&ie.x+r.width/2<=i.x+i.width&&ie.y-r.height/2>=i.y&&ie.y+r.height/2<=i.y+i.height,M=ie=>E(ie)&&(!a||bl(ie,r,a)),B=ie=>ie.startsWith("top")?ie.replace(/^top/,"bottom"):ie.replace(/^bottom/,"top"),A=ie=>ie.endsWith("left")?ie.replace(/left$/,"right"):ie.replace(/right$/,"left"),L=o.placement.side,H=[L,B(L),A(L),B(A(L)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],V=o.placement.offset??50;let G=c(L,V);if(b(G)||a&&!bl(G,r,a)){const ie=(pe,q)=>{const Te=new Set;for(const Pe of H){if(Te.has(Pe))continue;Te.add(Pe);const ke=c(Pe,V,pe);if(q(ke)&&!b(ke))return G=ke,!0}return!1};!ie(s,M)&&a&&ie(i,E)}return G}function Vt(e,t){return e.filter(n=>n.kind===t)}function kv(e,t){const n=new Map,i=new Set(Vt(e,"node.add").map(s=>s.node.id)),o=Vt(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&&Vt(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 GT(e,t,n){const i=new Map,o=new Set;for(const g of e){const v=i.get(g.source)??[];v.push(g.target),i.set(g.source,v),o.add(g.target)}const r=[...e.map(g=>g.source).filter(g=>!o.has(g)),...t,...e.map(g=>g.source)],a=new Map,s=new Set,c=g=>{a.set(g,"open");for(const v of i.get(g)??[]){const b=a.get(v);b==="open"?s.add(`${g}>${v}`):b||c(v)}a.set(g,"done")};for(const g of r)a.has(g)||c(g);const l=(g,v)=>!s.has(`${g}>${v}`),u=[],p=new Set,d=g=>{p.add(g);for(const v of i.get(g)??[])l(g,v)&&!p.has(v)&&d(v);u.push(g)};for(const g of r)p.has(g)||d(g);const f=new Map;for(const g of u.reverse()){const v=f.get(g)??0;f.set(g,v);for(const b of i.get(g)??[])l(g,b)&&(f.get(b)??-1)<v+1&&f.set(b,v+1)}const y=new Map;for(const g of e){if(!l(g.source,g.target)||!n(g.target))continue;const v=y.get(g.target)??[];v.includes(g.source)||v.push(g.source),y.set(g.target,v)}const h=new Map,m=(g,v)=>{let b=h.get(g);if(!b){b=new Set([g]);const E=[g];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))}h.set(g,b)}return b.has(v)},w=new Set;for(const g of e){const v=y.get(g.target);if(!v||v.length<2||!v.includes(g.source))continue;const b=f.get(g.source)??0;v.some(E=>E!==g.source&&(f.get(E)??0)>=b+2&&m(g.source,E))&&w.add(g.id)}return w}class Ov extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const Dv=new WeakMap;function zT(e){return Dv.get(e)??new Set}const Lv=new WeakMap;function VT(e,t){Lv.set(e,t)}const Iv=new WeakMap;function WT(e){return Iv.get(e)??[]}const Bv=new WeakMap;function UT(e){return Bv.get(e)??new Set}const Nv=new WeakMap;function qT(e){return Nv.get(e)??new Set}function $v(e,t){var gR,mR,yR,vR,xR,bR,wR,_R,ER,SR,RR,MR,CR,AR,TR,PR,kR,OR,DR,LR,IR,BR,NR,$R,FR,jR,HR,GR,zR,VR,WR,UR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;Dv.set(t,u);const p=[];Iv.set(t,p);const d=new Set;Bv.set(t,d);const f=new Set;Nv.set(t,f);const y=()=>a.getRootElement(),h=x=>r.get(x),m=x=>{const _=h(x);if(!_)throw new Error(`하강 참조 해소 실패: ${x}`);return _},w=x=>{let _=x.parent;for(;_;){if(_.type==="bpmn:Participant")return _;_=_.parent}},g=(x,_)=>{if(!x)return;const S=_.x+_.width/2,k=_.y+_.height/2;let I;const P=$=>{for(const D of $.children??[])if(D.type==="bpmn:Lane"){const O=D;S>=O.x&&S<=O.x+O.width&&k>=O.y&&k<=O.y+O.height&&(I=O,P(O))}};return P(x),I},v=new Map;for(const x of r.filter(_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number"))v.set(x.id,{x:x.x,y:x.y});const b=Vt(e,"participant.add"),E=Vt(e,"node.add"),M=Vt(e,"sequenceFlow.add"),B=Vt(e,"messageFlow.add"),A=Vt(e,"dataStore.add"),L=Vt(e,"dataAssociation.add"),H=Vt(e,"annotation.add"),V=Vt(e,"group.add"),G=new Map(E.map(x=>[x.node.id,x])),ie=kv(e,x=>{var _,S;return(S=(_=h(x))==null?void 0:_.source)==null?void 0:S.id}),pe=new Set([...ie.values()].map(x=>x.flow.id)),q=M.filter(x=>!pe.has(x.flow.id)),Te=new Set([...ie.values()].map(x=>x.flow.target)),Pe=x=>Vt(e,"sequenceFlow.update").filter(_=>_.target===x).length+(Te.has(x)?1:0),ke=(x,_,S)=>{var D;const k=x.businessObject,I=(((D=k.extensionElements)==null?void 0:D.values)??[]).filter(O=>O.$type!==_),P=S?[...I,i.create(_,S)]:I;if(!P.length){k.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const $=i.create("bpmn:ExtensionElements",{values:P});P.forEach(O=>{O.$parent=$}),n.updateProperties(x,{extensionElements:$})},ve=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Vt(e,"element.remove")){const _=h(x.id);if(!_)continue;const S="waypoints"in _?[]:[..._.incoming??[],..._.outgoing??[]];n.removeElements([...S,_])}const U=x=>r.filter(_=>{var S;return _.type==="bpmn:Lane"&&((S=w(_))==null?void 0:S.id)===x}).sort((_,S)=>_.y-S.y),de=[];for(const x of Vt(e,"participant.update")){const _=m(x.id);if(x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),!x.lanes)continue;const S=U(x.id);if(!S.length){n.splitLane(_,x.lanes.length),U(x.id).forEach((P,$)=>{const D=x.lanes[$];D&&n.updateProperties(P,{id:D.id,name:D.name})}),de.push({pool:x.id,lanes:new Set(x.lanes.map(P=>P.id))});continue}const k=new Set(S.map(P=>P.id)),I=x.lanes.reduce((P,$,D)=>k.has($.id)?D:P,-1);x.lanes.forEach((P,$)=>{if(k.has(P.id)){n.updateProperties(m(P.id),{name:P.name});return}const D=$===I+1&&I>=0,O=$===0?n.addLane(U(x.id)[0],"top"):D?n.addLane(U(x.id).at(-1),"bottom"):n.addLane(m(x.lanes[$-1].id),"bottom");n.updateProperties(O,{id:P.id,name:P.name})})}const z=150,Q=130,he=80,se=90,Ae=180,j=30,C=30,R=10,Z=300,ne=5,ge=(x,_,S,k,I)=>{const P=S-_.width/2,$=k-_.height/2;return(x.children??[]).find(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="bpmn:Lane"&&D.type!=="label"&&!(I!=null&&I.has(D.id))&&typeof D.x=="number"&&P<D.x+D.width+C&&P+_.width+C>D.x&&$<D.y+D.height&&$+_.height>D.y)},$e=new Set;for(const x of b){$e.add(`pool:${x.participant.id}`);for(const _ of x.participant.lanes??[])$e.add(_.id)}const rt=new Map;for(const x of E){const _=x.node.lane??`pool:${x.node.participant??""}`;let S=rt.get(_);S||rt.set(_,S=new Set([0])),x.band!==void 0&&S.add(x.band)}const ut=new Map;for(const[x,_]of rt){if(!$e.has(x))continue;const S=[..._].sort((P,$)=>P-$),k=S.map((P,$)=>$===0?0:$%2===1?Math.ceil($/2):-($/2)),I=Math.min(...k);ut.set(x,new Map(S.map((P,$)=>[P,k[$]-I])))}{const x=new Map;for(const _ of b)(_.participant.lanes??[]).forEach((S,k)=>x.set(S.id,k));for(const[_,S]of ut){if(!x.has(_)||S.size<2)continue;const k=x.get(_),I=S.get(0)??0,P=new Set;for(const Y of E){if(Y.node.lane!==_||(Y.band??0)!==0||!Y.node.type.endsWith("Gateway"))continue;const re={in:new Set,out:new Set,cross:new Set};for(const J of q){const ee=J.flow.source===Y.node.id;if(!ee&&J.flow.target!==Y.node.id)continue;const ue=G.get(ee?J.flow.target:J.flow.source);if(!ue||ue.node.participant!==Y.node.participant||!ue.node.lane)continue;let ae,X=!1;if(ue.node.lane!==_){const fe=x.get(ue.node.lane);if(fe===void 0)continue;ae=fe>k?"down":"up",X=!0}else{const fe=S.get(ue.band??0)??I;ae=fe>I?"down":fe<I?"up":void 0}ae&&(re[ee?"out":"in"].add(ae),X&&re.cross.add(ae))}for(const J of["up","down"])re.in.has(J)&&re.out.has(J)&&re.cross.has(J)&&P.add(J)}if(P.size!==1)continue;const[$]=P,D=Math.max(...S.values()),O=$==="down"?D:0;if(I===O)continue;const F=[...S.entries()].filter(([Y])=>Y!==0).sort((Y,re)=>Y[1]-re[1]),N=[...Array(D+1).keys()].filter(Y=>Y!==O),W=new Map([[0,O]]);F.forEach(([Y],re)=>W.set(Y,N[re])),ut.set(_,W)}}const pn=x=>{var _;return(((_=rt.get(x))==null?void 0:_.size)??0)>1},bt=x=>x.band??(x.node.lane||!pn(`pool:${x.node.participant??""}`)?void 0:0),qt=new Map,Kt=x=>qt.get(x.node.id)??bt(x),Ln=new Set,Bt=new Set,sn=new Set,zn=new Set,pa=new Set,oi=x=>H.some(_=>{var S,k;return(((S=_.placement)==null?void 0:S.anchor)??(_.association?_.association.source===_.annotation.id?_.association.target:_.association.source:void 0))===x&&((k=_.placement)==null?void 0:k.side.startsWith("bottom"))});{const x=new Map;for(const k of q)x.set(k.flow.target,(x.get(k.flow.target)??0)+1);const _=k=>{const I=[],P=new Set([k]),$=[k];for(;$.length;){const D=$.shift();I.push(D);for(const O of q)O.flow.source!==D||P.has(O.flow.target)||(x.get(O.flow.target)??0)!==1||(P.add(O.flow.target),$.push(O.flow.target))}return I},S=(k,I)=>{var P;return((P=ut.get(k))==null?void 0:P.get(I))??I};for(const k of E){if(!k.node.type.endsWith("Gateway"))continue;const I=k.node.lane??`pool:${k.node.participant??""}`,P=ut.get(I);if(!P||P.size<2)continue;const $=Kt(k);if($===void 0||S(I,$)!==S(I,0))continue;const D=S(I,$),O=q.filter(J=>J.flow.source===k.node.id).map(J=>G.get(J.flow.target)).filter(J=>!!J&&(J.node.lane??`pool:${J.node.participant??""}`)===I),F=O.filter(J=>{const ee=Kt(J);return ee!==void 0&&S(I,ee)===D&&(x.get(J.node.id)??0)===1}),N=O.some(J=>{const ee=Kt(J);return ee!==void 0&&S(I,ee)>D});if(F.length!==1||!N)continue;const W=new Set(O.flatMap(J=>_(J.node.id)));if(!q.some(J=>J.flow.target===k.node.id&&W.has(J.flow.source)))continue;const re=new Map;for(const[J,ee]of P)re.set(J,ee+1);re.set(-1,0),ut.set(I,re);for(const J of _(F[0].node.id))G.has(J)&&(qt.set(J,-1),Bt.add(J));Ln.add(k.node.id)}}{const x=N=>N.node.lane??`pool:${N.node.participant??""}`,_=N=>Kt(N)??0,S=new Map(b.map((N,W)=>({id:N.participant.id,order:N.order??Number.POSITIVE_INFINITY,declared:W})).sort((N,W)=>N.order!==W.order?N.order-W.order:N.declared-W.declared).map((N,W)=>[N.id,W])),k=N=>N===void 0?void 0:S.get(N)??-1,I=N=>{var re;const W=G.get(N);if(W)return W.node.participant;if(S.has(N))return N;const Y=h(N);if(Y)return Y.type==="bpmn:Participant"?Y.id:(re=w(Y))==null?void 0:re.id},P=new Map;for(const N of q)P.set(N.flow.target,(P.get(N.flow.target)??0)+1);const $=N=>{const W=[N],Y=new Set([N.node.id]);for(let re=0;re<W.length;re++)for(const J of q){if(J.flow.source!==W[re].node.id||Y.has(J.flow.target)||(P.get(J.flow.target)??0)!==1)continue;const ee=G.get(J.flow.target);!ee||ee.node.participant!==N.node.participant||(Y.add(ee.node.id),W.push(ee))}return W},D=N=>{const W=new Set(N.map(J=>J.node.id)),Y=k(N[0].node.participant);if(Y===void 0)return;const re=new Set;for(const J of B){const ee=W.has(J.flow.source)?J.flow.target:W.has(J.flow.target)?J.flow.source:void 0;if(ee===void 0)continue;const ue=k(I(ee));ue===void 0||ue===Y||re.add(ue<Y?"up":"down")}return re.size===1?[...re][0]:void 0},O=new Map;{const N=new Map;for(const ee of q){if(!G.has(ee.flow.source)||!G.has(ee.flow.target))continue;const ue=N.get(ee.flow.source)??[];ue.push(ee.flow.target),N.set(ee.flow.source,ue)}const W=new Map,Y=[],re=new Set,J=ee=>{W.set(ee,"open");for(const ue of N.get(ee)??[]){const ae=W.get(ue);ae==="open"?re.add(`${ee}>${ue}`):ae||J(ue)}W.set(ee,"done"),Y.push(ee)};for(const ee of E)W.has(ee.node.id)||J(ee.node.id);for(const ee of Y.reverse()){const ue=O.get(ee)??0;O.set(ee,ue);for(const ae of N.get(ee)??[])!re.has(`${ee}>${ae}`)&&(O.get(ae)??-1)<ue+1&&O.set(ae,ue+1)}}let F=-1e3;for(const N of E){if(!N.node.type.endsWith("Gateway"))continue;const W=x(N),Y=ut.get(W);if(!Y)continue;const re=Y.get(_(N))??0,J=X=>(Y.get(_(X))??0)-re,ee=q.filter(X=>X.flow.source===N.node.id).map(X=>G.get(X.flow.target)).filter(X=>!!X&&x(X)===W&&(P.get(X.node.id)??0)===1&&!Bt.has(X.node.id)).map(X=>{const fe=$(X);return{root:X,subtree:fe,dir:D(fe)}});if(ee.some(X=>X.dir==="up")&&ee.some(X=>X.dir==="down"))continue;const ue=q.some(X=>{const fe=X.flow.source===N.node.id?G.get(X.flow.target):void 0;return!!fe&&x(fe)===W&&J(fe)===0});let ae=!1;if(!ue){const X=q.filter(xe=>xe.flow.source===N.node.id).map(xe=>G.get(xe.flow.target)).filter(xe=>!!xe&&x(xe)===W&&(!!xe.node.lane||bt(xe)!==void 0)&&J(xe)<0),fe=X.length?Math.max(...X.map(J)):void 0,ye=X.filter(xe=>J(xe)===fe);if(!oi(N.node.id)&&ye.length===1&&(P.get(ye[0].node.id)??0)===1&&!Ln.has(N.node.id))continue;ae=!0}for(const X of ee){const fe=X.dir;if(!fe||ee.some(Re=>Re!==X&&Re.dir===fe))continue;const ye=J(X.root);if(ye===0||(fe==="up"?ye<0:ye>0)||q.some(Re=>{const Me=Re.flow.target===N.node.id?G.get(Re.flow.source):void 0;if(!Me||x(Me)!==W)return!1;const Ye=J(Me);return fe==="up"?Ye<0:Ye>0}))continue;const xe=[...Y].map(([Re,Me])=>({band:Re,rel:Me-re})).filter(Re=>fe==="up"?Re.rel<0:Re.rel>0).sort((Re,Me)=>Math.abs(Me.rel)-Math.abs(Re.rel));if(!xe.length&&fe==="down")continue;const me=_(X.root),_e=X.subtree.filter(Re=>x(Re)===W&&_(Re)===me),De=new Set(X.subtree.map(Re=>Re.node.id)),Fe=_e.map(Re=>O.get(Re.node.id)??0),Ie=Math.min(...Fe)-1,Ve=Math.max(...Fe)+1,Se=Re=>!E.some(Me=>{if(De.has(Me.node.id)||x(Me)!==W||_(Me)!==Re)return!1;if(!sn.has(Re))return!0;const Ye=O.get(Me.node.id)??0;return Ye>=Ie&&Ye<=Ve});let ce=ae?_(N):(gR=xe.find(Re=>Se(Re.band)))==null?void 0:gR.band;if(ce===void 0){if(ce=F--,sn.add(ce),fe==="up"){const Re=new Map;for(const[Me,Ye]of Y)Re.set(Me,Ye+1);Re.set(ce,0),ut.set(W,Re)}else Y.set(ce,Math.max(...Y.values())+1);(mR=rt.get(W))==null||mR.add(ce)}for(const Re of _e)qt.set(Re.node.id,ce)}}{const N=ee=>{const ue=q.find(ae=>ae.flow.target===ee.node.id);return ue?G.get(ue.flow.source):void 0},W=ee=>{const ue=N(ee);if(!ue||!ue.node.type.endsWith("Gateway")||x(ue)!==x(ee))return!1;const ae=ut.get(x(ue));if(!ae)return!1;const X=ae.get(_(ue))??0,fe=_e=>x(_e)===x(ue)?(ae.get(_(_e))??0)-X:Number.NaN,ye=q.filter(_e=>_e.flow.source===ue.node.id).map(_e=>G.get(_e.flow.target)).filter(_e=>!!_e&&(!!_e.node.lane||bt(_e)!==void 0));if(ye.some(_e=>fe(_e)===0))return!1;const oe=ye.filter(_e=>_e.node.lane===ue.node.lane&&fe(_e)<0);if(!oe.length)return!1;const xe=Math.max(...oe.map(fe)),me=oe.filter(_e=>fe(_e)===xe);return me.length===1&&me[0]===ee&&(P.get(ee.node.id)??0)===1&&!oi(ue.node.id)&&!Ln.has(ue.node.id)},Y=new Set;for(const ee of E){if(!ee.node.type.endsWith("Gateway")||oi(ee.node.id))continue;const ue=ut.get(x(ee));if(!ue)continue;const ae=ue.get(_(ee))??0;let X;for(const fe of q){if(fe.flow.source!==ee.node.id)continue;const ye=G.get(fe.flow.target);if(!ye||x(ye)!==x(ee)||!ye.node.lane&&bt(ye)===void 0)continue;const oe=ue.get(_(ye))??0;oe<=ae||(!X||oe>X.row?X={id:ye.node.id,row:oe,count:1}:oe===X.row&&X.count++)}X&&X.count===1&&(P.get(X.id)??0)===1&&Y.add(X.id)}const re=new Set,J=[...E].sort((ee,ue)=>Number(Y.has(ee.node.id))-Number(Y.has(ue.node.id)));for(const ee of J){const ue=x(ee),ae=ut.get(ue);if(!ae)continue;const X=ee.node.id,fe=B.filter(Ue=>Ue.flow.target===X);if(fe.length!==1||!(P.get(X)??0)||!ee.node.lane&&bt(ee)===void 0||Bt.has(X)||zn.has(X))continue;const ye=(yR=G.get(fe[0].flow.source))==null?void 0:yR.node.participant;if(!ye||ye===ee.node.participant)continue;const oe=k(ee.node.participant),xe=k(ye);if(oe===void 0||xe===void 0||oe===xe)continue;const me=xe<oe,_e=ae.get(0)??0,De=(ae.get(_(ee))??_e)-_e;if(De===0||(me?De<0:De>0)||W(ee))continue;let Fe;for(const[Ue,at]of ae){if(sn.has(Ue))continue;const Be=at-_e;(me?Be<0&&(!Fe||Be<Fe.row):Be>0&&(!Fe||Be>Fe.row))&&(Fe={band:Ue,row:Be})}if(!Fe)continue;const Ie=_(ee),Ve=$(ee).filter(Ue=>x(Ue)===ue&&_(Ue)===Ie&&!Bt.has(Ue.node.id)),Se=N(ee),ce=Se!=null&&Se.node.type.endsWith("Gateway")?`${Se.node.id}|${ue}|${Fe.band}`:void 0,Re=Fe,Me=!!ce&&Y.has(X)&&q.some(Ue=>{if(Ue.flow.source!==Se.node.id||Ue.flow.target===X)return!1;const at=G.get(Ue.flow.target);return!!at&&x(at)===ue&&!Ve.includes(at)&&_(at)===Re.band});let Ye=Fe.band;if(ce&&(re.has(ce)||Me)){if(Ye=F--,sn.add(Ye),me){const Ue=new Map;for(const[at,Be]of ae)Ue.set(at,Be+1);Ue.set(Ye,0),ut.set(ue,Ue)}else ae.set(Ye,Math.max(...ae.values())+1);(vR=rt.get(ue))==null||vR.add(Ye)}ce&&re.add(ce);for(const Ue of Ve)qt.set(Ue.node.id,Ye),zn.add(Ue.node.id);me&&Y.has(X)&&pa.add(X)}}}const In=(x,_)=>{var S;return((S=ut.get(x))==null?void 0:S.get(_))??_},Bn=(x,_,S,k)=>{const I=x?h(x):_?h(_):void 0;if(!I)return!1;const P=x?I.y+Math.min(I.height/2,se):I.y+he;return Math.abs(P+In(x??`pool:${_??""}`,S)*z-k)<=z/2},dn=new Map;for(const[x,_]of rt){let S=0;for(const k of _)S=Math.max(S,In(x,k));dn.set(x,S)}const _o=x=>Ae+z*x,Fi=(x,_,S,k)=>{const I=y().children.filter(P=>!("waypoints"in P&&P.waypoints)&&P.type!=="label"&&P.id!==_&&!(k!=null&&k.has(P.id))&&typeof P.y=="number"&&P.y>=x);I.length&&n.moveElements(I,{x:0,y:S})},mi=(x,_,S)=>{const k=x.type==="bpmn:Participant"?x:void 0;if(!k||k.children.some(D=>D.type==="bpmn:Lane"))return;const I=S+_.height/2+j-k.y;if(k.height>=I)return;const P=I-k.height,$=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:I}),Fi($,k.id,P)},St=(x,_,S)=>{const k=_-x.height;if(k<=0)return new Set;const I=w(x)??x,P=[],$=F=>{if(!(S!=null&&S.has(F.id))){P.push(F);for(const N of F.children??[])$(N)}};$(I);const D=x.y+x.height-10,O=l.calculateAdjustments(P,"y",k,D);return l.makeSpace(O.movingShapes,O.resizingShapes,{x:0,y:k},"s",D),new Set(O.movingShapes.map(F=>F.id))},Tt=(x,_,S)=>{if(x){const $=m(x),D=_o(_);if($.height>=D)return;const O=D-$.height,F=w($),N=F?F.y+F.height:$.y+$.height,W=St($,D);Fi(N,F==null?void 0:F.id,O,W);return}if(!S)return;const k=z*(_+1);if(S.height>=k)return;const I=k-S.height,P=S.y+S.height;n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:k}),Fi(P,S.id,I)},tm=new Map;for(const x of q)tm.set(x.flow.target,(tm.get(x.flow.target)??0)+1);const I1=x=>(tm.get(x)??0)<=1,gj=new Set(E.map(x=>x.node.id).filter(x=>Pe(x)===1&&!q.some(_=>_.flow.target===x||_.flow.source===x&&G.has(_.flow.target)))),nm=new Map,im=(x,_)=>{if(!x)return;const S=h(x);if(!S||S.height>=_o(_))return;const k=S.y+S.height-10,I=w(S);if(I)return new Set((I.children??[]).filter(P=>P.type!=="bpmn:Lane"&&typeof P.y=="number"&&P.y>k).map(P=>P.id))},Ip=(x,_,S)=>{if(!x)return!0;const k=h(x);return k?S-_.height/2>=k.y&&S+_.height/2<=k.y+k.height:!0},mj=10,yj=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:_}of de){const S=h(x),k=U(x);if(!S||k.length<2)continue;const I=_o(0),P=mj,$=new Set(Vt(e,"node.update").filter(oe=>oe.lane!==void 0&&_.has(oe.lane)).map(oe=>oe.id)),D=S.children??[],O=D.filter(oe=>!("waypoints"in oe&&oe.waypoints)&&oe.type!=="bpmn:Lane"&&oe.type!=="label"&&typeof oe.y=="number"),F=[];for(const oe of O){F.push([oe.y,oe.y+oe.height]);const xe=oe.label;xe&&F.push([xe.y,xe.y+xe.height])}for(const oe of D){const xe="waypoints"in oe&&oe.waypoints?oe.label:void 0;xe&&xe.y+xe.height>S.y&&xe.y<S.y+S.height&&F.push([xe.y,xe.y+xe.height])}for(const oe of y().children){if(oe.type!=="bpmn:TextAnnotation")continue;const xe=oe;xe.x<S.x+S.width&&xe.x+xe.width>S.x&&xe.y<S.y+S.height&&xe.y+xe.height>S.y&&F.push([xe.y,xe.y+xe.height])}F.sort((oe,xe)=>oe[0]-xe[0]);const N=S.y,W=S.y+S.height,Y=[];let re=N;for(const[oe,xe]of F)oe>re&&Y.push([re,oe]),re=Math.max(re,xe);const J=O.filter(oe=>yj.test(oe.type)&&!$.has(oe.id)),ee=(oe,xe)=>J.some(me=>me.y+me.height/2>=oe&&me.y+me.height/2<=xe),ue=oe=>F.some(([xe,me])=>xe<oe-.5&&oe+.5<me),ae=[];let X=N;for(const oe of k.slice(1).map(xe=>xe.y)){const xe=X+2*P,me=!ue(oe)&&oe>=xe&&oe<=W-2*P?[oe]:[];for(const[De,Fe]of Y){const Ie=Math.max(De+P,xe),Ve=Math.min(Fe-P,W-2*P);Ie<=Ve&&me.push(Math.min(Math.max(oe,Ie),Ve))}me.push(Math.max(re+P,xe));let _e;for(const De of me){const Fe=!ee(X,De)&&De-X<I?O.filter(Se=>Se.y>=De).length:0,Ie=Math.abs(De-oe),Ve=_e?Math.abs(_e.y-oe):0;(!_e||Fe<_e.cost||Fe===_e.cost&&(Ie<Ve||Ie===Ve&&De>_e.y))&&(_e={y:De,cost:Fe})}ae.push(_e.y),X=_e.y}const fe=ae[ae.length-1]+2*P-W;fe>0&&(n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+fe}),Fi(W,S.id,fe));const ye=[N,...ae,S.y+S.height];k.forEach((oe,xe)=>{const me=ye[xe],_e=ye[xe+1]-me;(oe.y!==me||oe.height!==_e)&&n.resizeShape(oe,{x:oe.x,y:me,width:oe.width,height:_e})});for(const oe of k){if(oe.height>=I||ee(oe.y,oe.y+oe.height))continue;const xe=I-oe.height,me=S.y+S.height,_e=St(oe,I);Fi(me,S.id,xe,_e)}}const Bp=b.map((x,_)=>({op:x,declared:_}));Bp.sort((x,_)=>{const S=x.op.order??Number.POSITIVE_INFINITY,k=_.op.order??Number.POSITIVE_INFINITY;return S!==k?S-k:x.declared-_.declared});let Nc=80;for(const x of r.getAll())x.parent===y()&&"height"in x&&typeof x.y=="number"&&(Nc=Math.max(Nc,x.y+x.height+60));const om=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===y()),vj=(()=>{if(!om.length)return;const x=om.filter(I=>!Vd(I)),_=x.length?x:om,S=Math.min(..._.map(I=>I.x)),k=Math.max(..._.map(I=>I.x+I.width));return k>S?{x:S,width:k-S}:void 0})();for(const{op:x}of Bp){const _=x.participant,S=E.filter(ee=>ee.node.participant===_.id).length,k=((xR=_.lanes)==null?void 0:xR.length)??0,I=Math.max(Fv,S*160+300),P=(_.lanes??[]).map(ee=>_o(dn.get(ee.id)??0)),$=P.reduce((ee,ue)=>ee+ue,0);k&&$<300&&(P[k-1]+=300-$);const D=Math.max(300,z*((dn.get(`pool:${_.id}`)??0)+1)),O=_.blackBox||S+k===0?120:k?Math.max(300,$):D,F=_.blackBox?vj:void 0,N=(F==null?void 0:F.x)??100,W=(F==null?void 0:F.width)??I,Y=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:_.id,name:_.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},..._.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:W,height:O,isExpanded:!0}),re=n.createShape(Y,{x:N+W/2,y:Nc+O/2},y()),J=_.lanes??[];if(J.length&&n.splitLane(re,J.length),J.length){const ee=r.filter(ue=>{var ae;return ue.type==="bpmn:Lane"&&((ae=w(ue))==null?void 0:ae.id)===_.id}).sort((ue,ae)=>ue.y-ae.y);if(ee.forEach((ue,ae)=>{const X=J[ae];X&&n.updateProperties(ue,{id:X.id,name:X.name})}),P.some(ue=>ue!==re.height/k)){let ue=re.y;ee.forEach((ae,X)=>{const fe=P[X];n.resizeShape(ae,{x:ae.x,y:ue,width:ae.width,height:fe}),ue+=fe})}}Nc=re.y+re.height+60}const xj=x=>{var k;const _=G.get(x);if(_)return _.node.participant??"";const S=h(x);return S?S.type==="bpmn:Participant"?S.id:((k=w(S))==null?void 0:k.id)??"":""},$c=new Map,B1=x=>{let _=$c.get(x);return _||$c.set(x,_={nodes:[],flows:[]}),_};for(const x of E)B1(x.node.participant??"").nodes.push(x);for(const x of q)B1(xj(x.flow.source)).flows.push(x);const Np=x=>{var _;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((_=x.condition)==null?void 0:_.label)})},rm=(x,_,S)=>o.createShape({type:vl(x.type),...x.eventDefinition?{eventDefinitionType:qc[x.eventDefinition]}:{},businessObject:i.create(vl(x.type),{id:x.id,name:x.name,..._!==void 0?{"bwl:band":_}:{},...S!==void 0?{"bwl:afterColumn":S}:{}})}),bj=[...Bp.map(({op:x})=>x.participant.id).filter(x=>$c.has(x)),...[...$c.keys()].filter(x=>!b.some(_=>_.participant.id===x))],am=x=>x.endsWith("Gateway");for(const x of bj){const _=$c.get(x),S=x?m(x):void 0,k=S?S.x+150:250;let I=S?S.y+80:120;const P=(me,_e,De)=>{if(me){const Fe=m(me);return Fe.y+Math.min(Fe.height/2,se)+In(me,_e??0)*z}return _e!==void 0&&S?S.y+he+In(`pool:${x}`,_e)*z:De},$=(me,_e,De)=>{if(me){const Fe=m(me);return Fe.y+Math.min(Fe.height/2,se)+_e*z}return S?S.y+he+_e*z:De},D=me=>me.participant?m(me.participant):y(),O=new Set,F=(me,_e,De,Fe,Ie,Ve,Se,ce,Re)=>{const Me=De!==void 0||Fe!==void 0,Ye=Je=>{const mt=()=>Tt(De,Je,S);ce?ce(mt):mt()},Ue=In(De??`pool:${x}`,Fe??0);if((Fe===void 0||Re||Bn(De,x,Fe,Se??Number.NaN))&&Se!==void 0&&Ip(De,_e,Se)&&!ge(me,_e,Ie,Se))return Re&&Fe!==void 0&&!Bn(De,x,Fe,Se)&&O.add(_e.id),{x:Ie,y:Se};if(Me)for(let Je=0;Je<4;Je++){const mt=$(De,Ue+Je,Ve);if(!ge(me,_e,Ie,mt,im(De,Ue+Je)))return Ye(Ue+Je),Je>0&&O.add(_e.id),{x:Ie,y:mt}}const at=P(De,Fe,Ve);Me?Ye(Ue):ce?ce(()=>mi(me,_e,_e.y+_e.height/2)):mi(me,_e,at);let Be=Ie;for(let Je=0;Je<64;Je++){const mt=ge(me,_e,Be,at);if(!mt)break;Be=mt.x+mt.width+Q+_e.width/2}return{x:Be,y:at}},N=(me,_e,De)=>{const Fe=r.getAll().filter(Ve=>{var Se;return/Association$/.test(Ve.type)&&(((Se=Ve.waypoints)==null?void 0:Se.length)??0)>=2});if(!Fe.length)return De;const Ie=Ve=>{const Se={id:_e.id,type:_e.type,x:Ve-_e.width/2,y:De.y-_e.height/2,width:_e.width,height:_e.height};return Fe.some(ce=>ce.waypoints.some((Re,Me)=>!!ce.waypoints[Me+1]&&Po(Re,ce.waypoints[Me+1],Se)<=R))};if(!Ie(De.x))return De;for(let Ve=ne;Ve<=Z;Ve+=ne){const Se=De.x+Ve;if(!Ie(Se)&&!ge(me,_e,Se,De.y))return{x:Se,y:De.y}}return De},W=(me,_e,De,Fe,Ie)=>{var Be;const Ve=In(Fe??`pool:${x}`,Ie??0),Se=$(Fe,Ve,Number.NaN);if(Number.isNaN(Se))return;const ce=ge(me,_e,De,Se,im(Fe,Ve));if(!ce||!G.has(ce.id)||ce.type!=="bpmn:EndEvent")return;const Re=Je=>(Je??[]).filter(mt=>mt.type==="bpmn:SequenceFlow"),Me=Re(ce.incoming);if(Re(ce.outgoing).length||Me.length>1)return;const Ye=ce.y+ce.height/2;if(Math.abs(Ye-Se)>1)return;const Ue=(Be=Me[0])==null?void 0:Be.source;if(!Ue||typeof Ue.x!="number"||ce.x-(Ue.x+Ue.width)>Q)return;const at=$(Fe,Ve+1,Number.NaN);Number.isNaN(at)||ge(me,ce,ce.x+ce.width/2,at,new Set([ce.id]))||(Tt(Fe,Ve+1,S),n.moveShape(ce,{x:0,y:at-Ye}))},Y=new Set(_.flows.map(me=>me.flow.target)),re=new Map,J=me=>{if(me===void 0)return;const _e=r.get(me);if(!(!_e||typeof _e.x!="number"||typeof _e.width!="number"))return _e.x+_e.width+Q},ee=me=>{if(Pe(me)>0)return;const _e=_.flows.filter(Fe=>Fe.flow.source===me);if(_e.length!==1)return;const De=r.get(_e[0].flow.target);return De&&typeof De.y=="number"&&typeof De.height=="number"?De.y+De.height/2:void 0};for(const me of _.nodes){if(Y.has(me.node.id))continue;const _e=rm(me.node,me.band,me.afterColumn),De=bt(me),Fe=me.node.lane?`${me.node.lane}|${De??""}`:De!==void 0?`band:${De}`:"",Ie=D(me.node),Ve=re.get(Fe)??k,Se=J(me.afterColumn),ce=Se===void 0?Ve:Math.max(Ve,Se);let Re;const Me=F(Ie,_e,me.node.lane,De,ce,I,ee(me.node.id),gj.has(me.node.id)&&me.node.participant!==void 0?Ye=>Re=Ye:void 0);if(Re?n.createShape(_e,Me,Ie,{autoResize:!1}):n.createShape(_e,Me,Ie),Re){const Ye=me.node.lane?m(me.node.lane):Ie;nm.set(me.node.id,{container:Ye,relCy:Me.y-Ye.y,grow:Re})}re.set(Fe,Me.x+_e.width+Q),!me.node.lane&&De===void 0&&(I+=160)}const ue=new Set,ae=new Map,X=new Map;if(x&&$e.has(`pool:${x}`)){const me=new Map;for(const ce of _.flows)me.set(ce.flow.target,(me.get(ce.flow.target)??0)+1);const _e=ce=>P(ce.node.lane,Kt(ce),Number.NaN),De=new Set,Fe=ce=>{var Ye;const Re=(Ye=G.get(ce))==null?void 0:Ye.node.participant;if(Re)return h(Re);const Me=h(ce);if(Me)return Me.type==="bpmn:Participant"?Me:w(Me)},Ie=ce=>{const Re=[],Me=new Set([ce]),Ye=[ce];for(;Ye.length;){const Ue=Ye.shift(),at=G.get(Ue);at&&Re.push(at);for(const Be of _.flows)Be.flow.source!==Ue||Me.has(Be.flow.target)||(me.get(Be.flow.target)??0)!==1||(Me.add(Be.flow.target),Ye.push(Be.flow.target))}return Re},Ve=ce=>{if(!S)return;const Re=new Set(ce.map(Ue=>Ue.node.id));let Me=!1,Ye=!1;for(const Ue of B){if(!Re.has(Ue.flow.source))continue;const at=Fe(Ue.flow.target);!at||at.id===S.id||(at.y<S.y?Me=!0:Ye=!0)}return Me&&!Ye?"up":Ye&&!Me?"down":void 0};for(const ce of _.nodes){if(!am(ce.node.type))continue;const Re=P(ce.node.lane,bt(ce),Number.NaN);if(Number.isNaN(Re))continue;const Me=[];for(const Be of _.flows){if(Be.flow.source!==ce.node.id)continue;const Je=G.get(Be.flow.target);if(!Je||Je.node.lane!==ce.node.lane||(me.get(Je.node.id)??0)!==1)continue;const mt=bt(Je);if(mt===void 0)continue;const Lt=P(Je.node.lane,mt,Number.NaN);if(Number.isNaN(Lt))continue;const zi=Ie(Je.node.id),cn=Ve(zi);cn&&Me.push({subtree:zi,band:mt,row:Lt,dir:cn})}if(!Me.some(Be=>Be.dir==="up")||!Me.some(Be=>Be.dir==="down")||!Me.some(Be=>Be.dir==="up"&&Me.some(Je=>Je.dir==="down"&&Je.row<Be.row)))continue;const Ue=[...Me].sort((Be,Je)=>Be.row-Je.row);[...Me.filter(Be=>Be.dir==="up"),...Me.filter(Be=>Be.dir==="down")].sort((Be,Je)=>Be.dir===Je.dir?Be.row-Je.row:Be.dir==="up"?-1:1).forEach((Be,Je)=>{const mt=Ue[Je].band;if(mt!==Be.band){De.add(ce.node.id);for(const Lt of Be.subtree)bt(Lt)===Be.band&&qt.set(Lt.node.id,mt)}})}const Se=ce=>{if(!S)return;const Re=new Set(ce.map(Ue=>Ue.node.id));let Me=!1,Ye=!1;for(const Ue of B){if(!Re.has(Ue.flow.target))continue;const at=Fe(Ue.flow.source);!at||at.id===S.id||(at.y<S.y?Me=!0:Ye=!0)}return Me&&!Ye?"up":Ye&&!Me?"down":void 0};for(const ce of _.nodes){if(!am(ce.node.type))continue;const Re=ce.node.lane??`pool:${x}`,Me=ut.get(Re);if(!Me||Me.size<2)continue;const Ye=Me.get(0);if(Ye===void 0)continue;const Ue=Math.max(...Me.values()),at=Ye===Ue&&Ye!==0?"down":void 0;if(!at)continue;const Be=[];for(const cn of _.flows){if(cn.flow.source!==ce.node.id)continue;const Ro=G.get(cn.flow.target);if(!Ro||Ro.node.lane!==ce.node.lane||(me.get(Ro.node.id)??0)!==1)continue;const Vn=Kt(Ro);Vn!==void 0&&Be.push({t:Ro,subtree:Ie(Ro.node.id),band:Vn})}const Je=Be.find(cn=>(Me.get(cn.band)??cn.band)===Ye);if(!Je||Se(Je.subtree)===at||Ve(Je.subtree)===at)continue;const mt=Be.find(cn=>cn!==Je&&Se(cn.subtree)===at);if(!mt)continue;const Lt=Je.band,zi=mt.band;for(const cn of Je.subtree)Kt(cn)===Lt&&qt.set(cn.node.id,zi);for(const cn of mt.subtree)Kt(cn)===zi&&qt.set(cn.node.id,Lt);De.add(ce.node.id)}for(const ce of _.nodes){if(!am(ce.node.type))continue;const Re=_e(ce);if(Number.isNaN(Re)||oi(ce.node.id))continue;let Me,Ye=!1,Ue;for(const at of _.flows){if(at.flow.source!==ce.node.id)continue;const Be=G.get(at.flow.target);if(!Be||!Be.node.lane&&bt(Be)===void 0)continue;const Je=_e(Be);Number.isNaN(Je)||(Math.abs(Je-Re)<.5&&(Ye=!0),Je>Re?!Me||Je>Me.row?Me={id:Be.node.id,row:Je,count:1}:Je===Me.row&&Me.count++:Je<Re&&Be.node.lane===ce.node.lane&&!zn.has(Be.node.id)&&(!Ue||Je>Ue.row?Ue={op:Be,row:Je,count:1}:Je===Ue.row&&Ue.count++))}Me&&Me.count===1&&(me.get(Me.id)??0)===1&&!De.has(ce.node.id)&&ue.add(Me.id),!Ye&&Ue&&Ue.count===1&&(me.get(Ue.op.node.id)??0)===1&&!Ln.has(ce.node.id)&&ae.set(Ue.op.node.id,{lane:ce.node.lane,band:Kt(ce)})}for(const ce of pa){const Re=(bR=_.flows.find(Me=>Me.flow.target===ce))==null?void 0:bR.flow.source;Re&&!De.has(Re)&&ue.add(ce)}}const fe=GT(_.flows.map(me=>me.flow),_.nodes.map(me=>me.node.id),me=>G.has(me));let ye=!1;const oe=new Set;let xe=0;for(;xe++<_.nodes.length+2;){for(let De=0;De<_.nodes.length+_.flows.length+2;De++){let Fe=!1,Ie=!1;for(const Ve of _.flows){const Se=Ve.flow;if(oe.has(Se.id))continue;const ce=h(Se.source);if(!ce)continue;const Re=h(Se.target),Me=G.get(Se.target);if(!Re&&Me&&!ye&&fe.has(Se.id)){Ie=!0;continue}if(!Re&&Me){const Ye=rm(Me.node,Me.band),Ue=Kt(Me);if(Me.node.lane||Ue!==void 0){const at=D(Me.node),Be=ce,Je=Be.x+(X.get(Se.source)??0)+Be.width+Q,mt=ae.get(Se.target),Lt=G.get(Se.source),zi=!mt&&!!Lt&&Y.has(Se.source)&&Ue!==void 0&&Lt.band!==void 0&&Lt.band===Me.band&&Lt.node.lane===Me.node.lane&&Lt.node.participant===Me.node.participant&&O.has(Se.source)&&!Bn(Me.node.lane,Me.node.participant,Ue,Be.y+Be.height/2);ue.has(Se.target)&&W(at,Ye,Be.x+Be.width/2,mt?mt.lane:Me.node.lane,mt?mt.band:Ue);const cn=F(at,Ye,mt?mt.lane:Me.node.lane,mt?mt.band:Ue,ue.has(Se.target)?Be.x+Be.width/2:Je,Number.NaN,mt||!I1(Se.target)?void 0:Be.y+Be.height/2,void 0,zi),Ro=G.has(Se.source)?cn:N(at,Ye,cn),Vn=n.createShape(Ye,Ro,at);ue.has(Se.target)&&X.set(Se.target,Je-(Vn.x+Vn.width/2)),n.connect(ce,Vn,{type:"bpmn:SequenceFlow",businessObject:Np(Se)})}else{const at=w(ce),Be=at?at.y+at.height:0;s.append(ce,Ye,{connection:{type:"bpmn:SequenceFlow",businessObject:Np(Se)}}),at&&at.y+at.height-Be>.5&&Fi(Be,at.id,at.y+at.height-Be)}}else if(Re)n.connect(ce,Re,{type:"bpmn:SequenceFlow",businessObject:Np(Se)});else continue;oe.add(Se.id),Fe=!0}if(!Fe){if(Ie&&!ye){ye=!0;continue}break}ye=!1}const me=_.nodes.filter(De=>!h(De.node.id));if(!me.length)break;const _e=me[0];{const De=rm(_e.node,_e.band),Fe=D(_e.node),Ie=bt(_e);n.createShape(De,F(Fe,De,_e.node.lane,Ie,k,I),Fe),!_e.node.lane&&Ie===void 0&&(I+=160)}}}const N1=new Map;for(const[x,_]of ie){const S=h(x),k=h(_.flow.target);if(!(S!=null&&S.target)||!k)continue;const I=S.label&&{x:S.label.x,y:S.label.y,width:S.label.width,height:S.label.height};N1.set(x,{waypoints:S.waypoints.map(D=>({x:D.x,y:D.y})),label:I});const P=S.target,$=D=>({x:D.x+D.width/2,y:D.y+D.height/2});n.reconnect(S,k,P,[$(k),$(P)]),n.layoutConnection(S,{waypoints:[]})}const $1=new Set;{const x=P=>P.endsWith("Task")||P==="bpmn:CallActivity"||P==="bpmn:SubProcess",_=P=>x(P)||P==="bpmn:EndEvent"||P==="bpmn:IntermediateThrowEvent"||P==="bpmn:IntermediateCatchEvent",S=P=>(P??[]).filter($=>$.type==="bpmn:SequenceFlow"),k=Vt(e,"sequenceFlow.update"),I=(P,$)=>{var D;return(D=g(P,$))==null?void 0:D.id};for(const P of k){if(P.source===void 0&&P.target===void 0||ie.has(P.id))continue;const $=h(P.id);if(!$)continue;const D=P.source!==void 0?h(P.source):$.source,O=P.target!==void 0?h(P.target):$.target;if(!D||!O||D.id===O.id||G.has(D.id)||G.has(O.id)||!x(D.type)||!_(O.type)||D.parent!==O.parent||S(O.incoming).some(X=>X.id!==$.id)||S(O.outgoing).some(X=>X.id!==$.id)||k.some(X=>X!==P&&(X.target===O.id||X.source===O.id))||O.x>=D.x+D.width)continue;const F=D.parent,N=w(D),W=D.x+D.width+Q,Y=D.y+D.height/2,re=O.y+O.height/2,J=I(N,D)===I(N,O),ee=new Set([O.id]),ue=[J?Y:re,re].find(X=>!ge(F,O,W,X,ee));if(ue===void 0)continue;if(n.moveElements([O],{x:W-(O.x+O.width/2),y:ue-re}),N){const X=O.x+O.width+_l-(N.x+N.width);X>0&&Ps(n,N,N.width+X)}const ae=X=>({x:X.x+X.width/2,y:X.y+X.height/2});n.reconnect($,D,O,[ae(D),ae(O)]),Math.abs(ae(D).y-ae(O).y)>1&&n.layoutConnection($,{waypoints:[]}),$1.add(P.id)}}const Lr=40,wj=10,Fc=x=>{const _=N=>N.kind==="label-over-line"||N.kind==="label-over-shape"||N.kind==="label-on-shared-segment"?N.edge===x.id:N.kind==="annotation-over-label"||N.kind==="pool-name-over-label"?N.label===x.id:!1,S=()=>new Map(dt(Ge(r)).filter(N=>!_(N)).map(N=>[ct(N),N])),k=S(),I=N=>[...N].filter(([W])=>!k.has(W)).map(([,W])=>W),P=N=>I(N).length<=[...k.keys()].filter(W=>!N.has(W)).length,$=x.waypoints.map(N=>({x:N.x,y:N.y})),D=x.label,O=D&&{x:D.x,y:D.y};n.layoutConnection(x,{waypoints:[]});const F=S();if(!P(F)){if(I(F).every(N=>N.kind==="edge-crosses-shape"&&N.edge===x.id)){const N=Ge(r),W=N.edges.find(ee=>ee.id===x.id),Y=hn(N),re=W?Pt(W,Y):[],J=W&&re.length&&!re.every(ee=>ee.type==="bpmn:TextAnnotation")?dl(W,Y,Ms(x),N.edges):null;if(J&&(n.updateWaypoints(x,J),P(S())))return}n.updateWaypoints(x,$),D&&O&&(D.x!==O.x||D.y!==O.y)&&n.moveElements([D],{x:O.x-D.x,y:O.y-D.y})}},sm=5,ji=10,F1=200,jc=new Set([...q.map(x=>x.flow.id),...B.map(x=>x.flow.id),...Vt(e,"sequenceFlow.update").map(x=>x.id),...Vt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),_j=(x,_,S,k,I,P)=>{const $=new Set(x.map(X=>X.id)),D=Math.min(...x.map(X=>X.x))+_-ji,O=Math.max(...x.map(X=>X.x+X.width))+_+F1+ji,F=Math.min(...x.map(X=>X.y+Math.min(0,...S)))-ji,N=Math.max(...x.map(X=>X.y+X.height+Math.max(0,...S)))+ji,W=r.getAll().filter(X=>{if(X.type!=="bpmn:SequenceFlow"&&X.type!=="bpmn:MessageFlow")return!1;const fe=X;return jc.has(fe.id)||!fe.waypoints||fe.waypoints.length<2||[fe.source,fe.target].some(oe=>!oe||$.has(oe.id)||oe.x>=k)?!1:fe.waypoints.some((oe,xe)=>{const me=fe.waypoints[xe+1];return!!me&&Math.max(oe.x,me.x)>=D&&Math.min(oe.x,me.x)<=O&&Math.max(oe.y,me.y)>=F&&Math.min(oe.y,me.y)<=N})});if(!W.length)return 0;const Y=X=>{const fe=new Map;for(const ye of x)for(const oe of S){const xe={id:ye.id,type:ye.type,x:ye.x+_+X,y:ye.y+oe,width:ye.width,height:ye.height};for(const me of W){let _e=1/0;for(let Fe=0;Fe+1<me.waypoints.length;Fe++)_e=Math.min(_e,Po(me.waypoints[Fe],me.waypoints[Fe+1],xe));const De=`${me.id}|${ye.id}`;fe.set(De,Math.min(fe.get(De)??1/0,_e))}}return fe},re=[...Y(0)].filter(([,X])=>X<=sm).map(([X])=>X);if(!re.length)return 0;let J=0;for(let X=1;X<=F1;X++){const fe=Y(X);if([...fe.values()].every(ye=>ye>sm)&&re.every(ye=>(fe.get(ye)??1/0)>=ji)){J=X;break}}if(!J)return 0;const ee=Math.min(...x.map(X=>X.x))+_+J,ue=new Set(re.map(X=>X.slice(0,X.indexOf("|"))));return W.some(X=>X.type==="bpmn:SequenceFlow"&&ue.has(X.id)&&X.waypoints.some((fe,ye)=>{const oe=X.waypoints[ye+1];if(!oe||Math.min(fe.y,oe.y)>P||Math.max(fe.y,oe.y)<P||fe.y===oe.y)return!1;const xe=fe.x+(P-fe.y)*(oe.x-fe.x)/(oe.y-fe.y);return xe>I&&xe<ee}))?0:J},eo=(x,_=()=>!0)=>{const S=h(x);if(!S)return[];const k=[S],I=new Set([x]);for(let P=0;P<k.length;P++){const $=k[P].id;for(const D of q){const O=D.flow.target;if(D.flow.source!==$||I.has(O)||!G.has(O))continue;I.add(O);const F=h(O);F&&_(F)&&k.push(F)}}return k},Ej=(x,_=()=>!0)=>{const S=h(x);if(!S)return[];const k=[S],I=new Set([x]);for(let P=0;P<k.length;P++){const $=k[P].id;for(const D of q){const O=D.flow.source;if(D.flow.target!==$||I.has(O)||!G.has(O))continue;I.add(O);const F=h(O);F&&_(F)&&k.push(F)}}return k},Hi=30,_i=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",ps=(x,_)=>Ps(n,x,_),Eo=(x,_,S=!1)=>{const k=new Set(x.flatMap(O=>O.subtree.map(F=>F.id)));for(const O of x){const F=(O.pool.children??[]).filter(_i).filter(W=>!k.has(W.id));if(O.subtree.some(W=>F.some(Y=>W.x+_<Y.x+Y.width+Hi&&W.x+_+W.width+Hi>Y.x&&W.y<Y.y+Y.height&&W.y+W.height>Y.y)))return null}const I=x.map(O=>O.pool.width),P=S?r.filter(O=>Array.isArray(O.waypoints)).map(O=>({c:O,wps:O.waypoints.map(F=>({x:F.x,y:F.y}))})):[],$=r.filter(O=>O.type==="label").map(O=>({label:O,x:O.x,y:O.y}));n.moveElements(x.flatMap(O=>O.subtree),{x:_,y:0});const D=x.map(O=>{const N=Math.max(...O.subtree.map(W=>W.x+W.width))+_l-(O.pool.x+O.pool.width);return N>0&&ps(O.pool,O.pool.width+N),N});return()=>{n.moveElements(x.flatMap(O=>O.subtree),{x:-_,y:0}),x.forEach((O,F)=>{D[F]>0&&ps(O.pool,I[F])});for(const{c:O,wps:F}of P){const N=O.waypoints??[];N.length===F.length&&N.every((Y,re)=>Math.abs(Y.x-F[re].x)<=.5&&Math.abs(Y.y-F[re].y)<=.5)||n.updateWaypoints(O,F.map(Y=>({x:Y.x,y:Y.y})))}for(let O=0;O<3;O++){let F=0;for(const N of $){const W=N.x-N.label.x,Y=N.y-N.label.y;Math.abs(W)<=.5&&Math.abs(Y)<=.5||(n.moveElements([N.label],{x:W,y:Y}),F++)}if(!F)break}}},cm=x=>{var I,P;const _=new Map,S=new Map;for(const $ of r.getAll()){if($.type!=="bpmn:Participant")continue;const D=$;(D.children??[]).length||(_.set(D.id,D),S.set(D.id,[]))}for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const D=$,O=(I=D.source)==null?void 0:I.id,F=(P=D.target)==null?void 0:P.id;O&&F&&S.has(O)&&S.get(O).push(F),O&&F&&S.has(F)&&S.get(F).push(O)}const k=[];for(const[$,D]of S)D.length&&D.every(O=>x.has(O))&&k.push(_.get($));return k},j1=(x,_)=>{if(!x.length)return null;const S=new Set(x.map(N=>N.id)),k=r.getAll().filter(N=>N.type==="bpmn:Participant"&&!S.has(N.id)),I=Math.min(...k.filter(N=>(N.children??[]).length>0).map(N=>N.x)),P=new Set(x.filter(N=>Math.abs(N.x-I)<=2).map(N=>N.id));if(x.some(N=>{const W=P.has(N.id)?N.x:N.x+_,Y=P.has(N.id)?N.width+_:N.width;return k.some(re=>W<re.x+re.width+Hi&&W+Y+Hi>re.x&&N.y<re.y+re.height&&N.y+N.height>re.y)}))return null;const D=r.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y})),O=x.filter(N=>!P.has(N.id)),F=x.filter(N=>P.has(N.id)).map(N=>({pool:N,was:{x:N.x,y:N.y,width:N.width,height:N.height}}));O.length&&n.moveElements(O,{x:_,y:0});for(const{pool:N,was:W}of F)n.resizeShape(N,{...W,width:W.width+_});return()=>{for(const{pool:N,was:W}of F)n.resizeShape(N,W);O.length&&n.moveElements(O,{x:-_,y:0});for(let N=0;N<3;N++){let W=0;for(const Y of D){const re=Y.x-Y.label.x,J=Y.y-Y.label.y;Math.abs(re)<=.5&&Math.abs(J)<=.5||(n.moveElements([Y.label],{x:re,y:J}),W++)}if(!W)break}}},H1=(x,_,S)=>{const k=S.x+S.width/2,I=_.y>S.y,P=I?S.y+S.height:S.y,$=I?_.y:_.y+_.height,D=x.source===_?[{x:k,y:$},{x:k,y:P}]:[{x:k,y:P},{x:k,y:$}],O=Ge(r),F={...O.edges.find(N=>N.id===x.id),waypoints:D};return Pt(F,hn(O)).length?!1:(n.updateWaypoints(x,D),!0)},Sj=()=>{const x=r.filter($=>$.type==="bpmn:Participant"),_=Math.min(...x.filter($=>($.children??[]).length>0).map($=>$.x)),S=$=>b.some(D=>D.participant.id===$.id),k=$=>!!$&&$.type==="bpmn:Participant"&&!($.children??[]).length&&Math.abs($.x-_)<=2&&!S($),I=$=>!!$&&$.type==="bpmn:Participant"&&($.children??[]).length>0&&!S($),P=new Set;for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const D=$;if((D.waypoints??[]).length!==2)continue;const O=[D.source,D.target].find(W=>k(W)||I(W)),F=O===D.source?D.target:D.source;if(!O||!F||F.type==="bpmn:Participant")continue;const N=F.x+F.width/2;I(O)&&(N<O.x||N>O.x+O.width)||P.add(D.id)}return P},Rj=x=>{var S;const _=new Map;for(const k of x){const I=r.get(k);if(!I||(I.waypoints??[]).length===2)continue;const P=((S=I.source)==null?void 0:S.type)==="bpmn:Participant"?I.source:I.target,$=P===I.source?I.target:I.source;if($.x+$.width/2<=P.x+P.width)continue;const D=_.get(P.id)??{pool:P,msgs:[]};D.msgs.push({conn:I,other:$}),_.set(P.id,D)}for(const{pool:k,msgs:I}of _.values()){const P=Math.max(...I.map(({other:J})=>J.x+J.width/2))+zd;if(r.getAll().some(J=>{if(J.type!=="bpmn:Participant"||J.id===k.id)return!1;const ee=J;return k.x<ee.x+ee.width+Hi&&P+Hi>ee.x&&k.y<ee.y+ee.height&&k.y+k.height>ee.y}))continue;const D={x:k.x,y:k.y,width:k.width,height:k.height},O=[...k.incoming??[],...k.outgoing??[]],F=O.map(J=>({c:J,wps:(J.waypoints??[]).map(ee=>({x:ee.x,y:ee.y}))})),N=O.flatMap(J=>{const ee=J.label;return ee?[{label:ee,x:ee.x,y:ee.y}]:[]}),W=Ir();ps(k,P-k.x);const Y=I.filter(({conn:J,other:ee})=>H1(J,k,ee)).length,re=Ir();if(!(Y>0&&re.messages>W.messages&&re.lines>=W.lines)){ps(k,D.width);for(const{c:J,wps:ee}of F){const ue=J.waypoints??[];ue.length===ee.length&&ue.every((X,fe)=>Math.abs(X.x-ee[fe].x)<=.5&&Math.abs(X.y-ee[fe].y)<=.5)||n.updateWaypoints(J,ee.map(X=>({x:X.x,y:X.y})))}for(let J=0;J<3;J++){let ee=0;for(const ue of N){const ae=ue.x-ue.label.x,X=ue.y-ue.label.y;Math.abs(ae)<=.5&&Math.abs(X)<=.5||(n.moveElements([ue.label],{x:ae,y:X}),ee++)}if(!ee)break}}}},G1=()=>{let x=0;for(const _ of r.getAll()){if(_.type!=="bpmn:DataInputAssociation"&&_.type!=="bpmn:DataOutputAssociation")continue;const S=_.waypoints??[];for(let k=1;k<S.length;k++)x+=Math.hypot(S[k].x-S[k-1].x,S[k].y-S[k-1].y)}return x},z1=()=>{let x=0;for(const _ of r.getAll()){if(_.type!=="bpmn:Association")continue;const S=_.waypoints??[];for(let k=1;k<S.length;k++)x+=Math.hypot(S[k].x-S[k-1].x,S[k].y-S[k-1].y)}return x},Mj=x=>{const _=[];for(const S of r.getAll()){if(S.type!=="bpmn:TextAnnotation")continue;const k=S;if(x.has(k.id))continue;const P=[...k.incoming??[],...k.outgoing??[]].filter(O=>O.type==="bpmn:Association").map(O=>O.source===k?O.target:O.source);if(!P.length||P.some(O=>O===void 0))continue;const $=O=>{if(!("waypoints"in O&&O.waypoints))return[O.id];const F=O,N=[F.source,F.target];return N.some(W=>!W)?[]:N.map(W=>W.id)},D=P.flatMap(O=>$(O));D.length&&D.every(O=>x.has(O))&&_.push(k)}return _},V1=()=>dt(Ge(r)).filter(x=>x.kind==="edge-crosses-shape").length,W1=x=>{const _=(x.children??[]).filter(_i);let S=0;for(let k=0;k<_.length;k++)for(let I=k+1;I<_.length;I++){const P=_[k],$=_[I];P.x<$.x+$.width&&P.x+P.width>$.x&&P.y<$.y+$.height&&P.y+P.height>$.y&&S++}return S},Ir=()=>{const x=Ge(r),_=S=>S.length>=2&&(S.every(k=>Math.abs(k.x-S[0].x)<.01)||S.every(k=>Math.abs(k.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=>_(S.waypoints)).length}},U1=x=>{const _=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const I=k;if(!I.waypoints||I.waypoints.length!==2)continue;const P=I.source,$=I.target;if(!P||!$)continue;const D=x.has(P.id);if(D===x.has($.id))continue;const O=D?$:P,F=w(O);if(!F||x.has(O.id))continue;const N=_.get(F.id);N?O.x<N.minX&&(N.minX=O.x):_.set(F.id,{pool:F,minX:O.x})}const S=[];for(const{pool:k,minX:I}of _.values()){const P=(k.children??[]).filter($=>_i($)&&!x.has($.id)&&$.x>=I);P.length&&S.push({subtree:P,pool:k})}return S},Cj=(x,_,S)=>{const k=new Map(_.map($=>[$.pool.id,{subtree:[...$.subtree],pool:$.pool}])),I=new Set(x);for(const $ of _)for(const D of $.subtree)I.add(D.id);let P=!1;for(;;){let $=0;for(const D of U1(I)){if(D.pool===S)continue;const O=k.get(D.pool.id);O?O.subtree.push(...D.subtree):k.set(D.pool.id,{subtree:[...D.subtree],pool:D.pool});for(const F of D.subtree)I.add(F.id);$+=D.subtree.length}if(!$)break;P=!0}return P?[...k.values()]:null},Aj=(x,_)=>{const S=new Map;for(const I of r.getAll()){if(I.type!=="bpmn:DataInputAssociation"&&I.type!=="bpmn:DataOutputAssociation")continue;const P=I,$=P.waypoints;if(!$||$.length<2||!$.every(re=>Math.abs(re.x-$[0].x)<1))continue;const D=P.source,O=P.target;if(!D||!O)continue;const F=x.has(D.id);if(F===x.has(O.id))continue;const N=F?O:D,W=w(N);if(!W||W===_||W===w(F?D:O))continue;const Y=S.get(W.id);Y?N.x<Y.minX&&(Y.minX=N.x):S.set(W.id,{pool:W,minX:N.x})}const k=[];for(const{pool:I,minX:P}of S.values()){const $=(I.children??[]).filter(D=>_i(D)&&!x.has(D.id)&&D.x>=P);$.length&&k.push({subtree:$,pool:I})}return k},q1=x=>{const _=Ge(r),S=_.shapes.filter(I=>x.has(I.id)),k=new Set;for(const I of _.edges)if(!(I.type!=="bpmn:SequenceFlow"&&I.type!=="bpmn:MessageFlow"))for(const P of Pt(I,S))k.add(`${I.id}|${P.id}`);return k},lm=new Map,Tj=Vt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const _=ie.get(x.id);return _?[{id:x.id,target:_.flow.target,source:_.flow.source}]:[]});for(const x of Tj){if(x.target===void 0)continue;const _=G.get(x.target);if(!_)continue;const S=h(x.target),k=h(x.id);if(!S||!k)continue;const I=x.source!==void 0?h(x.source):k.source,P=k.target;if(!I||!P||P.id===S.id)continue;const $=N1.get(k.id)??{waypoints:k.waypoints,label:k.label},D=$.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,O=D?$.waypoints[1].y:void 0,F=D&&$.label?{x:$.label.x,y:$.label.y}:void 0,N=F&&$.label&&Math.abs(F.y+$.label.height/2-O)<=z/5&&F.x+$.label.width>D.x?F.x+$.label.width+6:void 0,W=(I.outgoing??[]).filter(Oe=>Oe.type==="bpmn:SequenceFlow"&&Oe.id!==k.id&&Oe.target&&!jc.has(Oe.id)),Y=new Set(W.map(Oe=>Oe.target.id)),re=Oe=>{const Ot={type:"bpmn:Task",x:Oe.x+2,y:Oe.y+2,width:Oe.width-4,height:Oe.height-4};return W.find(Rt=>(Rt.waypoints??[]).some((en,ze)=>!!Rt.waypoints[ze+1]&&Po(en,Rt.waypoints[ze+1],Ot)===0))},J=eo(x.target),ee=new Set(J.map(Oe=>Oe.id)),ue=nm.has(x.target)?{autoResize:!1}:void 0,ae=Math.min(...J.map(Oe=>Oe.x)),X=Math.max(...J.map(Oe=>Oe.x+Oe.width)),fe=I.x+I.width,ye=P.x+P.width<=I.x,oe=(()=>{if(!ye)return;const Oe=w(S),Ot=((Oe==null?void 0:Oe.children)??[]).filter(qe=>_i(qe)&&!ee.has(qe.id)&&qe.type!=="bpmn:Group"&&qe.type!=="bpmn:Participant"),Rt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],en=r.getAll().filter(qe=>{if(!Rt.includes(qe.type))return!1;const Gt=qe;return Gt.id===k.id||jc.has(Gt.id)||!Gt.waypoints||Gt.waypoints.length<2?!1:![Gt.source,Gt.target].some(Nt=>!Nt||ee.has(Nt.id))}),ze=(qe,Gt)=>J.every(Nt=>{var ha;const Ct={id:Nt.id,type:Nt.type,x:Nt.x+qe,y:Nt.y+Gt,width:Nt.width,height:Nt.height};return Oe&&(Ct.x<Oe.x||Ct.x+Ct.width>Oe.x+Oe.width||Ct.y<Oe.y||Ct.y+Ct.height>Oe.y+Oe.height)||!Ip((ha=G.get(Nt.id))==null?void 0:ha.node.lane,Nt,Nt.y+Gt+Nt.height/2)||Ot.some(Qn=>Ct.x<Qn.x+Qn.width+ji&&Ct.x+Ct.width+ji>Qn.x&&Ct.y<Qn.y+Qn.height+ji&&Ct.y+Ct.height+ji>Qn.y)?!1:en.every(Qn=>{for(let Co=0;Co+1<Qn.waypoints.length;Co++)if(Po(Qn.waypoints[Co],Qn.waypoints[Co+1],Ct)<ji)return!1;return!0})}),Qe=I.x+I.width/2,_t=I.y+I.height/2,st=$.waypoints??[],It=st.length>=2&&Math.abs(st[0].y-st[1].y)<1&&st[1].x<st[0].x;return[...O!==void 0?[{cx:Qe,cy:O}]:[],...It?[{cx:I.x-Lr-S.width/2,cy:st[0].y}]:[],{cx:Qe,cy:_t+z},{cx:Qe,cy:_t-z}].find(qe=>ze(qe.cx-(S.x+S.width/2),qe.cy-(S.y+S.height/2)))})(),xe=ye&&!oe?fe:P.x,me=(()=>{var _t;if(D||ye)return 0;const Oe=$.label,Ot=((_t=k.businessObject)==null?void 0:_t.name)??"";if(!Oe||Oe.width==null||!Ot.trim())return 0;const Rt=fe+Lr,en=I.y+I.height/2-S.height/2;if(Math.min(Oe.y+Oe.height,en+S.height)-Math.max(Oe.y,en)<3||Oe.x+Oe.width-Rt<3)return 0;const Qe=Oe.x+Oe.width+wj-Rt;return Qe<=S.width?Qe:0})();me>0&&u.add(k.id);const _e=S.y+S.height/2,De=_j(J,fe+Lr+me-ae,[0,I.y+I.height/2-_e,P.y+P.height/2-_e],xe,fe,I.y+I.height/2),Fe=fe+Lr+me+De,Ie=(()=>{if(N===void 0)return 0;const Oe=fe+Lr,Ot=I.y+I.height/2-S.height/2,Rt={x:Oe,y:Ot,width:X-ae,height:S.height},en=w(I);return((en==null?void 0:en.children)??[]).some(Qe=>_i(Qe)&&!ee.has(Qe.id)&&Qe.id!==I.id&&Qe.id!==P.id&&Qe.type!=="bpmn:Group"&&Qe.type!=="bpmn:Participant"&&Qe.x<Rt.x+Rt.width&&Qe.x+Qe.width>Rt.x&&Qe.y<Rt.y+Rt.height&&Qe.y+Qe.height>Rt.y)||re(Rt)?Math.max(0,N-Oe):0})(),Ve=oe?0:X-ae+Lr*2+De+Ie+me-(ye?0:P.x-fe);let Se=[];if(Ve>0){const Oe=w(S),Ot=(Oe==null?void 0:Oe.children)??[],Rt=st=>st.type==="bpmn:Lane";Se=(()=>{const st=new Set;for(const Xe of Ot)_i(Xe)&&!ee.has(Xe.id)&&Xe.id!==I.id&&Xe.x>=xe&&st.add(Xe.id);const It=[];for(const Xe of Ot){if(Xe.type!=="bpmn:DataStoreReference"&&Xe.type!=="bpmn:DataObjectReference")continue;const qe=Xe,Nt=[...qe.incoming??[],...qe.outgoing??[]].filter(Ct=>Ct.type==="bpmn:DataInputAssociation"||Ct.type==="bpmn:DataOutputAssociation").map(Ct=>Ct.source===qe?Ct.target:Ct.source);Nt.length&&Nt.every(Ct=>Ct!==void 0&&st.has(Ct.id))&&It.push(qe)}return It})();const ze=Ot.filter(st=>!("waypoints"in st&&st.waypoints)&&!Rt(st)&&st.type!=="label"&&!ee.has(st.id)&&st.id!==I.id&&st.x>=xe),Qe=ze.flatMap(st=>st.labels??[]),_t=Oe?[Oe,...Ot.filter(st=>Rt(st))]:[];if(ze.length){const st=new Set(ze.map(pt=>pt.id)),It=U1(st),Xe=It.length?Cj(st,It,Oe):null,qe=pt=>{const At=new Set(st);for(const zt of pt)for(const Yo of zt.subtree)At.add(Yo.id);return Mj(At)},Gt=qe(It),Nt=Xe?qe(Xe):Gt,Ct=cm(st),ha=new Set(st);for(const pt of It)for(const At of pt.subtree)ha.add(At.id);const Qn=It.length?cm(ha):Ct,Co=(()=>{if(!Xe)return[];const pt=new Set(st);for(const At of Xe)for(const zt of At.subtree)pt.add(zt.id);return cm(pt)})(),ms=Xe??It,ga=(()=>{const pt=new Set(st);for(const At of ms)for(const zt of At.subtree)pt.add(zt.id);return Aj(pt,Oe)})(),Sm=ga.length?qe([...ms,...ga]):Gt,to=new Set([...ze,..._t].map(pt=>pt.id)),Mt=Ot.filter(pt=>{const At=pt.labelTarget;return pt.type==="label"&&!!At&&"waypoints"in At&&!!At.source&&!!At.target&&to.has(At.source.id)&&to.has(At.target.id)}),Pn=Sj();n.createSpace([...ze,...Qe,...Mt],_t,{x:Ve,y:0},"e",xe-1);const tn=(pt,At,zt)=>{const Yo=Ir(),jp=zt?q1(zt):null,Hp=Eo(pt,Ve,!!zt);if(!Hp)return!1;const zc=At.length?j1(At,Ve):null,Gp=Ir(),nn=!!zt&&!!jp&&[...q1(zt)].some(ya=>!jp.has(ya));return Gp.messages>Yo.messages&&Gp.lines>=Yo.lines&&!nn?!0:(zc==null||zc(),Hp(),!1)},vi=ga.length>0&&tn([...ms,...ga],Xe?Co:Qn,new Set(ga.flatMap(pt=>pt.subtree.map(At=>At.id)))),ma=!vi&&Xe?tn(Xe,Co):!1;let Ao=vi||ma;!Ao&&It.length&&(Ao=tn(It,Qn));const ys=vi?Sm:ma?Nt:Gt;if(!Ao){for(const pt of It){const At=Ir(),zt=Eo([pt],Ve);if(!zt)continue;const Yo=Ir();(Yo.messages<=At.messages||Yo.lines<At.lines)&&zt()}if(Ct.length){const pt=Ir(),At=j1(Ct,Ve);if(At){const zt=Ir();(zt.messages<=pt.messages||zt.lines<pt.lines)&&At()}}}if(Rj(Pn),ys.length){const pt=()=>new Set(dt(Ge(r)).map(zt=>ct(zt))),At=zt=>{const Yo=z1(),jp=pt(),Hp=zt.map(nn=>({a:nn,x:nn.x,y:nn.y})),zc=r.filter(nn=>nn.type==="label").map(nn=>({label:nn,x:nn.x,y:nn.y}));n.moveElements(zt,{x:Ve,y:0});const Gp=[...pt()].filter(nn=>!jp.has(nn));if(z1()<Yo&&Gp.length===0)return!0;for(const{a:nn,x:ya,y:Vc}of Hp)(nn.x!==ya||nn.y!==Vc)&&n.moveElements([nn],{x:ya-nn.x,y:Vc-nn.y});for(const nn of zc){const ya=nn.x-nn.label.x,Vc=nn.y-nn.label.y;(ya!==0||Vc!==0)&&n.moveElements([nn.label],{x:ya,y:Vc})}return!1};if(!At(ys)&&ys.length>1)for(const zt of ys)At([zt])}}}const ce=_.node.lane!==void 0?h(_.node.lane):_.node.participant!==void 0?h(_.node.participant):void 0,Re=Oe=>{if(!ce)return!0;const Ot=Oe.y+Oe.height/2;return Ot>=ce.y&&Ot<=ce.y+ce.height},Me=!Re(I)&&Re(P),Ye=Oe=>Oe.y+Oe.height/2,Ue=()=>{const Oe=I.x+I.width,Ot=P.x,Rt=Ye(P)-S.height/2,en=Ye(P)+S.height/2;return!r.getAll().some(ze=>_i(ze)&&ze.type!=="bpmn:Participant"&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:TextAnnotation"&&ze.id!==I.id&&ze.id!==P.id&&ze.id!==S.id&&ze.x<Ot&&ze.x+ze.width>Oe&&ze.y<en&&ze.y+ze.height>Rt)},at=!Me&&_.band!==void 0&&Re(P)&&!Bn(_.node.lane,_.node.participant,_.band,Ye(I))&&Bn(_.node.lane,_.node.participant,_.band,Ye(P))&&P.x>=I.x+I.width&&Ue(),Be=Me||at?P:I,Je=Be.y+Be.height/2,mt=Je-(S.y+S.height/2),Lt=_.band!==void 0,zi=Lt?[S]:J,cn=(_.band===void 0||Bn(_.node.lane,_.node.participant,_.band,Je))&&I1(x.target)&&zi.every(Oe=>{var Ot;return Ip((Ot=G.get(Oe.id))==null?void 0:Ot.node.lane,Oe,Oe.y+Oe.height/2+mt)}),Ro=Oe=>Math.abs(Oe.y+Oe.height/2-(S.y+S.height/2))<=z/2;if(cn&&Lt){const Oe=Math.abs(mt)<=z/2?J.filter(ze=>ze.id!==S.id&&Ro(ze)):[],Ot=S.y+S.height/2,en=_.band!==void 0&&!Bn(_.node.lane,_.node.participant,_.band,Ot)?J.filter(ze=>{var Qe,_t;return ze.id!==S.id&&!Oe.includes(ze)&&((Qe=G.get(ze.id))==null?void 0:Qe.band)===_.band&&((_t=G.get(ze.id))==null?void 0:_t.node.lane)===_.node.lane&&(Math.abs(ze.y+ze.height/2-Ot)<=z/2||Bn(_.node.lane,_.node.participant,_.band,ze.y+ze.height/2))}).map(ze=>({t:ze,dy:Je-(ze.y+ze.height/2)})).filter(({dy:ze})=>ze!==0):[];if(n.moveElements(J,{x:Fe-ae,y:0},void 0,ue),n.moveElements([S],{x:0,y:mt},void 0,ue),Oe.length){const ze=()=>new Set(dt(Ge(r)).map(qe=>ct(qe))),Qe=ze(),_t=r.filter(qe=>qe.type==="label").map(qe=>({label:qe,x:qe.x,y:qe.y}));n.moveElements(Oe,{x:0,y:mt});const st=ze(),It=[...st].filter(qe=>!Qe.has(qe)).length,Xe=[...Qe].filter(qe=>!st.has(qe)).length;if(It>Xe){n.moveElements(Oe,{x:0,y:-mt});for(const qe of _t){const Gt=qe.x-qe.label.x,Nt=qe.y-qe.label.y;(Gt!==0||Nt!==0)&&n.moveElements([qe.label],{x:Gt,y:Nt})}}}if(en.length){const ze=new Set(J.map(Qe=>Qe.id));for(const{t:Qe,dy:_t}of en)ge(Qe.parent,Qe,Qe.x+Qe.width/2,Qe.y+Qe.height/2+_t,ze)||n.moveElements([Qe],{x:0,y:_t})}}else n.moveElements(J,{x:Fe-ae,y:cn?mt:0},void 0,ue);const Vn=w(S);if(!cn&&_.node.lane===void 0&&_.band!==void 0&&Vn){const Oe=Vn.y+he+In(`pool:${_.node.participant??""}`,_.band)*z,Ot=Oe-(S.y+S.height/2);Ot!==0&&!ge(Vn,S,S.x+S.width/2,Oe,ee)&&n.moveElements([S],{x:0,y:Ot},void 0,ue)}if(oe)n.moveElements(J,{x:oe.cx-(S.x+S.width/2),y:oe.cy-(S.y+S.height/2)},void 0,ue);else if(Vn){const Oe=(Vn.children??[]).filter(ze=>_i(ze)&&!ee.has(ze.id)&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:Participant"),Ot=(ze,Qe,_t,st,It)=>ze.x+Qe<It.x+It.width+st&&ze.x+Qe+ze.width+st>It.x&&ze.y+_t<It.y+It.height+st&&ze.y+_t+ze.height+st>It.y,Rt=Oe.find(ze=>Ot(S,0,0,0,ze)),en=Rt?void 0:re(S);if(Rt||en){const ze=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Qe=r.getAll().filter(Mt=>{if(!ze.includes(Mt.type))return!1;const Pn=Mt;return jc.has(Pn.id)||!Pn.waypoints||Pn.waypoints.length<2?!1:![Pn.source,Pn.target].some(tn=>!tn||ee.has(tn.id))}),_t=(Mt,Pn,tn)=>{var vi;return Ip((vi=G.get(Mt.id))==null?void 0:vi.node.lane,Mt,Mt.y+tn+Mt.height/2)&&Mt.x+Pn>=Vn.x&&Mt.x+Pn+Mt.width<=Vn.x+Vn.width&&Mt.y+tn>=Vn.y&&Mt.y+tn+Mt.height<=Vn.y+Vn.height},st=(Mt,Pn)=>J.every(tn=>_t(tn,Mt,Pn)&&!Oe.some(vi=>Ot(tn,Mt,Pn,ji,vi))&&Qe.every(vi=>{const ma={id:tn.id,type:tn.type,x:tn.x+Mt,y:tn.y+Pn,width:tn.width,height:tn.height};for(let Ao=0;Ao+1<vi.waypoints.length;Ao++)if(Po(vi.waypoints[Ao],vi.waypoints[Ao+1],ma)<ji)return!1;return!0})),It=S.y+S.height/2,Xe=[O,P.y+P.height/2].filter(Mt=>Mt!==void 0&&Math.abs(Mt-It)>=1),qe=Rt&&Y.has(Rt.id)?Rt:en==null?void 0:en.target,Gt=qe?qe.x-S.x:0,Nt=Math.max(...J.map(Mt=>Mt.x+Mt.width)),Ct=[...Gt!==0?[Gt]:[],...De!==0?[-De]:[],0],ha=N===void 0?[]:Ct.map(Mt=>Math.max(Mt,N-S.x)),Qn=Mt=>Nt+Mt+Lr<=P.x,Co=[...new Set([...ha,...Ct])].filter(Qn),ms=Rt&&Y.has(Rt.id)?[Rt.x+Rt.width+Lr-S.x]:[],ga=N===void 0?[]:ms.map(Mt=>Math.max(Mt,N-S.x)),Sm=[...new Set([...ga,...ms])].filter(Mt=>Qn(Mt)&&!Co.includes(Mt));let to;for(const Mt of[Co,Sm]){for(const Pn of Xe){for(const tn of Mt)if(st(tn,Pn-It)){to={dx:tn,dy:Pn-It};break}if(to)break}if(to)break}if(to){const Mt=pt=>{const At=pt;return[At.edge,At.other,...Array.isArray(At.edges)?At.edges:[]].some(zt=>typeof zt=="string"&&jc.has(zt))},Pn=()=>new Set(dt(Ge(r)).filter(pt=>!Mt(pt)).map(pt=>ct(pt))),tn=Pn(),vi=r.filter(pt=>pt.type==="label").map(pt=>({label:pt,x:pt.x,y:pt.y}));n.moveElements(J,{x:to.dx,y:to.dy},void 0,ue);const ma=Pn(),Ao=[...ma].filter(pt=>!tn.has(pt)).length,ys=[...tn].filter(pt=>!ma.has(pt)).length;if(Ao>ys){n.moveElements(J,{x:-to.dx,y:-to.dy},void 0,ue);for(const pt of vi){const At=pt.x-pt.label.x,zt=pt.y-pt.label.y;(At!==0||zt!==0)&&n.moveElements([pt.label],{x:At,y:zt})}}else D&&lm.set(k.id,{exit:D,channelY:O,label:F})}}}{const Oe=new Set(J.map(Qe=>Qe.id)),Ot=new Set(q.map(Qe=>Qe.flow.id)),Rt=20,en=Qe=>{const _t=Qe.source,st=Qe.target,It=Math.min(_t.x,st.x)-Rt,Xe=Math.max(_t.x+_t.width,st.x+st.width)+Rt,qe=Math.min(_t.y,st.y)-Rt,Gt=Math.max(_t.y+_t.height,st.y+st.height)+Rt;return Qe.waypoints.some(Nt=>Nt.x<It||Nt.x>Xe||Nt.y<qe||Nt.y>Gt)},ze=new Map;for(const Qe of J)for(const _t of[...Qe.incoming??[],...Qe.outgoing??[]])(ie.has(_t.id)||_t.id!==x.id&&Ot.has(_t.id))&&!(Oe.has(_t.source.id)&&Oe.has(_t.target.id))&&ze.set(_t.id,_t);for(const Qe of ze.values())en(Qe)&&Fc(Qe)}const Mo=Se.length?w(Se[0]):void 0;if(Mo){const Oe={assoc:G1(),overlaps:W1(Mo),crosses:V1()},Ot=Se.map(Xe=>({st:Xe,x:Xe.x})),Rt=r.filter(Xe=>Xe.type==="label").map(Xe=>({label:Xe,x:Xe.x,y:Xe.y})),en=Math.min(...Se.flatMap(Xe=>[...Xe.incoming??[],...Xe.outgoing??[]].filter(qe=>qe.type==="bpmn:DataInputAssociation"||qe.type==="bpmn:DataOutputAssociation").map(qe=>(qe.source===Xe?qe.target:qe.source).x))),ze=new Set(Se.map(Xe=>Xe.id)),Qe=(Mo.children??[]).filter(_i).filter(Xe=>!ze.has(Xe.id));let _t=en;for(const Xe of[...Se].sort((qe,Gt)=>qe.x-Gt.x)){let qe=_t;for(let Gt=0;Gt<100;Gt++){const Nt=Qe.find(Ct=>qe<Ct.x+Ct.width+Hi&&qe+Xe.width+Hi>Ct.x&&Xe.y<Ct.y+Ct.height&&Xe.y+Xe.height>Ct.y);if(!Nt)break;qe=Nt.x+Nt.width+Hi}qe!==Xe.x&&n.moveElements([Xe],{x:qe-Xe.x,y:0}),_t=qe+Xe.width+Hi}const st=_t+150-(Mo.x+Mo.width);st>0&&ps(Mo,Mo.width+st);const It={assoc:G1(),overlaps:W1(Mo),crosses:V1()};if(It.assoc>=Oe.assoc||It.overlaps>Oe.overlaps||It.crosses>Oe.crosses){for(const{st:Xe,x:qe}of Ot)Xe.x!==qe&&n.moveElements([Xe],{x:qe-Xe.x,y:0});st>0&&ps(Mo,Mo.width-st);for(const Xe of Rt){const qe=Xe.x-Xe.label.x,Gt=Xe.y-Xe.label.y;(qe!==0||Gt!==0)&&n.moveElements([Xe.label],{x:qe,y:Gt})}}}}for(const[x,_]of nm){const S=h(x);if(!S)continue;const k=_.container,I=Math.abs(S.y+S.height/2-k.y-_.relCy)>=.5,P=S.label,$=Math.min(S.y,P&&!P.hidden?P.y:S.y),D=Math.max(S.y+S.height,P&&!P.hidden?P.y+P.height:0);if(I&&$>=k.y&&D<=k.y+k.height)continue;const O=S.y;_.grow(),S.y!==O&&n.moveElements([S],{x:0,y:O-S.y},void 0,{autoResize:!1})}const Y1=(x,_)=>{const S=_.target===x,k=m(_.source),I=m(_.target),P=S?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,I,_.id?{type:P,businessObject:i.create(P,{id:_.id})}:{type:P})},um=x=>{for(const _ of b){if(!_.participant.blackBox)continue;const S=h(_.participant.id);if(!S)continue;const k=[];for(const P of B){const $=P.flow.source===_.participant.id?P.flow.target:P.flow.target===_.participant.id?P.flow.source:void 0,D=$?h($):void 0;D&&typeof D.x=="number"&&D.type!=="bpmn:Participant"&&k.push(D)}if(!k.length)continue;if(!x&&_.order===void 0){const P=(()=>{var D;const $=new Map;for(const O of k){const F=w(O);if(!F)continue;const N=$.get(F.id);N?N.n+=1:$.set(F.id,{shape:F,n:1})}return(D=[...$.values()].sort((O,F)=>F.n-O.n)[0])==null?void 0:D.shape})();if(P){const $=F=>F.reduce((N,W)=>N+W,0)/F.length,D=$(k.map(F=>F.y+F.height/2))<P.y+P.height/2,O=r.filter(F=>F.type==="bpmn:Participant"&&F.id!==_.participant.id&&F.id!==P.id).filter(F=>D?F.y+F.height<=P.y+5:F.y>=P.y+P.height-5);if(O.length){const F=[...O.reduce((ye,oe)=>ye.set(oe.y,(ye.get(oe.y)??0)+1),new Map)].sort((ye,oe)=>oe[1]-ye[1]||(D?oe[0]-ye[0]:ye[0]-oe[0]))[0][0],N=Math.min(S.width,$T),W=FT,Y=k.map(ye=>ye.x+ye.width/2),re=Math.round($(Y)-N/2),J=Math.max(...Y)+zd,ee=ye=>({x:ye,width:Math.max(N,J-ye)}),ue=O.filter(ye=>Math.min(ye.y+ye.height,F+W)-Math.max(ye.y,F)>0),ae=ye=>{const oe=ee(ye);return ue.some(xe=>xe.x<oe.x+oe.width&&oe.x<xe.x+xe.width)},X=ye=>{const oe=ee(ye);return Y.filter(xe=>xe>=oe.x+10&&xe<=oe.x+oe.width-10).length},fe=(()=>{if(!ae(re))return re;const ye=X(re);return ue.flatMap(oe=>[oe.x+oe.width+Av,oe.x-Av-N]).map(oe=>Math.round(oe)).filter(oe=>!ae(oe)&&X(oe)>=ye).sort((oe,xe)=>Math.abs(oe-re)-Math.abs(xe-re))[0]??re})();if(fe!==S.x||F!==S.y||N!==S.width||W!==S.height){const ye=()=>new Set(dt(Ge(r)).map(Fe=>ct(Fe))),oe=ye(),xe={x:S.x,y:S.y,width:S.width,height:S.height};n.resizeShape(S,{x:fe,y:F,width:N,height:W});const me=ye(),_e=[...me].filter(Fe=>!oe.has(Fe)).length,De=[...oe].filter(Fe=>!me.has(Fe)).length;_e>De&&n.resizeShape(S,xe)}}}}const I=Math.max(...k.map(P=>P.x+P.width/2))+zd;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 P of B){const $=h(P.flow.id),D=P.flow.source===_.participant.id?P.flow.target:P.flow.target===_.participant.id?P.flow.source:void 0,O=D?h(D):void 0;if(!$||!O||O.type==="bpmn:Participant")continue;const F=O.x+O.width/2;F<S.x+10||F>S.x+S.width-10||H1($,S,O)}}};um(!1);for(const x of B){const _=x.flow;n.connect(m(_.source),m(_.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:_.id,name:_.name})})}{const S=new Set([...q.map(O=>O.flow.id),...B.map(O=>O.flow.id)].filter(O=>!!O)),k=r.filter(O=>!!O.waypoints),I=(O,F)=>Math.abs(F.x-O.x)<2?"L":Math.abs(F.x-(O.x+O.width))<2?"R":Math.abs(F.y-O.y)<2?"T":Math.abs(F.y-(O.y+O.height))<2?"B":void 0,P=new Map,$=(O,F,N)=>{if(!O||!F||typeof O.x!="number")return;const W=I(O,F);if(!W)return;let Y=P.get(O.id);Y||P.set(O.id,Y=new Map),Y.set(W,[...Y.get(W)??[],N])};for(const O of k){const F=O.waypoints;!F||F.length<2||($(O.source,F[0],{id:O.id,dir:"out"}),$(O.target,F[F.length-1],{id:O.id,dir:"in"}))}const D=new Set;for(const[O,F]of P){const N=h(O);if(!N||typeof N.x!="number")continue;const W=X=>{var ye;const fe=(ye=h(X.id))==null?void 0:ye.source;return!!fe&&typeof fe.x=="number"&&fe.x+fe.width/2>N.x+N.width/2};if(![...F.values()].some(X=>X.length>=3&&X.some(fe=>fe.dir==="out")&&X.some(fe=>fe.dir==="in"&&S.has(fe.id)&&W(fe))))continue;const re=w(N);if(!re||D.has(re.id)||(re.children??[]).some(X=>X.type==="bpmn:Lane"))continue;const J=(wR=F.get("T"))!=null&&wR.length?(_R=F.get("B"))!=null&&_R.length?void 0:"B":"T";if(!J||(J==="T"?N.y-re.y:re.y+re.height-(N.y+N.height))>=z)continue;const ue=(re.children??[]).filter(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="label"&&typeof X.x=="number"),ae=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+z}),Fi(ae,re.id,z),J==="T"&&ue.length&&n.moveElements(ue,{x:0,y:z}),D.add(re.id)}}const pm=20,dm=4,Pj=3,kj=2,K1=2,fm=[10,30,80],yi=()=>{const x=Ge(r);return{bad:dt(x).filter(_=>_.kind==="edge-crosses-shape"||_.kind==="edge-overlap-opposite"||_.kind==="edge-overlap-mixed").length,crossings:vy(x),straight:x.edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.waypoints.length===2).length}},So=x=>{const _=Ge(r),S=_.edges.find(k=>k.id===x);return S?Pt(S,hn(_)).length:0},da=x=>So(x)>0,ds=x=>Ge(r).edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.id!==x&&_.waypoints.length===2).length,X1=(x,_,S)=>Eo([{subtree:x,pool:_}],S),Z1=(x,_)=>_.bad>x.bad||_.crossings>x.crossings&&_.straight<=x.straight&&_.bad>=x.bad,Br=(x,_)=>Z1(x,_)||_.straight<x.straight,Nr=(x,_,S=()=>!0,k=Z1,I=!1)=>{const P=yi(),$=Eo(x,_,I);if(!$)return!1;const D=yi();return k(P,D)||!S()?($(),!1):!0},J1=(x,_,S,k=()=>!0)=>Nr([{subtree:x,pool:_}],S,k),qo=x=>{var _;return!!((_=G.get(x))!=null&&_.node.participant)},fs=new Map;for(const x of B){if(!qo(x.flow.target))continue;const _=fs.get(x.flow.target)??[];_.push(x),fs.set(x.flow.target,_)}const Hc=[...fs.keys()],hm=new Set(q.map(x=>x.flow.target)),Q1=x=>Bp.findIndex(({op:_})=>_.participant.id===x);Hc.sort((x,_)=>{var I,P;const S=hm.has(x)?1:0,k=hm.has(_)?1:0;return S!==k?S-k:Q1((I=G.get(x))==null?void 0:I.node.participant)-Q1((P=G.get(_))==null?void 0:P.node.participant)});const Gi=x=>x.x+x.width/2,Oj=x=>{const _=new Map;for(const I of r.getAll()){const P=I;if(!P.waypoints||!P.source||!P.target)continue;(_.get(P.source.id)??_.set(P.source.id,[]).get(P.source.id)).push(P.target.id)}const S=new Set([x]),k=[x];for(let I=0;I<k.length;I++)for(const P of _.get(k[I])??[])S.has(P)||(S.add(P),k.push(P));return S},Dj=(x,_)=>{const S=Oj(_);let k;for(const I of r.getAll()){const P=I;if(P.type!=="bpmn:MessageFlow"||!P.source||!P.target||P.target.id!==x||S.has(P.source.id))continue;const $=P.source;if(typeof $.x!="number"||$.type==="bpmn:Participant")continue;const D=Gi($);(k===void 0||D>k)&&(k=D)}return k},gm=(x,_)=>{const S=h(x.flow.source);if(S)return S.type==="bpmn:Participant"?Dj(S.id,_):Gi(S)},eR=x=>{let _;for(const S of fs.get(x)??[]){const k=gm(S,x);k!==void 0&&(!_||k>_.cx)&&(_={op:S,cx:k})}return _==null?void 0:_.op},Lj=x=>{const _=eR(x),S=h(x),k=_?gm(_,x):void 0;return S&&k!==void 0?k-Gi(S):void 0},tR=x=>{const _=Lj(x);return _!==void 0&&Math.abs(_)<pm},Gc=(x,_,S,k,I)=>{var P;for(let $=!0;$;){$=!1;for(const D of B){if(D.flow.id===S)continue;const O=_.has(D.flow.source),F=_.has(D.flow.target);if(O===F||k(O?D.flow.source:D.flow.target))continue;const N=O?D.flow.target:D.flow.source;if(I(N)||!qo(N))continue;const W=h(D.flow.id);if(!(W!=null&&W.waypoints)||W.waypoints.length!==2)continue;const Y=h(N),re=(P=G.get(N))==null?void 0:P.node.participant;if(!Y||!re)continue;const J=eo(N,ee=>ee.x>=Y.x).filter(ee=>!_.has(ee.id));if(!(!J.length||J.some(ee=>I(ee.id)))){for(const ee of J)_.add(ee.id);x.set(re,[...x.get(re)??[],...J]),$=!0}}}return[...x].map(([$,D])=>({subtree:D,pool:m($)}))},mm=(x,_,S,k,I)=>Gc(new Map([[_,[...x]]]),new Set(x.map(P=>P.id)),k,P=>P===S,P=>P===I),ym=x=>{const _=eR(x);if(!_)return null;const S=h(x),k=h(_.flow.source),I=gm(_,x);if(!S||!k||I===void 0)return null;const P=I-Gi(S);if(P>=pm){const $=G.get(x).node.participant,D=eo(x,F=>F.x>=S.x),O=eo(x,F=>F.x>=S.x&&!tR(F.id));return{groups:mm(D,$,x,_.flow.id,_.flow.source),dx:P,cut:O.length<D.length?mm(O,$,x,_.flow.id,_.flow.source):void 0}}if(-P>=pm&&qo(_.flow.source)){const $=G.get(_.flow.source).node.participant,D=eo(_.flow.source,O=>O.x>=k.x&&!tR(O.id));return{groups:mm(D,$,_.flow.source,_.flow.id,x),dx:-P}}return null},nR=()=>Hc.map(x=>({id:x,plan:ym(x)})).filter(x=>!!x.plan).sort((x,_)=>Math.min(...x.plan.groups.flatMap(S=>S.subtree.map(k=>k.x)))-Math.min(..._.plan.groups.flatMap(S=>S.subtree.map(k=>k.x)))).map(x=>x.id),iR=()=>{var k;const x=r.getAll().filter(_i).filter(I=>I.type!=="bpmn:Participant"&&I.type!=="bpmn:Group").map(I=>[I.x,I.x+I.width]).sort((I,P)=>I[0]-P[0]);let _=((k=x[0])==null?void 0:k[1])??0,S=0;for(const[I,P]of x.slice(1))I>_&&(S=Math.max(S,I-_)),_=Math.max(_,P);return S},oR=x=>{if(!x.cut)return Eo(x.groups,x.dx);const _=Eo(x.groups,x.dx,!0);if(!_)return null;const S=yi(),k=iR();_();const I=Eo(x.cut,x.dx,!0);if(I){const P=yi();if(P.bad<=S.bad&&P.crossings<=S.crossings&&P.straight>=S.straight&&iR()<k)return I;I()}return Eo(x.groups,x.dx)};for(let x=0;x<3;x++){const _=yi(),S=[];for(const I of nR()){const P=ym(I);if(!P)continue;const $=oR(P);$&&S.push($)}if(!S.length)break;if(!Br(_,yi()))continue;for(const I of S.reverse())I();let k=!1;for(const I of nR()){const P=ym(I);if(!P)continue;const $=yi(),D=oR(P);D&&(Br($,yi())?D():k=!0)}if(!k)break}for(const x of Hc){if(hm.has(x))continue;const _=G.get(x);if(!_||_.node.lane!==void 0)continue;const S=bt(_);if(S===void 0)continue;const k=h(x),I=k?w(k):void 0;if(!k||!I)continue;const P=I.y+he+In(`pool:${_.node.participant??""}`,S)*z,$=P-(k.y+k.height/2);$!==0&&!ge(I,k,k.x+k.width/2,P)&&n.moveElements([k],{x:0,y:$})}const $p=()=>{const x=r.filter(k=>k.type==="bpmn:Participant"),_=new Map(x.map(k=>[k.id,k]));let S=0;for(const{pools:[k,I]}of Ed(x)){const P=_.get(k),$=_.get(I);S+=(Math.min(P.x+P.width,$.x+$.width)-Math.max(P.x,$.x))*(Math.min(P.y+P.height,$.y+$.height)-Math.max(P.y,$.y))}return S},vm=new Set,rR=new Set;for(let x=0,_=!0;_&&x<Pj;x++){_=!1;for(const S of Hc.flatMap(k=>fs.get(k)??[])){if(vm.has(S.flow.id)||!da(S.flow.id))continue;const k=h(S.flow.target);if(!k)continue;const I=m(G.get(S.flow.target).node.participant),P=eo(S.flow.target,N=>N.x>=k.x),$=k.width+Q,D=So(S.flow.id),O=ds(S.flow.id),F=$p();for(let N=1;N<=dm;N++){const W=()=>So(S.flow.id)>=D||$p()>F?!1:ds(S.flow.id)>=O?!0:(rR.add(S.flow.id),!1);if(J1(P,I,$*N,W)){vm.add(S.flow.id),_=!0;break}}}}const aR=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const _=x.source,S=x.target;return!!_&&!!S&&S.x+S.width<_.x}).length;for(const x of Hc.flatMap(_=>fs.get(_)??[])){if(vm.has(x.flow.id)||!rR.has(x.flow.id)||!da(x.flow.id))continue;const _=h(x.flow.target);if(!_)continue;const S=m(G.get(x.flow.target).node.participant),k=eo(x.flow.target,Y=>Y.x>=_.x),I=new Set(k.map(Y=>Y.id)),P=new Map;for(const Y of r.filter(re=>re.type==="bpmn:MessageFlow")){if(((ER=Y.waypoints)==null?void 0:ER.length)!==2||!Y.source||!Y.target)continue;const re=I.has(Y.source.id);if(re===I.has(Y.target.id))continue;const J=re?Y.target:Y.source,ee=(SR=G.get(J.id))==null?void 0:SR.node.participant;!ee||P.has(J.id)||P.set(J.id,{subtree:[J],pool:m(ee)})}if(!P.size)continue;const $=_.width+Q,D=So(x.flow.id),O=ds(x.flow.id),F=$p(),N=aR(),W=()=>So(x.flow.id)<D&&ds(x.flow.id)>=O&&$p()<=F&&aR()<=N;for(let Y=1;Y<=kj&&!Nr([{subtree:k,pool:S},...P.values()],$*Y,W);Y++);}const xm=B.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),sR=new Set(xm.map(x=>x.id));for(const x of r.filter(_=>_.type==="bpmn:MessageFlow"))sR.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&xm.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of xm){if(!da(x.id))continue;const _=h(x.source),S=h(x.target);if(!_||!S)continue;let k,I,P,$;const D=_.type==="bpmn:Participant",O=S.type==="bpmn:Participant";if(D!==O){const[N,W]=D?[S,_]:[_,S];if(k=Gi(N),k<W.x||k>W.x+W.width)continue;if([I,P]=N.y<W.y?[N.y+N.height,W.y]:[W.y+W.height,N.y],!x.preexisting){const Y=w(N);if(!Y)continue;$=[Math.min(Y.y,W.y),Math.max(Y.y,W.y)]}}else{if(D||(k=_.x+_.width/2,Math.abs(k-(S.x+S.width/2))>15))continue;[I,P]=_.y<S.y?[_.y+_.height,S.y]:[S.y+S.height,_.y]}const F=[...G.values()].map(N=>h(N.node.id)).filter(N=>!!N&&N.id!==_.id&&N.id!==S.id).filter(N=>N.x<=k&&k<=N.x+N.width&&N.y+N.height>I&&N.y<P).sort((N,W)=>N.x-W.x);for(const N of F){const W=(RR=G.get(N.id))==null?void 0:RR.node.participant,Y=W?h(W):void 0;if(!W||!Y||$&&!(Y.y>$[0]&&Y.y<$[1]))continue;const re=[...G.values()].filter(xe=>xe.node.participant===W).map(xe=>xe.node.id),J=xe=>xe.map(me=>h(me)).filter(me=>!!me),ue=[Ej(N.id,xe=>{var me;return((me=G.get(xe.id))==null?void 0:me.node.participant)===W}),J(re)].filter(xe=>xe.length).map(xe=>[{subtree:xe,pool:Y}]);if(x.preexisting||$){const xe=J(re);xe.length&&ue.push(Gc(new Map([[W,[...xe]]]),new Set(xe.map(me=>me.id)),x.id,()=>!1,me=>me===_.id||me===S.id))}const ae=N.width+Q,X=So(x.id),fe=ds(x.id),ye=()=>So(x.id)<X&&ds(x.id)>=fe;let oe=!1;for(const xe of ue){for(let me=1;me<=dm;me++)if(Nr(xe,ae*me,ye)){oe=!0;break}if(oe)break}if(!da(x.id))break}}const hs=()=>{var _;const x=new Set;for(const S of dt(Ge(r)))S.kind!=="edge-crosses-shape"||sR.has(S.edge)||((_=h(S.edge))==null?void 0:_.type)==="bpmn:MessageFlow"&&x.add(`${S.edge}>${S.shape}`);return x},bm=(x,_)=>yi().bad>=x&&[...hs()].some(S=>!_.has(S)),wm=x=>{var _,S;return So(x)===0&&((S=(_=h(x))==null?void 0:_.waypoints)==null?void 0:S.length)===2},Ij=(x,_,S)=>{const k=new Set(x.flatMap(P=>P.subtree.map($=>$.id))),I=[...hs()].filter(P=>!S.has(P)).map(P=>P.split(">")[1]);return[...new Set(I)].filter(P=>k.has(P)&&P!==_.source&&P!==_.target)},Bj=(x,_,S,k,I)=>{const P=x.map(F=>({...F,subtree:F.subtree.filter(N=>!I.includes(N.id))})).filter(F=>F.subtree.length),$=new Set(P.flatMap(F=>F.subtree.map(N=>N.id))),D=()=>I.every(F=>{const N=h(F);return!!N&&q.filter(W=>W.flow.target===F&&$.has(W.flow.source)).every(W=>{const Y=h(W.flow.source);return!!Y&&Y.x+Y.width<=N.x})});return Nr(P,_,()=>wm(S.id)&&[...hs()].every(F=>k.has(F))&&D(),Br,!0)},Fp=(x,_,S,k)=>{let I=0;for(const P of x){const $=h(P.id);for(const D of[...($==null?void 0:$.incoming)??[],...($==null?void 0:$.outgoing)??[]]){if(D.type!=="bpmn:SequenceFlow")continue;const O=D.waypoints??[];for(let F=0;F+1<O.length;F++){const N=O[F],W=O[F+1];if(Math.abs(N.y-W.y)<.5)Math.min(N.x,W.x)<_&&_<Math.max(N.x,W.x)&&S<N.y&&N.y<k&&I++;else if(Math.abs(N.x-W.x)>=.5){const Y=(_-N.x)/(W.x-N.x);if(Y<=0||Y>=1)continue;const re=N.y+Y*(W.y-N.y);S<re&&re<k&&I++}}}}return I};for(const x of B){if(!da(x.flow.id))continue;const _=h(x.flow.id);if(((MR=_==null?void 0:_.waypoints)==null?void 0:MR.length)!==2)continue;const S=h(x.flow.source),k=h(x.flow.target);if(!S||!k||S.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!qo(x.flow.source)||!qo(x.flow.target)||Math.abs(Gi(S)-Gi(k))>K1)continue;const I=Gi(S),P=_.waypoints.map(ae=>ae.y),[$,D]=[Math.min(...P),Math.max(...P)],O=hn(Ge(r)).filter(ae=>ae.id!==S.id&&ae.id!==k.id&&ae.x<I&&I<ae.x+ae.width&&$<ae.y+ae.height&&ae.y<D);if(!O.length)continue;const F=(CR=G.get(x.flow.source))==null?void 0:CR.node.participant,N=(AR=G.get(x.flow.target))==null?void 0:AR.node.participant;if(!F||!N)continue;const W=new Map;for(const[ae,X,fe]of[[x.flow.source,S,F],[x.flow.target,k,N]]){const ye=W.get(fe)??[],oe=eo(ae,xe=>xe.x>=X.x).filter(xe=>!ye.some(me=>me.id===xe.id));W.set(fe,[...ye,...oe])}const Y=new Set([...W.values()].flat().map(ae=>ae.id)),re=Gc(W,Y,x.flow.id,ae=>ae===x.flow.source||ae===x.flow.target,()=>!1),J=Math.max(...O.map(ae=>ae.x+ae.width)),ee=Math.min(...O.map(ae=>ae.x)),ue=fm[0];if(Fp(O,J+ue,$,D)>0&&Fp(O,ee-ue,$,D)===0){let ae=!1;for(const X of fm){const fe=ee-X-I;if(fe>=0)continue;const ye=yi().bad,oe=hs();if(ae=Nr(re,fe,()=>wm(x.flow.id)&&!bm(ye,oe),Br),ae)break}if(ae){f.add(x.flow.id);continue}}for(const ae of fm){const X=J+ae-I;if(X<=0)continue;const fe=yi().bad,ye=hs();let oe=[],xe=!0;const me=()=>!wm(x.flow.id)||xe&&(oe=Ij(re,x.flow,ye),oe.length)?!1:!bm(fe,ye);if(Nr(re,X,me,Br))break;if(oe.length&&(Bj(re,X,x.flow,ye,oe)||(xe=!1,Nr(re,X,me,Br))))break}}{const x=P=>P.y+P.height/2,_=/(Task|Event|Gateway|CallActivity|SubProcess)$/,S=()=>{const P=Ge(r),$=new Set(dt(P).flatMap(F=>F.kind==="edge-crosses-shape"?[`${F.edge}|${F.shape}`]:[])),D=P.shapes.filter(F=>!F.container&&_.test(F.type)),O=new Set;for(const F of P.edges){if(F.type!=="bpmn:SequenceFlow"&&F.type!=="bpmn:MessageFlow")continue;const N=new Set(F.endpoints);for(const W of[F.waypoints[0],F.waypoints[F.waypoints.length-1]])for(const Y of D)Y.x-4<=W.x&&W.x<=Y.x+Y.width+4&&Y.y-4<=W.y&&W.y<=Y.y+Y.height+4&&N.add(Y.id);for(const W of D)if(!(N.has(W.id)||$.has(`${F.id}|${W.id}`))){for(let Y=0;Y+1<F.waypoints.length;Y++)if(Po(F.waypoints[Y],F.waypoints[Y+1],W)<=sm){O.add(`${F.id}|${W.id}`);break}}}return O},k=()=>({...yi(),grazes:S()}),I=[];for(const P of G.keys()){if(!qo(P))continue;const $=q.filter(F=>F.flow.target===P);if($.length!==1)continue;const D=h($[0].flow.source),O=h(P);!D||!O||!G.has(D.id)||Math.abs(x(D)-x(O))>1||O.x-(D.x+D.width)<=Q+1||I.push({id:P,pred:D,node:O})}I.sort((P,$)=>P.node.x-$.node.x);for(const{id:P}of I){const $=G.get(P),D=h(P),O=h(q.find(fe=>fe.flow.target===P).flow.source);if(!D||!O)continue;const F=D.x-(O.x+O.width);if(F<=Q+1)continue;const N=m($.node.participant),W=eo(P,fe=>fe.x>=D.x),Y=-(F-Q),re=(fe,ye)=>ye.bad>fe.bad||ye.crossings>fe.crossings||ye.crossings===fe.crossings&&ye.bad===fe.bad||ye.straight<fe.straight||[...ye.grazes].some(oe=>!fe.grazes.has(oe)),J=Gc(new Map([[$.node.participant,[...W]]]),new Set(W.map(fe=>fe.id)),"",()=>!1,()=>!1),ee=J.some(fe=>fe.pool!==N)||J.reduce((fe,ye)=>fe+ye.subtree.length,0)>W.length,ue=k(),ae=X1(W,N,Y);if(!ae)continue;const X=k();if(ee&&!re(ue,X)){ae();const fe=Eo(J,Y);if(fe){const ye=k();if(!re(ue,ye)&&ye.bad<=X.bad&&ye.crossings<=X.crossings)continue;fe()}X1(W,N,Y);continue}re(ue,X)&&ae()}}um(!0);const Nj=new Set(b.filter(x=>x.participant.blackBox).map(x=>x.participant.id)),cR=x=>{const _=Ge(r),S=hn(_);return _.edges.filter(k=>{if(k.type!=="bpmn:MessageFlow"||k.id===x)return!1;if(k.waypoints.length===2)return!0;const I=h(k.id),[P,$]=[I==null?void 0:I.source,I==null?void 0:I.target];if(!P||!$||P.type==="bpmn:Participant"==($.type==="bpmn:Participant"))return!1;const[D,O]=P.type==="bpmn:Participant"?[P,$]:[$,P];if(!Nj.has(D.id))return!1;const F=Gi(O);if(F<=D.x+D.width-10)return!1;const N=D.y>O.y,W=[{x:F,y:N?O.y+O.height:O.y},{x:F,y:N?D.y:D.y+D.height}];return!Pt({...k,waypoints:W},S).length}).length};let lR=!1;for(const x of B){if(!da(x.flow.id))continue;const _=h(x.flow.source),S=h(x.flow.target);if(!_||!S)continue;const k=_.type==="bpmn:Participant";if(k===(S.type==="bpmn:Participant"))continue;const[I,P]=k?[S,_]:[_,S],$=Gi(I);if($<P.x+10||$>P.x+P.width-10)continue;const D=(TR=G.get(I.id))==null?void 0:TR.node.participant;if(!D)continue;const[O,F]=I.y<P.y?[I.y+I.height,P.y]:[P.y+P.height,I.y],N=[...G.values()].filter(J=>J.node.participant===D&&J.node.id!==I.id).map(J=>h(J.node.id)).filter(J=>!!J&&J.x<$&&$<J.x+J.width&&J.y+J.height>O&&J.y<F).sort((J,ee)=>J.x-ee.x);if(!N.length)continue;const W=hn(Ge(r)).filter(J=>J.id!==I.id&&J.id!==P.id);let Y=!1;for(let J=I.x+10;J<=I.x+I.width-10&&!Y;J+=5)Y=!W.some(ee=>ee.x<J&&J<ee.x+ee.width&&ee.y<F&&ee.y+ee.height>O);if(Y)continue;const re=m(D);for(const J of N){const ee=eo(J.id,ye=>ye.x>=J.x);if(ee.some(ye=>ye.id===I.id))continue;const ue=J.width+Q,ae=So(x.flow.id),X=cR(x.flow.id),fe=()=>So(x.flow.id)<ae&&cR(x.flow.id)>=X;for(let ye=1;ye<=dm;ye++)if(J1(ee,re,ue*ye,fe)){lR=!0;break}if(!da(x.flow.id))break}}lR&&um(!0);const gs=40;{const S=/(Task|Event|Gateway|CallActivity|SubProcess)$/,k=D=>{var J,ee;const O=h(D),F=O==null?void 0:O.waypoints;if(!O||!F||F.length!==2||Math.abs(F[0].x-F[1].x)>.5)return[];const N=F[0].x,W=Math.min(F[0].y,F[1].y),Y=Math.max(F[0].y,F[1].y),re=[];for(const ue of hn(Ge(r))){if(!S.test(ue.type)||ue.id===((J=O.source)==null?void 0:J.id)||ue.id===((ee=O.target)==null?void 0:ee.id))continue;const ae=ue.y+ue.height/2;if(!(W<ae&&ae<Y))continue;let X,fe;if(N<=ue.x)X="L",fe=ue.x-N;else if(N>=ue.x+ue.width)X="R",fe=N-ue.x-ue.width;else continue;if(fe>80||!Fp([ue],N,W,Y))continue;const ye=X==="R"?ue.x-fe:ue.x+ue.width+fe;Fp([ue],ye,W,Y)===0&&re.push({id:ue.id,side:X,d:fe,x:ue.x,width:ue.width,col:N})}return re.sort((ue,ae)=>ue.d-ae.d)},I=()=>B.reduce((D,O)=>D+k(O.flow.id).length,0),P=D=>{const O=Ge(r),F=O.edges.find(N=>N.id===D);return F?Ta(F,O.edges.filter(N=>N.type==="bpmn:SequenceFlow")):0},$=()=>{var re,J;const D=Ge(r),O=ee=>ee.map(h).filter(ue=>!!ue&&typeof ue.x=="number"),F=(ee,ue)=>{const ae=Math.min(...ue.map(oe=>oe.x))-gs,X=Math.min(...ue.map(oe=>oe.y))-gs,fe=Math.max(...ue.map(oe=>oe.x+oe.width))+gs,ye=Math.max(...ue.map(oe=>oe.y+oe.height))+gs;return{id:ee,type:"bpmn:Group",x:ae,y:X,width:fe-ae,height:ye-X,container:!0,attached:!1}},N=[];for(const ee of V){const ue=O(ee.group.members??[]);ue.length&&N.push(F(ee.group.id,ue))}const W=new Map(Vt(e,"group.update").map(ee=>[ee.id,ee]));for(const ee of r.filter(ue=>ue.type==="bpmn:Group")){const ue=(re=W.get(ee.id))==null?void 0:re.members;if(ue){const oe=O(ue);oe.length&&N.push(F(ee.id,oe));continue}const X=(((J=ee.businessObject.extensionElements)==null?void 0:J.values)??[]).find(oe=>oe.$type==="bwl:Members"),fe=O(((X==null?void 0:X.refs)??"").split(" ").filter(Boolean)),ye=fe.some(oe=>oe.x<ee.x||oe.y<ee.y||oe.x+oe.width>ee.x+ee.width||oe.y+oe.height>ee.y+ee.height);N.push(fe.length&&ye?F(ee.id,fe):{id:ee.id,type:"bpmn:Group",x:ee.x,y:ee.y,width:ee.width,height:ee.height,container:!0,attached:!1})}const Y=dt({...D,shapes:[...D.shapes.filter(ee=>ee.type!=="bpmn:Group"),...N]},{includeObservationOnly:!0});return{cuts:Y.filter(ee=>ee.kind==="group-cuts-shape").length,along:Y.filter(ee=>ee.kind==="edge-along-group-boundary").length}};for(const D of B)for(let O=0;O<3;O++){const F=k(D.flow.id).filter(X=>X.d>10);if(!F.length)break;const N=h(D.flow.source),W=h(D.flow.target);if(!N||!W||N.type==="bpmn:Participant"||W.type==="bpmn:Participant"||!qo(D.flow.source)||!qo(D.flow.target)||Math.abs(Gi(N)-Gi(W))>K1)break;const Y=(PR=G.get(D.flow.source))==null?void 0:PR.node.participant,re=(kR=G.get(D.flow.target))==null?void 0:kR.node.participant;if(!Y||!re)break;const J=new Map;for(const[X,fe,ye]of[[D.flow.source,N,Y],[D.flow.target,W,re]]){const oe=J.get(ye)??[],xe=eo(X,me=>me.x>=fe.x).filter(me=>!oe.some(_e=>_e.id===me.id));J.set(ye,[...oe,...xe])}const ee=new Set([...J.values()].flat().map(X=>X.id)),ue=Gc(J,ee,D.flow.id,X=>X===D.flow.source||X===D.flow.target,()=>!1);let ae=!1;for(const X of F)if(!ee.has(X.id)){for(const fe of[...new Set([Math.max(10,Math.round(X.d)),30,80])].sort((ye,oe)=>ye-oe)){const ye=X.side==="L"?X.x+X.width+fe-X.col:X.x-fe-X.col,oe=yi(),xe=hs(),me=I(),_e=P(D.flow.id),De=$(),Fe=Eo(ue,ye,!0);if(!Fe)continue;if((()=>{if(Br(oe,yi())||k(D.flow.id).some(Se=>Se.id===X.id)||I()>=me||P(D.flow.id)>=_e||bm(oe.bad,xe))return!0;const Ve=$();return Ve.cuts>De.cuts||Ve.along>De.along})()){Fe();continue}ae=!0;break}if(ae)break}if(!ae)break}}{const x=D=>!("waypoints"in D&&D.waypoints)&&/(Task|Event|Gateway)$/.test(D.type)&&typeof D.x=="number",_=D=>(D??[]).filter(O=>O.type==="bpmn:SequenceFlow"),S=(D,O)=>D.y+(O.get(D.id)??0),k=(D,O,F)=>{var re;const N=D.x+D.width/2,W=S(D,F),Y=S(O,F);return Y<=W?[]:(((re=O.parent)==null?void 0:re.children)??[]).filter(J=>{if(!x(J)||J.id===D.id||J.id===O.id||!(J.x<N&&N<J.x+J.width))return!1;const ee=S(J,F);return ee>=W+D.height&&ee+J.height<=Y})},I=()=>{const D=[];for(const O of q){const F=G.get(O.flow.target);if(!F||!G.has(O.flow.source)||!$e.has(`pool:${F.node.participant??""}`))continue;const N=h(O.flow.source),W=h(O.flow.target);!N||!W||!W.parent||W.parent!==N.parent||!/Gateway$/.test(N.type)||_(W.incoming).length!==1||Math.abs(N.x+N.width/2-(W.x+W.width/2))>1||W.y<=N.y+N.height||D.push([N,W])}return D},P=D=>I().reduce((O,[F,N])=>O+k(F,N,D).length,0),$=D=>{const O=D.y+D.height/2,F=new Map([[D.id,D]]),N=[D];for(;N.length;){const W=N.shift();for(const Y of[..._(W.incoming),..._(W.outgoing)]){const re=Y.source===W?Y.target:Y.source;!re||F.has(re.id)||!G.has(re.id)||!x(re)||Math.abs(re.y+re.height/2-O)>1||(F.set(re.id,re),N.push(re))}}return F};for(const[D,O]of I()){const F=k(D,O,new Map);if(F.length!==1||!G.has(F[0].id))continue;const N=F[0],W=$(N),Y=$(O);if(W.has(D.id)||Y.has(D.id)||[...Y.keys()].some(ae=>W.has(ae)))continue;const re=O.y+O.height/2-(N.y+N.height/2),J=new Map([...[...Y.keys()].map(ae=>[ae,-re]),...[...W.keys()].map(ae=>[ae,re])]),ee=new Set([...Y.keys(),...W.keys()]),ue=O.parent;[...Y.values(),...W.values()].some(ae=>ge(ue,ae,ae.x+ae.width/2,S(ae,J)+ae.height/2,ee))||P(J)>=P(new Map)||(n.moveElements([...W.values()],{x:0,y:re}),n.moveElements([...Y.values()],{x:0,y:-re}))}}const $j=10,Fj=400,jj=x=>[...x.incoming??[],...x.outgoing??[]].filter(_=>_.type==="bpmn:DataInputAssociation"||_.type==="bpmn:DataOutputAssociation").map(_=>_.source===x?_.target:_.source).filter(_=>!!_&&typeof _.y=="number"),Hj=r.filter(x=>x.type==="bpmn:DataStoreReference"&&v.has(x.id)),Gj=(x,_)=>{const S=x.x+x.width/2,k=x.y+x.height/2;let I;for(const P of Hj){if((w(P)??y())!==_||P.y<x.y+x.height)continue;const $=Math.abs(P.x+P.width/2-S);$>Fj||$<P.width||!jj(P).some(O=>O.height===x.height&&Math.abs(O.y+O.height/2-k)<=$j&&P.y>=O.y+O.height)||(!I||$<I.dx||$===I.dx&&P.id<I.id)&&(I={dx:$,id:P.id,cy:P.y+P.height/2})}return I==null?void 0:I.cy},zj=50,Vj=(x,_)=>{const S=w(_);if(!S||x.y<_.y+_.height)return;const k=g(S,_),I=k??S,P=x.label,$=Math.max(x.y+x.height,P?P.y+P.height:0),D=I.y+I.height;if($<=D)return;const O=Math.ceil($+zj-D),F=S.y+S.height;if(k){const N=St(k,k.height+O,new Set([x.id]));Fi(F,S.id,O,N)}else n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+O}),Fi(F,S.id,O)};for(const x of A){const _=x.associations??[],S=_.map($=>$.source===x.dataStore.id?$.target:$.source).map(h).find(Boolean),k=S?w(S)??y():y(),I=S?{x:S.x+S.width/2,y:Gj(S,k)??S.y+S.height+110}:{x:200,y:Nc+60},P=n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},I,k);S&&Vj(P,S);for(const $ of _)Y1(x.dataStore.id,$)}for(const x of L){const S=m(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;Y1(S,x.association)}let uR=0;const fa=10,Wj=(x,_)=>{const S=_.map(O=>w(O)).filter(O=>!!O);for(const O of S){const F=fa,N=O.y,W=O.y+O.height,Y=O.x,re=O.x+O.width;if(Math.abs(x.y-N)<F){const J=N+F-x.y;x.y+=J,x.height-=J}if(Math.abs(x.y+x.height-W)<F&&(x.height=W-F-x.y),Math.abs(x.x-Y)<F){const J=Y+F-x.x;x.x+=J,x.width-=J}Math.abs(x.x+x.width-re)<F&&(x.width=re-F-x.x)}if(!S.length)return;const k=Math.min(...S.map(O=>O.y)),I=Math.max(...S.map(O=>O.y+O.height)),P=k-x.y,$=x.y+x.height-I,D=gs-fa;if(P>0!=$>0)if(P>0&&P<D){const O=P+fa;x.y+=O,x.height-=O}else $>0&&$<D&&(x.height-=$+fa)},Uj=(x,_)=>{const S=fa,k=30,I=r.filter(P=>P.type==="bpmn:Group"&&P.id!==_);for(const P of I){const $=P.x,D=P.x+P.width,O=P.y,F=P.y+P.height,N=x.y<F&&O<x.y+x.height,W=x.x<D&&$<x.x+x.width;if(N){if(Math.abs(x.x-D)<S){const Y=Math.min(D+S-x.x,k);Y>0&&x.width-Y>0&&(x.x+=Y,x.width-=Y)}if(Math.abs(x.x+x.width-$)<S){const Y=Math.min(x.x+x.width-($-S),k);Y>0&&x.width-Y>0&&(x.width-=Y)}}if(W){if(Math.abs(x.y-F)<S){const Y=Math.min(F+S-x.y,k);Y>0&&x.height-Y>0&&(x.y+=Y,x.height-=Y)}if(Math.abs(x.y+x.height-O)<S){const Y=Math.min(x.y+x.height-(O-S),k);Y>0&&x.height-Y>0&&(x.height-=Y)}}}},_m=(x,_)=>{const S=gs,k=Math.min(...x.map(O=>O.x))-S,I=Math.min(...x.map(O=>O.y))-S,P=Math.max(...x.map(O=>O.x+O.width))+S,$=Math.max(...x.map(O=>O.y+O.height))+S,D={x:k,y:I,width:P-k,height:$-I};return Wj(D,x),Uj(D,_),D};for(const x of V){const _=(x.group.members??[]).map(h).filter(I=>!!I);let S;_.length?S=_m(_,x.group.id):(S={x:300+uR*350,y:40,width:300,height:200},uR++);const k=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},y());x.group.name&&n.updateLabel(k,x.group.name),(OR=x.group.members)!=null&&OR.length&&ke(k,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(I=>!!I.waypoints),_=new Map,S=(I,P)=>{!I||!P||(_.has(I)||_.set(I,new Set),_.get(I).add(P))};for(const I of x){const P=(DR=I.source)==null?void 0:DR.id,$=(LR=I.target)==null?void 0:LR.id;S(P,$),((IR=I.type)!=null&&IR.includes("DataOutputAssociation")||(BR=I.type)!=null&&BR.includes("DataInputAssociation")||I.type==="bpmn:Association")&&S($,P)}const k=r.filter(I=>I.type==="bpmn:Group");for(const I of k){const $=(((NR=I.businessObject.extensionElements)==null?void 0:NR.values)??[]).find(ae=>ae.$type==="bwl:Members"),D=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean);if(!D.length)continue;const O=new Set(D),F=[...D];for(;F.length;){const ae=F.shift();for(const X of _.get(ae)??[])O.has(X)||(O.add(X),F.push(X))}const N=I.x,W=I.x+I.width,Y=I.y,re=I.y+I.height,J=ae=>q.filter(X=>X.flow.target===ae).length,ee=ae=>{var fe;const X=((fe=h(ae))==null?void 0:fe.type)??"";if(X==="bpmn:StartEvent"&&J(ae)===0)return!1;if(X.endsWith("Gateway")){const ye=q.filter(oe=>oe.flow.target===ae).map(oe=>oe.flow.source);if(ye.length&&ye.every(oe=>{var xe;return((xe=h(oe))==null?void 0:xe.type)==="bpmn:StartEvent"&&J(oe)===0}))return!1}return!0},ue=r.filter(ae=>_i(ae)).filter(ae=>ae.type!=="bpmn:Group"&&ae.type!=="bpmn:Participant"&&ae.type!=="bpmn:TextAnnotation"&&!O.has(ae.id)&&qo(ae.id)&&ee(ae.id)&&ae.x<W&&ae.x+ae.width>N&&ae.y<re&&ae.y+ae.height>Y);if(ue.length)for(const ae of[-1,1]){const X=ue.filter(Ie=>(Ie.x+Ie.width-N<=W-Ie.x?-1:1)===ae);if(!X.length)continue;const fe=[];for(const Ie of X){const Ve=fe.find(Se=>Se.some(ce=>Ie.y<ce.y+ce.height&&Ie.y+Ie.height>ce.y));Ve?Ve.push(Ie):fe.push([Ie])}const ye=new Map;for(const Ie of fe){let Ve=ae<0?N-fa:W+fa;for(const Se of[...Ie].sort((ce,Re)=>ae<0?Re.x-ce.x:ce.x-Re.x)){const ce=ae<0?Math.min(Se.x,Ve-Se.width):Math.max(Se.x,Ve);Ve=ae<0?ce-Hi:ce+Se.width+Hi,ce!==Se.x&&Math.sign(ce-Se.x)===ae&&ye.set(Se.id,ce-Se.x)}}const oe=new Map,xe=Ie=>oe.get(Ie)===Ie||!oe.get(Ie)?Ie:xe(oe.get(Ie));for(const Ie of X)oe.set(Ie.id,Ie.id);for(const Ie of B){const Ve=ye.has(Ie.flow.source)?Ie.flow.source:void 0,Se=ye.has(Ie.flow.target)?Ie.flow.target:void 0;if(!Ve||!Se)continue;const ce=h(Ie.flow.id);(($R=ce==null?void 0:ce.waypoints)==null?void 0:$R.length)===2&&oe.set(xe(Ve),xe(Se))}const me=new Map;for(const Ie of X){if(!ye.has(Ie.id))continue;const Ve=xe(Ie.id);me.set(Ve,[...me.get(Ve)??[],Ie])}const _e=[...me.values()].sort((Ie,Ve)=>ae<0?Math.min(...Ie.map(Se=>Se.x))-Math.min(...Ve.map(Se=>Se.x)):Math.max(...Ve.map(Se=>Se.x))-Math.max(...Ie.map(Se=>Se.x))),De=[];let Fe=!0;for(const Ie of _e){const Ve=Ie.map(Re=>ye.get(Re.id)??0).reduce((Re,Me)=>Math.abs(Me)>Math.abs(Re)?Me:Re,0),Se=new Map;let ce=!0;for(const Re of Ie){const Me=w(Re);if(!Me){ce=!1;break}Se.has(Me.id)||Se.set(Me.id,{subtree:[],pool:Me}),Se.get(Me.id).subtree.push(Re)}ce&&Nr([...Se.values()],Ve,()=>!0,Br)?De.push({shapes:Ie,dx:Ve}):Fe=!1}if(!Fe)for(const Ie of De.reverse())n.moveElements(Ie.shapes,{x:-Ie.dx,y:0})}}}{const x=new Set([...V.map(_=>_.group.id),...Vt(e,"group.update").map(_=>_.id)]);for(const _ of r.filter(S=>S.type==="bpmn:Group")){if(x.has(_.id))continue;const k=(((FR=_.businessObject.extensionElements)==null?void 0:FR.values)??[]).find(D=>D.$type==="bwl:Members"),I=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(h).filter(D=>!!D);!I.length||!I.some(D=>{const O=v.get(D.id);return!O||O.x!==D.x||O.y!==D.y})||!I.some(D=>D.x<_.x||D.y<_.y||D.x+D.width>_.x+_.width||D.y+D.height>_.y+_.height)||n.resizeShape(_,_m(I,_.id))}}{const _=new Map(or(Ge(r)).map(D=>[D.owner,D.rect])),S=r.filter(D=>!!D.waypoints),k=new Map,I=(D,O)=>{!D||!O||(k.has(D)||k.set(D,new Set),k.get(D).add(O))};for(const D of S){const O=(jR=D.source)==null?void 0:jR.id,F=(HR=D.target)==null?void 0:HR.id;I(O,F),((GR=D.type)!=null&&GR.includes("DataOutputAssociation")||(zR=D.type)!=null&&zR.includes("DataInputAssociation")||D.type==="bpmn:Association")&&I(F,O)}const P=D=>q.filter(O=>O.flow.target===D).length,$=D=>{var F;const O=((F=h(D))==null?void 0:F.type)??"";if(O==="bpmn:StartEvent"&&P(D)===0)return!1;if(O.endsWith("Gateway")){const N=q.filter(W=>W.flow.target===D).map(W=>W.flow.source);if(N.length&&N.every(W=>{var Y;return((Y=h(W))==null?void 0:Y.type)==="bpmn:StartEvent"&&P(W)===0}))return!1}return!0};for(const D of r.filter(O=>O.type==="bpmn:Group")){const F=(((VR=D.businessObject.extensionElements)==null?void 0:VR.values)??[]).find(ce=>ce.$type==="bwl:Members"),N=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean);if(!N.length)continue;const W=N.map(h).filter(ce=>!!ce);if(!W.length||!(V.some(ce=>ce.group.id===D.id)||Vt(e,"group.update").some(ce=>ce.id===D.id)||W.some(ce=>{const Re=v.get(ce.id);return!Re||Re.x!==ce.x||Re.y!==ce.y})))continue;const re=new Set(N),J=[...N];for(;J.length;){const ce=J.shift();for(const Re of k.get(ce)??[])re.has(Re)||(re.add(Re),J.push(Re))}const ee=D.x,ue=D.x+D.width,ae=D.y,X=D.y+D.height,fe=ce=>{const Re=_.get(ce.id),Me={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return Re?[Me,{x:Re.x,y:Re.y,width:Re.width,height:Re.height}]:[Me]},ye=W.flatMap(fe),oe=Math.min(...ye.map(ce=>ce.x)),xe=Math.max(...ye.map(ce=>ce.x+ce.width)),me=Math.min(...ye.map(ce=>ce.y)),_e=Math.max(...ye.map(ce=>ce.y+ce.height)),De={L:oe-ee,R:ue-xe,T:me-ae,B:X-_e},Fe=new Set(N),Ie=ce=>ce.x>=ee&&ce.x+ce.width<=ue&&ce.y>=ae&&ce.y+ce.height<=X,Ve=r.filter(ce=>_i(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!Fe.has(ce.id)&&(!re.has(ce.id)||!Ie(ce))&&$(ce.id)&&ce.x<ue&&ce.x+ce.width>ee&&ce.y<X&&ce.y+ce.height>ae);if(!Ve.length)continue;const Se={L:0,R:0,T:0,B:0};for(const ce of Ve){const Re=fe(ce),Me=Math.min(...Re.map(Lt=>Lt.x)),Ye=Math.max(...Re.map(Lt=>Lt.x+Lt.width)),Ue=Math.min(...Re.map(Lt=>Lt.y)),at=Math.max(...Re.map(Lt=>Lt.y+Lt.height)),Be={L:Ye-ee,R:ue-Me,T:at-ae,B:X-Ue},Je=["L","R","T","B"].filter(Lt=>Be[Lt]<=De[Lt]+.001);if(!Je.length)continue;const mt=Je.reduce((Lt,zi)=>Be[zi]<Be[Lt]?zi:Lt,Je[0]);Se[mt]=Math.max(Se[mt],Math.min(Be[mt]+10,De[mt]))}!Se.L&&!Se.R&&!Se.T&&!Se.B||n.resizeShape(D,{x:D.x+Se.L,y:D.y+Se.T,width:D.width-Se.L-Se.R,height:D.height-Se.T-Se.B})}}const pR=x=>{const _=x.waypoints;if(_!=null&&_.length){const k=_[Math.floor((_.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const S=x;return{x:S.x,y:S.y,width:S.width,height:S.height}};let dR=0;const Em=Lv.get(t),fR=(x,_)=>{var k;const S=(k=Em==null?void 0:Em.get(x))==null?void 0:k.texts;return S?[...new Set([_,...Object.values(S)])]:[_]};for(const x of H){const _=x.association,S=((WR=x.placement)==null?void 0:WR.anchor)??(_?_.source===x.annotation.id?_.target:_.source:void 0),k=S?h(S):void 0,I=k?pR(k):void 0,P=Ev(fR(x.annotation.id,x.annotation.text??"")),$=x.placement??(I&&S?{anchor:S,side:"top"}:void 0);let D;if(I&&$){const[W,Y]=xl[$.side],re=$.offset??50;D={x:I.x+I.width/2+W*(I.width/2+P.width/2+re),y:I.y+I.height/2+Y*(I.height/2+P.height/2+re)}}else D={x:300+dR*260,y:60},dR++;const O=k?w(k)??y():y(),F=O;I&&$&&typeof F.x=="number"&&typeof F.width=="number"&&F.type==="bpmn:Participant"&&(D=wl(r,I,P,F,{placement:$}));const N=n.createShape({type:"bpmn:TextAnnotation",width:P.width,height:P.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},D,O);if(_){const W=Y=>Y===x.annotation.id?N:m(Y);n.connect(W(_.source),W(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}x.placement&&ke(N,"bwl:Placement",ve(x.placement))}for(const x of Vt(e,"association.add")){const _=x.association;n.connect(m(_.source),m(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}const qj=(x,_,S,k)=>{const I=x.parent;if(!I)return k;const P=x.x+x.width/2,$=new Set([x.id]);if(!ge(I,x,P,k,$))return k;const D=_?_.y+Math.min(_.height/2,se):S?S.y+he:void 0;if(D===void 0)return k;const O=Math.floor((k-D)/z+1e-6);for(let F=1;F<=3;F++){const N=O+F,W=D+N*z,Y=im(_==null?void 0:_.id,N);if(!ge(I,x,P,W,Y?new Set([...$,...Y]):$))return Tt(_==null?void 0:_.id,N,S),W}return k},hR=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of Vt(e,"node.update")){let _=m(x.id);if(x.type&&vl(x.type)!==_.type){const S=_.x+_.width/2,k=_.y+_.height/2,I=hR();_=c.replaceElement(_,{type:vl(x.type),...x.eventDefinition?{eventDefinitionType:qc[x.eventDefinition]}:{}});const P=hR(),$=[...I].filter(F=>F!==x.id&&!P.has(F));if($.length)throw new Ov({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:$});const D=Math.round(S-(_.x+_.width/2)),O=Math.round(k-(_.y+_.height/2));if(D!==0||O!==0){n.moveShape(_,{x:D,y:O});for(const F of[..._.incoming??[],..._.outgoing??[]])Fc(F)}}if(x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(_,{"bwl:band":x.band});const S=_.y+_.height/2,k=w(_),I=x.lane?m(x.lane):((k==null?void 0:k.children)??[]).find($=>$.type==="bpmn:Lane"&&S>=$.y&&S<=$.y+$.height);x.band!==void 0&&Tt(I==null?void 0:I.id,x.band,k);const P=I?I.y+(x.band===void 0?I.height/2:Math.min(I.height/2,se)+In(I.id,x.band)*z):x.band!==void 0&&k?k.y+he+In(`pool:${k.id}`,x.band)*z:void 0;if(P!==void 0){const $=qj(_,I,k,P),D=$===P?P-S:$-(_.y+_.height/2);if(D!==0){p.push({id:_.id,x:_.x,y:_.y,width:_.width,height:_.height}),n.moveElements([_],{x:0,y:D});for(const O of[..._.incoming??[],..._.outgoing??[]])O.type!=="bpmn:SequenceFlow"&&O.type!=="bpmn:MessageFlow"||wd(O.waypoints??[],[O.source,O.target])&&(Fc(O),d.add(O.id))}}}}for(const x of Vt(e,"sequenceFlow.update")){const _=m(x.id),S=ie.get(x.id);if(S){const k=F=>({x:F.x+F.width/2,y:F.y+F.height/2}),I=m(S.flow.source),P=m(S.flow.target),$=n.connect(I,P,{type:"bpmn:SequenceFlow",businessObject:Np(S.flow)}),D=lm.get(x.id),O=P.y+P.height/2;D&&P.x>D.exit.x&&Math.abs(O-D.exit.y)>1?n.updateWaypoints($,[D.exit,{x:D.exit.x,y:O},{x:P.x,y:O}]):(n.reconnect($,I,P,[k(I),k(P)]),Math.abs(O-(I.y+I.height/2))>1&&Fc($))}else if((x.source!==void 0||x.target!==void 0)&&!$1.has(x.id)){const k=_,I=x.source!==void 0?m(x.source):k.source,P=x.target!==void 0?m(x.target):k.target,$=F=>({x:F.x+F.width/2,y:F.y+F.height/2});n.reconnect(k,I,P,[$(I),$(P)]);const D=lm.get(k.id),O=P.y+P.height/2;if(D&&P.x>D.exit.x&&Math.abs(O-D.exit.y)>1){n.updateWaypoints(k,[D.exit,{x:D.exit.x,y:O},{x:P.x,y:O}]);const F=k.label;if(F&&D.label){const W=Math.abs(D.label.y+F.height/2-D.channelY)<=z/5&&D.label.x+F.width>D.exit.x,Y=D.exit.x+6,re=P.x-6-F.width,J=W?re>=Y?{x:Math.max(Y,Math.min(D.label.x,re)),y:D.label.y+(O-D.channelY)}:void 0:D.label;J&&(J.x!==F.x||J.y!==F.y)&&n.moveElements([F],{x:J.x-F.x,y:J.y-F.y})}}else Math.abs(O-(I.y+I.height/2))>1&&Fc(k)}x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(_,{name:((UR=x.condition)==null?void 0:UR.label)??void 0})}for(const x of Vt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Vt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Vt(e,"annotation.update")){const _=m(x.id);if(x.text!==void 0){n.updateProperties(_,{text:x.text});const S=Ev(fR(x.id,x.text));if(S.width!==_.width||S.height!==_.height){const k={x:_.x,y:_.y,width:S.width,height:S.height};n.resizeShape(_,k,void 0,{[Sv]:k})}}if(x.placement===null)ke(_,"bwl:Placement",null);else if(x.placement){const S=m(x.placement.anchor),k=pR(S),I=w(S)??y(),P=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[$,D]=xl[x.placement.side],O=x.placement.offset??50,F={x:k.x+k.width/2+$*(k.width/2+_.width/2+O),y:k.y+k.height/2+D*(k.height/2+_.height/2+O)},N=P?wl(r,k,{width:_.width,height:_.height},I,{placement:x.placement,selfId:x.id}):F;n.moveElements([_],{x:N.x-(_.x+_.width/2),y:N.y-(_.y+_.height/2)}),ke(_,"bwl:Placement",ve(x.placement))}}for(const x of Vt(e,"group.update")){const _=m(x.id);if(x.name!==void 0&&n.updateLabel(_,x.name??""),x.members){const S=x.members.map(h).filter(k=>!!k);S.length&&n.resizeShape(_,_m(S,x.id)),ke(_,"bwl:Members",{refs:x.members.join(" ")})}}}function Ts(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 YT(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 KT(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(y=>y.original?{x:y.x,y:y.y,original:{x:y.original.x,y:y.original.y}}:{x:y.x,y:y.y}),c=(f,y)=>f.length===y.length&&f.every((h,m)=>{var w,g,v,b;return h.x===y[m].x&&h.y===y[m].y&&((w=h.original)==null?void 0:w.x)===((g=y[m].original)==null?void 0:g.x)&&((v=h.original)==null?void 0:v.y)===((b=y[m].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=[...Si(p),...Ri(p)].filter(([f,y])=>u.has(f)!==u.has(y)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,y)=>{c(f.waypoints,l[y])||r.updateWaypoints(f,l[y])}),d}function XT(e,t,n,i=new Set,o=new Set){var h,m;const{elementRegistry:r}=e,a=e.modeling,s=w=>dt(w).filter(g=>!t.has(ct(g))),c=w=>{var g;return((g=r.get(w))==null?void 0:g.type)==="bpmn:TextAnnotation"},l=Ge(r),u=s(l),p=w=>!n.has(w),d=w=>u.some(g=>g.kind==="edge-crosses-shape"&&g.shape===w&&i.has(g.edge)||g.kind==="shape-overlap"&&g.shapes.includes(w)&&g.shapes.every(c)),f=[...new Set(u.flatMap(Ts))].filter(w=>c(w)&&(!p(w)||d(w))),y=[...f.filter(w=>!p(w)),...f.filter(p)];if(y.length)for(const w of y){const g=r.get(w);if(!g||typeof g.x!="number"||typeof g.width!="number")continue;let v=g.parent,b;for(;v;){if(v.type==="bpmn:Participant"){b=v;break}v=v.parent}if(!b){const z=g.x+g.width/2,Q=g.y+g.height/2;b=r.getAll().find(he=>{if(he.type!=="bpmn:Participant")return!1;const se=he;return typeof se.x=="number"&&typeof se.width=="number"&&z>=se.x&&z<=se.x+se.width&&Q>=se.y&&Q<=se.y+se.height})}if(!b||typeof b.x!="number"||typeof b.width!="number")continue;const M=(((h=g.businessObject.extensionElements)==null?void 0:h.values)??[]).find(z=>z.$type==="bwl:Placement"),B=[...g.incoming??[],...g.outgoing??[]].find(z=>z.type==="bpmn:Association"),A=(M!=null&&M.anchor?r.get(M.anchor):void 0)??(B?((m=B.source)==null?void 0:m.id)===w?B.target:B.source:void 0);if(!A)continue;const L=A.waypoints,H=L!=null&&L.length?{x:L[Math.floor((L.length-1)/2)].x,y:L[Math.floor((L.length-1)/2)].y,width:0,height:0}:{x:A.x,y:A.y,width:A.width,height:A.height},V={width:g.width,height:g.height},G={x:g.x+g.width/2,y:g.y+g.height/2},ie=M==null?void 0:M.side,pe=Pv(r,H,b),q=[];if(ie&&ie in xl&&q.push(wl(r,H,V,b,{placement:{side:ie,offset:(M==null?void 0:M.offset)??null},selfId:w})),pe&&!bl(G,V,pe))for(const z of HT)q.push(wl(r,H,V,b,{placement:{side:z,offset:null},selfId:w}));for(const[z,Q]of[[-1,0],[1,0],[0,-1],[0,1]])for(let he=1;he<=jT;he++)q.push({x:G.x+z*Tv*he,y:G.y+Q*Tv*he});const Te=p(w)?Ge(r):l,Pe={...Te,edges:Te.edges.filter(z=>z.id!==(B==null?void 0:B.id))},ke=s(Pe),ve=ke.filter(z=>Ts(z).includes(w)).length;if(!ve)continue;let U,de=!1;for(const z of q){const Q=z.x-G.x,he=z.y-G.y;if(!Q&&!he||z.x-V.width/2<b.x||z.x+V.width/2>b.x+b.width||z.y-V.height/2<b.y||z.y+V.height/2>b.y+b.height||pe&&!bl(z,V,pe))continue;const se={...Pe,shapes:Pe.shapes.map(R=>R.id===w?{...R,x:R.x+Q,y:R.y+he}:R)},Ae=o.has(w)?s(se):dt(se).filter(R=>!t.has(ct(R))||Ts(R).includes(w)),j=Ae.filter(R=>Ts(R).includes(w)).length;if(j>=ve||Ae.length>ke.length)continue;const C=Math.abs(Q)+Math.abs(he);if(de||((!U||j<U.mine||j===U.mine&&(Ae.length<U.all||Ae.length===U.all&&C<U.dist))&&(U={x:z.x,y:z.y,mine:j,all:Ae.length,dist:C}),U.mine===0&&U.all<ke.length&&(de=!0)),j===0&&Ae.length<ke.length&&KT(e,g,Q,he)===0){U={x:z.x,y:z.y,mine:j,all:Ae.length,dist:C};break}}U&&a.moveElements([g],{x:U.x-G.x,y:U.y-G.y})}}const ZT=60;function Ps(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 JT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=w=>dt(w).filter(g=>!t.has(ct(g))),a=w=>w.filter(g=>g.kind==="pool-overlap"),s=new Map(n.shapes.map(w=>[w.id,w])),c=(w,g)=>g.x>=w.x&&g.y>=w.y&&g.x+g.width<=w.x+w.width&&g.y+g.height<=w.y+w.height,l=w=>{if(!s.get(w))return[w];const v=new Set,b=new Set([w]);for(let M=0;M<4;M++){let B=!1;for(const A of n.shapes)A.type!=="bpmn:Group"||v.has(A.id)||[...b].some(L=>{const H=s.get(L);return H&&c(A,H)})&&(v.add(A.id),B=!0);for(const A of n.shapes)A.type!=="bpmn:Participant"||b.has(A.id)||[...v].some(L=>{const H=s.get(L);return H&&c(H,A)})&&(b.add(A.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 A=s.get(B);return A&&c(A,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 y=0,h=p,m=d;for(let w=0;w<6;w++){const g=Ge(i),v=a(r(g));if(!v.length)break;const b=new Map(g.shapes.map(L=>[L.id,L]));let E=null;for(const L of v){if(L.kind!=="pool-overlap")continue;const[H,V]=L.pools,G=b.get(H),ie=b.get(V);if(!G||!ie)continue;const[pe,q]=G.x<=ie.x?[G,ie]:[ie,G];if(L.contained)continue;const Te=s.get(pe.id),Pe=s.get(q.id),ke=Te&&Pe?Math.max(Pe.x-(Te.x+Te.width),0):ZT,ve=pe.x+pe.width+ke-q.x;if(ve<=0)continue;const U=l(q.id).filter(de=>i.get(de));U.length&&(!E||ve>E.dx)&&(E={movers:U,dx:ve})}if(!E)break;const M=E.movers.map(L=>i.get(L)).filter(L=>!!L&&typeof L.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)),A=a(B).length;A<p&&B.length<=d&&(A<h||A===h&&B.length<m||y===0)&&(y=f.length,h=A,m=B.length)}for(const{els:w,dx:g}of f.slice(y).reverse())o.moveElements(w,{x:-g,y:0})}const ks=.5,_l=150,Fv=1200;function QT(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of tP(n))i.length<n.length&&i.some(r=>Vd(e.elementRegistry.get(r.id)))||nP(e,i)}function eP(e,t){const n=e.modeling,i=new Set(t.shapes.map(r=>r.id)),o=e.elementRegistry.getAll().filter(r=>r.type==="bpmn:Participant"&&!i.has(r.id)&&!Vd(r));for(const r of o){let a=-1/0;const s=d=>{d&&typeof d.x=="number"&&typeof d.width=="number"&&(a=Math.max(a,d.x+d.width))},c=d=>{for(const f of d.children??[]){if("waypoints"in f&&f.waypoints){for(const y of f.waypoints)a=Math.max(a,y.x);s(f.label);continue}f.type!=="label"&&(f.type!=="bpmn:Lane"&&(s(f),s(f.label)),c(f))}};if(c(r),!Number.isFinite(a))continue;const l=d=>d.x<r.x+r.width&&d.x+d.width>r.x&&d.y<r.y+r.height&&d.y+d.height>r.y;for(const d of e.elementRegistry.getAll()){if(d.type==="bpmn:Participant"||d.type==="bpmn:Lane"||d.type==="label")continue;const f="waypoints"in d&&d.waypoints?[d.label]:[d,d.label];for(const y of f)y&&typeof y.x=="number"&&typeof y.width=="number"&&l(y)&&s(y)}const u=Math.max(Fv,Math.round(a+_l-r.x));u>=r.width-1||[...r.incoming??[],...r.outgoing??[]].flatMap(d=>d.waypoints??[]).some(d=>d.x>=r.x+u-1)||Ps(n,r,u,{layout:!1})}}function tP(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)<=ks?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function Vd(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 nP(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(g=>g.x+g.width),r=Math.max(...o);if(r-Math.min(...o)>ks)return;const a=t.map(g=>n.get(g.id)).filter(g=>!!g&&typeof g.x=="number");if(a.length<2)return;const s=new Map(t.map(g=>[g.id,g.x]));if(a.some(g=>Math.abs(g.x-s.get(g.id))>ks))return;const c=a.map(g=>g.x+g.width);if(Math.max(...c)-Math.min(...c)<=ks)return;const l=g=>g.x+g.width,u=g=>!!g&&typeof g.width=="number",p=g=>{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(g),v},d=new Map(a.map(g=>[g.id,p(g)]));let f=r;for(const g of a){const{shapes:v}=d.get(g.id),b=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+_l))}const y=a.filter(g=>Math.abs(l(g)-f)>ks);if(!y.length)return;for(const g of y){const v=l(g),{shapes:b,edges:E,lanes:M}=d.get(g.id);if([...b.flatMap(L=>[l(L),...u(L.label)?[l(L.label)]:[]]),...E.flatMap(L=>[...L.waypoints.map(H=>H.x),...u(L.label)?[l(L.label)]:[]])].some(L=>L>f)||[...(g.incoming??[]).map(L=>L.waypoints[L.waypoints.length-1]),...(g.outgoing??[]).map(L=>L.waypoints[0])].some(L=>!L||L.x>f||Math.abs(L.x-v)<1))return;if(f>v){const L={x:v,y:g.y,width:f-v,height:g.height},H=new Set([g.id,...b.map(G=>G.id),...E.map(G=>G.id),...M.map(G=>G.id)]);if(n.getAll().some(G=>{var q;if("waypoints"in G&&G.waypoints||G.type==="bpmn:Group"||!u(G))return!1;const ie=G.type==="label"?(q=G.labelTarget)==null?void 0:q.id:G.id;if(!ie||H.has(ie)||H.has(G.id))return!1;const pe=G;return pe.x<L.x+L.width&&pe.x+pe.width>L.x&&pe.y<L.y+L.height&&pe.y+pe.height>L.y}))return}}const h=()=>new Set(dt(Ge(n)).map(ct)),m=h(),w=y.map(g=>g.width);for(const g of y)Ps(i,g,f-g.x,{layout:!1});[...h()].every(g=>m.has(g))||y.forEach((g,v)=>Ps(i,g,w[v],{layout:!1}))}function iP(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>dt(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),y=s(d),h=y.l+(l.x-f.l),m=y.t+(l.y-f.t),w=y.r+(l.x+l.width-f.r),g=y.b+(l.y+l.height-f.b),v={x:h,y:m,width:w-h,height:g-m};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 El=20,Sl=10;function oP(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(dt(f,{includeObservationOnly:!0}).filter(y=>y.kind==="edge-along-group-boundary").map(ct)),s=Ge(o),c=dt(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,y]of u){const h=s.shapes.find(Ae=>Ae.id===f);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const m=l.get(f);if(!(!m||Math.abs(m.x-h.x)>=.5||Math.abs(m.y-h.y)>=.5||Math.abs(m.width-h.width)>=.5||Math.abs(m.height-h.height)>=.5))continue;const g=h.members.map(Ae=>o.get(Ae)).filter(Ae=>!!Ae&&typeof Ae.x=="number");if(!g.length)continue;const v=Math.min(...g.map(Ae=>Ae.x)),b=Math.min(...g.map(Ae=>Ae.y)),E=Math.max(...g.map(Ae=>Ae.x+Ae.width)),M=Math.max(...g.map(Ae=>Ae.y+Ae.height)),B=h.x,A=h.y,L=h.x+h.width,H=h.y+h.height;let V=B,G=A,ie=L,pe=H;for(const Ae of y){const j=s.edges.find(R=>R.id===Ae.edge);if(!j)continue;const C=j.endpoints.some(R=>{const Z=s.shapes.find($e=>$e.id===R);if(!Z||Z.container)return!1;const ne=Z.x+Z.width/2,ge=Z.y+Z.height/2;return B<ne&&ne<L&&A<ge&&ge<H});for(const R of fn(j)){const Z=R.axis==="v"?[A,H]:[B,L];Math.min(R.hi,Z[1])-Math.max(R.lo,Z[0])<md||(R.axis==="v"?B<R.at&&R.at<L:A<R.at&&R.at<H)&&C||(R.axis==="v"?(Math.abs(R.at-B)<=Ra&&(V=Math.max(V,R.at+El)),Math.abs(R.at-L)<=Ra&&(ie=Math.min(ie,R.at-El))):(Math.abs(R.at-A)<=Ra&&(G=Math.max(G,R.at+El)),Math.abs(R.at-H)<=Ra&&(pe=Math.min(pe,R.at-El))))}}if(V>v-Sl&&(V=B),G>b-Sl&&(G=A),ie<E+Sl&&(ie=L),pe<M+Sl&&(pe=H),V===B&&G===A&&ie===L&&pe===H)continue;const q=o.get(f),Te={x:q.x,y:q.y,width:q.width,height:q.height},Pe=Ge(o),ke=new Set(dt(Pe).map(ct)),ve=a(Pe);r.resizeShape(q,{x:V,y:G,width:ie-V,height:pe-G});let U=Ge(o),de=dt(U).filter(Ae=>!ke.has(ct(Ae)));const z=[];if(de.length>0&&de.every(Ae=>Ae.kind==="label-over-line"&&!i.has(Ae.edge)&&U.edges.some(j=>j.id===Ae.edge))){for(const Ae of de){if(Ae.kind!=="label-over-line")continue;const j=U.edges.find(ge=>ge.id===Ae.edge),C=j&&$d(j,U),R=(d=o.get(Ae.edge))==null?void 0:d.label;if(!C||!R)continue;const Z=C.x-R.x,ne=C.y-R.y;r.moveElements([R],{x:Z,y:ne}),z.push({label:R,dx:Z,dy:ne})}U=Ge(o),de=dt(U).filter(Ae=>!ke.has(ct(Ae)))}const he=a(U),se=[...he].some(Ae=>!ve.has(Ae));if(de.length||se||he.size>=ve.size){for(const Ae of z.reverse())r.moveElements([Ae.label],{x:-Ae.dx,y:-Ae.dy});r.resizeShape(q,Te)}}}function rP(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Xp((o==null?void 0:o.$parent)??o),a=xs(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:Zp(u,i,r),requests:ed(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 Wd(e,t,n={}){var Pe,ke;const{i18n:i,lower:o=$v}=n,r=Cv(e),a=Ty(r.elementRegistry),s=vv(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=RT(t,a,i),u=i&&l.writes.size?rP(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ge(r.elementRegistry),d=new Set(dt(p).map(ct)),f=new Set(dt(p,{includeObservationOnly:!0}).map(ct)),y=new Set(kv(l.ops,ve=>{var U,de;return(de=(U=r.elementRegistry.get(ve))==null?void 0:U.source)==null?void 0:de.id}).keys()),h=new Set(p.edges.map(ve=>ve.id).filter(ve=>!y.has(ve))),m=new Set(t.flatMap(ve=>ve.kind==="sequenceFlow.update"&&(ve.source!==void 0||ve.target!==void 0)?[ve.id]:[])),w=()=>new Set(p.edges.filter(ve=>{var de;const U=(de=r.elementRegistry.get(ve.id))==null?void 0:de.waypoints;return U?!(U.length===ve.waypoints.length&&ve.waypoints.every((z,Q)=>Math.round(z.x)===Math.round(U[Q].x)&&Math.round(z.y)===Math.round(U[Q].y))):!1}).map(ve=>ve.id)),g=(ve,U)=>new Set([...ve].filter(de=>!U.has(de))),v=new Set(p.shapes.map(ve=>ve.id)),b=new Set(t.flatMap(ve=>ve.kind==="annotation.update"&&ve.placement?[ve.id]:[])),E=Si(p),M=E.length,B=new Set(E.map(([ve,U])=>`${ve}|${U}`)),A=Ri(p),L=new Set(A.map(([ve,U])=>`${ve}|${U}`)),H=new Map;for(const ve of r.elementRegistry.filter(U=>"waypoints"in U&&!!U.waypoints))ve.label&&H.set(ve.id,{wps:ve.waypoints.map(U=>({x:U.x,y:U.y})),label:{x:ve.label.x,y:ve.label.y},source:(Pe=ve.source)==null?void 0:Pe.id,target:(ke=ve.target)==null?void 0:ke.id});const V=e.get("commandStack");try{VT(r,l.writes),km(V,()=>{o(l.ops,r);for(const he of(u==null?void 0:u.contexts())??[])V.execute(Qc,he);JT(r,d,p),QT(r,p),iP(r,d,p),XA(r,p,m),qA(r,h,v),zy(r,h);const ve=Cd(r,d,v),U=NA(r,WT(r),h,m);Ny(r,B,h);const de=bT(r,h),z=w(),Q=rv(r,d,g(h,z),z);Ky(r,h),lT(r,h,m,v),tv(r,d,h),vT(r,d,h),VA(r,L,h),nT(r,h,p),dv(r,d,g(h,w())),pv(r,h,new Set([...m,...Q,...de,...U,...UT(r)]),qT(r)),fv(r,v),XT(r,d,v,ve,b),Cd(r,d,v,ve),oP(r,f,p,h),hv(r,d),uv(r,H,zT(r)),eP(r,p)})}catch(ve){return{ok:!1,issues:[ve instanceof Ov?ve.issue:{kind:"lower-failed",message:ve instanceof Error?ve.message:String(ve)}],findings:[],stats:c}}const G=Ge(r.elementRegistry),ie=YT(p,G,ve=>{var z,Q,he;const U=r.elementRegistry.get(ve),de=[...(U==null?void 0:U.incoming)??[],...(U==null?void 0:U.outgoing)??[]].find(se=>se.type==="bpmn:Association");return de&&(((z=de.source)==null?void 0:z.id)===ve?(Q=de.target)==null?void 0:Q.id:(he=de.source)==null?void 0:he.id)}),pe=dt(G,{includeObservationOnly:!0}).filter(ve=>!f.has(ct(ve))||Ts(ve).some(U=>ie.has(U))),q=xy(G),Te=Ri(G);return{ok:!0,issues:[],findings:pe,stats:{edgeCrossings:{before:M,after:q.pairs.length,pairs:q.pairs,solidPairs:q.solidPairs,dashedPairs:q.dashedPairs,mixedPairs:q.mixedPairs,crossPoolMessages:q.crossPoolMessages},sharedEndpointCrossings:{before:A.length,after:Te.length,pairs:Te}}}}function aP(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function jv(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Hv(e,t){const n=jv(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Gv(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function sP(e){return typeof e=="string"&&Wp.includes(e)}function Zi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function zv(e,t={}){const n=e.rootElements??[],i=n.find(U=>U.$type==="bpmn:Collaboration"),o=new Map(n.filter(U=>U.$type==="bpmn:Process").map(U=>[U.id,U])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},d=[],f=[],y=[],h=[],m=[],w=[],g=[],v=new Map,b=new Set,E=new Set,M=U=>{U&&b.add(U)},B=U=>{b.add(U),E.add(U)},A=U=>{const de=Gv(U,"bwl:Placement");if(!de)return;const z=typeof de.anchor=="string"?de.anchor:void 0;if(!z||!sP(de.side))return;const Q=typeof de.offset=="number"?de.offset:void 0;m.push({owner:U.id,anchor:z,side:de.side,...Q!==void 0?{offset:Q}:{}})},L=U=>{const de=Gv(U,"bwl:Members"),z=typeof(de==null?void 0:de.refs)=="string"?de.refs.split(/\s+/).filter(Boolean):[];z.length&&g.push({owner:U.id,refs:z})},H=U=>{var de;for(const z of U)switch(M(z.id),z.$type){case"bpmn:TextAnnotation":B(z.id),v.set(z.id,z),c.push({id:z.id,text:typeof z.text=="string"?z.text:""}),A(z);break;case"bpmn:Association":y.push({id:z.id,type:z.$type,source:Zi(z.sourceRef),target:Zi(z.targetRef)});break;case"bpmn:Group":{B(z.id),v.set(z.id,z);const Q=(de=z.categoryValueRef)==null?void 0:de.value;l.push({id:z.id,...typeof Q=="string"&&Q?{name:Q}:{}}),L(z);break}default:u.push({id:z.id,type:z.$type,reason:"type-outside-mvp"})}},V=U=>{for(const de of U.flowElements??[])M(de.id),u.push({id:de.id,type:de.$type,reason:"inside-container"}),(de.flowElements??[]).length&&V(de);for(const de of U.artifacts??[])M(de.id),u.push({id:de.id,type:de.$type,reason:"inside-container"})},G=(U,de)=>{const z=U.flowElements??[],Q=(U.laneSets??[]).flatMap(se=>se.lanes??[]),he=new Map;for(const se of Q){M(se.id),v.set(se.id,se);for(const Ae of se.flowNodeRef??[]){const j=Zi(Ae);j&&he.set(j,se.id)}}for(const se of z){if(M(se.id),v.set(se.id,se),se.$type==="bpmn:SequenceFlow"){d.push({id:se.id,source:Zi(se.sourceRef),target:Zi(se.targetRef),...typeof se.name=="string"&&se.name?{name:se.name}:{}});continue}if(se.$type==="bpmn:DataStoreReference"){B(se.id),s.push({id:se.id,...se.name?{name:se.name}:{}});continue}const Ae=aP(se.$type),j=Ae==="intermediateCatchEvent"?zp((se.eventDefinitions??[]).map(ne=>ne.$type)):void 0;if(!Rm(Ae)||Ae==="intermediateCatchEvent"&&!j){u.push({id:se.id,type:se.$type,reason:"type-outside-mvp"});continue}B(se.id);const C=Ae==="boundaryEvent"?Zi(se.attachedToRef):void 0;a.push({id:se.id,type:Ae,...se.name?{name:se.name}:{},...de?{participant:de}:{},...he.has(se.id)?{lane:he.get(se.id)}:{},...C?{attachedTo:C}:{},...j?{eventDefinition:j}:{}}),Ae==="subProcess"&&V(se);const R=Hv(se,"bwl:band");R!==void 0&&(p.bands[se.id]=R);const Z=jv(se,"bwl:afterColumn");typeof Z=="string"&&Z!==""&&w.push([se.id,Z]);for(const ne of se.dataOutputAssociations??[])M(ne.id),h.push({id:ne.id,type:ne.$type,source:se.id,target:Zi(ne.targetRef)});for(const ne of se.dataInputAssociations??[])M(ne.id),h.push({id:ne.id,type:ne.$type,source:Zi((ne.sourceRef??[])[0]),target:se.id})}H(U.artifacts??[])};if(i){const U=new Set;for(const de of i.participants??[]){B(de.id),v.set(de.id,de);const z=Zi(de.processRef);z&&U.add(z);const Q=z?o.get(z):void 0,he=((Q==null?void 0:Q.laneSets)??[]).flatMap(C=>C.lanes??[]),se=he.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of se)B(C.id);const Ae=!Q||(Q.flowElements??[]).length===0&&he.length===0&&(Q.artifacts??[]).length===0;r.push({id:de.id,...de.name?{name:de.name}:{},...Ae?{blackBox:!0}:{},...se.length?{lanes:se}:{}});const j=Hv(de,"bwl:poolOrder");j!==void 0&&(p.poolOrders[de.id]=j),Q&&G(Q,de.id)}for(const de of i.messageFlows??[])M(de.id),v.set(de.id,de),f.push({id:de.id,source:Zi(de.sourceRef),target:Zi(de.targetRef),...typeof de.name=="string"&&de.name?{name:de.name}:{}});H(i.artifacts??[]);for(const[de,z]of o)!U.has(de)&&(z.flowElements??[]).length>0&&u.push({id:de,type:z.$type,reason:"unreachable-process"})}else for(const U of o.values())G(U);const ie=[],pe=[],q=[],Te=[],Pe=(U,de)=>!!U&&!!de&&E.has(U)&&E.has(de);for(const U of d){if(!Pe(U.source,U.target)){u.push({id:U.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}ie.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),E.add(U.id)}for(const U of f){if(!Pe(U.source,U.target)){u.push({id:U.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}pe.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),E.add(U.id)}for(const U of h){if(!Pe(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}Te.push({...U.id?{id:U.id}:{},source:U.source,target:U.target}),U.id&&E.add(U.id)}for(const U of y){if(!Pe(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}q.push({...U.id?{id:U.id}:{},source:U.source,target:U.target})}const ke=new Map(l.map(U=>[U.id,U]));for(const{owner:U,refs:de}of g){const z=de.filter(he=>b.has(he)),Q=ke.get(U);Q&&z.length&&(Q.members=z)}for(const U of m)b.has(U.anchor)&&(p.placements[U.owner]={anchor:U.anchor,side:U.side,...U.offset!==void 0?{offset:U.offset}:{}});for(const[U,de]of w)b.has(de)&&(p.afterColumns[U]=de);const ve={...r.length?{participants:r}:{},nodes:a,sequenceFlows:ie,...pe.length?{messageFlows:pe}:{},...s.length?{dataStores:s}:{},...Te.length?{dataAssociations:Te}:{},...c.length?{annotations:c}:{},...q.length?{associations:q}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:ve,hints:p,omitted:u,i18n:cP(ve,v,e,t.i18n)}:{definition:ve,hints:p,omitted:u}}function cP(e,t,n,i){const o=Xp(n),r=xs(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Zp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of ed(u)){if(!r.includes(d.locale))continue;const f=!!d.sourceLocale&&!p[d.sourceLocale];a.push({id:c.id,...d,...f?{cleared:!0}:{}})}};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 lP(e,t={}){const{definitions:n,warnings:i}=await Sa(e);return{...zv(n,t),warnings:i}}const uP=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Ud(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function pP(e){return Ud(e.processRef)!==void 0}function dP(e){const t=new Set,n=o=>{const r=Ud(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 fP(e){const t=[],n=i=>{for(const o of i.flowElements??[])uP.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 hP(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 qd(e){const t=[],n=e.rootElements??[],i=dP(e);for(const r of fP(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??[])pP(s)&&hP(r.get(Ud(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 gP(e){const{definitions:t,warnings:n}=await Sa(e);return{issues:qd(t),warnings:n}}const mP=.5,yP=8,vP=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Oa=e=>typeof e=="number"?e:Number(e??NaN),Rl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function xP(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}=${Rl(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=>`${Rl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Rl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function bP(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?[Oa(s.x),Oa(s.y),Oa(s.width),Oa(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=Rl(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=>[Oa(d.x),Oa(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 Vv(e){const t=bP(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:")&&!vP.has(s)&&n.set(c,{type:s,props:xP(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 Wv(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 Uv(e,t,n={}){const i=n.moveTolerance??mP,o=Vv(e),r=Vv(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||Wv(p.geometry,u.geometry,i)||Wv(p.label,u.label,n.labelTolerance??yP))&&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 wP(e,t,n={}){const[i,o]=await Promise.all([Sa(e),Sa(t)]);return{...Uv(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function _P(e){return new Set([...e.added,...e.modified])}function qv(e){return e.get("moddle").ids}function Yv(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=qv(e),i=n.nextPrefixed,o=[];return{value:Yv(n,function(a,s){const c=i.call(this,a,s);return o.push(c),c},t),generatedIds:o}}function Xv(e,t,n){const i=qv(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:Yv(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 EP(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Zv(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>Wd(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 Os=()=>typeof performance>"u"?Date.now():performance.now();function SP(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class Yd extends Error{constructor(t,n){super(n),this.reason=t}}async function Jv(e,t,{expectedXml:n,i18n:i}){const o=Os(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(Os()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(Os()-o)};const a=e.get("commandStack"),s=Om(a),c=t.flatMap(p=>p.generatedIds);let l;try{r.run(()=>{const p=Xv(e,c,()=>{t.forEach((d,f)=>{f>0&&r.atBatchBoundary();const y=Wd(e,d.ops,{...i?{i18n:i}:{}});if(!y.ok)throw new Yd("rejected",`배치 ${f+1}/${t.length} — ${SP(y.issues)}`)})});if(p.missed||p.remaining)throw new Yd("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof Yd?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=Dm(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(Os()-o)}):{status:"replayed",ms:Math.round(Os()-o)}}const RP=new Set(["lasso","lasso.selection","hand","hand.move"]),Qv=1e4,MP="bwl-edit-locked",ex=new WeakMap;function CP(e){const t=ex.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",Qv,()=>{var s;if(o)return RP.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"],Qv,()=>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(MP,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 ex.set(e,a),a}const AP=Symbol("bpmn-editor"),Kd={geometry:[],semantic:[]};function TP(){const e=Ce.ref(!1),t=Ce.ref(!0),n=Ce.ref(!1),i=Ce.shallowRef(Kd),o=Ce.shallowRef(void 0),r=Ce.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=Kd;return}const g=dt(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:g,semantic:v?qd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const g=p();if(!g||!a){r.value=void 0;return}const v=g.locales(),b={};for(const E of v)b[E]={untranslated:g.untranslatedCount(E),reviewRequested:g.reviewRequestedCount(E)};r.value={designLocale:a.designLocale,locales:v,displayLocale:g.getDisplayLocale()??a.designLocale,counts:b}}function f(){const g=p();g&&(g.configure(a),a&&s&&(s=g.setDisplayLocale(s)))}const y=()=>{l||(e.value=!0,u())};function h(g,v){CP(g).set(!v)}function m(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function w(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:o,i18n:r,configureI18n(g){a=g,f(),d()},setDisplayLocale(g){var b;s=g;const v=(b=p())==null?void 0:b.setDisplayLocale(g);v&&(s=v),d()},setChangeScope(g){o.value=g===void 0?void 0:new Set(g)},requestFocus(g){if(!c)return;const v=c.get("elementRegistry").get(g);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(g){const v=c==null?void 0:c.get("elementRegistry").get(g),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(g){c&&this.detach(),c=g,c.get("eventBus").on("commandStack.changed",y),t.value||h(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",y),c&&!t.value&&h(c,!0),c=void 0,i.value=Kd,o.value=void 0,r.value=void 0},setEditable(g){t.value=g,c&&h(c,g)},async applyAgentBatch(g,v){const b=m();n.value=!0;try{const E=await Zv(b,g,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return E.status==="applied"&&(e.value=!1),E}finally{n.value=!1}},async replayAgentTurn(g,v){const b=m(),E=e.value;n.value=!0,l=!0;try{const M=await Jv(b,g,{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(g){const{warnings:v}=await m().importXML(g);return e.value=!1,o.value=void 0,u(),{warnings:gd(v)}},async saveXml(){const{xml:g}=await m().saveXML({format:!0});return e.value=!1,g??""},undo:()=>{var g;return(g=w())==null?void 0:g.undo()},redo:()=>{var g;return(g=w())==null?void 0:g.redo()},canUndo:()=>{var g;return((g=w())==null?void 0:g.canUndo())??!1},canRedo:()=>{var g;return((g=w())==null?void 0:g.canRedo())??!1}}}const PP=new RegExp("\\p{Script=Hangul}","u"),kP=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,OP=new RegExp("\\p{Script=Han}","u");function Ml(e){const t=PP.test(e),n=kP.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:OP.test(e)?"han":"other"}}function tx(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 nx(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=Zo(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Wi(a).filter(l=>ln(l))})}return n}const Ds=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function DP(e,t={}){const n=tx(e),i=nx(e);let o;const r={},a=[],s=[],c=[];for(const h of i){const m=h.trs.filter(w=>(w.body??"")===h.name).map(ln);if(m.length){const w=[...m].sort().join("+");r[w]=(r[w]??0)+1,o=o?new Set([...o].filter(g=>m.includes(g))):new Set(m)}else h.trs.some(w=>w.body)?a.push(Ds(h)):c.push({e:h,inference:Ml(h.name)});for(const w of h.trs){const g=ln(w),v=w.body??"",b=Ml(v);b.locale&&b.locale!==g?s.push({...Ds(h),locale:g,script:b.script}):g==="ko"&&b.script==="han"&&h.trs.some(E=>E!==w&&E.body===v)&&s.push({...Ds(h),locale:g,script:"han"})}}const l=new Set(c.map(h=>h.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 h=l.size===1?[...l][0]:void 0;h&&o.has(h)?[u,p]=[h,"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=[],y=[];for(const{e:h,inference:m}of c)m.locale?m.locale!==d&&f.push({...Ds(h),locale:m.locale}):y.push({...Ds(h),script:m.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:y,drift:a,matchedBy:r,scriptMismatch:s}}function LP(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!tx(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(nx(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=>ln(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(jr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function ix(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 Xd=e=>ln(e)||void 0,ox=e=>e.body??"";function rx(e){const t=new Map;for(const n of ix(e)){const i=Wi(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Xd(o),body:ox(o)}))})}return t}const ax=e=>JSON.stringify(e.map(t=>t.body).sort());class IP{constructor(){on(this,"byId",new Map);on(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};sx(this.byId,o,a),sx(this.byBodies,ax(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(ax(t))??[]}}function sx(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function BP(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 Zd(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 NP(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 $P=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function FP(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=rx(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=BP(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(m=>m.doc===t.doc&&Zd(m.state,c)).sort((m,w)=>w.version-m.version).slice(0,1).map(m=>m.state)],["lineage",t.index.sameId(a).filter(m=>m.doc!==t.doc&&Zd(m.state,c)).map(m=>m.state)],["bodies",t.index.sameBodies(s.cells).filter(m=>!(m.doc===t.doc&&m.id===a)&&Zd(m.state,c)).map(m=>m.state)]].find(([,m])=>m.length);if(!p){if(!r(s))continue;for(const[m,w]of c)for(let g=0;g<w;g++)n.unresolved.push({...l,body:m,script:Ml(m).script});continue}const[d,f]=p,y=f.map(m=>NP(s,m,c));if(y.some(m=>m.overflow)||new Set(y.map($P)).size>1){n.ambiguous.push({...l,source:d});continue}const[h]=y;for(const m of h.stale)n.stale.push({...l,...m});h.cells.length&&n.restores.push({...l,source:d,cells:h.cells})}return n}function jP(e,t){if(!t.restores.length)return 0;const n=new Map(ix(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=Wi(r),s=new Set(a.map(Xd).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Xd(p)&&ox(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function je(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function HP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jd={exports:{}},cx;function GP(){if(cx)return Jd.exports;cx=1;var e=Jd.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},Jd.exports}var zP=GP(),VP=HP(zP);function ao(e){if(!(this instanceof ao))return new ao(e);e=e||[128,36,1],this._seed=e.length?VP.rack(e[0],e[1],e[2]):e}ao.prototype.next=function(e){return this._seed(e||!0)},ao.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ao.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ao.prototype.assigned=function(e){return this._seed.get(e)||!1},ao.prototype.unclaim=function(e){delete this._seed.hats[e]},ao.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Rn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Rn.td=Rn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Rn.option=Rn.optgroup=[1,'<select multiple="multiple">',"</select>"],Rn.thead=Rn.tbody=Rn.colgroup=Rn.caption=Rn.tfoot=[1,"<table>","</table>"],Rn.polyline=Rn.ellipse=Rn.polygon=Rn.circle=Rn.text=Rn.line=Rn.path=Rn.rect=Rn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Wt(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(Rn,i)?Rn[i]:Rn._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 WP(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function Zn(e,...t){const n=e.style;return K(t,function(i){i&&K(i,function(o,r){n[r]=o})}),e}function On(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const UP=Object.prototype.toString;function Dt(e){return new ar(e)}function ar(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}ar.prototype.add=function(e){return this.list.add(e),this},ar.prototype.remove=function(e){return UP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},ar.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},ar.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},ar.prototype.array=function(){return Array.from(this.list)},ar.prototype.has=ar.prototype.contains=function(e){return this.list.contains(e)};function Cl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ur(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function qP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Al={},lx;function YP(){if(lx)return Al;lx=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Al.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},Al.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},Al}var ux=YP(),KP=qP(ux),Ke=WP({__proto__:null,default:KP},[ux]),px=["focus","blur"];function XP(e,t,n,i,o){return px.indexOf(n)!==-1&&(o=!0),Ke.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Ur(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function ZP(e,t,n,i){return px.indexOf(t)!==-1&&(i=!0),Ke.unbind(e,t,n,i)}var ci={bind:XP,unbind:ZP};function Qd(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function kt(e,t){return t=t||document,t.querySelector(e)}function Ls(e,t){return t=t||document,t.querySelectorAll(e)}function so(e){e.parentNode&&e.parentNode.removeChild(e)}function JP(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function QP(e,t){return t.appendChild(JP(e,t))}function ot(e,t){return QP(t,e),e}var ef=2,dx={"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":ef,"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":ef,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function ek(e,t){return dx[t]?e.style[t]:e.getAttributeNS(null,t)}function fx(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=dx[i];o?(o===ef&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function tk(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)fx(e,o,t[o])}function Le(e,t,n){if(typeof t=="string")if(n!==void 0)fx(e,t,n);else return ek(e,t);else tk(e,t);return e}const nk=Object.prototype.toString;function vt(e){return new sr(e)}function sr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}sr.prototype.add=function(e){return this.list.add(e),this},sr.prototype.remove=function(e){return nk.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},sr.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},sr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},sr.prototype.array=function(){return Array.from(this.list)},sr.prototype.has=sr.prototype.contains=function(e){return this.list.contains(e)};function Is(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function tf(e){return e.cloneNode(!0)}var nf={svg:"http://www.w3.org/2000/svg"},hx='<svg xmlns="'+nf.svg+'"';function ik(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(nf.svg)===-1&&(e=hx+e.substring(4)):(e=hx+">"+e+"</svg>",t=!0);var n=ok(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function ok(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function We(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=ik(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(nf.svg,e),t&&Le(n,t),n}var of=null;function gx(){return of===null&&(of=We("svg")),of}function mx(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function rk(e,t,n,i,o,r){var a=gx().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return mx(a,e);case 6:return mx(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function Bs(e){return gx().createSVGTransform()}var yx=/([&<>]{1})/g,ak=/([&<>\n\r"]{1})/g,sk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function rf(e,t){function n(i,o){return sk[o]||o}return e.replace(t,n)}function vx(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(rf(e.textContent,yx));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,'="',rf(r.value,ak),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)vx(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",rf(e.nodeValue,yx),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function ck(e){for(var t=e.firstChild,n=[];t;)vx(t,n),t=t.nextSibling;return n.join("")}function xx(e,t){return ck(e)}function mn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function lk(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function uk(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(lk(e,i))}function Ns(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),uk(n,t)),n.consolidate()}const pk=/^class[ {]/;function dk(e){return pk.test(e.toString())}function af(e){return Array.isArray(e)}function sf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Tl(...e){e.length===1&&af(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const fk=/constructor\s*[^(]*\(\s*([^)]*)\)/m,hk=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,gk=/\/\*([^*]*)\*\//m;function mk(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(dk(e)?fk:hk);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(gk);return(o&&o[1]||i).trim()})||[]}function bx(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(sf(r,v))return r[v];if(sf(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(af(v))v=Tl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const M=(v.$inject||mk(v)).map(B=>sf(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 Tl(b=>v.get(b))}function f(v,b){if(b&&b.length){const E=Object.create(null),M=Object.create(null),B=[],A=[],L=[];let H,V,G,ie;for(let pe in o)H=o[pe],b.indexOf(pe)!==-1&&(H[2]==="private"?(V=B.indexOf(H[3]),V===-1?(G=H[3].createChild([],b),ie=d(G),B.push(H[3]),A.push(G),L.push(ie),E[pe]=[ie,pe,"private",G]):E[pe]=[L[V],pe,"private",A[V]]):E[pe]=[H[2],H[1]],M[pe]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(q=>{H[1].$scope.indexOf(q)!==-1&&(E[pe]=[H[2],H[1]],M[q]=!0)});b.forEach(pe=>{if(!M[pe])throw new Error('No provider for "'+pe+'". Cannot use provider from the parent!')}),v.unshift(E)}return new bx(v,a)}const y={factory:p,type:u,value:function(v){return v}};function h(v,b){const E=v.__init__||[];return function(){E.forEach(M=>{typeof M=="string"?b.get(M):b.invoke(M)})}}function m(v){const b=v.__exports__;if(b){const E=v.__modules__,M=Object.keys(v).reduce((V,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(V[G]=v[G]),V),Object.create(null)),B=(E||[]).concat(M),A=f(B),L=Tl(function(V){return A.get(V)});b.forEach(function(V){o[V]=[L,V,"private",A]});const H=(v.__init__||[]).slice();return H.unshift(function(){A.init()}),v=Object.assign({},v,{__init__:H}),h(v,A)}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],A=M[1];o[E]=[y[B],yk(B,A),B]}),h(v,a)}function w(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(w,v),v.indexOf(b)!==-1)?v:v.concat(b)}function g(v){const b=v.reduce(w,[]).map(m);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=g(e)}function yk(e,t){return e!=="value"&&af(t)&&(t=Tl(t.slice())),t}var vk=1e3;function ko(e,t){var n=this;t=t||vk,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)})}ko.prototype.canRender=function(e){},ko.prototype.drawShape=function(e,t){},ko.prototype.drawConnection=function(e,t){},ko.prototype.getShapePath=function(e){},ko.prototype.getConnectionPath=function(e){};function qr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function xk(e){return["M",e.x,e.y]}function cf(e){return["L",e.x,e.y]}function bk(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function wk(e,t){const n=e.length,i=[xk(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(cf(a));continue}const c=Math.min(t,lf(a.x-r.x,a.y-r.y),lf(s.x-a.x,s.y-a.y));if(!c){i.push(cf(a));continue}const l=Pl(a,r,c),u=Pl(a,r,c*.5),p=Pl(a,s,c),d=Pl(a,s,c*.5);i.push(cf(l)),i.push(bk(u,d,p))}return i}function Pl(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=lf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function lf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function $s(e,t,n){tt(t)&&(n=t,t=null),t||(t={});const i=We("path",t);return tt(n)&&(i.dataset.cornerRadius=String(n)),uf(i,e)}function uf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Le(e,{d:qr(wk(t,n))}),e}function kl(e){var t=new Set(e);return gt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Yr(e,t,n){n=n||0,et(e)||(e=[e]),K(e,function(i,o){var r=t(i,o,n);et(r)&&r.length&&Yr(r,t,n+1)})}function pf(e,t,n){var i=new Set,o=new Set;return Yr(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 Fs(e,t){return pf(e)}function _k(e,t,n){Fr(t)&&(t=!0),Sn(t)&&(n=t,t=!0),n=n||{};var i=js(n.allShapes),o=js(n.allConnections),r=js(n.enclosedElements),a=js(n.enclosedConnections),s=js(n.topLevel,t&&ba(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,K(u.incoming,c),K(u.outgoing,c),u.children}return Yr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function yn(e,t){t=!!t,et(e)||(e=[e]);var n,i,o,r;return K(e,function(a){var s=a;a.waypoints&&!t&&(s=yn(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 Da(e,t){var n={};return K(e,function(i){var o=i;o.waypoints&&(o=yn(o)),!tt(t.y)&&o.x>t.x&&(n[i.id]=i),!tt(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(tt(t.width)&&tt(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!tt(t.width)||!tt(t.height))&&(n[i.id]=i)}),n}function wx(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function _x(e){return!!(e&&e.isFrame)}function js(e,t){return te({},e||{},t||{})}var Ek=1;function cr(e,t){ko.call(this,e,Ek),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})}je(cr,ko),cr.prototype.canRender=function(){return!0},cr.prototype.drawShape=function(t,n,i){var o=We("rect");return Le(o,{x:0,y:0,width:n.width||0,height:n.height||0}),_x(n)?Le(o,te({},this.FRAME_STYLE,i||{})):Le(o,te({},this.SHAPE_STYLE,i||{})),ot(t,o),o},cr.prototype.drawConnection=function(t,n,i){var o=$s(n.waypoints,te({},this.CONNECTION_STYLE,i||{}));return ot(t,o),o},cr.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 qr(a)},cr.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 qr(r)},cr.$inject=["eventBus","styles"];function Sk(){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 te(r,{class:n})},this.style=function(n,i){!et(n)&&!i&&(i=n,n=[]);var o=si(n,function(r,a){return te(r,e[a]||{})},{});return i?te(o,i):o},this.computeStyle=function(n,i,o){return et(i)||(o=i,i=[]),t.style(i||[],te({},o,n||{}))}}const Rk={__init__:["defaultRenderer"],defaultRenderer:["type",cr],styles:["type",Sk]};function an(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function un(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 df(e,t){return!e||!t?-1:e.indexOf(t)}function Hs(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ff(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=Hs(e,t);return Math.abs(o/r)<=i}var Mk=2;function Oo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(Ck(o,n))return r;return!1}function Ck(e,t){const n=t[0];return Ko(t,function(i){return Math.abs(n[e]-i[e])<=Mk})}function Ex(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 hf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Ak=/,?([a-z]),?/gi,Sx=parseFloat,vn=Math,lr=vn.PI,co=vn.min,lo=vn.max,Rx=vn.pow,ur=vn.abs,Tk=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Pk=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Mx=Array.isArray||function(e){return e instanceof Array};function kk(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ok(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 Dk(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 kk(o,i)?(Ok(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function Lk(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(Tk,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(Pk,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([o,...a.splice(0,2)]),s="l",o=o=="m"?"l":"L");a.length>=t[s]&&(n.push([o,...a.splice(0,t[s])]),!!t[s]););}),n.toString=mf,n}function Ik(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 Bk(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 gf(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function mf(){return this.join(",").replace(Ak,"$1")}function Nk(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var o=e[n],r=t[n]=new Array(o.length),a=0,s=o.length;a<s;a++)r[a]=o[a];return t.toString=mf,t}function Cx(e,t,n,i,o,r,a,s,c){var l=1-c,u=Rx(l,3),p=Rx(l,2),d=c*c,f=d*c,y=u*e+p*3*c*n+l*3*c*c*o+f*a,h=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:Ol(y),y:Ol(h)}}function Ax(e){var t=zk(...e);return gf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function pr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function $k(e,t){return e=gf(e),t=gf(t),pr(t,e.x,e.y)||pr(t,e.x2,e.y)||pr(t,e.x,e.y2)||pr(t,e.x2,e.y2)||pr(e,t.x,t.y)||pr(e,t.x2,t.y)||pr(e,t.x,t.y2)||pr(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 Tx(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,y=0;y<u;y++){var h=l*p[y]+l,m=Tx(h,e,n,o,a),w=Tx(h,t,i,r,s),g=m*m+w*w;f+=d[y]*vn.sqrt(g)}return l*f}function Fk(e,t,n,i,o,r,a,s){if(!(lo(e,n)<co(o,a)||co(e,n)>lo(o,a)||lo(t,i)<co(r,s)||co(t,i)>lo(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=Ol(c/u),d=Ol(l/u),f=+p.toFixed(2),y=+d.toFixed(2);if(!(f<+co(e,n).toFixed(2)||f>+lo(e,n).toFixed(2)||f<+co(o,a).toFixed(2)||f>+lo(o,a).toFixed(2)||y<+co(t,i).toFixed(2)||y>+lo(t,i).toFixed(2)||y<+co(r,s).toFixed(2)||y>+lo(r,s).toFixed(2)))return{x:p,y:d}}}}function Ol(e){return Math.round(e*1e11)/1e11}function jk(e,t,n){var i=Ax(e),o=Ax(t);if(!$k(i,o))return[];var r=Px(...e),a=Px(...t),s=Ox(e)?1:~~(r/5)||1,c=Ox(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,y;for(f=0;f<s+1;f++){var h=Cx(...e,f/s);l[f]={x:h.x,y:h.y,t:f/s}}for(f=0;f<c+1;f++)h=Cx(...t,f/c),u[f]={x:h.x,y:h.y,t:f/c};for(f=0;f<s;f++)for(y=0;y<c;y++){var m=l[f],w=l[f+1],g=u[y],v=u[y+1],b=ur(w.x-m.x)<.01?"y":"x",E=ur(v.x-g.x)<.01?"y":"x",M=Fk(m.x,m.y,w.x,w.y,g.x,g.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 A=m.t+ur((M[b]-m[b])/(w[b]-m[b]))*(w.t-m.t),L=g.t+ur((M[E]-g[E])/(v[E]-g[E]))*(v.t-g.t);A>=0&&A<=1&&L>=0&&L<=1&&d.push({x:M.x,y:M.y,t1:A,t2:L})}}return d}function kx(e,t,n){e=Ix(e),t=Ix(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],y=0,h=e.length;y<h;y++){var m=e[y];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var w=0,g=t.length;w<g;w++){var v=t[w];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=jk(p,d);{for(var E=0,M=b.length;E<M;E++)b[E].segment1=y,b[E].segment2=w,b[E].bez1=p,b[E].bez2=d;f=f.concat(b)}}}}}return f}function Hk(e){return Mx(e)&&Mx(e[0])}function Gk(e){if(Ik(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 y=0,h=l.length;y<h;y++)c[y]=l[y];switch(s=s.toUpperCase(),c[0]){case"Z":n=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=mf,t}function Ox(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Dl(e,t,n,i){return[e,t,n,i,n,i]}function Dx(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 Lx(e,t,n,i,o,r,a,s,c,l){var u=lr*120/180,p=lr/180*(+o||0),d=[],f,y=Dk(function(j,C,R){var Z=j*vn.cos(R)-C*vn.sin(R),ne=j*vn.sin(R)+C*vn.cos(R);return{x:Z,y:ne}});if(l)B=l[0],A=l[1],E=l[2],M=l[3];else{f=y(e,t,-p),e=f.x,t=f.y,f=y(s,c,-p),s=f.x,c=f.y;var h=(e-s)/2,m=(t-c)/2,w=h*h/(n*n)+m*m/(i*i);w>1&&(w=vn.sqrt(w),n=w*n,i=w*i);var g=n*n,v=i*i,b=(r==a?-1:1)*vn.sqrt(ur((g*v-g*m*m-v*h*h)/(g*m*m+v*h*h))),E=b*n*m/i+(e+s)/2,M=b*-i*h/n+(t+c)/2,B=vn.asin(((t-M)/i).toFixed(9)),A=vn.asin(((c-M)/i).toFixed(9));B=e<E?lr-B:B,A=s<E?lr-A:A,B<0&&(B=lr*2+B),A<0&&(A=lr*2+A),a&&B>A&&(B=B-lr*2),!a&&A>B&&(A=A-lr*2)}var L=A-B;if(ur(L)>u){var H=A,V=s,G=c;A=B+u*(a&&A>B?1:-1),s=E+n*vn.cos(A),c=M+i*vn.sin(A),d=Lx(s,c,n,i,o,0,a,V,G,[A,H,E,M])}L=A-B;var ie=vn.cos(B),pe=vn.sin(B),q=vn.cos(A),Te=vn.sin(A),Pe=vn.tan(L/4),ke=4/3*n*Pe,ve=4/3*i*Pe,U=[e,t],de=[e+ke*pe,t-ve*ie],z=[s+ke*Te,c-ve*q],Q=[s,c];if(de[0]=2*U[0]-de[0],de[1]=2*U[1]-de[1],l)return[de,z,Q].concat(d);d=[de,z,Q].concat(d).join().split(",");for(var he=[],se=0,Ae=d.length;se<Ae;se++)he[se]=se%2?y(d[se-1],d[se],p).y:y(d[se],d[se+1],p).x;return he}function zk(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,y,h,m,w,g=0;g<2;++g){if(g==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),ur(u)<1e-12){if(ur(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}m=p*p-4*d*u,w=vn.sqrt(m),!(m<0)&&(y=(-p+w)/(2*u),0<y&&y<1&&c.push(y),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}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:co(...l[0]),y0:co(...l[1]),x1:lo(...l[0]),y1:lo(...l[1])}}function Ix(e){if(Hk(e)||(e=Lk(e)),Bk(e))return e;for(var t=Nk(Gk(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,y){var h,m;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",...Lx(f.x,f.y,...d.slice(1))];break;case"S":y=="C"||y=="S"?(h=f.x*2-f.bx,m=f.y*2-f.by):(h=f.x,m=f.y),d=["C",h,m,...d.slice(1)];break;case"T":y=="Q"||y=="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",...Dx(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",...Dx(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",...Dl(f.x,f.y,d[1],d[2])];break;case"H":d=["C",...Dl(f.x,f.y,d[1],f.y)];break;case"V":d=["C",...Dl(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",...Dl(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 y=d[f];y.length;)r[f]="A",d.splice(f++,0,["C",...y.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=Sx(u[p-4])||n.x,n.by=Sx(u[p-3])||n.y}return t}function $t(e){return Sn(e)&&ai(e,"waypoints")}function ft(e){return Sn(e)&&ai(e,"labelTarget")}function Vk(e){return Sn(e)&&va(e.parent)}function Bx(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Do(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ze(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ll(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Wk(e){return Do({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Uk(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],y=f&&f.endLength||0,h=Kk(d,u);l.push({start:d,end:u,startLength:y,endLength:y+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),o=i/2,r=0,a=n[r];a.endLength<o;)a=n[++r];var s=(o-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function nt(e){return $t(e)?Uk(e):Wk(e)}function $n(e,t,n){n=n||0,Sn(n)||(n={x:n,y:n});var i=Ze(e),o=Ze(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 Gs(e,t,n){var i=qk(e,t);return i.length===1||i.length===2&&Hs(i[0],i[1])<1?Do(i[0]):i.length>1?(i=no(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),Do(i[n?0:i.length-1])):null}function qk(e,t){return kx(e,t)}function Yk(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Hs(n,o)===0||ff(i,o,n)?e.splice(t,1):t++;return e}function Kk(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Il(e,t){return Math.round(e*t)/t}function Nx(e){return tt(e)?e+"px":e}function Xk(e){for(;e.parent;)e=e.parent;return e}function Zk(e){e=te({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Zn(n,{position:"relative",overflow:"hidden",width:Nx(e.width),height:Nx(e.height)}),t.appendChild(n),n}function $x(e,t,n){const i=We("g");vt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const Jk="base",Fx=0,Qk=1,e2={shape:["x","y","width","height"],connection:["waypoints"]};function it(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||{})}it.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],it.prototype._init=function(e){const t=this._eventBus,n=this._container=Zk(e),i=this._svg=We("svg");Le(i,{width:"100%",height:"100%"}),On(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")}),ot(n,i);const o=this._viewport=$x(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Kp(this._viewboxChanged,300)),this._restoreFocus=Kp(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)},it.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},it.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},it.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=wx(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},it.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},it.prototype.restoreFocus=function(){this._restoreFocus()},it.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},it.prototype.isFocused=function(){return this._focused},it.prototype.getDefaultLayer=function(){return this.getLayer(Jk,Fx)},it.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},it.prototype._getChildIndex=function(e){return si(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},it.prototype._createLayer=function(e,t){typeof t>"u"&&(t=Qk);const n=this._getChildIndex(t);return{group:$x(this._viewport,"layer-"+e,n),index:t,visible:!0}},it.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},it.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&&(mn(n),t.visible=!1),n},it.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],mn(t.group))},it.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},it.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(Xk(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},it.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},it.prototype._findPlaneForRoot=function(e){return Ht(this._planes,function(t){return t.rootElement===e})},it.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},it.prototype._resolveElements=function(e){return et(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},it.prototype.getContainer=function(){return this._container},it.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(K([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),vt(o).add(t)):(e.markers.delete(t),vt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},it.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},it.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},it.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},it.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},it.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},it.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,Fx);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},it.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},it.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},it.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)},it.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})},it.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})},it.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=e2[e];if(!Ko(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},it.prototype._setParent=function(e,t,n){un(t.children,e,n),e.parent=t},it.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},it.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},it.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},it.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),an(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},it.prototype.removeShape=function(e){return this._removeElement(e,"shape")},it.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},it.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},it.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},it.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},it.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);Ns(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Ns(t),o=a?a.matrix:rk(),s=Il(o.a,1e3),c=Il(-o.e||0,1e3),l=Il(-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},it.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=te({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),jx(t,n)}),{x:n.e,y:n.f}},it.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(y=>y!=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=yn(r),s=Ze(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=Ze(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const y=Math.max(0,s.right-d.right),h=Math.min(0,s.left-d.left),m=Math.max(0,s.bottom-d.bottom),w=Math.min(0,s.top-d.top);u=y||h,p=m||w}this.scroll({dx:-u*l,dy:-p*l})},it.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)}),Il(i.a,1e3)};function jx(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}it.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},it.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=te(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),jx(this._viewport,u),u},it.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},it.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}},it.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var La="data-element-id";function bi(e){this._elements={},this._eventBus=e}bi.$inject=["eventBus"],bi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Le(t,La,i),n&&Le(n,La,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},bi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Le(i.gfx,La,""),i.secondaryGfx&&Le(i.secondaryGfx,La,""),delete t[n])},bi.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)},bi.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,La,i),t},bi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Le(e,La);var n=this._elements[t];return n&&n.element},bi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},bi.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}},bi.prototype.getAll=function(){return this.filter(function(e){return e})},bi.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)})},bi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},bi.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 t2(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 n2(e){return e.__refs_collection===!0}function i2(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Hx(e,t,n){var i=t2(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 o2(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 Ci(e,t){if(!(this instanceof Ci))return new Ci(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ci.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?Hx(this,t,e):o2(this,t,e)},Ci.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return n2(n)||Hx(this,t,e),n},Ci.prototype.ensureBound=function(e,t){i2(e,t)||this.bind(e,t)},Ci.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ci.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var yf=new Ci({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Gx=new Ci({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),zx=new Ci({name:"attachers",collection:!0},{name:"host"}),Vx=new Ci({name:"outgoing",collection:!0},{name:"source"}),Wx=new Ci({name:"incoming",collection:!0},{name:"target"});function Ia(){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)}}),yf.bind(this,"parent"),Gx.bind(this,"labels"),Vx.bind(this,"outgoing"),Wx.bind(this,"incoming")}function zs(){Ia.call(this),yf.bind(this,"children"),zx.bind(this,"host"),zx.bind(this,"attachers")}je(zs,Ia);function Ux(){Ia.call(this),yf.bind(this,"children")}je(Ux,zs);function qx(){zs.call(this),Gx.bind(this,"labelTarget")}je(qx,zs);function Yx(){Ia.call(this),Vx.bind(this,"source"),Wx.bind(this,"target")}je(Yx,Ia);var r2={connection:Yx,shape:zs,label:qx,root:Ux};function a2(e,t){var n=r2[e];if(!n)throw new Error("unknown type: <"+e+">");return te(new n,t)}function s2(e){return e instanceof Ia}function Lo(){this._uid=12}Lo.prototype.createRoot=function(e){return this.create("root",e)},Lo.prototype.createLabel=function(e){return this.create("label",e)},Lo.prototype.createShape=function(e){return this.create("shape",e)},Lo.prototype.createConnection=function(e){return this.create("connection",e)},Lo.prototype.create=function(e,t){return t=te({},t||{}),t.id||(t.id=e+"_"+this._uid++),a2(e,t)};var Bl="__fn",Kx=1e3,c2=Array.prototype.slice;function li(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}li.prototype.on=function(e,t,n,i){if(e=et(e)?e:[e],An(t)&&(i=n,n=t,t=Kx),!tt(t))throw new Error("priority must be a number");var o=n;i&&(o=ei(n,i),o[Bl]=n[Bl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},li.prototype.once=function(e,t,n,i){var o=this;if(An(t)&&(i=n,n=t,t=Kx),!tt(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[Bl]=n,this.on(e,t,r)},li.prototype.off=function(e,t){e=et(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},li.prototype.createEvent=function(e){var t=new Vs;return t.init(e),t},li.prototype.fire=function(e,t){var n,i,o,r;if(r=c2.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 Vs?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}},li.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},li.prototype._destroy=function(){this._listeners={}},li.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},li.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=l2(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},li.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},li.prototype._getListeners=function(e){return this._listeners[e]},li.prototype._setListeners=function(e,t){this._listeners[e]=t},li.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[Bl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Vs(){}Vs.prototype.stopPropagation=function(){this.cancelBubble=!0},Vs.prototype.preventDefault=function(){this.defaultPrevented=!0},Vs.prototype.init=function(e){te(this,e||{})};function l2(e,t){return e.apply(null,t)}function dr(e){return e.childNodes[0]}function u2(e){return e.parentNode.childNodes[1]}function Nl(e,t,n,i,o){var r=Bs();r.setTranslate(t,n);var a=Bs();a.setRotate(i||0,0,0);var s=Bs();s.setScale(1,1),Ns(e,[r,a,s])}function Fn(e,t,n){var i=Bs();i.setTranslate(t,n),Ns(e,i)}function Xx(e,t){var n=Bs();n.setRotate(t,0,0),Ns(e,n)}function wi(e,t){this._eventBus=e,this._elementRegistry=t}wi.$inject=["eventBus","elementRegistry"],wi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=u2(t),n||(n=We("g"),vt(n).add("djs-children"),ot(t.parentNode,n))):n=t,n},wi.prototype._clear=function(e){var t=dr(e);return Cl(t),t},wi.prototype._createContainer=function(e,t,n,i){var o=We("g");vt(o).add("djs-group"),typeof n<"u"?p2(o,t,t.childNodes[n]):ot(t,o);var r=We("g");vt(r).add("djs-element"),vt(r).add("djs-"+e),i&&vt(r).add("djs-frame"),ot(o,r);var a=We("g");return vt(a).add("djs-visual"),ot(r,a),r},wi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,_x(t))},wi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=si(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),K(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;K(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},wi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},wi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},wi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},wi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},wi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Fn(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")}},wi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);mn(t.parentNode)};function p2(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const d2={__depends__:[Rk],__init__:["canvas"],canvas:["type",it],elementRegistry:["type",bi],elementFactory:["type",Lo],eventBus:["type",li],graphicsFactory:["type",wi]};function f2(e){var t=new bx(e);return t.init(),t}function h2(e){e=e||{};var t={config:["value",e]},n=[t,d2].concat(e.modules||[]);return f2(n)}function fr(e,t){this._injector=t||h2(e),this.get("eventBus").fire("diagram.init")}fr.prototype.get=function(e,t){return this._injector.get(e,t)},fr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},fr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},fr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Yn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function ti(e,t){return e.$instanceOf(t)}function g2(e){return Ht(e.rootElements,function(t){return ti(t,"bpmn:Process")||ti(t,"bpmn:Collaboration")})}function m2(e){var t={},n=[],i={};function o(z,Q){return function(he){z(he,Q)}}function r(z){t[z.id]=z}function a(z){return t[z.id]}function s(z,Q){var he=z.gfx;if(he)throw new Error(`already rendered ${Yn(z)}`);return e.element(z,i[z.id],Q)}function c(z,Q){return e.root(z,i[z.id],Q)}function l(z,Q){try{var he=i[z.id]&&s(z,Q);return r(z),he}catch(se){u(se.message,{element:z,error:se}),console.error(`failed to import ${Yn(z)}`,se)}}function u(z,Q){e.error(z,Q)}var p=this.registerDi=function(Q){var he=Q.bpmnElement;he?i[he.id]?u(`multiple DI elements defined for ${Yn(he)}`,{element:he}):i[he.id]=Q:u(`no bpmnElement referenced in ${Yn(Q)}`,{element:Q})};function d(z){f(z.plane)}function f(z){p(z),K(z.planeElement,y)}function y(z){p(z)}this.handleDefinitions=function(Q,he){var se=Q.diagrams;if(he&&se.indexOf(he)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!he&&se&&se.length&&(he=se[0]),!he)throw new Error("no diagram to display");i={},d(he);var Ae=he.plane;if(!Ae)throw new Error(`no plane for ${Yn(he)}`);var j=Ae.bpmnElement;if(!j)if(j=g2(Q),j)u(`correcting missing bpmnElement on ${Yn(Ae)} to ${Yn(j)}`),Ae.bpmnElement=j,p(Ae);else throw new Error("no process or collaboration to display");var C=c(j,Ae);if(ti(j,"bpmn:Process")||ti(j,"bpmn:SubProcess"))m(j,C);else if(ti(j,"bpmn:Collaboration"))U(j,C),w(Q.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Yn(Ae)}: ${Yn(j)}`);h(n)};var h=this.handleDeferred=function(){for(var Q;n.length;)Q=n.shift(),Q()};function m(z,Q){Pe(z,Q),L(z.ioSpecification,Q),A(z.artifacts,Q),r(z)}function w(z,Q){var he=gt(z,function(se){return!a(se)&&ti(se,"bpmn:Process")&&se.laneSets});he.forEach(o(m,Q))}function g(z,Q){l(z,Q)}function v(z,Q){K(z,o(g,Q))}function b(z,Q){l(z,Q)}function E(z,Q){l(z,Q)}function M(z,Q){l(z,Q)}function B(z,Q){l(z,Q)}function A(z,Q){K(z,function(he){ti(he,"bpmn:Association")?n.push(function(){B(he,Q)}):B(he,Q)})}function L(z,Q){z&&(K(z.dataInputs,o(E,Q)),K(z.dataOutputs,o(M,Q)))}var H=this.handleSubProcess=function(Q,he){Pe(Q,he),A(Q.artifacts,he)};function V(z,Q){var he=l(z,Q);ti(z,"bpmn:SubProcess")&&H(z,he||Q),ti(z,"bpmn:Activity")&&L(z.ioSpecification,Q),n.push(function(){K(z.dataInputAssociations,o(b,Q)),K(z.dataOutputAssociations,o(b,Q))})}function G(z,Q){l(z,Q)}function ie(z,Q){l(z,Q)}function pe(z,Q){n.push(function(){var he=l(z,Q);z.childLaneSet&&q(z.childLaneSet,he||Q),de(z)})}function q(z,Q){K(z.lanes,o(pe,Q))}function Te(z,Q){K(z,o(q,Q))}function Pe(z,Q){ke(z.flowElements,Q),z.laneSets&&Te(z.laneSets,Q)}function ke(z,Q){K(z,function(he){ti(he,"bpmn:SequenceFlow")?n.push(function(){G(he,Q)}):ti(he,"bpmn:BoundaryEvent")?n.unshift(function(){V(he,Q)}):ti(he,"bpmn:FlowNode")?V(he,Q):ti(he,"bpmn:DataObject")||(ti(he,"bpmn:DataStoreReference")||ti(he,"bpmn:DataObjectReference")?ie(he,Q):u(`unrecognized flowElement ${Yn(he)} in context ${Yn(Q&&Q.businessObject)}`,{element:he,context:Q}))})}function ve(z,Q){var he=l(z,Q),se=z.processRef;se&&m(se,he||Q)}function U(z,Q){K(z.participants,o(ve,Q)),n.push(function(){v(z.messageFlows,Q)}),A(z.artifacts,Q)}function de(z){K(z.flowNodeRef,function(Q){var he=Q.get("lanes");he&&he.push(z)})}}function Zx(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,w){return i.add(h,m,w)},error:function(h,m){s.push({message:h,context:m})}},d=new m2(p);u=u||l.diagrams&&l.diagrams[0];var f=y2(l,u);if(!f)throw new Error("no diagram to display");K(f,function(h){d.handleDefinitions(l,h)});var y=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(y+"_plane")||r.findRoot(y))}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 y2(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!T(n,"bpmn:Process")&&!T(n,"bpmn:Collaboration")&&(i=v2(n));var o;T(i,"bpmn:Collaboration")?o=i:o=Ht(e.rootElements,function(l){if(T(l,"bpmn:Collaboration"))return Ht(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Wn(o.participants,function(l){return l.processRef}),r.push(o));var a=Jx(r),s=[t],c=[n];return K(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 Jx(e){var t=[];return K(e,function(n){n&&(t.push(n),t=t.concat(Jx(n.flowElements)))}),t}function v2(e){for(var t=e;t;){if(T(t,"bpmn:Process"))return t;t=t.$parent}}var x2='<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>',Qx=x2,eb={verticalAlign:"middle"},tb={color:"#404040"},b2={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},w2={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},_2={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"},E2='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Qx+'</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>',uo;function S2(){uo=Wt(E2),Zn(uo,b2),Zn(kt("svg",uo),eb),Zn(kt(".backdrop",uo),w2),Zn(kt(".notice",uo),_2),Zn(kt(".link",uo),tb,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function R2(){uo||(S2(),ci.bind(uo,".backdrop","click",function(e){document.body.removeChild(uo)})),document.body.appendChild(uo)}const $l=5,nb="djs-outline-hidden";function Xt(e){e=te({},C2,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),T2(this._container)}je(Xt,fr),Xt.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||[]),Fl(s,r),s=M2(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw Fl(r,[]),r}if(typeof t=="string"&&(i=A2(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw Fl(r,[]),r}try{this.clear()}catch(r){throw Fl(r,[]),r}const{warnings:o}=await Zx(this,n,i);return{warnings:o}},Xt.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},Xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=kt(":scope > defs",i._svg),a=xx(o),s=r?"<defs>"+xx(r)+"</defs>":"",c=i.getContainer();Dt(c).add(nb);let l;try{l=o.getBBox()}finally{Dt(c).remove(nb)}const u=l.x-$l,p=l.y-$l,d=l.width+$l*2,f=l.height+$l*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}},Xt.prototype._setDefinitions=function(e){this._definitions=e},Xt.prototype.getModules=function(){return this._modules},Xt.prototype.clear=function(){this.getDefinitions()&&pr.prototype.clear.call(this)},Xt.prototype.destroy=function(){pr.prototype.destroy.call(this),ao(this._container)},Xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Xt.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=kt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Xt.prototype.getDefinitions=function(){return this._definitions},Xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Xt.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=te(no(n,["additionalModules"]),{canvas:te({},n.canvas,{container:e}),modules:a});pr.call(this,s),n&&n.container&&this.attachTo(n.container)},Xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Xt.prototype._createContainer=function(e){const t=Wt('<div class="bjs-container"></div>');return Zn(t,{width:nb(e.width),height:nb(e.height),position:e.position}),t},Xt.prototype._createModdle=function(e){const t=te({},this._moddleExtensions,e.moddleExtensions);return new ty(t)},Xt.prototype._modules=[];function $l(e,t){return e.warnings=t,e}function M2(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 C2={width:"100%",height:"100%",position:"relative"};function nb(e){return e+(tt(e)?"px":"")}function A2(e,t){return t&&Ht(e.diagrams,function(n){return n.id===t})||null}function P2(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Jx+"</a>",i=Wt(n);Zn(kt("svg",i),Qx),Zn(i,eb,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ke.bind(i,"click",function(o){R2(),o.preventDefault()})}function Kr(e){Xt.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)}je(Kr,Xt),Kr.prototype._createModdle=function(e){var t=Xt.prototype._createModdle.call(this,e);return t.ids=new ro([32,36,1]),t},Kr.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 xt(e,t){return P(e,"bpmn:CallActivity")?!1:P(e,"bpmn:SubProcess")?(t=t||wt(e),t&&P(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):P(e,"bpmn:Participant")?!!Ee(e).processRef:!0}function An(e){if(!(!P(e,"bpmn:Participant")&&!P(e,"bpmn:Lane"))){var t=wt(e).isHorizontal;return t===void 0?!0:t}}function T2(e){return e&&Ee(e).isInterrupting!==!1}function Kn(e){return e&&!!Ee(e).triggeredByEvent}function Ba(e,t){var n=Ee(e).eventDefinitions;return Yo(n,function(i){return P(i,t)})}function k2(e){return Ba(e,"bpmn:ErrorEventDefinition")}function O2(e){return Ba(e,"bpmn:EscalationEventDefinition")}function D2(e){return Ba(e,"bpmn:CompensateEventDefinition")}var Xr={width:90,height:20},ib=15;function dr(e){return P(e,"bpmn:Event")||P(e,"bpmn:Gateway")||P(e,"bpmn:DataStoreReference")||P(e,"bpmn:DataObjectReference")||P(e,"bpmn:DataInput")||P(e,"bpmn:DataOutput")||P(e,"bpmn:SequenceFlow")||P(e,"bpmn:MessageFlow")||P(e,"bpmn:Group")}function Fl(e){return ft(e.label)}function L2(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=I2(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-=ib:a+=ib,{x:a,y:s}}function I2(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 vf(e){return e.waypoints?L2(e.waypoints):P(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Xr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Xr.height/2}}function ob(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Xr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=vf(t),i=Xr),te({x:n.x-i.width/2,y:n.y-i.height/2},i)}function rb(e){if(P(e,"bpmn:FlowElement")||P(e,"bpmn:Participant")||P(e,"bpmn:Lane")||P(e,"bpmn:SequenceFlow")||P(e,"bpmn:MessageFlow")||P(e,"bpmn:DataInput")||P(e,"bpmn:DataOutput"))return"name";if(P(e,"bpmn:TextAnnotation"))return"text";if(P(e,"bpmn:Group"))return"categoryValueRef"}function B2(e){var t=e.categoryValueRef;return t&&t.value||""}function li(e){var t=e.businessObject,n=rb(t);if(n)return n==="categoryValueRef"?B2(t):t[n]||""}function N2(e,t){var n=e.businessObject,i=rb(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function $2(e){return ft(e)&&dr(e.labelTarget)}var Na=7;function ab(e){let t=[];return K(e.incoming,n=>{P(n,"bpmn:Association")&&P(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),K(e.outgoing,n=>{P(n,"bpmn:Association")&&P(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Vs(e){const t=new Map;return K(pf(e),n=>{K(ab(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 xf="hsl(225, 10%, 15%)",F2="white";function uo(e,t){return Yo(e.eventDefinitions,function(n){return n.$type===t})}function j2(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function H2(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function yt(e,t,n){var i=wt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||F2}function Ne(e,t,n){var i=wt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||xf}function Ws(e,t,n,i){var o=wt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Ne(e,n)}function sb(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 qr(o)}function bf(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 qr(a)}function G2(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 qr(s)}function z2(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 qr(r)}function Us(e,t={}){return{width:Ai(e,t),height:ui(e,t)}}function Ai(e,t={}){return ri(t,"width")?t.width:e.width}function ui(e,t={}){return ri(t,"height")?t.height:e.height}var V2=new ro,W2=10,jl=3,U2=1.5,Hl=10,q2=4,$a=.95,Y2=1,K2=.25;function Zr(e,t,n,i,o,r,a){Po.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(j){return n.computeStyle(j,{strokeLinecap:"round",strokeLinejoin:"round",stroke:xf,strokeWidth:2,fill:"white"})}function p(j){return n.computeStyle(j,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:xf,strokeWidth:2})}function d(j,C){var{ref:R={x:0,y:0},scale:Z=1,element:ne,parentGfx:ge=o._svg}=C,$e=We("marker",{id:j,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*Z,markerHeight:20*Z,orient:"auto"});ot($e,ne);var rt=kt(":scope > defs",ge);rt||(rt=We("defs"),ot(ge,rt)),ot(rt,$e)}function f(j,C,R,Z){var ne=V2.nextPrefixed("marker-");return y(j,ne,C,R,Z),"url(#"+ne+")"}function y(j,C,R,Z,ne){if(R==="sequenceflow-end"){var ge=We("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:ne,stroke:ne,strokeWidth:1})});d(C,{element:ge,ref:{x:11,y:10},scale:.5,parentGfx:j})}if(R==="messageflow-start"){var $e=We("circle",{cx:6,cy:6,r:3.5,...u({fill:Z,stroke:ne,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:$e,ref:{x:6,y:6},parentGfx:j})}if(R==="messageflow-end"){var rt=We("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:Z,stroke:ne,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:rt,ref:{x:8.5,y:5},parentGfx:j})}if(R==="association-start"){var ut=We("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:ne,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:ut,ref:{x:1,y:10},scale:.5,parentGfx:j})}if(R==="association-end"){var ln=We("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:ne,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:ln,ref:{x:11,y:10},scale:.5,parentGfx:j})}if(R==="conditional-flow-marker"){var bt=We("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:Z,stroke:ne})});d(C,{element:bt,ref:{x:-1,y:10},scale:.5,parentGfx:j})}if(R==="conditional-default-flow-marker"){var qt=We("path",{d:"M 6 4 L 10 16",...u({stroke:ne,fill:"none"})});d(C,{element:qt,ref:{x:0,y:10},scale:.5,parentGfx:j})}}function h(j,C,R,Z,ne={}){En(Z)&&(ne=Z,Z=0),Z=Z||0,ne=u(ne);var ge=C/2,$e=R/2,rt=We("circle",{cx:ge,cy:$e,r:Math.round((C+R)/4-Z),...ne});return ot(j,rt),rt}function m(j,C,R,Z,ne,ge){En(ne)&&(ge=ne,ne=0),ne=ne||0,ge=u(ge);var $e=We("rect",{x:ne,y:ne,width:C-ne*2,height:R-ne*2,rx:Z,ry:Z,...ge});return ot(j,$e),$e}function w(j,C,R,Z){var ne=C/2,ge=R/2,$e=[{x:ne,y:0},{x:C,y:ge},{x:ne,y:R},{x:0,y:ge}],rt=$e.map(function(ln){return ln.x+","+ln.y}).join(" ");Z=u(Z);var ut=We("polygon",{...Z,points:rt});return ot(j,ut),ut}function g(j,C,R,Z){R=p(R);var ne=Ns(C,R,Z);return ot(j,ne),ne}function v(j,C,R){return g(j,C,R,5)}function b(j,C,R){R=p(R);var Z=We("path",{...R,d:C});return ot(j,Z),Z}function E(j,C,R,Z){return b(C,R,te({"data-marker":j},Z))}function M(j){return Ae[j]}function B(j){return function(C,R,Z){return M(j)(C,R,Z)}}var A={"bpmn:MessageEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill),$e=Z?yt(C,s,R.fill):Ne(C,c,R.stroke),rt=b(j,ne,{fill:ge,stroke:$e,strokeWidth:1});return rt},"bpmn:TimerEventDefinition":function(j,C,R={}){var Z=R.width||C.width,ne=R.height||C.height,ge=R.width?1:2,$e=h(j,Z,ne,.2*ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:ge}),rt=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:Z,containerHeight:ne,position:{mx:.5,my:.5}});b(j,rt,{stroke:Ne(C,c,R.stroke),strokeWidth:ge});for(var ut=0;ut<12;ut++){var ln=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:Z,containerHeight:ne,position:{mx:.5,my:.5}}),bt=Z/2,qt=ne/2;b(j,ln,{strokeWidth:1,stroke:Ne(C,c,R.stroke),transform:"rotate("+ut*30+","+qt+","+bt+")"})}return $e},"bpmn:EscalationEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(j,C,R={}){var Z=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(j,Z,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(j,C,R={},Z){var ne=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}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ge=Z?Ne(C,c,R.stroke):"none",$e=b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1});return Kx($e,45),$e},"bpmn:CompensateEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{strokeWidth:1,fill:ge,stroke:Ne(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(j,C,R={},Z){var ne=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}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(j,C,R={}){var Z=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(j,Z,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(j,C,R={}){var Z=h(j,C.width,C.height,8,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:4});return Z}};function L(j,C,R={},Z){var ne=Ee(j),ge=j2(ne),$e=Z||j;return ne.get("eventDefinitions")&&ne.get("eventDefinitions").length>1?ne.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](C,$e,R,ge):A["bpmn:MultipleEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](C,$e,R,ge):uo(ne,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](C,$e,R,ge):null}var H={ParticipantMultiplicityMarker:function(j,C,R={}){var Z=Ai(C,R),ne=ui(C,R),ge=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:(Z/2-6)/Z,my:(ne-15)/ne}});E("participant-multiplicity",j,ge,{strokeWidth:2,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},SubProcessMarker:function(j,C,R={}){var Z=m(j,14,14,0,{strokeWidth:1,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)});Fn(Z,C.width/2-7.5,C.height-20);var ne=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",j,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},ParallelMarker:function(j,C,R){var Z=Ai(C,R),ne=ui(C,R),ge=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:(Z/2+R.parallel)/Z,my:(ne-20)/ne}});E("parallel",j,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},SequentialMarker:function(j,C,R){var Z=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",j,Z,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},CompensationMarker:function(j,C,R){var Z=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",j,Z,{strokeWidth:1,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},LoopMarker:function(j,C,R){var Z=Ai(C,R),ne=ui(C,R),ge=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:(Z/2+R.loop)/Z,my:(ne-7)/ne}});E("loop",j,ge,{strokeWidth:1.5,fill:"none",stroke:Ne(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(j,C,R){var Z=Ai(C,R),ne=ui(C,R),ge=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:(Z/2+R.adhoc)/Z,my:(ne-15)/ne}});E("adhoc",j,ge,{strokeWidth:1,fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke)})}};function V(j,C,R,Z){H[j](C,R,Z)}function G(j,C,R=[],Z={}){Z={fill:Z.fill,stroke:Z.stroke,width:Ai(C,Z),height:ui(C,Z)};var ne=Ee(C),ge=R.includes("SubProcessMarker");ge?Z={...Z,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:Z={...Z,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},ne.get("isForCompensation")&&R.push("CompensationMarker"),P(ne,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),ge||te(Z,{compensation:Z.compensation-18}));var $e=ne.get("loopCharacteristics"),rt=$e&&$e.get("isSequential");$e&&(te(Z,{compensation:Z.compensation-18}),R.includes("AdhocMarker")&&te(Z,{seq:-23,loop:-18,parallel:-24}),rt===void 0&&R.push("LoopMarker"),rt===!1&&R.push("ParallelMarker"),rt===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&te(Z,{compensation:-8}),K(R,function(ut){V(ut,j,C,Z)})}function ie(j,C,R={}){R=te({size:{width:100}},R);var Z=r.createText(C||"",R);return vt(Z).add("djs-label"),ot(j,Z),Z}function pe(j,C,R,Z={}){var ne=Ee(C),ge=Us({x:C.x,y:C.y,width:C.width,height:C.height},Z);return ie(j,ne.name,{align:R,box:ge,padding:7,style:{fill:Ws(C,l,c,Z.stroke)}})}function q(j,C,R={}){var Z={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return ie(j,li(C),{box:Z,style:te({},r.getExternalStyle(),{fill:Ws(C,l,c,R.stroke)})})}function Pe(j,C,R,Z={}){var ne=An(R),ge=ie(j,C,{box:{height:30,width:ne?ui(R,Z):Ai(R,Z)},align:"center-middle",style:{fill:Ws(R,l,c,Z.stroke)}});if(ne){var $e=-1*ui(R,Z);Bl(ge,0,-$e,270)}}function Te(j,C,R={}){var{width:Z,height:ne}=Us(C,R);return m(j,Z,ne,Hl,{...R,fill:yt(C,s,R.fill),fillOpacity:$a,stroke:Ne(C,c,R.stroke)})}function ke(j,C,R={}){var Z=Ee(C),ne=yt(C,s,R.fill),ge=Ne(C,c,R.stroke);return(Z.get("associationDirection")==="One"||Z.get("associationDirection")==="Both")&&(R.markerEnd=f(j,"association-end",ne,ge)),Z.get("associationDirection")==="Both"&&(R.markerStart=f(j,"association-start",ne,ge)),R=Et(R,["markerStart","markerEnd"]),v(j,C.waypoints,{...R,stroke:ge,strokeDasharray:"0, 5"})}function ve(j,C,R={}){var Z=yt(C,s,R.fill),ne=Ne(C,c,R.stroke),ge=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),$e=b(j,ge,{fill:Z,fillOpacity:$a,stroke:ne}),rt=Ee(C);if(H2(rt)){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(j,ut,{strokeWidth:2,fill:Z,stroke:ne})}return $e}function U(j,C,R={}){return h(j,C.width,C.height,{fillOpacity:$a,...R,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})}function de(j,C,R={}){return w(j,C.width,C.height,{fill:yt(C,s,R.fill),fillOpacity:$a,stroke:Ne(C,c,R.stroke)})}function z(j,C,R={}){var Z=m(j,Ai(C,R),ui(C,R),0,{fill:yt(C,s,R.fill),fillOpacity:R.fillOpacity||$a,stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),ne=Ee(C);if(P(ne,"bpmn:Lane")){var ge=ne.get("name");Pe(j,ge,C,R)}return Z}function Q(j,C,R={}){var Z=Te(j,C,R),ne=xt(C);if(Kn(C)&&(Le(Z,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!ne)){var ge=Ee(C).flowElements||[],$e=ge.filter(rt=>P(rt,"bpmn:StartEvent"));$e.length===1&&he($e[0],j,R,C)}return pe(j,C,ne?"center-top":"center-middle",R),ne?G(j,C,void 0,R):G(j,C,["SubProcessMarker"],R),Z}function he(j,C,R,Z){var ne=22,ge={fill:yt(Z,s,R.fill),stroke:Ne(Z,c,R.stroke),width:ne,height:ne},$e=Ee(j).isInterrupting,rt=$e?0:3,ut=$e?1:1.2,ln=20,bt=(ne-ln)/2,qt="translate("+bt+","+bt+")";h(C,ln,ln,{fill:ge.fill,stroke:ge.stroke,strokeWidth:ut,strokeDasharray:rt,transform:qt}),L(j,C,ge,Z)}function se(j,C,R={}){var Z=Te(j,C,R);return pe(j,C,"center-middle",R),G(j,C,void 0,R),Z}var Ae=this.handlers={"bpmn:AdHocSubProcess":function(j,C,R={}){return xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]),Q(j,C,R)},"bpmn:Association":function(j,C,R={}){return R=Et(R,["fill","stroke"]),ke(j,C,R)},"bpmn:BoundaryEvent":function(j,C,R={}){var{renderIcon:Z=!0}=R;R=Et(R,["fill","stroke"]);var ne=Ee(C),ge=ne.get("cancelActivity");R={strokeWidth:1.5,fill:yt(C,s,R.fill),fillOpacity:Y2,stroke:Ne(C,c,R.stroke)},ge||(R.strokeDasharray="6");var $e=U(j,C,R);return h(j,C.width,C.height,jl,{...R,fill:"none"}),Z&&L(C,j,R),$e},"bpmn:BusinessRuleTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ge=b(j,ne);Le(ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1});var $e=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),rt=b(j,$e);return Le(rt,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:CallActivity":function(j,C,R={}){return R=Et(R,["fill","stroke"]),Q(j,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=de(j,C,R),ne=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(j,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:DataInput":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=i.getRawPath("DATA_ARROW"),ne=ve(j,C,R);return b(j,Z,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1}),ne},"bpmn:DataInputAssociation":function(j,C,R={}){return R=Et(R,["fill","stroke"]),ke(j,C,{...R,markerEnd:f(j,"association-end",yt(C,s,R.fill),Ne(C,c,R.stroke))})},"bpmn:DataObject":function(j,C,R={}){return R=Et(R,["fill","stroke"]),ve(j,C,R)},"bpmn:DataObjectReference":B("bpmn:DataObject"),"bpmn:DataOutput":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=i.getRawPath("DATA_ARROW"),ne=ve(j,C,R);return b(j,Z,{strokeWidth:1,fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke)}),ne},"bpmn:DataOutputAssociation":function(j,C,R={}){return R=Et(R,["fill","stroke"]),ke(j,C,{...R,markerEnd:f(j,"association-end",yt(C,s,R.fill),Ne(C,c,R.stroke))})},"bpmn:DataStoreReference":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(j,Z,{fill:yt(C,s,R.fill),fillOpacity:$a,stroke:Ne(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(j,C,R={}){var{renderIcon:Z=!0}=R;R=Et(R,["fill","stroke"]);var ne=U(j,C,{...R,strokeWidth:4});return Z&&L(C,j,R),ne},"bpmn:EventBasedGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=Ee(C),ne=de(j,C,R);h(j,C.width,C.height,C.height*.2,{fill:yt(C,"none",R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1});var ge=Z.get("eventGatewayType"),$e=!!Z.get("instantiate");function rt(){var ln=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(j,ln,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:2})}if(ge==="Parallel"){var ut=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(j,ut,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1})}else ge==="Exclusive"&&($e||h(j,C.width,C.height,C.height*.26,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1}),rt());return ne},"bpmn:ExclusiveGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=de(j,C,R),ne=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ge=wt(C);return ge.get("isMarkerVisible")&&b(j,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:Gateway":function(j,C,R={}){return R=Et(R,["fill","stroke"]),de(j,C,R)},"bpmn:Group":function(j,C,R={}){return R=Et(R,["fill","stroke","width","height"]),m(j,C.width,C.height,Hl,{stroke:Ne(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ai(C,R),height:ui(C,R)})},"bpmn:InclusiveGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=de(j,C,R);return h(j,C.width,C.height,C.height*.24,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:2.5}),Z},"bpmn:IntermediateEvent":function(j,C,R={}){var{renderIcon:Z=!0}=R;R=Et(R,["fill","stroke"]);var ne=U(j,C,{...R,strokeWidth:1.5});return h(j,C.width,C.height,jl,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),Z&&L(C,j,R),ne},"bpmn:IntermediateCatchEvent":B("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":B("bpmn:IntermediateEvent"),"bpmn:Lane":function(j,C,R={}){return R=Et(R,["fill","stroke","width","height"]),z(j,C,{...R,fillOpacity:K2})},"bpmn:ManualTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(j,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5}),Z},"bpmn:MessageFlow":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=Ee(C),ne=wt(C),ge=yt(C,s,R.fill),$e=Ne(C,c,R.stroke),rt=v(j,C.waypoints,{markerEnd:f(j,"messageflow-end",ge,$e),markerStart:f(j,"messageflow-start",ge,$e),stroke:$e,strokeDasharray:"10, 11",strokeWidth:1.5});if(Z.get("messageRef")){var ut=rt.getPointAtLength(rt.getTotalLength()/2),ln=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ut.x,y:ut.y}}),bt={strokeWidth:1};ne.get("messageVisibleKind")==="initiating"?(bt.fill=ge,bt.stroke=$e):(bt.fill=$e,bt.stroke=ge);var qt=b(j,ln,bt),Kt=Z.get("messageRef"),Dn=Kt.get("name"),Bt=ie(j,Dn,{align:"center-top",fitBox:!0,style:{fill:$e}}),an=qt.getBBox(),zn=Bt.getBBox(),pa=ut.x-zn.width/2,ii=ut.y+an.height/2+W2;Bl(Bt,pa,ii,0)}return rt},"bpmn:ParallelGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=de(j,C,R),ne=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(j,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:Participant":function(j,C,R={}){R=Et(R,["fill","stroke","width","height"]);var Z=z(j,C,R),ne=xt(C),ge=An(C),$e=Ee(C),rt=$e.get("name");if(ne){var ut=ge?[{x:30,y:0},{x:30,y:ui(C,R)}]:[{x:0,y:30},{x:Ai(C,R),y:30}];g(j,ut,{stroke:Ne(C,c,R.stroke),strokeWidth:U2}),Pe(j,rt,C,R)}else{var ln=Us(C,R);ge||(ln.height=Ai(C,R),ln.width=ui(C,R));var bt=ie(j,rt,{box:ln,align:"center-middle",style:{fill:Ws(C,l,c,R.stroke)}});if(!ge){var qt=-1*ui(C,R);Bl(bt,0,-qt,270)}}return $e.get("participantMultiplicity")&&V("ParticipantMultiplicityMarker",j,C,R),Z},"bpmn:ReceiveTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=Ee(C),ne=se(j,C,R),ge;return Z.get("instantiate")?(h(j,28,28,20*.22,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),ge=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ge=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(j,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),ne},"bpmn:ScriptTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(j,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:SendTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(j,ne,{fill:Ne(C,c,R.stroke),stroke:yt(C,s,R.fill),strokeWidth:1}),Z},"bpmn:SequenceFlow":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=yt(C,s,R.fill),ne=Ne(C,c,R.stroke),ge=v(j,C.waypoints,{markerEnd:f(j,"sequenceflow-end",Z,ne),stroke:ne}),$e=Ee(C),{source:rt}=C;if(rt){var ut=Ee(rt);$e.get("conditionExpression")&&P(ut,"bpmn:Activity")&&Le(ge,{markerStart:f(j,"conditional-flow-marker",Z,ne)}),ut.get("default")&&(P(ut,"bpmn:Gateway")||P(ut,"bpmn:Activity"))&&ut.get("default")===$e&&Le(ge,{markerStart:f(j,"conditional-default-flow-marker",Z,ne)})}return ge},"bpmn:ServiceTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R);h(j,10,10,{fill:yt(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var ne=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(j,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),h(j,10,10,{fill:yt(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var ge=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(j,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:StartEvent":function(j,C,R={}){var{renderIcon:Z=!0}=R;R=Et(R,["fill","stroke"]);var ne=Ee(C);ne.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var ge=U(j,C,R);return Z&&L(C,j,R),ge},"bpmn:SubProcess":function(j,C,R={}){return xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]),Q(j,C,R)},"bpmn:Task":function(j,C,R={}){return R=Et(R,["fill","stroke"]),se(j,C,R)},"bpmn:TextAnnotation":function(j,C,R={}){R=Et(R,["fill","stroke"]);var{width:Z,height:ne}=Us(C,R),ge=m(j,Z,ne,0,0,{fill:"none",stroke:"none"}),$e=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:0,my:0}});b(j,$e,{stroke:Ne(C,c,R.stroke)});var rt=Ee(C),ut=rt.get("text")||"";return ie(j,ut,{align:"left-top",box:Us(C,R),padding:Na,style:{fill:Ws(C,l,c,R.stroke)}}),ge},"bpmn:Transaction":function(j,C,R={}){xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]);var Z=Q(j,C,{strokeWidth:1.5,...R}),ne=n.style(["no-fill","no-events"],{stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),ge=xt(C);return ge||(R={}),m(j,Ai(C,R),ui(C,R),Hl-jl,jl,ne),Z},"bpmn:UserTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=15,ge=12,$e=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:ne,y:ge}});b(j,$e,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5});var rt=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:ne,y:ge}});b(j,rt,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5});var ut=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:ne,y:ge}});return b(j,ut,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:.5}),Z},label:function(j,C,R={}){return q(j,C,R)}};this._drawPath=b,this._renderer=M}je(Zr,Po),Zr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Zr.prototype.canRender=function(e){return P(e,"bpmn:BaseElement")},Zr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Zr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Zr.prototype.getShapePath=function(e){return ft(e)?bf(e,q2):P(e,"bpmn:Event")?sb(e):P(e,"bpmn:Activity")?bf(e,Hl):P(e,"bpmn:Gateway")?G2(e):z2(e)};function Et(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var X2=0,Z2={width:150,height:50};function J2(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Q2(e){return En(e)?te({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var wf=null;function eO(){return wf||(wf=document.createElement("canvas").getContext("2d")),wf}function tO(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(cb(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function cb(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function nO(e,t){var n=eO();if(!n)return{width:0,height:0};n.font=tO(t),"letterSpacing"in n&&(n.letterSpacing=cb(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 iO(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=nO(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return oO(e,o,i,r);o=aO(o,r.width,t)}}function oO(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 lb="­";function rO(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===lb)&&o.pop();break}var a=o[o.length-1];return a&&a===lb&&(o[o.length-1]="-"),o.join("")}function aO(e,t,n){var i=Math.max(e.length*(n/t),1),o=rO(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Gl(e){this._config=te({},{size:Z2,padding:X2,style:{},align:"center-top"},e||{})}Gl.prototype.createText=function(e,t){return this.layoutText(e,t).element},Gl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Gl.prototype.layoutText=function(e,t){for(var n=te({},this._config.size,t.box),i=te({},this._config.style,t.style),o=J2(t.align||this._config.align),r=Q2(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=sO(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(iO(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ai(l,function(m,w,g){return m+(s||w.height)},0)+r.top+r.bottom,d=ai(l,function(m,w,g){return w.width>m?w.width:m},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var y=We("text");Le(y,i),K(l,function(m){var w;switch(f+=s||m.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?d:u)-r.right-m.width;break;default:w=Math.max(((a?d:u)-m.width)/2+r.left,0)}var g=We("tspan");Le(g,{x:w,y:f}),g.textContent=m.text,ot(y,g)});var h={width:d,height:p};return{dimensions:h,element:y}};function sO(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var cO=12,lO=1.2,uO=40;function ub(e){var t=te({fontFamily:"Arial, sans-serif",fontSize:cO,fontWeight:"normal",lineHeight:lO},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=te({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Gl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Xr.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:Na});return{x:a.x,y:a.y,width:a.width,height:Math.max(uO,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,te({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}ub.$inject=["config.textRenderer"];function pO(){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=gO(i.d,{mx:o,my:r,e:a});return p}}var dO=/\{([^{}]+)\}/g,fO=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function hO(e,t,n){var i=n;return t.replace(fO,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 gO(e,t){return String(e).replace(dO,function(n,i){return hO(n,i,t)})}const mO={__init__:["bpmnRenderer"],bpmnRenderer:["type",Zr],textRenderer:["type",ub],pathMap:["type",pO]};function yO(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const qs={translate:["value",yO]};function zl(e,t,n){return te({id:e.id,type:e.$type,businessObject:e,di:t},n)}function vO(e,t,n){var i=e.waypoint;return!i||i.length<2?[nt(t),nt(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function pb(e,t,n){return new Error(`element ${Yn(t)} referenced by ${Yn(e)}#${n} not yet drawn`)}function Do(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Do.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Do.prototype.add=function(e,t,n){var i,o,r;if(P(t,"bpmndi:BPMNPlane")){var a=P(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(zl(e,t,a)),this._canvas.addRootElement(i)}else if(P(t,"bpmndi:BPMNShape")){var s=!xt(e,t),c=bO(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(zl(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})),P(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),P(e,"bpmn:Lane")&&(r=0),P(e,"bpmn:DataStoreReference")&&(xO(n,nt(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(P(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(zl(e,t,{hidden:o,source:u,target:p,waypoints:vO(t,u,p)})),P(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Yn(t)} for element ${Yn(e)}`);return dr(e)&&li(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Do.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Yn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw pb(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Do.prototype.addLabel=function(e,t,n){var i,o,r;return i=ob(t,n),o=li(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(zl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!li(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)},Do.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?pb(e,i,t+"Ref"):new Error(`${Yn(e)}#${t} Ref not specified`)},Do.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Do.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Do.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function xO(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 bO(e){return P(e,"bpmn:Group")}const db={__depends__:[mO,{__depends__:[qs],bpmnImporter:["type",Do]}]};function Ys(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Zi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _f(e){return Math.log(e)/Math.log(10)}var wO=1e3;function we(e){this._eventBus=e}we.$inject=["eventBus"];function _O(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}we.prototype.on=function(e,t,n,i,o,r){if((Cn(t)||tt(t))&&(r=o,o=i,i=n,n=t,t=null),Cn(n)&&(r=o,o=i,i=n,n=wO),En(o)&&(r=o,o=!1),!Cn(i))throw new Error("handlerFn must be a function");et(e)||(e=[e]);var a=this._eventBus;K(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?_O(i,r):i,r)})},we.prototype.canExecute=Lo("canExecute"),we.prototype.preExecute=Lo("preExecute"),we.prototype.preExecuted=Lo("preExecuted"),we.prototype.execute=Lo("execute"),we.prototype.executed=Lo("executed"),we.prototype.postExecute=Lo("postExecute"),we.prototype.postExecuted=Lo("postExecuted"),we.prototype.revert=Lo("revert"),we.prototype.reverted=Lo("reverted");function Lo(e){return function(n,i,o,r,a){(Cn(n)||tt(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Ef=["top","bottom","left","right"],Vl=10;function Sf(e,t){we.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(Fl(o)&&!$t(o)){var r=RO(o);r&&i(o,r)}}function i(o,r){var a=nt(o),s=o.label,c=nt(s);if(s.parent){var l=Ze(o),u;switch(r){case"top":u={x:a.x,y:l.top-Vl-s.height/2};break;case"left":u={x:l.left-Vl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Vl+s.height/2};break;case"right":u={x:l.right+Vl+s.width/2,y:a.y};break}var p=Zi(u,c);t.moveShape(s,p)}}}je(Sf,we),Sf.$inject=["eventBus","modeling"];function EO(e){var t=e.host,n=nt(e),i=$n(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Ef.filter(function(a){return o.indexOf(a)===-1});return r}function SO(e){var t=nt(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 fb(t,i)});return n}function RO(e){var t=nt(e.label),n=nt(e),i=fb(n,t);if(MO(i)){var o=SO(e);if(e.host){var r=EO(e);o=o.concat(r)}var a=Ef.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?$n(e.label,e)!=="intersect"?void 0:i:a[0]}}function fb(e,t){return $n(t,e,5)}function MO(e){return Ef.indexOf(e)!==-1}function Rf(e){we.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(P(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)}je(Rf,we),Rf.$inject=["eventBus"];var CO=1500;function Mf(e,t,n){e.invoke(we,this),this.preExecute("elements.delete",CO,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=gt(o,l=>P(l,"bpmn:Participant")||P(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>P(l,"bpmn:Artifact"))),c=new Set;return K(r,l=>{const u=new Set(xa(Da(Array.from(s),mn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}je(Mf,we),Mf.$inject=["injector","eventBus","canvas"];function Cf(e,t){e.invoke(we,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=gt(o.incoming.concat(o.outgoing),function(a){return P(a,"bpmn:Association")});K(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}je(Cf,we),Cf.$inject=["injector","modeling"];function Fa(e,t){for(oi(t)&&(t=[t]);e=e.parent;)if(ht(e,t))return e;return null}function hb(e,t){var n=Fa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Fa(e,i),n)return An(n);if(ht(e,i))return An(e);var o;for(o=Ee(e);o&&!P(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=Ee(a);return s&&s.get("processRef")===o});return r?An(r):!0}var gb=500;function Wl(e,t){t.invoke(we,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",gb,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return mb(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",gb,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];mb(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}Wl.$inject=["bpmnReplace","injector"],je(Wl,we),Wl.prototype._replaceShape=function(e,t){var n=AO(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function AO(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function mb(e,t){return!ft(e)&&ht(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Af(e,t){we.call(this,e);function n(i){return gt(i.attachers,function(o){return P(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);P(o,"bpmn:EventBasedGateway")&&P(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;P(o,"bpmn:Gateway")&&P(r,"bpmn:EventBasedGateway")&&K(r.outgoing,function(a){var s=a.target,c=n(s);P(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Af.$inject=["eventBus","modeling"],je(Af,we);function yb(e){return e.create("bpmn:Category")}function PO(e){return e.create("bpmn:CategoryValue")}function vb(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=PO(e)),n.$parent||(n.$parent=yb(e)),n}function TO(e,t,n){return cn(t.get("categoryValue"),e),e.$parent=t,cn(n.get("rootElements"),t),t.$parent=n,e}function kO(e){var t=e.$parent;return t&&(rn(t.get("categoryValue"),e),e.$parent=null),e}function OO(e){var t=e.$parent;return t&&(rn(t.get("rootElements"),e),e.$parent=null),e}var DO=500;function Pf(e,t,n){n.invoke(we,this);function i(c){return t.filter(function(l){return P(l,"bpmn:Group")&&!l.labelTarget}).map(Ee).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&&TO(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&OO(l),c&&!o(c,u)&&kO(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!P(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;!P(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.executed(["shape.move","shape.resize"],DO,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,Ee(l))},!0),this.executed("group.updateRefs",function(c){xb(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){xb(c).forEach(function(l){s(l.categoryValue,l.category,Ee(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!P(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!P(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Pf.$inject=["bpmnjs","elementRegistry","injector"],je(Pf,we);function xb(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Tf(e,t,n){we.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(m){const w=m.source,g=m.target;ja(w)&&Ks(g)&&u(g)}function o(m){const w=m.connection,g=m.source,v=m.target;ja(g)&&Ul(v)&&(l(v),d(g,[w]))}function r(m){const w=m.newTarget,g=m.oldSource,v=m.oldTarget;if(v!==w){const b=g;Ks(v)&&u(v),ja(b)&&Ul(w)&&l(w)}}function a(m){const{element:w}=m;Ks(w)?(p(w),f(w)):Ul(w)&&y(w)}function s(m){const{newData:w,oldShape:g}=m;if(ja(m.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const v=g.outgoing.find(({target:b})=>Ks(b));v&&v.target&&(m._connectionTarget=v.target)}else if(!ja(m.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const v=g.outgoing.find(({target:b})=>Ul(b));v&&v.target&&(m._connectionTarget=v.target),h(g)}}function c(m){const{_connectionTarget:w,newShape:g}=m;w&&t.connect(g,w)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const w of m.incoming)n.canConnect(w.source,m)||t.removeConnection(w);for(const w of m.outgoing)n.canConnect(m,w.target)||t.removeConnection(w)}function d(m,w){m.outgoing.filter(b=>P(b,"bpmn:Association")).filter(b=>Ks(b.target)&&!w.includes(b)).forEach(b=>t.removeConnection(b))}function f(m){const w=m.attachers.slice();w.length&&t.removeElements(w)}function y(m){const w=m.incoming.filter(g=>ja(g.source));t.removeElements(w)}function h(m){const w=m.outgoing.filter(g=>P(g,"bpmn:SequenceFlow"));t.removeElements(w)}}je(Tf,we),Tf.$inject=["eventBus","modeling","bpmnRules"];function Ks(e){const t=Ee(e);return t&&t.get("isForCompensation")}function ja(e){return e&&P(e,"bpmn:BoundaryEvent")&&Ba(e,"bpmn:CompensateEventDefinition")}function Ul(e){return e&&P(e,"bpmn:Activity")&&!Kn(e)}function kf(e){e.invoke(we,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;P(i,"bpmn:Lane")&&!P(o,"bpmn:Lane")&&(n.parent=Fa(i,"bpmn:Participant"))})}kf.$inject=["injector"],je(kf,we);function Of(e,t){we.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(P(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}})}Of.$inject=["eventBus","bpmnFactory"],je(Of,we);var Df=20,Lf=20,bb=30,ql=2e3;function If(e,t,n){we.call(this,t),t.on(["create.start","shape.move.start"],ql,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!P(a,"bpmn:Participant")||!P(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!P(p,"bpmn:Group")&&!ft(p)&&!$t(p)});if(c.length){var l=mn(c),u=LO(a,l);te(a,u),r.createConstraints=IO(a,l)}}}),t.on("create.start",ql,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}P(a,"bpmn:Participant")&&P(s,"bpmn:Process")&&(t.on("element.hover",ql,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return P(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",ql,function(o){var r=o.elements,a=o.parent,s=BO(r),c;s&&P(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=Ee(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;P(a,"bpmn:Participant")&&P(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=Ee(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)&&Ee(s).set("processRef",Ee(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)&&Ee(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)}If.$inject=["canvas","eventBus","modeling"],je(If,we);function LO(e,t){t={width:t.width+Df*2+bb,height:t.height+Lf*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 IO(e,t){return t=Ze(t),{bottom:t.top+e.height/2-Lf,left:t.right-e.width/2+Df,top:t.bottom-e.height/2+Lf,right:t.left+e.width/2-Df-bb}}function BO(e){return Ht(e,function(t){return P(t,"bpmn:Participant")})}var wb="__targetRef_placeholder";function Bf(e,t){we.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],_b(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],_b(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Ht(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Ht(c,function(u){return u.name===wb});return!l&&s&&(l=t.create("bpmn:Property",{name:wb}),cn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||rn(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,y=s.oldTarget||s.target,h=y&&y.businessObject,m=c.businessObject,w;h&&h!==p&&o(h,l),f&&f!==p&&o(f,l),p?(w=i(p,!0),m.targetRef=w):m.targetRef=null}}Bf.$inject=["eventBus","bpmnFactory"],je(Bf,we);function _b(e){return function(t){var n=t.context,i=n.connection;if(P(i,"bpmn:DataInputAssociation"))return e(t)}}function Yl(e){this._bpmnUpdater=e}Yl.$inject=["bpmnUpdater"],Yl.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),[]},Yl.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 Nf(e,t,n,i){we.call(this,i),t.registerHandler("dataStore.updateContainment",Yl);function o(){return n.filter(function(s){return P(s,"bpmn:Participant")&&Ee(s).processRef})[0]}function r(s){return s.children.filter(function(c){return P(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:wt(s),newSemanticParent:u.processRef||u,newDiParent:wt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;P(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 P(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!P(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;P(l,"bpmn:DataStoreReference")&&l.type!=="label"&&P(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(!P(u,"bpmn:Collaboration")&&P(l,"bpmn:DataStoreReference")&&l.type!=="label"&&P(p,"bpmn:Collaboration")){var d=P(u,"bpmn:Participant")?u:$O(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();ht(l,["bpmn:Participant","bpmn:SubProcess"])&&P(u,"bpmn:Collaboration")&&r(u).filter(function(p){return NO(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){P(u,"bpmn:Process")&&a(d,u)})})}Nf.$inject=["canvas","commandStack","elementRegistry","eventBus"],je(Nf,we);function NO(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 $O(e,t){for(;e.parent;){if(P(e.parent,t))return e.parent;e=e.parent}}var Kl=Math.max,Xl=Math.min,FO=20;function Eb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function jO(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 HO(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 Zl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return tt(o)&&(i=(/top|left/.test(e)?Xl:Kl)(i,o)),tt(r)&&(i=(/top|left/.test(e)?Kl:Xl)(i,r)),i}function GO(e,t){if(!t)return e;var n=Ze(e);return Dl({top:Zl("top",n,t),right:Zl("right",n,t),bottom:Zl("bottom",n,t),left:Zl("left",n,t)})}function zO(e,t,n,i){var o=Ze(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?Ze(i):r,s={top:Xl(r.top,a.top),left:Xl(r.left,a.left),bottom:Kl(r.bottom,a.bottom),right:Kl(r.right,a.right)};return Dl(s)}function Xs(e,t){return typeof e<"u"?e:FO}function VO(e,t){var n,i,o,r;return typeof t=="object"?(n=Xs(t.left),i=Xs(t.right),o=Xs(t.top),r=Xs(t.bottom)):n=i=o=r=Xs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function WO(e){return!(e.waypoints||e.type==="label")}function Sb(e,t){var n;if(e.length===void 0?n=gt(e.children,WO):n=e,n.length)return VO(mn(n),t)}var fr=Math.abs;function UO(e,t){return Eb(Ze(t),Ze(e))}var qO=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Pi=30;function Jl(e,t){return t=t||[],e.children.filter(function(n){P(n,"bpmn:Lane")&&(Jl(n,t),t.push(n))}),t}function hr(e){return e.children.filter(function(t){return P(t,"bpmn:Lane")})}function Ti(e){return Fa(e,qO)||e}function YO(e,t){var n=Ti(e),i=P(n,"bpmn:Process")?[]:[n],o=Jl(n,i),r=Ze(e),a=Ze(t),s=UO(e,t),c=[],l=An(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,y=l?s.left:0,h=Ze(u);s.top&&(fr(h.bottom-r.top)<10&&(f=a.top-h.bottom),fr(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(fr(h.right-r.left)<10&&(d=a.left-h.right),fr(h.left-r.left)<5&&(y=a.left-h.left)),s.bottom&&(fr(h.top-r.bottom)<10&&(p=a.bottom-h.top),fr(h.bottom-r.bottom)<5&&(f=a.bottom-h.bottom)),s.right&&(fr(h.left-r.right)<10&&(y=a.right-h.left),fr(h.right-r.right)<5&&(d=a.right-h.right)),(p||d||f||y)&&c.push({shape:u,newBounds:HO(u,{top:p,right:d,bottom:f,left:y})})}}),c}var KO=500;function $f(e,t){we.call(this,e);function n(i,o){var r=An(i),a=hr(o),s=[],c=[],l=[],u=[];if(Yr(a,function(m){return r?m.y>i.y?c.push(m):s.push(m):m.x>i.x?u.push(m):l.push(m),m.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,y,h;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&&(y=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(y.movingShapes,y.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",KO,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;P(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}$f.$inject=["eventBus","spaceTool"],je($f,we);var Rb=500;function Ql(e,t){t.invoke(we,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Rb,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Mb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Rb,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Mb(a,ZO(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Ql.$inject=["bpmnReplace","injector"],je(Ql,we),Ql.prototype._replaceShape=function(e){var t=XO(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function XO(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function Mb(e,t){return!ft(e)&&P(e,"bpmn:BoundaryEvent")&&!t}function ZO(e,t){return e.indexOf(t)!==-1}var eu=Math.round,JO=Math.max;function QO(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 eD(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Cb=10;function tD(e,t){var n,i;for(n=0;i=e[n];n++)if(js(i,t)<=Cb)return{point:e[n],bendpoint:!0,index:n};return null}function nD(e,t){var n=Tx(QO(t,Cb),eD(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=JO(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:eu(i.x+o.x)/2,y:eu(i.y+o.y)/2},index:i.segment2}:{point:{x:eu(i.x),y:eu(i.y)},index:i.segment2}:null}function Ff(e,t){return tD(e,t)||nD(e,t)}function jf(e,t,n){we.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,y,h=o.outgoing.slice(),m=o.incoming.slice(),w;tt(a.width)?w=nt(a):w=a;var g=Ff(s,w);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:w,(c.length===1||!Ab(o,c[c.length-1]))&&c.push(Pb(u)),(l.length===1||!Ab(o,l[0]))&&l.unshift(Pb(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||w),f=r),t.canConnect(o,d,r)&&(f?y=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),y=r));var v=[].concat(f&&gt(m,function(b){return b.source===f.source})||[],y&&gt(h,function(b){return b.target===y.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=nt(c),u={x:l.x+s.x,y:l.y+s.y},p=Ht(r.children,function(d){var f=t.canInsert(a,d);return f&&Ff(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)}je(jf,we),jf.$inject=["eventBus","bpmnRules","modeling"];function Ab(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 te({},e)}function Hf(e,t){we.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)&&Ha(o)){var c=[];P(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Ha(l)):c=a.incoming.filter(l=>l!==o&&Ha(l)&&P(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(P(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Ha).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Ha).forEach(function(s){const c=a.incoming.filter(Ha).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}Hf.$inject=["eventBus","modeling"],je(Hf,we);function Ha(e){return P(e,"bpmn:SequenceFlow")}var tu=1500,Tb=2e3;function kb(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"],tu,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;P(a,"bpmn:Lane")&&!ht(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ti(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||ht(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"],tu,function(i){var o=i.hover;P(o,"bpmn:Lane")&&(i.hover=Ti(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],tu,function(i){var o=i.context,r=i.hover,a=o.type;P(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ti(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],tu,function(i){var o=i.context,r=o.start;P(r,"bpmn:Lane")&&(o.start=Ti(r)||r)}),t.on("shape.move.start",Tb,function(i){var o=i.shape;P(o,"bpmn:Lane")&&(i.shape=Ti(o)||o)}),t.on("spaceTool.move",Tb,function(i){var o=i.hover;o&&P(o,"bpmn:Lane")&&(i.hover=Ti(o))})}kb.$inject=["elementRegistry","eventBus","canvas"];var Ob=770;function Gf(e,t,n,i){n.invoke(we,this);function o(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef;u||(u=vb(e,l));var p=c.category||u.$parent||yb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=Ee(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;P(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;P(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=Ee(l);if(!(!P(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(!(!P(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=Ee(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!P(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!P(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!P(l,"bpmn:Group")||l.labelTarget||Ee(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!P(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",Ob,function(s){var c=s.descriptor,l=s.element;if(!(!P(l,"bpmn:Group")||l.labelTarget)){var u=Ee(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",Ob,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})}Gf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],je(Gf,we);function zf(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 Db(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=zf(i,o,r,a),l=zf(i,o,r,s),u;c&&l?Lb(c,r)>Lb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],nt(i.source)),t(o[o.length-1],o[o.length-2],nt(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Db.$inject=["eventBus"];function Lb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vf(e){we.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=Ee(i),r=wt(i);if(ht(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}Vf.$inject=["eventBus"],je(Vf,we);function Ib(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Bb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function iD(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 oD(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 Wf(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=oD([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 Nb(e,t){var n=Wf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Ib(i)}function Zs(e,t){return Ib({x:e.x-t.x,y:e.y-t.y})}var $b=Math.sqrt,Fb=Math.min,rD=Math.max,jb=Math.abs;function Hb(e){return Math.pow(e,2)}function Js(e,t){return $b(Hb(e.x-t.x)+Hb(e.y-t.y))}function aD(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],zb(i,o)?l=[i]:(r=Js(e,i),a=Js(e,o),c=Fb(r,a),l=sD(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:zb(i,l[0])?n:n+1}),l.length===2&&(s=lD(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Js(i,s)/Js(i,o)}),p=Js(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function sD(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 y=$b(f),h=-p+y,m=-p-y,w={x:e.x-o*h,y:e.y-r*h};if(f===0)return[w];var g={x:e.x-o*m,y:e.y-r*m};return[w,g].filter(function(v){return cD(v,e,t)})}function cD(e,t,n){return Gb(e.x,t.x,n.x)&&Gb(e.y,t.y,n.y)}function Gb(e,t,n){return e>=Fb(t,n)-nu&&e<=rD(t,n)+nu}function lD(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var nu=.1;function zb(e,t){return jb(e.x-t.x)<=nu&&jb(e.y-t.y)<=nu}function uD(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=Wb(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 Vb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=aD(e,n),c=s.segmentIndex,l=uD(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Ub(n,c),p=Ub(t,l),d=s.position,f=dD(u,d),y=pD(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,w=n[m];if(t.indexOf(w)!==-1)return a;if(h===0){var g=t[m];return o=g.x-s.position.x,r=g.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&m!==0&&m<n.length-1&&(f=Wb(n,m))}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=iD({x:e.x-d.x,y:e.y-d.y},y);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:ko(v),delta:ko({x:o,y:r})}}function Wb(e,t){var n=Zs(e[t-1],e[t]),i=Zs(e[t],e[t+1]),o=n/(n+i);return o}function pD(e,t){var n=Bb(e),i=Bb(t);return i-n}function Ub(e,t){return[e[t],e[t+1]]}function dD(e,t){var n=Zs(e[0],e[1]),i=Zs(e[0],t);return n===0?0:i/n}function fD(e,t,n,i){var o=nt(e);return Vb(o,t,n,i).delta}function Qs(e,t,n){var i=Ys(t),o=Ys(n),r=Zi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return ko({x:o.x+a.x,y:o.y+a.y})}function qb(e,t,n){var i=Ys(e),o=Ys(t),r=Ys(n),a=Zi(e,i),s=Zi(i,o),c=hD(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 ko({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function hD(e,t,n){var i=Ze(t),o=Ze(n);if(gD(i,o))return null;var r=$n(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=$n(n,s),c!==r?null:a}function gD(e,t){return mD(e,t)||yD(e,t)}function mD(e,t){return e.right!==t.right&&e.left!==t.left}function yD(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Yb="name",Kb="text";function Uf(e,t,n,i){we.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{Ee(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Yb in l&&t.updateLabel(c,l[Yb]),Kb in l&&P(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;ft(l)||!dr(l)||li(l)&&t.updateLabel(l,li(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=te({},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),fD(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=Ee(c);u&&dr(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(!(!ft(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(li(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,y=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?y-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Fl(c)){var p=c.label,d=nt(p),f=bD(u),y=xD(d,f),h=vD(y,u,l);t.moveShape(p,h)}})}je(Uf,we),Uf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function vD(e,t,n){var i=Qs(e,t,n);return ko(Zi(i,e))}function xD(e,t){if(t.length){var n=wD(e,t);return Wf(e,n)}}function bD(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 wD(e,t){var n=t.map(function(o){return{line:o,distance:Nb(e,o)}}),i=to(n,"distance");return i[0].line}function _D(e,t,n,i){return Vb(e,t,n,i).point}function qf(e,t){we.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=te({},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),_D(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)})})}je(qf,we),qf.$inject=["eventBus","modeling"];function iu(e,t,n){var i=ru(e),o=Zb(i,t),r=i[0];return o.length?o[o.length-1]:Qs(r.original||r,n,t)}function ou(e,t,n){var i=ru(e),o=Zb(i,t),r=i[i.length-1];return o.length?o[0]:Qs(r.original||r,n,t)}function Yf(e,t,n){var i=ru(e),o=Xb(t,n),r=i[0];return Qs(r.original||r,o,t)}function Kf(e,t,n){var i=ru(e),o=Xb(t,n),r=i[i.length-1];return Qs(r.original||r,o,t)}function Xb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ru(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Zb(e,t){var n=Wn(e,SD);return gt(n,function(i){return ED(i,t)})}function ED(e,t){return $n(t,e,1)==="intersect"}function SD(e){return e.original||e}function Xf(e,t){we.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(RD(i,o)){var r=MD(i);r.incoming.forEach(function(a){var s=ou(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=iu(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Xf.$inject=["eventBus","modeling"],je(Xf,we);function RD(e,t){return P(e,"bpmn:Participant")&&xt(e)&&P(t,"bpmn:Participant")&&!xt(t)}function MD(e){var t=$s([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){P(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){P(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const CD=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Jb(e){const t=Ee(e);if(!P(t,"bpmn:BoundaryEvent")&&!(P(t,"bpmn:StartEvent")&&Kn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:CD.some(i=>P(n[0],i))}function Qb(e){return P(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Zf(e,t){e.invoke(we,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Jb(o))return;const a=Qb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=Ee(i).get(a),l=Ee(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Zf.$inject=["injector","modeling"],je(Zf,we);function Jf(e,t){we.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=wt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}je(Jf,we),Jf.$inject=["eventBus","modeling"];function Qf(e,t,n){we.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(!(!P(r,"bpmn:SequenceFlow")||!P(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=AD(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}je(Qf,we),Qf.$inject=["eventBus","bpmnRules","modeling"];function Ga(e){return e.original||e}function AD(e,t){var n=zf(Ga(e[e.length-2]),Ga(e[e.length-1]),Ga(t[1]),Ga(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ga(e[0]),Ga(t[t.length-1])]}function eh(e,t){we.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;P(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)}eh.$inject=["eventBus","modeling"],je(eh,we);function th(e,t,n,i){we.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;P(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),P(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,y;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(y=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=y,o&&s(u,y))}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;K(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=Ht(p.outgoing,wa({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})})}je(th,we),th.$inject=["eventBus","modeling","bpmnRules","injector"];function au(e,t,n,i,o,r){i.invoke(we,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=ai(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=[];K(s.closure.topLevel,function(d){Kn(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})})}je(au,we),au.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;K(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)},au.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var PD=1500,TD={width:140,height:120},nh={width:300,height:60},ih={width:60,height:300},su={width:300,height:150},cu={width:150,height:300},ew={width:140,height:120},tw={width:100,height:40};function nw(e){e.on("resize.start",PD,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(P(i,"bpmn:Lane")||P(i,"bpmn:Participant"))&&(n.resizeConstraints=ID(i,o,r)),P(i,"bpmn:SubProcess")&&xt(i)&&(n.minDimensions=ew),P(i,"bpmn:TextAnnotation")&&(n.minDimensions=tw)})}nw.$inject=["eventBus"];var gr=Math.abs,kD=Math.min,OD=Math.max;function iw(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function za(e,t,n){return iw(e,t,n,kD)}function Va(e,t,n){return iw(e,t,n,OD)}var DD={top:20,left:50,right:20,bottom:20},LD={top:50,left:20,right:20,bottom:20};function ID(e,t,n){var i=Ti(e),o=!0,r=!0,a=Jl(i,[i]),s=Ze(e),c={},l={},u=An(e),p=u?nh:ih;/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(y){var h=Ze(y);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&gr(s.top-h.bottom)<10&&Va(c,"top",h.top+p.height),gr(s.top-h.top)<5&&za(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&gr(s.right-h.left)<10&&za(c,"right",h.right-p.width),gr(s.right-h.right)<5&&Va(l,"right",h.left+p.width)),/s/.test(t)&&(n&&gr(s.bottom-h.top)<10&&za(c,"bottom",h.bottom-p.height),gr(s.bottom-h.bottom)<5&&Va(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&gr(s.left-h.right)<10&&Va(c,"left",h.left+p.width),gr(s.left-h.left)<5&&za(l,"left",h.right-p.width))});var d=i.children.filter(function(y){return!y.hidden&&!y.waypoints&&(P(y,"bpmn:FlowElement")||P(y,"bpmn:Artifact"))}),f=u?DD:LD;return d.forEach(function(y){var h=Ze(y);/n/.test(t)&&(!u||o)&&za(l,"top",h.top-f.top),/e/.test(t)&&(u||r)&&Va(l,"right",h.right+f.right),/s/.test(t)&&(!u||r)&&Va(l,"bottom",h.bottom+f.bottom),/w/.test(t)&&(u||o)&&za(l,"left",h.left-f.left)}),{min:l,max:c}}function ow(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Wa(e){return e.originalEvent||e.srcEvent}function oh(e){ow(e),ow(Wa(e))}function Jr(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 rw(){return/mac/i.test(navigator.platform)}function aw(e,t){return(Wa(e)||e).button===t}function mr(e){return aw(e,0)}function BD(e){return aw(e,1)}function ec(e){var t=Wa(e)||e;return mr(e)?rw()?t.metaKey:t.ctrlKey:!1}function lu(e){var t=Wa(e)||e;return mr(e)&&t.shiftKey}var sw=1001;function cw(e,t){e.on("resize.start",sw+500,function(n){var i=n.context,o=i.shape;(P(o,"bpmn:Lane")||P(o,"bpmn:Participant"))&&(i.balanced=!ec(n))}),e.on("resize.end",sw,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(P(o,"bpmn:Lane")||P(o,"bpmn:Participant"))return r&&(a=Ix(a),t.resizeLane(o,a,i.balanced)),!1})}cw.$inject=["eventBus","modeling"];var ND=500;function rh(e,t,n,i,o){n.invoke(we,this);function r(u){return ht(u,["bpmn:ReceiveTask","bpmn:SendTask"])||$D(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!Ht(d,wa({id:u.id}))}function s(u){if(P(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(P(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(P(u,"bpmn:MessageEventDefinition"))return"messageRef";if(P(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(ht(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(ht(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=Ee(p),f=c(d),y;f&&!a(f)&&(y=e.getDefinitions().get("rootElements"),cn(y,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");rn(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=Ee(d),y=c(f);y&&(p.referencedRootElement=y)}}),t.on("copyPaste.pasteElement",ND,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)})}rh.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],je(rh,we);function $D(e,t){return et(t)||(t=[t]),Yo(t,function(n){return Ba(e,n)})}var lw=Math.max;function uw(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return K(n,function(a){var s=a.id;P(a,"bpmn:Participant")&&(r[s]=jD(a,i,o)),P(a,"bpmn:Lane")&&(r[s]=An(a)?nh:ih),P(a,"bpmn:SubProcess")&&xt(a)&&(r[s]=ew),P(a,"bpmn:TextAnnotation")&&(r[s]=tw),P(a,"bpmn:Group")&&(r[s]=TD)}),r})}uw.$inject=["eventBus"];function FD(e){return e==="x"}function jD(e,t,n){var i=An(e);if(!zD(e))return i?su:cu;var o=FD(t),r={};return o?i?r=su:r={width:GD(e,n,o),height:cu.height}:i?r={width:su.width,height:HD(e,n,o)}:r=cu,r}function HD(e,t,n){var i;return i=VD(e,t,n),lw(su.height,i)}function GD(e,t,n){var i;return i=WD(e,t,n),lw(cu.width,i)}function zD(e){return!!hr(e).length}function VD(e,t,n){var i=hr(e),o;return o=ah(i,t,n),e.height-o.height+nh.height}function WD(e,t,n){var i=hr(e),o;return o=ah(i,t,n),e.width-o.width+ih.width}function ah(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=hr(o),r.length?ah(r,t,n):o}var pw="_plane";function dw(e){var t=e.id;return UD(t)}function po(e){var t=e.id;return P(e,"bpmn:SubProcess")?fw(t):t}function Qr(e){return fw(e)}function uu(e){var t=wt(e);return P(t,"bpmndi:BPMNPlane")}function fw(e){return e+pw}function UD(e){return e.replace(new RegExp(pw+"$"),"")}var hw=400,qD=600,gw={x:180,y:160};function Io(e,t,n,i,o,r,a){we.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 P(p,"bpmn:SubProcess")&&!xt(p)}function l(p){var d=p.shape,f=p.newRootElement,y=Ee(d);f=s._addDiagram(f||y),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=Ee(d);s._removeDiagram(f);var y=p.newRootElement=a.get(po(f));e.removeRootElement(y)}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;K(d,function(f){if(c(f)){var y=a.get(po(f));if(!(!y||!f.children||!f.children.length)){var h=mw(f);s._showRecursively(h),s._moveChildrenToShape(h,y)}}})},!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;!P(d,"bpmn:SubProcess")||!xt(d)||K(Vs([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(po(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(po(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,y=e.findRoot(po(d));if(!(!f||!y)){var h=f.children;n.moveElements(h,{x:0,y:0},y)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(P(d,"bpmn:SubProcess")){var f=p.properties,y=p.oldProperties,h=y.id,m=f.id;if(h!==m){if(uu(d)){a.updateId(d,Qr(m)),a.updateId(h,m);return}var w=a.get(Qr(h));w&&a.updateId(Qr(h),Qr(m))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(P(d,"bpmn:SubProcess")){var f=p.properties,y=p.oldProperties,h=y.id,m=f.id;if(h!==m){if(uu(d)){a.updateId(d,Qr(h)),a.updateId(m,h);return}var w=a.get(Qr(m));w&&a.updateId(w,Qr(h))}}},!0),t.on("element.changed",function(p){var d=p.element;if(uu(d)){var f=d,y=a.get(dw(f));!y||y===f||t.fire("element.changed",{element:y})}}),this.executed("shape.toggleCollapse",hw,function(p){var d=p.shape;P(d,"bpmn:SubProcess")&&(xt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",hw,function(p){var d=p.shape;P(d,"bpmn:SubProcess")&&(xt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",qD,function(p){var d=p.shape;if(P(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(xt(d))s._moveChildrenToShape(f.children.slice(),d),K(Vs(d.children),h=>{n.moveShape(h.annotation,{x:0,y:0},d.parent),K(h.associations,m=>{n.moveConnection(m,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var y=mw(d);s._moveChildrenToShape(y,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var y=po(d),h=a.get(y);h&&f.push.apply(f,h.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,y=p.elements,h=f.parent,m=P(wt(h),"bpmndi:BPMNPlane");if(m){var w=dw(h),g=Ht(y,function(v){return v.id===w});g&&(d.parent=g.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}je(Io,we),Io.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=mn(i),r;if(!t.x)r={x:gw.x-o.x,y:gw.y-o.y};else{var a=nt(t),s=nt(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},Io.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(ab(e).map(i=>i.annotation));n.size&&K(Vs(e.children),i=>{n.has(i.annotation)&&K(i.associations,o=>{t.removeConnection(o)})})},Io.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},Io.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},Io.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:po(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},Io.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ht(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Io.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function YD(e){var t=[];return K(Vs(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function mw(e){return e.children.slice().concat(YD(e.children)).concat(KD(e))}function KD(e){return pf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function sh(e,t){e.invoke(we,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!P(o,"bpmn:SubProcess")||P(o,"bpmn:AdHocSubProcess")||!(P(i,"bpmn:Task")||P(i,"bpmn:CallActivity"))||!xt(o))){var r=XD(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}sh.$inject=["injector","modeling"],je(sh,we);function XD(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ch(e,t){we.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;P(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&&P(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(!(!P(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,li(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}}})}je(ch,we),ch.$inject=["eventBus","textRenderer"];function lh(e,t){we.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(xt(i))return;var o=$s(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();K(s,function(l){r(l,!0)}),K(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||P(a,"bpmn:Association")&&(P(a.source,"bpmn:TextAnnotation")||P(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,nt(i)):t.reconnectStart(a,i,nt(i)))}},!0)}je(lh,we),lh.$inject=["eventBus","modeling"];var uh=500;function ph(e,t,n){we.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=ZD(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"],uh,function(a){var s=a.context,c=s.shape;P(c,"bpmn:SubProcess")&&(c.collapsed?wt(c).isExpanded=!1:(i(c.children),wt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],uh,function(a){var s=a.context,c=s.shape;c.collapsed?wt(c).isExpanded=!1:wt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],uh,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"})})}je(ph,we),ph.$inject=["eventBus","elementFactory","modeling"];function ZD(e){return e.filter(function(t){return!t.hidden})}function dh(e,t,n,i){t.invoke(we,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;ft(a)||(P(a,"bpmn:Participant")&&xt(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;P(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}je(dh,we),dh.$inject=["canvas","injector","moddle","modeling"];function fh(e,t){we.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;JD(o,r)&&t.updateProperties(r,{default:null})})}je(fh,we),fh.$inject=["eventBus","modeling"];function JD(e,t){if(!P(e,"bpmn:SequenceFlow"))return!1;var n=Ee(t),i=Ee(e);return n.get("default")===i}var QD=500,eL=5e3,yw=["shape.create","shape.delete","shape.move","shape.resize"],vw=[...yw,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function hh(e,t){we.call(this,e);var n;function i(){return n=n||new tL,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(vw,eL,function(){i()}),this.postExecuted(vw,QD,function(){r()}),this.preExecute(yw,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(P(c,"bpmn:Lane")&&l.addLane(c),P(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}hh.$inject=["eventBus","modeling"],je(hh,we);function tL(){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 nL=500,iL=5e3,xw=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],bw=[...xw,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function gh(e,t){we.call(this,e);var n;function i(){return n=n||new oL,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(bw,iL,function(){i()}),this.postExecuted(bw,nL,function(){r()}),this.preExecute(xw,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(P(s,"bpmn:FlowElement")&&c.addFlowElement(s),P(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;P(s,"bpmn:Group")&&o().addGroup(s)})}gh.$inject=["eventBus","modeling"],je(gh,we);function oL(){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 mh(e,t){we.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)rL(r)&&!sL(r)&&t.updateProperties(r,{isForCompensation:void 0})})}je(mh,we),mh.$inject=["eventBus","modeling"];function rL(e){const t=Ee(e);return t&&t.isForCompensation}function aL(e){return e&&P(e,"bpmn:BoundaryEvent")&&Ba(e,"bpmn:CompensateEventDefinition")}function sL(e){return e.incoming.filter(n=>aL(n.source)).length>0}const cL={__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",Sf],appendBehavior:["type",Rf],associationBehavior:["type",Cf],attachEventBehavior:["type",Wl],artifactBehavior:["type",Mf],boundaryEventBehavior:["type",Af],categoryRootElementReferenceBehavior:["type",Pf],compensateBoundaryEventBehaviour:["type",Tf],createBehavior:["type",kf],createDataObjectBehavior:["type",Of],createParticipantBehavior:["type",If],dataInputAssociationBehavior:["type",Bf],dataStoreBehavior:["type",Nf],deleteLaneBehavior:["type",$f],detachEventBehavior:["type",Ql],dropOnFlowBehavior:["type",jf],eventBasedGatewayBehavior:["type",Hf],fixHoverBehavior:["type",kb],groupBehavior:["type",Gf],importDockingFix:["type",Db],isHorizontalFix:["type",Vf],labelBehavior:["type",Uf],layoutConnectionBehavior:["type",qf],messageFlowBehavior:["type",Xf],nonInterruptingBehavior:["type",Zf],removeElementBehavior:["type",Qf],removeEmbeddedLabelBoundsBehavior:["type",Jf],removeParticipantBehavior:["type",eh],replaceConnectionBehavior:["type",th],replaceElementBehaviour:["type",au],resizeBehavior:["type",nw],resizeLaneBehavior:["type",cw],rootElementReferenceBehavior:["type",rh],spaceToolBehavior:["type",uw],subProcessPlaneBehavior:["type",Io],subProcessStartEventBehavior:["type",sh],textAnnotationBehavior:["type",ch],toggleCollapseConnectionBehaviour:["type",lh],toggleElementCollapseBehaviour:["type",ph],unclaimIdBehavior:["type",dh],unsetDefaultFlowBehavior:["type",fh],updateFlowNodeRefsBehavior:["type",hh],updateCategoryValueRefsBehavior:["type",gh],setCompensationActivityAfterPasteBehavior:["type",mh]};function yh(e){this._commandStack=e.get("commandStack",!1)}yh.$inject=["injector"],yh.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const fo={__init__:["rules"],rules:["type",yh]};function ki(e){we.call(this,e),this.init()}ki.$inject=["eventBus"],je(ki,we),ki.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)})},ki.prototype.init=function(){};function ww(e,t){var n=$n(e,t,-15);return n!=="intersect"?n:null}function jn(e){ki.call(this,e)}je(jn,ki),jn.$inject=["eventBus"],jn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return lL(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 du(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return du(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 Lw(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return $t(i)&&!fu(t,i)?!1:qo(t,function(o){return $t(o)?du(o.source,o.target,o):o.host?tc(o,o.host,null,n):wh(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 Aw(a)&&!n.includes(a.host)})?!1:tc(n,t,null,i)||Ow(n,t,i)||Dw(n,t)||fu(n,t)}),this.addRule("shape.create",function(e){return wh(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return tc(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Fw(n,t)})},jn.prototype.canConnectMessageFlow=Nw,jn.prototype.canConnectSequenceFlow=$w,jn.prototype.canConnectDataAssociation=_h,jn.prototype.canConnectAssociation=Iw,jn.prototype.canConnectCompensationAssociation=Bw,jn.prototype.canMove=Dw,jn.prototype.canAttach=tc,jn.prototype.canReplace=Ow,jn.prototype.canDrop=Ua,jn.prototype.canInsert=fu,jn.prototype.canCreate=wh,jn.prototype.canConnect=du,jn.prototype.canResize=Lw,jn.prototype.canCopy=Fw;function lL(e){return vh(e)?null:ht(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function vh(e){return!e||ft(e)}function _w(e){do{if(P(e,"bpmn:Process"))return Ee(e);if(P(e,"bpmn:Participant"))return Ee(e).processRef||Ee(e)}while(e=e.parent)}function xh(e){return P(e,"bpmn:TextAnnotation")}function bh(e){return P(e,"bpmn:Group")&&!e.labelTarget}function Ew(e){return P(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function pu(e){return Ee(e).isForCompensation}function uL(e,t){var n=_w(e),i=_w(t);return n===i}function pL(e){return P(e,"bpmn:InteractionNode")&&!P(e,"bpmn:BoundaryEvent")&&(!P(e,"bpmn:Event")||P(e,"bpmn:ThrowEvent")&&Mw(e,"bpmn:MessageEventDefinition"))}function dL(e){return P(e,"bpmn:InteractionNode")&&!pu(e)&&(!P(e,"bpmn:Event")||P(e,"bpmn:CatchEvent")&&Mw(e,"bpmn:MessageEventDefinition"))&&!(P(e,"bpmn:BoundaryEvent")&&!ho(e,"bpmn:MessageEventDefinition"))}function Sw(e){for(var t=e;t=t.parent;){if(P(t,"bpmn:FlowElementsContainer"))return Ee(t);if(P(t,"bpmn:Participant"))return Ee(t).processRef}return null}function Rw(e,t){var n=Sw(e),i=Sw(t);return n===i}function ho(e,t){var n=Ee(e);return!!Ht(n.eventDefinitions||[],function(i){return P(i,t)})}function Mw(e,t){var n=Ee(e);return(n.eventDefinitions||[]).every(function(i){return P(i,t)})}function fL(e){return P(e,"bpmn:FlowNode")&&!P(e,"bpmn:EndEvent")&&!Kn(e)&&!(P(e,"bpmn:IntermediateThrowEvent")&&ho(e,"bpmn:LinkEventDefinition"))&&!Ew(e)&&!pu(e)}function hL(e){return P(e,"bpmn:FlowNode")&&!P(e,"bpmn:StartEvent")&&!P(e,"bpmn:BoundaryEvent")&&!Kn(e)&&!(P(e,"bpmn:IntermediateCatchEvent")&&ho(e,"bpmn:LinkEventDefinition"))&&!pu(e)}function gL(e){return P(e,"bpmn:ReceiveTask")||P(e,"bpmn:IntermediateCatchEvent")&&(ho(e,"bpmn:MessageEventDefinition")||ho(e,"bpmn:TimerEventDefinition")||ho(e,"bpmn:ConditionalEventDefinition")||ho(e,"bpmn:SignalEventDefinition"))}function mL(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Cw(e,t){var n=mL(t);return n.indexOf(e)!==-1}function du(e,t,n){if(vh(e)||vh(t))return null;if(!P(n,"bpmn:DataAssociation")){if(Nw(e,t))return{type:"bpmn:MessageFlow"};if($w(e,t))return{type:"bpmn:SequenceFlow"}}var i=_h(e,t);return i||(Bw(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Iw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ua(e,t){return ft(e)||bh(e)?!0:P(t,"bpmn:Participant")&&!xt(t)?!1:P(e,"bpmn:Participant")?P(t,"bpmn:Process")||P(t,"bpmn:Collaboration"):ht(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:P(e,"bpmn:Lane")?P(t,"bpmn:Participant")||P(t,"bpmn:Lane"):P(e,"bpmn:BoundaryEvent")&&!yL(e)?!1:P(e,"bpmn:FlowElement")&&!P(e,"bpmn:DataStoreReference")?P(t,"bpmn:FlowElementsContainer")?xt(t):ht(t,["bpmn:Participant","bpmn:Lane"]):P(e,"bpmn:DataStoreReference")&&P(t,"bpmn:Collaboration")?Yo(Ee(t).get("participants"),function(n){return!!n.get("processRef")}):ht(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ht(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):P(e,"bpmn:MessageFlow")?P(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function yL(e){return Ee(e).cancelActivity&&(Pw(e)||Tw(e))}function Aw(e){return!ft(e)&&P(e,"bpmn:BoundaryEvent")}function vL(e){return P(e,"bpmn:Lane")}function xL(e){return Aw(e)||P(e,"bpmn:IntermediateThrowEvent")&&Pw(e)?!0:P(e,"bpmn:IntermediateCatchEvent")&&Tw(e)}function Pw(e){var t=Ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Tw(e){return kw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function kw(e,t){return t.some(function(n){return ho(e,n)})}function bL(e){return P(e,"bpmn:ReceiveTask")&&Ht(e.incoming,function(t){return P(t.source,"bpmn:EventBasedGateway")})}function tc(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return ft(o)||!xL(o)||Kn(t)||!P(t,"bpmn:Activity")||pu(t)||i&&!ww(i,t)||bL(t)?!1:"attach"}function Ow(e,t,n){if(!t)return!1;var i={replacements:[]};return K(e,function(o){Kn(t)||P(o,"bpmn:StartEvent")&&o.type!=="label"&&Ua(o,t)&&(T2(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(k2(o)||O2(o)||D2(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),kw(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&P(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),P(t,"bpmn:Transaction")||ho(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(P(o,"bpmn:EndEvent")&&Ua(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),P(o,"bpmn:BoundaryEvent")&&tc(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Dw(e,t){return Yo(e,vL)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ua(n,t)})}function wh(e,t,n,i){return t?ft(e)||bh(e)?!0:Ua(e,t)||fu(e,t):!1}function Lw(e,t,n){return P(e,"bpmn:SubProcess")?xt(e)&&(!t||t.width>=100&&t.height>=80):P(e,"bpmn:Lane")||P(e,"bpmn:Participant")?!0:xh(e)?n?n==="e"||n==="w":!0:bh(e)?!0:ft(e)?n?n==="e"||n==="w":!0:!1}function wL(e,t){var n=xh(e),i=xh(t);return(n||i)&&n!==i}function Iw(e,t){return Cw(t,e)||Cw(e,t)?!1:wL(e,t)?!0:!!_h(e,t)}function Bw(e,t){return Rw(e,t)&&Ew(e)&&P(t,"bpmn:Activity")&&!EL(t,e)&&!Kn(t)}function Nw(e,t){return Hw(e)&&!Hw(t)?!1:pL(e)&&dL(t)&&!uL(e,t)}function $w(e,t){return fL(e)&&hL(t)&&Rw(e,t)&&!(P(e,"bpmn:EventBasedGateway")&&!gL(t))}function _h(e,t){return ht(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ht(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ht(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ht(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function fu(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:ht(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ft(t)&&P(e,"bpmn:FlowNode")&&!P(e,"bpmn:BoundaryEvent")&&Ua(e,t.parent)}function Eh(e,t){return e&&t&&e.indexOf(t)!==-1}function Fw(e,t){return ft(t)?!0:!(P(t,"bpmn:Lane")&&!Eh(e,t.parent)||P(t,"bpmn:MessageFlow")&&!_L(e,t))}function _L(e,t){var n=jw(t.source),i=jw(t.target);return Eh(e,n)&&Eh(e,i)}function jw(e){for(;e;e=e.parent)if(P(e,"bpmn:Participant"))return e;return null}function Hw(e){return Fa(e,"bpmn:Process")||Fa(e,"bpmn:Collaboration")}function EL(e,t){return e.attachers.includes(t)}const SL={__depends__:[fo],__init__:["bpmnRules"],bpmnRules:["type",jn]};var RL=2e3;function Gw(e,t){e.on("saveXML.start",RL,n);function n(){var i=t.getRootElements();K(i,function(o){var r=wt(o),a,s;a=$s([o]),a=gt(a,function(c){return c!==o&&!c.labelTarget}),s=Wn(a,wt),r.set("planeElement",s)})}}Gw.$inject=["eventBus","canvas"];const ML={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Gw]};function hu(e){we.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)})}hu.prototype.getOrdering=function(e,t){return null},je(hu,we);function Sh(e,t){hu.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=Ht(n,function(c){return ht(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&&!ht(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||P(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=Dm(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}}}Sh.$inject=["eventBus","canvas"],je(Sh,hu);const CL={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Sh]};function nc(){}nc.prototype.get=function(){return this._data},nc.prototype.set=function(e){this._data=e},nc.prototype.clear=function(){var e=this._data;return delete this._data,e},nc.prototype.isEmpty=function(){return!this._data};const AL={clipboard:["type",nc]};var zw=1500;function Vw(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",zw,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",zw,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=Jr(a),c=document.elementFromPoint(s.x,s.y),PL(c)}}Vw.$inject=["elementRegistry","eventBus","injector"];function PL(e){return Ur(e,"svg, .djs-element",!0)}const TL={__init__:["hoverFix"],hoverFix:["type",Vw]};function kL(e){return!0}function gu(e){return mr(e)||BD(e)}var Ww=500;function Uw(e,t,n){var i=this;function o(A,L,H){if(!s(A,L)){var V,G,ie;H?G=t.getGraphics(H):(V=L.delegateTarget||L.target,V&&(G=V,H=t.get(G))),!(!G||!H)&&(ie=e.fire(A,{element:H,gfx:G,originalEvent:L}),ie===!1&&(L.stopPropagation(),L.preventDefault()))}}var r={};function a(A){return r[A]}function s(A,L){var H=l[A]||mr;return!H(L)}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":kL,"element.mousedown":gu,"element.mouseup":gu,"element.click":gu,"element.dblclick":gu};function u(A,L,H){var V=c[A];if(!V)throw new Error("unmapped DOM event name <"+A+">");return o(V,L,H)}var p="svg, .djs-element";function d(A,L,H,V){var G=r[H]=function(ie){o(H,ie)};V&&(l[H]=V),G.$delegate=si.bind(A,p,L,G)}function f(A,L,H){var V=a(H);V&&si.unbind(A,L,V.$delegate)}function y(A){K(c,function(L,H){d(A,H,L)})}function h(A){K(c,function(L,H){f(A,H,L)})}e.on("canvas.destroy",function(A){h(A.svg)}),e.on("canvas.init",function(A){y(A.svg)}),e.on(["shape.added","connection.added"],function(A){var L=A.element,H=A.gfx;e.fire("interactionEvents.createHit",{element:L,gfx:H})}),e.on(["shape.changed","connection.changed"],Ww,function(A){var L=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:L,gfx:H})}),e.on("interactionEvents.createHit",Ww,function(A){var L=A.element,H=A.gfx;i.createDefaultHit(L,H)}),e.on("interactionEvents.updateHit",function(A){var L=A.element,H=A.gfx;i.updateDefaultHit(L,H)});var m=E("djs-hit djs-hit-stroke"),w=E("djs-hit djs-hit-click-stroke"),g=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),b={all:g,"click-stroke":w,stroke:m,"no-move":v};function E(A,L){return L=te({stroke:"white",strokeWidth:15},L||{}),n.cls(A,["no-fill","no-border"],L)}function M(A,L){var H=b[L];if(!H)throw new Error("invalid hit type <"+L+">");return Le(A,H),A}function B(A,L){ot(A,L)}this.removeHits=function(A){var L=Ds(".djs-hit",A);K(L,gn)},this.createDefaultHit=function(A,L){var H=A.waypoints,V=A.isFrame,G;return H?this.createWaypointsHit(L,H):(G=V?"stroke":"all",this.createBoxHit(L,G,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,L){var H=Ns(L);return M(H,"stroke"),B(A,H),H},this.createBoxHit=function(A,L,H){H=te({x:0,y:0},H);var V=We("rect");return M(V,L),Le(V,H),B(A,V),V},this.updateDefaultHit=function(A,L){var H=kt(".djs-hit",L);if(H)return A.waypoints?uf(H,A.waypoints):Le(H,{width:A.width,height:A.height}),H},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}Uw.$inject=["eventBus","elementRegistry","styles"];const mu={__init__:["interactionEvents"],interactionEvents:["type",Uw]};function qa(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)})}qa.$inject=["eventBus","canvas"],qa.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()})}},qa.prototype.get=function(){return Array.from(this._selectedElements)},qa.prototype.isSelected=function(e){return this._selectedElements.has(e)},qa.prototype.select=function(e,t){var n=this.get();et(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?K(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var qw="hover",Yw="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,qw)}),t.on("element.out",function(o){i(o.element,qw)}),t.on("selection.changed",function(o){function r(l){i(l,Yw)}function a(l){n(l,Yw)}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 Xw(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;et(l)?t.select(l):t.select(s.filter(OL))}}),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=Ht(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(mr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=lu(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Xw.$inject=["eventBus","selection","canvas","elementRegistry"];function OL(e){return!e.hidden}const Oi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[mu],selection:["type",qa],selectionVisuals:["type",Kw],selectionBehavior:["type",Xw]};var DL=/^djs-cursor-.*$/;function yu(e){var t=Dt(document.body);t.removeMatching(DL),e&&t.add("djs-cursor-"+e)}function Zw(){yu(null)}var LL=5e3;function Jw(e,t){t=t||"element.click";function n(){return!1}return e.once(t,LL,n),function(){e.off(t,n)}}var IL=["c","C"],BL=["v","V"],NL=["d","D"],$L=["x","X"],FL=["y","Y"],Qw=["z","Z"];function jL(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function pi(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Rn(e,t){return e=et(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Rh(e){return e.shiftKey}function HL(e){return pi(e)&&Rn(IL,e)}function GL(e){return pi(e)&&Rn(BL,e)}function zL(e){return pi(e)&&Rn(NL,e)}function VL(e){return pi(e)&&Rn($L,e)}function WL(e){return pi(e)&&!Rh(e)&&Rn(Qw,e)}function UL(e){return pi(e)&&(Rn(FL,e)||Rn(Qw,e)&&Rh(e))}var Ya=Math.round,e_="djs-drag-active";function ea(e){e.preventDefault()}function qL(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function YL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function t_(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(te({},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,A=Jr(v),L=Zi(A,B),H=r.localStart,V=a(A),G=Zi(V,H);if(!r.active&&(b||YL(L)>r.threshold)){if(te(E,{x:Ya(H.x+M.x),y:Ya(H.y+M.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&yu(r.cursor),t.addMarker(t.getRootElement(),e_)}oh(v),r.active&&(te(E,{x:Ya(V.x+M.x),y:Ya(V.y+M.y),dx:Ya(G.x),dy:Ya(G.y)},{originalEvent:v}),s("move"))}function u(v){var b,E=!0;r.active&&(v&&(r.payload.originalEvent=v,oh(v)),E=s("end")),E===!1&&s("rejected"),b=w(E!==!0),s("ended",b)}function p(v){Rn("Escape",v)&&(ea(v),m())}function d(v){var b;r.active&&(b=Jw(e),setTimeout(b,400),ea(v)),u(v)}function f(v){l(v)}function y(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function h(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function m(v){var b;if(r){var E=r.active;E&&s("cancel"),b=w(v),E&&s("canceled",b)}}function w(v){var b,E;s("cleanup"),Zw(),r.trapClick?E=d:E=u,Ke.unbind(document,"mousemove",l),Ke.unbind(document,"dragstart",ea),Ke.unbind(document,"selectstart",ea),Ke.unbind(document,"mousedown",E,!0),Ke.unbind(document,"mouseup",E,!0),Ke.unbind(document,"keyup",p),Ke.unbind(document,"touchstart",f,!0),Ke.unbind(document,"touchcancel",m,!0),Ke.unbind(document,"touchmove",l,!0),Ke.unbind(document,"touchend",u,!0),e.off("element.hover",y),e.off("element.out",h),t.removeMarker(t.getRootElement(),e_);var M=r.payload.previousSelection;return v!==!1&&M&&!n.get().length&&c(M),b=r,r=null,b}function g(v,b,E,M){r&&m(!1),typeof b=="string"&&(M=E,E=b,b=null),M=te({},o,M||{});var B=M.data||{},A,L,H,V,G;if(M.trapClick?V=d:V=u,v?(A=Wa(v)||v,L=Jr(v),oh(v),A.type==="dragstart"&&ea(A)):(A=null,L={x:0,y:0}),H=a(L),b||(b=H),G=qL(A),r=te({prefix:E,data:B,payload:{},globalStart:L,displacement:Zi(b,H),localStart:H,isTouch:G},M),M.manual||(G?(Ke.bind(document,"touchstart",f,!0),Ke.bind(document,"touchcancel",m,!0),Ke.bind(document,"touchmove",l,!0),Ke.bind(document,"touchend",u,!0)):(Ke.bind(document,"mousemove",l),Ke.bind(document,"dragstart",ea),Ke.bind(document,"selectstart",ea),Ke.bind(document,"mousedown",V,!0),Ke.bind(document,"mouseup",V,!0)),Ke.bind(document,"keyup",p),e.on("element.hover",y),e.on("element.out",h)),s("init")===!1)return m(),!1;M.autoActivate&&l(v,!0)}e.on("diagram.destroy",m),this.init=g,this.move=l,this.hover=y,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(v){te(o,v)}}t_.$inject=["eventBus","canvas","selection","elementRegistry"];const Bo={__depends__:[TL,Oi],dragging:["type",t_]};function ta(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ta.prototype.next=function(){return this._prefix+ ++this._counter};const KL=new ta("ps");var XL=["marker-start","marker-mid","marker-end"],ZL=["circle","ellipse","line","path","polygon","polyline","path","rect"];function yr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}yr.$inject=["elementRegistry","eventBus","canvas","styles"],yr.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")},yr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},yr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=tf(n);return this._cloneMarkers(ur(o),i),Le(o,this._styles.cls(i,[])),ot(t,o),Le(o,"data-preview-support-element-id",e.id),o},yr.prototype.addFrame=function(e,t){var n=We("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ot(t,n),Le(n,"data-preview-support-element-id",e.id),n},yr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),tI(e)&&XL.forEach(function(o){if(Le(e,o)){var r=JL(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},yr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,KL.next()].join("-"),a=kt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||tf(n);s.id=r,vt(s).add(o);var c=kt(":scope > defs",e);c||(c=We("defs"),ot(e,c)),ot(c,s);var l=eI(s.id);Le(t,i,l)};function JL(e,t,n){var i=QL(Le(e,t));return kt("marker#"+i,n||document)}function QL(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function eI(e){return"url(#"+e+")"}function tI(e){return ZL.indexOf(e.nodeName)!==-1}const Ka={__init__:["previewSupport"],previewSupport:["type",yr]};var nI="drop-ok",n_="drop-not-ok",i_="attach-ok",o_="new-parent",r_="create",iI=2e3;function a_(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=gt(c,function(g){var v=g.labelTarget;return!g.parent&&!(ft(g)&&c.indexOf(v)!==-1)});var f=Ht(c,function(g){return!$t(g)}),y=!1,h=!1,m=!1;c_(c)&&(y=o.allowed("shape.attach",{position:u,shape:f,target:l})),y||(c_(c)?m=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var w=d.connectionTarget;return m||y?(f&&p&&(h=o.allowed("connection.create",{source:w===p?f:p,target:w===p?p:f,hints:{targetParent:l,targetAttach:y}})),{attach:y,connect:h}):m===null||y===null?null:!1}function a(c,l){[i_,nI,n_,o_].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}s_(c);var y={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,y,d,f);p&&h!==null&&(l.target=p,h&&h.attach?a(p,i_):a(p,h?o_:n_))}),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,y=l.canExecute,h=y&&y.attach,m=y&&y.connect,w=l.hints||{};if(y===!1||!f)return!1;s_(c);var g={x:c.x,y:c.y};m?p=i.appendShape(u,p,g,f,{attach:h,connection:m===!0?{}:m,connectionTarget:w.connectionTarget}):(d=i.createElements(d,g,f,te({},w,{attach:h})),p=Ht(d,function(v){return!$t(v)})),te(l,{elements:d,shape:p}),te(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===r_&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],iI,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){et(l)||(l=[l]);var p=Ht(l,function(y){return!$t(y)});if(p){u=te({elements:l,hints:{},shape:p},u||{}),K(l,function(y){tt(y.x)||(y.x=0),tt(y.y)||(y.y=0)});var d=gt(l,function(y){return!y.hidden}),f=mn(d);K(l,function(y){$t(y)&&(y.waypoints=Wn(y.waypoints,function(h){return{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2}})),te(y,{x:y.x-f.x-f.width/2,y:y.y-f.y-f.height/2})}),t.init(c,r_,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}a_.$inject=["canvas","dragging","eventBus","modeling","rules"];function s_(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 c_(e){return e&&e.length===1&&!$t(e[0])}var oI=750;function l_(e,t,n,i,o){function r(a){var s=We("g");Le(s,o.cls("djs-drag-group",["no-events"]));var c=We("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(ur(u),l)):(u=n._createContainer("shape",c),n.drawShape(ur(u),l),Fn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",oI,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(),ot(p,u)),Fn(u,a.x,a.y)):gn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&gn(c)})}l_.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const vu={__depends__:[Bo,Ka,fo,Oi],__init__:["create","createPreview"],create:["type",a_],createPreview:["type",l_]};function Mh(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)})}Mh.$inject=["eventBus"],Mh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||rI(0,0)};function rI(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 ic={__init__:["mouse"],mouse:["type",Mh]};var u_=2e3;function di(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),aI(u)&&(l.priority=2,l.host=u.host.id),$t(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=sI(u)),ft(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),K(["x","y","width","height"],function(d){tt(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",u_,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",u_,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;te(l,{createElementsBehavior:!1})})}di.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],di.prototype.copy=function(e,t={}){var n,i;return et(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(et(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},di.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})}}},di.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},di.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},di.prototype._getElementIdsFromTree=function(e){var t={};return K(e,function(n){K(n,function(i){i.id&&(t[i.id]=!0)})}),t},di.prototype._paste=function(e,t,n,i){K(e,function(r){tt(r.x)||(r.x=0),tt(r.y)||(r.y=0)});var o=mn(e);return K(e,function(r){$t(r)&&(r.waypoints=Wn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),te(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,te({},i))},di.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return K(e,function(r,a){r=to(r,"priority"),K(r,function(s){var c=te({},no(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if($t(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(ft(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},di.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(no(e,["id"]));return t},di.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(no(e,["id"]));return t},di.prototype.createShape=function(e){var t=this._elementFactory.createShape(no(e,["id"]));return t},di.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!($t(e)&&(!n.has(e.source)||!n.has(e.target))||ft(e)&&!n.has(e.labelTarget))},di.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=Tl(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 y={element:p,depth:d};o.push(y),r.set(p,y);return}if(f.depth<d){o=l(f,o);var h={element:f.element,depth:d};o.push(h),r.set(p,h)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}Yr(a,function(p,d,f){if(ft(p))return;K(p.labels,function(m){c(m,f)});function y(m){m&&m.length&&K(m,function(w){K(w.labels,function(g){c(g,f)}),c(w,f)})}K([p.attachers,p.incoming,p.outgoing],y),c(p,f);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Wn(o,function(p){return p.element});var u=new Set(e);return o=Wn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=to(o,function(p){return p.descriptor.priority}),e=Wn(o,function(p){return p.element}),K(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){d_(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){d_(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function aI(e){return!!e.host}function sI(e){return Wn(e.waypoints,function(t){return t=p_(t),t.original&&(t.original=p_(t.original)),t})}function p_(e){return te({},e)}function d_(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const cI={__depends__:[AL,vu,ic,fo],__init__:["copyPaste"],copyPaste:["type",di]};function Ch(e,t,n){et(n)||(n=[n]),K(n,function(i){$r(e[i])||(t[i]=e[i])})}var Ah=750;function f_(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Ah,function(c){var l=c.descriptor,u=c.element,p=Ee(u);if(ft(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(wt(u),!0);f.bpmnElement=d,Ch(d,l,"name"),Ch(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=Ee(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(Ee(c).attachedToRef=Ee(l[c.host])),no(u,ai(u,function(d,f,y){var h=f.element,m=f.property;return y===c.id&&(h.set(m,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(ft(u)){u.businessObject=Ee(l[u.labelTarget]),u.di=wt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,Ch(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Ah,function(c){var l=c.descriptor,u=c.element;if(P(u,"bpmn:Participant")){var p=Ee(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;P(l,"bpmn:SubProcess")&&K(Vs(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Ah,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}f_.$inject=["bpmnFactory","eventBus","moddleCopy"];const lI=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],uI=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function oc(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 to(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=En(o)&&o.$descriptor;if(a&&uI.includes(a))return r;if(a&&lI.includes(a)||a&&s&&!Ht(s.properties,wa({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(P(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}oc.$inject=["eventBus","bpmnFactory","moddle"],oc.prototype.copyElement=function(e,t,n,i=!1){n&&!et(n)&&(n=[n]),n=n||Ph(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(et(o)&&(n=o),K(n,r=>{let a;ri(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!_n(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},oc.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 En(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):et(e)?ai(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):En(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},oc.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 Ph(e,t){return ai(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const h_={__depends__:[cI],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",f_],moddleCopy:["type",oc]};var g_=Math.round;function Th(e,t){this._modeling=e,this._eventBus=t}Th.$inject=["modeling","eventBus"],Th.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=g_(s+r/2),u=g_(c+a/2),p=i.replaceShape(e,te({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function m_(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}m_.$inject=["selection","eventBus"];const pI={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",m_],replace:["type",Th]};function dI(e,t,n){et(n)||(n=[n]),K(n,function(i){$r(e[i])||(t[i]=e[i])})}var fI=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function hI(e,t){var n=e&&ri(e,"collapsed")?e.collapsed:!xt(e),i;return t&&(ri(t,"collapsed")||ri(t,"isExpanded"))?i=ri(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function y_(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(xu(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&hI(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),dI(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var y=Ph(p.$descriptor),h=Ph(d.$descriptor,!0),m=gI(y,h);te(d,Vi(c,fI));var w=gt(m,function(b){return b==="eventDefinitions"?v_(s,c.eventDefinitionType):b==="loopCharacteristics"?!Kn(d):ri(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Kn(d):!0});if(d=n.copyElement(p,d,w),c.eventDefinitionType&&(v_(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),P(p,"bpmn:Activity")){if(xu(p))f.isExpanded=xt(s);else if(c&&ri(c,"isExpanded")){f.isExpanded=c.isExpanded;var g=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=g.width,f.height=g.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}xt(s)&&!P(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(xu(p)&&!xu(d)&&(l.moveChildren=!1),P(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=An(s);wt(s).isHorizontal||(wt(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,ht(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ht(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!P(p,"bpmn:BoundaryEvent")&&P(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}y_.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function xu(e){return P(e,"bpmn:SubProcess")}function v_(e,t){var n=Ee(e);return t&&n.get("eventDefinitions").some(function(i){return P(i,t)})}function gI(e,t){return e.filter(function(n){return t.includes(n)})}const x_={__depends__:[h_,pI,Oi],bpmnReplace:["type",y_]};var mI=250;function na(e){this._eventBus=e,this._tools=[],this._active=null}na.$inject=["eventBus"],na.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)},na.prototype.isActive=function(e){return e&&this._active===e},na.prototype.length=function(e){return this._tools.length},na.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},na.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),K(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,mI,function(o){this._active&&(yI(o)||this.setActive(null))},this)};function yI(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Ur(t,'.group[data-group="tools"]')}const bu={__depends__:[Bo],__init__:["toolManager"],toolManager:["type",na]};function vI(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 xI(e,t){var n=[],i=new Set(e);K(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;K(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 bI(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 kh=Math.abs,wI=Math.round,No={x:"width",y:"height"},b_="crosshair",vr={n:"top",w:"left",s:"bottom",e:"right"},_I=1500,wu={n:"s",w:"e",s:"n",e:"w"},_u=20;function Di(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",_I,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&__(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,y=l.start;if(l.initialized){__(c);var h={x:0,y:0};h[u]=wI(c["d"+u]),s.makeSpace(d,f,h,p,y),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Di.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Di.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:b_,data:{context:{reactivate:n}},trapClick:!1})},Di.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:b_,data:{context:{}}})},Di.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Di.prototype.init=function(e,t){var n=kh(e.dx)>kh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(kh(i)<5)return!1;i<0&&(i*=-1),ec(e)&&(i*=-1);var r=vI(n,i),a=this._canvas.getRootElement();!lu(e)&&e.hover&&(a=e.hover);var s=[...$s(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=EI(c,n,r,o,l);return te(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),yu("resize-"+(n==="x"?"ew":"ns")),!0},Di.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 y=f.label;y&&!s.has(y)&&(s.add(y),r.push(y))}function d(f){c.has(f)||(c.add(f),a.push(f))}return K(e,function(f){if(!(!f.parent||ft(f))){if($t(f)){u.push(f);return}var y=f[t],h=y+f[No[t]];if(SI(f)&&(n>0&&nt(f)[t]>i||n<0&&nt(f)[t]<i)){l.push(f);return}if(n>0&&y>i||n<0&&h<i){p(f);return}if(y<i&&h>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),K(r,function(f){var y=f.attachers;y&&K(y,function(h){p(h)})}),K(l,function(f){var y=f.host;(s.has(y)||c.has(y))&&p(f)}),K(u,function(f){var y=f.source,h=f.target,m=f.label;(s.has(y)||c.has(y))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:r,resizingShapes:a}},Di.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Di.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function w_(e){return{top:e.top-_u,right:e.right+_u,bottom:e.bottom+_u,left:e.left-_u}}function __(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;tt(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),tt(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),tt(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),tt(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function EI(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 K(a,function(d){var f=d.attachers,y=d.children,h=Ze(d),m=gt(y,function(G){return!$t(G)&&!ft(G)&&!u.has(G)&&!p.has(G)}),w=gt(y,function(G){return!$t(G)&&!ft(G)&&u.has(G)}),g,v,b,E=[],M=[],B,A,L,H;m.length&&(v=w_(Ze(mn(m))),g=i-h[vr[n]]+v[vr[n]],n==="n"?s.bottom=l=tt(l)?Math.min(l,g):g:n==="w"?s.right=l=tt(l)?Math.min(l,g):g:n==="s"?s.top=c=tt(c)?Math.max(c,g):g:n==="e"&&(s.left=c=tt(c)?Math.max(c,g):g)),w.length&&(b=w_(Ze(mn(w))),g=i-b[vr[wu[n]]]+h[vr[wu[n]]],n==="n"?s.bottom=l=tt(l)?Math.min(l,g):g:n==="w"?s.right=l=tt(l)?Math.min(l,g):g:n==="s"?s.top=c=tt(c)?Math.max(c,g):g:n==="e"&&(s.left=c=tt(c)?Math.max(c,g):g)),f&&f.length&&(f.forEach(function(G){u.has(G)?E.push(G):M.push(G)}),E.length&&(B=Ze(mn(E.map(nt))),A=h[vr[wu[n]]]-(B[vr[wu[n]]]-i)),M.length&&(L=Ze(mn(M.map(nt))),H=L[vr[n]]-(h[vr[n]]-i)),n==="n"?(g=Math.min(A||1/0,H||1/0),s.bottom=l=tt(l)?Math.min(l,g):g):n==="w"?(g=Math.min(A||1/0,H||1/0),s.right=l=tt(l)?Math.min(l,g):g):n==="s"?(g=Math.max(A||-1/0,H||-1/0),s.top=c=tt(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(A||-1/0,H||-1/0),s.left=c=tt(c)?Math.max(c,g):g));var V=o&&o[d.id];V&&(n==="n"?(g=i+d[No[t]]-V[No[t]],s.bottom=l=tt(l)?Math.min(l,g):g):n==="w"?(g=i+d[No[t]]-V[No[t]],s.right=l=tt(l)?Math.min(l,g):g):n==="s"?(g=i-d[No[t]]+V[No[t]],s.top=c=tt(c)?Math.max(c,g):g):n==="e"&&(g=i-d[No[t]]+V[No[t]],s.left=c=tt(c)?Math.max(c,g):g))}),s}}function SI(e){return!!e.host}var Oh="djs-dragging",E_="djs-resizing",RI=250,Eu=Math.max;function S_(e,t,n,i,o){function r(a,s){K(a,function(c){o.addDragger(c,s),n.addMarker(c,Oh)})}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=We("g");Le(u,i.cls("djs-crosshair-group",["no-events"])),ot(s,u);var p=We("path");Le(p,"d",l.x),vt(p).add("djs-crosshair"),ot(u,p);var d=We("path");Le(d,"d",l.y),vt(d).add("djs-crosshair"),ot(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Fn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&gn(c)}),e.on("spaceTool.move",RI,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=We("path"),Le(c,"d","M0,0 L0,0"),vt(c).add("djs-crosshair"),ot(d,c),s.line=c;var f=We("g");Le(f,i.cls("djs-drag-group",["no-events"])),ot(n.getActiveLayer(),f),r(u,f);var y=new Set(u);K(p,function(M){y.add(M)});var h=new Set,m=s.movingConnections=[];y.forEach(function(M){K(M.outgoing,function(B){h.has(B)||!$t(B)||!y.has(B.target)||(h.add(B),m.push(B))})}),r(m,f),s.dragGroup=f}if(!s.frameGroup){var w=We("g");Le(w,i.cls("djs-frame-group",["no-events"])),ot(n.getActiveLayer(),w);var g=[];K(p,function(M){var B=o.addFrame(M,w),A=B.getBBox();g.push({element:B,initialBounds:A}),n.addMarker(M,E_)}),s.frameGroup=w,s.frames=g}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,Fn(s.dragGroup,E.x,E.y),K(s.frames,function(M){var B=M.element,A=M.initialBounds,L,H;s.direction==="e"?Le(B,{width:Eu(A.width+E.x,5)}):(L=Eu(A.width-E.x,5),Le(B,{width:L,x:A.x+A.width-L})),s.direction==="s"?Le(B,{height:Eu(A.height+E.y,5)}):(H=Eu(A.height-E.y,5),Le(B,{height:H,y:A.y+A.height-H}))})}}),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;K(c,function(y){n.removeMarker(y,Oh)}),K(l,function(y){n.removeMarker(y,Oh)}),d&&(gn(p),gn(d)),K(u,function(y){n.removeMarker(y,E_)}),f&&gn(f)})}S_.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const MI={__init__:["spaceToolPreview"],__depends__:[Bo,fo,bu,Ka,ic],spaceTool:["type",Di],spaceToolPreview:["type",S_]};function Su(e,t){e.invoke(Di,this),this._canvas=t}Su.$inject=["injector","canvas"],je(Su,Di),Su.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=xa(Da(o.children.filter(l=>P(l,"bpmn:Artifact")),mn(r))));const s=[...e,...a];var c=Di.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(P(l,"bpmn:TextAnnotation")||CI(l)&&(t==="y"&&An(l)||t==="x"&&!An(l)))}),c};function CI(e){return P(e,"bpmn:Participant")&&!Ee(e).processRef}const R_={__depends__:[MI],spaceTool:["type",Su]};function Zt(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)}Zt.$inject=["eventBus","injector"],Zt.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()},Zt.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},Zt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Zt.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()}},Zt.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()}},Zt.prototype.register=function(e,t){this._setHandler(e,t)},Zt.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)},Zt.prototype.canUndo=function(){return!!this._getUndoAction()},Zt.prototype.canRedo=function(){return!!this._getRedoAction()},Zt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Zt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Zt.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)})},Zt.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},Zt.prototype._createId=function(){return this._uid++},Zt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Zt.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()},Zt.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)},Zt.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:Lm("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Zt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=et(e)?e:[e],t.dirty=t.dirty.concat(e))},Zt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Zt.prototype._revertedAction=function(e){this._stackIdx--},Zt.prototype._getHandler=function(e){return this._handlerMap[e]},Zt.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 AI={commandStack:["type",Zt]};function xr(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 PI=250,M_=1400;function Dh(e,t,n){we.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",M_,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=C_(a),r.validatedShapes=C_(s)}),i&&t.on("shape.move.start",PI,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",M_,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];K(s,function(l){K(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;xr(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=df(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&&(cn(s.labels,a,c),a.labelTarget=s)})}je(Dh,we),Dh.$inject=["injector","eventBus","modeling"];function C_(e){var t=new Set(e);return gt(e,function(n){return!t.has(n.labelTarget)})}const TI={__init__:["labelSupport"],labelSupport:["type",Dh]};var kI=251,A_=1401,P_="attach-ok";function Lh(e,t,n,i,o){we.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",A_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=OI(c),s.validatedShapes=DI(l)}),r&&t.on("shape.move.start",kI,function(a){var s=a.context,c=s.shapes,l=Ih(c);K(l,function(u){r.makeDraggable(s,u,!0),K(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",A_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Ih(l);K(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=gt(c,function(p){var d=p.host;return LI(p)&&!II(c,d)}),K(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;K(s,function(c){K(c.attachers,function(l){K(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),K(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;xr(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&&K(l.attachers,function(u){var p=qb(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&&K(p,function(f){var y=qb(f,l,u);o.moveShape(f,y,f.parent),K(f.labels,function(h){o.moveShape(h,y,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;xr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}je(Lh,we),Lh.$inject=["injector","eventBus","canvas","rules","modeling"];function Ih(e){return Up(Wn(e,function(t){return t.attachers||[]}))}function OI(e){var t=Ih(e);return QR("id",e,t)}function DI(e){var t=ba(e,"id");return gt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function LI(e){return!!e.host}function II(e,t){return e.indexOf(t)!==-1}const BI={__depends__:[fo],__init__:["attachSupport"],attachSupport:["type",Lh]};function T_(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(bx(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)})}T_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Bh={__init__:["changeSupport"],changeSupport:["type",T_]};function Li(e){this._model=e}Li.$inject=["moddle"],Li.prototype._needsId=function(e){return ht(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"])},Li.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;P(e,"bpmn:Activity")?t="Activity":P(e,"bpmn:Event")?t="Event":P(e,"bpmn:Gateway")?t="Gateway":ht(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))},Li.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Li.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Li.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",te({bpmnElement:e,bounds:this.createDiBounds()},t))},Li.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Li.prototype.createDiWaypoints=function(e){var t=this;return Wn(e,function(n){return t.createDiWaypoint(n)})},Li.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Vi(e,["x","y"]))},Li.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",te({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Li.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",te({bpmnElement:e},t))};function fi(e,t,n){we.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var y=f.context,h=y.hints||{},m;!y.cropped&&h.createElementsBehavior!==!1&&(m=y.connection,m.waypoints=n.getCroppedWaypoints(m),y.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var y=f.context;i.updateParent(y.shape||y.connection,y.oldParent)}function a(f){var y=f.context,h=y.shape||y.connection,m=y.parent||y.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],hi(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],hi(a));function s(f){var y=f.context,h=y.oldRoot,m=h.children;K(m,function(w){P(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var y=f.context.shape;P(y,"bpmn:BaseElement")&&i.updateBounds(y)}this.executed(["shape.move","shape.create","shape.resize"],hi(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],hi(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"],hi(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],hi(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],hi(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],hi(u)),this.executed("connection.reconnect",hi(function(f){var y=f.context,h=y.connection,m=y.oldSource,w=y.newSource,g=Ee(h),v=Ee(m),b=Ee(w);g.conditionExpression&&!ht(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(y.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),m!==w&&v.default===g&&(y.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",hi(function(f){var y=f.context,h=y.connection,m=y.oldSource,w=y.newSource,g=Ee(h),v=Ee(m),b=Ee(w);y.oldConditionExpression&&(g.conditionExpression=y.oldConditionExpression),y.oldDefault&&(v.default=y.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],hi(p)),this.reverted(["element.updateAttachment"],hi(p)),this.executed("element.updateLabel",hi(d)),this.reverted("element.updateLabel",hi(d));function d(f){const{element:y}=f.context,h=li(y),m=wt(y),w=m&&m.get("label");dr(y)||uu(y)||(h&&!w?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&m.set("label",void 0))}}je(fi,we),fi.$inject=["eventBus","bpmnFactory","connectionDocking"],fi.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},fi.prototype.updateParent=function(e,t){if(!ft(e)&&!(P(e,"bpmn:DataStoreReference")&&e.parent&&P(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=wt(e),r=n&&n.businessObject,a=wt(n);P(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),P(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),P(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),P(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},fi.prototype.updateBounds=function(e){var t=wt(e),n=$I(e);if(n){var i=Zi(n,t.get("bounds"));te(n,{x:e.x+i.x,y:e.y+i.y})}var o=ft(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),te(r,{x:e.x,y:e.y,width:e.width,height:e.height})},fi.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;P(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),rn(i,e)),P(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),cn(o,e))}},fi.prototype.updateDiConnection=function(e,t,n){var i=wt(e),o=wt(t),r=wt(n);i.sourceElement&&i.sourceElement.bpmnElement!==Ee(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==Ee(n)&&(i.targetElement=n&&r)},fi.prototype.updateDiParent=function(e,t){if(t&&!P(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(rn(n,e),e.$parent=null)}};function NI(e){for(;e&&!P(e,"bpmn:Definitions");)e=e.$parent;return e}fi.prototype.getLaneSet=function(e){var t,n;return P(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(P(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)},fi.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((P(e,"bpmn:DataInput")||P(e,"bpmn:DataOutput"))&&(P(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(P(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(P(e,"bpmn:FlowElement")){if(t){if(P(t,"bpmn:Participant"))t=t.processRef;else if(P(t,"bpmn:Lane"))do t=t.$parent.$parent;while(P(t,"bpmn:Lane"))}i="flowElements"}else if(P(e,"bpmn:Artifact")){for(;t&&!P(t,"bpmn:Process")&&!P(t,"bpmn:SubProcess")&&!P(t,"bpmn:Collaboration");)if(P(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(P(e,"bpmn:MessageFlow"))i="messageFlows";else if(P(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=NI(e.$parent||t),e.$parent&&(rn(r.get("rootElements"),o),o.$parent=null),t&&(cn(r.get("rootElements"),o),o.$parent=r))}else P(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":P(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),rn(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);rn(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},fi.prototype.updateConnectionWaypoints=function(e){var t=wt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},fi.prototype.updateConnection=function(e){var t=e.connection,n=Ee(t),i=t.source,o=Ee(i),r=t.target,a=Ee(t.target),s;if(P(n,"bpmn:DataAssociation"))P(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):P(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=P(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(rn(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(rn(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)},fi.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function hi(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;P(i,"bpmn:BaseElement")&&e(t)}}function $I(e){if(P(e,"bpmn:Activity")){var t=wt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function br(e,t){Oo.call(this),this._bpmnFactory=e,this._moddle=t}je(br,Oo),br.$inject=["bpmnFactory","moddle"],br.prototype._baseCreate=Oo.prototype.create,br.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,te({type:"label",di:n},Xr,t))}return this.createElement(e,t)},br.prototype.createElement=function(e,t){t=te({},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(!jI(o)){var r=te({},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)}P(i,"bpmn:Group")&&(t=te({isFrame:!0},t)),t=FI(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Nh(o,t,"isExpanded")),ht(i,["bpmn:Lane","bpmn:Participant"])&&(t=Nh(o,t,"isHorizontal")),P(i,"bpmn:SubProcess")&&(t.collapsed=!xt(i,o)),P(i,"bpmn:ExclusiveGateway")&&(ri(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),_n(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),_n(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=te({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},br.prototype.getDefaultSize=function(e,t){var n=Ee(e);if(t=t||wt(e),P(n,"bpmn:SubProcess"))return xt(n,t)?{width:350,height:200}:{width:100,height:80};if(P(n,"bpmn:Task"))return{width:100,height:80};if(P(n,"bpmn:Gateway"))return{width:50,height:50};if(P(n,"bpmn:Event"))return{width:36,height:36};if(P(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return xt(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return P(n,"bpmn:Lane")?{width:400,height:100}:P(n,"bpmn:DataObjectReference")?{width:36,height:50}:P(n,"bpmn:DataStoreReference")?{width:50,height:50}:P(n,"bpmn:TextAnnotation")?{width:100,height:40}:P(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},br.prototype.createParticipantShape=function(e){return En(e)||(e={isExpanded:e}),e=te({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function FI(e,t,n){return K(n,function(i){t=Nh(e,t,i)}),t}function Nh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],no(t,[n]))}function jI(e){return ht(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Ru(e,t){this._modeling=e,this._canvas=t}Ru.$inject=["modeling","canvas"],Ru.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;K(n,function(o){var r={x:0,y:0};_n(i.left)?r.x=i.left-o.x:_n(i.right)?r.x=i.right-o.width-o.x:_n(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:_n(i.top)?r.y=i.top-o.y:_n(i.bottom)?r.y=i.bottom-o.height-o.y:_n(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},Ru.prototype.postExecute=function(e){};function Mu(e){this._modeling=e}Mu.$inject=["modeling"],Mu.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},Mu.prototype.postExecute=function(e){var t=e.hints||{};HI(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 HI(e,t){return Yo(e.outgoing,function(n){return n.target===t})}function Cu(e,t){this._canvas=e,this._layouter=t}Cu.$inject=["canvas","layouter"],Cu.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},Cu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Au=Math.round;function $h(e){this._modeling=e}$h.$inject=["modeling"],$h.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;K(t,function(p){tt(p.x)||(p.x=0),tt(p.y)||(p.y=0)});var s=gt(t,function(p){return!p.hidden}),c=mn(s);K(t,function(p){$t(p)&&(p.waypoints=Wn(p.waypoints,function(d){return{x:Au(d.x-c.x-c.width/2+o.x),y:Au(d.y-c.y-c.height/2+o.y)}})),te(p,{x:Au(p.x-c.x-c.width/2+o.x),y:Au(p.y-c.y-c.height/2+o.y)})});var l=new Set(Tl(t)),u={};K(t,function(p){if($t(p)){u[p.id]=tt(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=te({},r);l.has(p)||(d.autoResize=!1),ft(p)&&(d=no(d,["attach"])),u[p.id]=tt(i)?a.createShape(p,Vi(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,Vi(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=xa(u)};var k_=Math.round;function wr(e){this._canvas=e}wr.$inject=["canvas"],wr.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?te(t,n):te(t,{x:n.x-k_(t.width/2),y:n.y-k_(t.height/2)}),this._canvas.addShape(t,i,o),t},wr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function rc(e){wr.call(this,e)}je(rc,wr),rc.$inject=["canvas"];var GI=wr.prototype.execute;rc.prototype.execute=function(e){var t=e.shape;return VI(t),t.labelTarget=e.labelTarget,GI.call(this,e)};var zI=wr.prototype.revert;rc.prototype.revert=function(e){return e.shape.labelTarget=null,zI.call(this,e)};function VI(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ac(e,t){this._canvas=e,this._modeling=t}ac.$inject=["canvas","modeling"],ac.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;xr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),xr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ac.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=df(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ac.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,cn(n.children,t,i),this._canvas.addConnection(t,n),t};function Fh(e,t){this._modeling=e,this._elementRegistry=t}Fh.$inject=["modeling","elementRegistry"],Fh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;K(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function sc(e,t){this._canvas=e,this._modeling=t}sc.$inject=["canvas","modeling"],sc.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;xr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),xr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),xr(n.children,function(i){$t(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},sc.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=df(i.children,n),t.removeShape(n),n},sc.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return cn(i.children,n,o),t.addShape(n,i),n};function Pu(e){this._modeling=e}Pu.$inject=["modeling"];var O_={x:"y",y:"x"};Pu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,w){m.range.min=Math.min(w[i],m.range.min),m.range.max=Math.max(w[i]+w[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,w){var g={y:0};g[i]=m-a(w),g[i]&&(g[O_[i]]=0,t.moveElements([w],g,w.parent))}var u=n[0],p=s(n),d=n[p],f,y,h=0;K(n,function(m,w){var g,v,b;if(m.elements.length<2){w&&w!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}g=to(m.elements,i),v=g[0],w===p&&(v=g[s(g)]),b=a(v),m.range=null,K(g,function(E){if(l(b,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),w&&w!==n.length-1&&(h+=c(m.range))}),y=Math.abs(d.range.min-u.range.max),f=Math.round((y-h)/(n.length-1)),!(f<n.length-1)&&K(n,function(m,w){var g={},v;m===u||m===d||(v=n[w-1],m.range.max=0,K(m.elements,function(b,E){g[O_[i]]=0,g[i]=v.range.max-b[i]+f,m.range.min!==b[i]&&(g[i]+=b[i]-m.range.min),g[i]&&t.moveElements([b],g,b.parent),m.range.max=Math.max(b[i]+b[o],E?m.range.max:0)}))})},Pu.prototype.postExecute=function(e){};function Tu(e,t){this._layouter=e,this._canvas=t}Tu.$inject=["layouter","canvas"],Tu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return te(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Tu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function jh(){}jh.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=rn(r.children,t),cn(i.children,t,o),t.parent=i,K(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},jh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return rn(n.children,t),cn(i.children,t,o),t.parent=i,K(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 Hh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Hh.prototype.add=function(e,t){return this.addAll([e],t)},Hh.prototype.addAll=function(e,t){var n=_k(e,!!t,this);return te(this,n),this};function cc(e){this._modeling=e}cc.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},cc.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),K(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),K(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&&Yf(p,p.source,t),connectionEnd:f&&Kf(p,p.target,t)})})},cc.prototype.getClosure=function(e){return new Hh().addAll(e,!0)};function ku(e){this._helper=new cc(e)}ku.$inject=["modeling"],ku.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},ku.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 ia(e){this._modeling=e,this._helper=new cc(e)}ia.$inject=["modeling"],ia.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=Vi(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=rn(r.children,t),cn(i.children,t,o),te(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},ia.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(K(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:Kf(r,t,n)})}),K(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Yf(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},ia.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return cn(n.children,t,i),te(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},ia.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},ia.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function lc(e){this._modeling=e}lc.$inject=["modeling"],lc.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 et(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},lc.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||D_(et(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||D_(et(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},lc.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 D_(e){return e.original||e}function $o(e,t){this._modeling=e,this._rules=t}$o.$inject=["modeling","rules"],$o.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(y,h,m){return i.allowed("connection.reconnect",{connection:m,source:y,target:h})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var d=o.incoming.slice(),f=o.outgoing.slice();K(d,function(y){var h=y.source,m=c(h,s,y);m&&t.reconnectEnd(y,s,ou(y,s,u),a)}),K(f,function(y){var h=y.target,m=c(s,h,y);m&&t.reconnectStart(y,s,iu(y,s,u),a)})},$o.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},$o.prototype.execute=function(e){},$o.prototype.revert=function(e){},$o.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},$o.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},$o.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function uc(e){this._modeling=e}uc.$inject=["modeling"],uc.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},te(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},uc.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(K(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:ou(r,n,i)})}),K(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:iu(r,n,i)})}))},uc.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return te(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function _r(e){this._modeling=e}_r.$inject=["modeling"],_r.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),K(o,function(s){a[s.id]=UI(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(xI(i,o),t,n,r,i,o,a)},_r.prototype.execute=function(){},_r.prototype.revert=function(){},_r.prototype.moveShapes=function(e,t){var n=this;K(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},_r.prototype.resizeShapes=function(e,t,n){var i=this;K(e,function(o){var r=bI(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},_r.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);K(e,function(u){var p=u.source,d=u.target,f=WI(u),y=I_(n),h={},m=c.has(p)||l.has(p),w=c.has(d)||l.has(d);m&&w?(f=Wn(f,function(g){return B_(g,i,n)&&(g[y]=g[y]+t[y]),g.original&&B_(g.original,i,n)&&(g.original[y]=g.original[y]+t[y]),g}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(m||w)&&(c.has(p)?h.connectionStart=Yf(u,p,t):c.has(d)?h.connectionEnd=Kf(u,d,t):l.has(p)?h.connectionStart=iu(u,p,a[p.id]):l.has(d)&&(h.connectionEnd=ou(u,d,a[d.id])),s._modeling.layoutConnection(u,h))})};function L_(e){return te({},e)}function WI(e){return Wn(e.waypoints,function(t){return t=L_(t),t.original&&(t.original=L_(t.original)),t})}function I_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function B_(e,t,n){var i=I_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function UI(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ou(e){this._modeling=e}Ou.$inject=["modeling"],Ou.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=N_(n),t.collapsed=!t.collapsed;var i=$_(n,t.collapsed);return[t].concat(i)},Ou.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=F_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function N_(e){var t={};return K(e,function(n){t[n.id]=n.hidden,n.children&&(t=te({},t,N_(n.children)))}),t}function $_(e,t){var n=[];return K(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat($_(i.children,i.collapsed||t)))}),n}function F_(e,t){var n=[];return K(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(F_(i.children,t)))}),n}function Du(e){this._modeling=e}Du.$inject=["modeling"],Du.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=j_(i,t),H_(n,t),t.host=n,t},Du.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,j_(n,t),H_(i,t,o),t};function j_(e,t){return rn(e&&e.attachers,t)}function H_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),cn(i,t,n)}}function Gh(){}Gh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Gh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ft(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ft.$inject=["eventBus","elementFactory","commandStack"],Ft.prototype.getHandlers=function(){return{"shape.append":Mu,"shape.create":wr,"shape.delete":sc,"shape.move":ia,"shape.resize":uc,"shape.replace":$o,"shape.toggleCollapse":Ou,spaceTool:_r,"label.create":rc,"connection.create":Cu,"connection.delete":ac,"connection.move":jh,"connection.layout":Tu,"connection.updateWaypoints":Gh,"connection.reconnect":lc,"elements.create":$h,"elements.move":ku,"elements.delete":Fh,"elements.distribute":Pu,"elements.align":Ru,"element.updateAttachment":Du}},Ft.prototype.registerHandlers=function(e){K(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ft.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)},Ft.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ft.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)},Ft.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)},Ft.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ft.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},Ft.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},Ft.prototype.createElements=function(e,t,n,i,o){et(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},Ft.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},Ft.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},Ft.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ft.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ft.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ft.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ft.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ft.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ft.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Ft.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)},Ft.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ft.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)},Ft.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,te(i,{docking:"source"}))},Ft.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,te(i,{docking:"target"}))},Ft.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ft.prototype._create=function(e,t){return s2(t)?t:this._elementFactory.create(e,t)},Ft.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function pc(e){this._elementRegistry=e}pc.$inject=["elementRegistry"],pc.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||qI(n,Kc(i));return G_(n,i),e.oldProperties=r,e.changed=o,o},pc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return G_(n,t),i},pc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return P(e,"bpmn:DataObject")?YI(e,t):[]};function qI(e,t){return ai(t,function(n,i){return n[i]=e.get(i),n},{})}function G_(e,t){K(t,function(n,i){e.set(i,n)})}function YI(e,t){return t.filter(function(n){return P(n,"bpmn:DataObjectReference")&&Ee(n).dataObjectRef===e})}var dc="default",Fo="id",z_="di",KI={width:0,height:0};function fc(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}fc.$inject=["elementRegistry","moddle","modeling","textRenderer"],fc.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=eB(e.properties),s=e.oldProperties||XI(t,a);return V_(a,r)&&(o.unclaim(r[Fo]),i.updateId(t,a[Fo]),o.claim(a[Fo],r)),dc in a&&(a[dc]&&n.push(i.get(a[dc].id)),r[dc]&&n.push(i.get(r[dc].id))),W_(t,a),e.oldProperties=s,e.changed=n,n},fc.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Ee(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,KI)}},fc.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 W_(t,i),V_(n,o)&&(a.unclaim(n[Fo]),r.updateId(t,i[Fo]),a.claim(i[Fo],o)),e.changed};function V_(e,t){return Fo in e&&e[Fo]!==t[Fo]}function XI(e,t){var n=Kc(t),i=e.businessObject,o=wt(e);return ai(n,function(r,a){return a!==z_?r[a]=i.get(a):r[a]=ZI(o,Kc(t.di)),r},{})}function ZI(e,t){return ai(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function W_(e,t){var n=e.businessObject,i=wt(e);K(t,function(o,r){r!==z_?n.set(r,o):i&&JI(i,o)})}function JI(e,t){K(t,function(n,i){e.set(i,n)})}var QI=["default"];function eB(e){var t=te({},e);return QI.forEach(function(n){n in e&&(t[n]=Ee(t[n]))}),t}function Lu(e,t){this._canvas=e,this._modeling=t}Lu.$inject=["canvas","modeling"],Lu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=wt(o);return t.setRootElement(n),t.removeRootElement(o),cn(a.rootElements,i),i.$parent=a,rn(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},Lu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=wt(n);return t.setRootElement(o),t.removeRootElement(n),rn(a.rootElements,i),i.$parent=null,cn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function zh(e,t){this._modeling=e,this._spaceTool=t}zh.$inject=["modeling","spaceTool"],zh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ti(i),a=r===i,s=a?i:i.parent,c=hr(s),l=An(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+Pi,y:i.y,width:i.width-Pi,height:i.height}:{x:i.x,y:i.y+Pi,width:i.width,height:i.height-Pi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Yr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:gt(b.children,function(E){return E!==i})});var d,f,y,h,m;o==="top"?(d=-120,f=i.y,y=f+10,h="n",m="y"):o==="left"?(d=-120,f=i.x,y=f+10,h="w",m="x"):o==="bottom"?(d=120,f=i.y+i.height,y=f-10,h="s",m="y"):o==="right"&&(d=120,f=i.x+i.width,y=f-10,h="e",m="x");var w=t.calculateAdjustments(p,m,d,y),g=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,g,h,y);var v=l?{x:i.x+(a?Pi:0),y:f-(o==="top"?120:0),width:i.width-(a?Pi:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Pi:0),width:120,height:i.height-(a?Pi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function Vh(e){this._modeling=e}Vh.$inject=["modeling"],Vh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=hr(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=An(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+Pi,y:n.y+d*c,width:n.width-Pi,height:l}:{x:n.x+d*c,y:n.y+Pi,width:l,height:n.height-Pi},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function hc(e,t){this._modeling=e,this._spaceTool=t}hc.$inject=["modeling","spaceTool"],hc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},hc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=YO(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},hc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ze(e),o=Ze(t),r=Eb(o,i),a=Ti(e),s=[],c=[];Yr(a,function(y){return s.push(y),(P(y,"bpmn:Lane")||P(y,"bpmn:Participant"))&&c.push(y),y.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 gc="flowNodeRef",Wh="lanes";function Iu(){}Iu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=Ze(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=Ti(u);return o[p.id]||(o[p.id]=Jl(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=Ti(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return P(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get(Wh),f=d.slice(),y=l(u);i.push({flowNode:p,remove:f,add:y})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(gc).forEach(function(d){i.push({flowNode:d,remove:[p],add:[]})})}),i},Iu.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(Wh);n.remove.forEach(function(r){rn(o,r),rn(r.get(gc),i)}),n.add.forEach(function(r){cn(o,r),cn(r.get(gc),i)})}),[]},Iu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(Wh);n.add.forEach(function(r){rn(o,r),rn(r.get(gc),i)}),n.remove.forEach(function(r){cn(o,r),cn(r.get(gc),i)})}),[]};var Uh="categoryValueRef";function mc(e,t){this._bpmnFactory=e,this._elementRegistry=t}mc.$inject=["bpmnFactory","elementRegistry"],mc.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(g,v,b){if(v){var E=a.get(g);E||(E={},a.set(g,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:v,root:qh(g)}:E.past={categoryValue:v}))}}function c(g){o.set(g,Ee(g))}function l(){n.filter(function(g){return P(g,"bpmn:FlowElement")&&!ft(g)&&g.parent}).forEach(c)}function u(g){var v=Ee(g),b=v.get("categoryValueRef");return b||(b=vb(i,v),r.push(tB(g,b))),b}function p(g){return g.reduce(function(v,b){var E=qh(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(g){return P(g,"bpmn:Group")&&!ft(g)&&g.parent}).forEach(function(g){var v=Ee(g).get("categoryValueRef");if(!v){var b=qh(g),E=d.get(b)||[],M=Da(E,g),B=Object.keys(M).length>0;B&&(v=u(g))}s(g,v,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),y=Array.from(a.values()).reduce(function(g,v){return v.present&&g.add(v.present.categoryValue),v.past&&g.add(v.past.categoryValue),g},new Set),h=new Map,m=p(f);a.forEach(function(g,v){var b=g.present;if(b){var E=m.get(b.root)||[],M=Da(E,v);E.forEach(function(B){if(M[B.id]){var A=h.get(B);A||(A=new Set,h.set(B,A)),A.add(b.categoryValue)}})}});var w=f.reduce(function(g,v){var b=o.get(v),E=b.get(Uh),M=new Set(E),B=h.get(v)||new Set,A=Array.from(B).filter(function(H){return!M.has(H)}),L=E.filter(function(H){return y.has(H)&&!B.has(H)});return(A.length||L.length)&&g.push({businessObject:b,categoryValuesToAdd:A,categoryValuesToRemove:L}),g},[]);return{flowElements:w,groups:r}},mc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),nB(t.groups),oB(t.flowElements),[]},mc.prototype.revert=function(e){var t=e.updates;return rB(t.flowElements),iB(t.groups),[]};function tB(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function nB(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function iB(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=null})}function oB(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Uh);t.categoryValuesToRemove.forEach(function(o){rn(i,o)}),t.categoryValuesToAdd.forEach(function(o){cn(i,o,!0)})})}function rB(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Uh);t.categoryValuesToAdd.forEach(function(o){rn(i,o)}),t.categoryValuesToRemove.forEach(function(o){cn(i,o,!0)})})}function qh(e){for(;e.parent;)e=e.parent;return e}function Bu(e){this._moddle=e}Bu.$inject=["moddle"],Bu.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),[]},Bu.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 aB={fill:void 0,stroke:void 0};function Yh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(oi(t)){var n=sB(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Yh.$inject=["commandStack"],Yh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||aB,i=this,o={};"fill"in n&&te(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&te(o,{"border-color":this._normalizeColor(n.stroke)}),K(t,function(r){var a=$t(r)?Vi(o,["border-color"]):o,s=wt(r);if(cB(a),ft(r)){if(!s||!P(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!ht(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function sB(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 cB(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var lB={width:0,height:0};function U_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return N2(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!ft(l)&&dr(l)&&!Fl(l)&&!q_(p)){var d=7,f=vf(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=li(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(!(!ft(u)&&!P(u,"bpmn:TextAnnotation"))){if(ft(u)&&q_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var y=li(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,y)),d&&e.resizeShape(u,d,lB)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}U_.$inject=["modeling","textRenderer","bpmnFactory"];function q_(e){return!e||!e.trim()}function Hn(e,t,n,i){Ft.call(this,e,t,n),this._bpmnRules=i}je(Hn,Ft),Hn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Hn.prototype.getHandlers=function(){var e=Ft.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=pc,e["element.updateProperties"]=fc,e["canvas.updateRoot"]=Lu,e["lane.add"]=zh,e["lane.resize"]=hc,e["lane.split"]=Vh,e["lane.updateRefs"]=Iu,e["group.updateRefs"]=mc,e["id.updateClaim"]=Bu,e["element.setColor"]=Yh,e["element.updateLabel"]=U_,e},Hn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Hn.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)},Hn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Hn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Hn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Hn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Hn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Hn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Hn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Hn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Hn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Hn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Hn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Hn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Y_(){}Y_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||nt(t.source||e.source),t.connectionEnd||nt(t.target||e.target)]};var Nu=20,uB=5,$u=Math.round,K_=20,pB={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function dB(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function fB(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function X_(e,t,n){var i=$n(t,e,uB),o=n.split(":")[0],r=$u((t.x-e.x)/2+e.x),a=$u((t.y-e.y)/2+e.y),s,c,l=fB(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=dB(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+Nu*(/l/.test(o)?-1:1),y:d?a+Nu:a}):(d=r===e.x,s={x:d?r+Nu:r,y:e.y+Nu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Kh(e,s,c).concat(s),directions:c,turnNextDirections:d}}function hB(e,t,n){return X_(e,t,n)}function gB(e,t,n){var i=X_(t,e,Z_(n));return{waypoints:i.waypoints.slice().reverse(),directions:Z_(i.directions),turnNextDirections:i.turnNextDirections}}function mB(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=Kh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function Z_(e){return e.split(":").reverse().join(":")}function yB(e,t,n){var i=$u((t.x-e.x)/2+e.x),o=$u((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 Kh(e,t,n){if(n=n||"h:h",!MB(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Q_(n)){var i=hB(e,t,n),o=gB(e,t,n),r=mB(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return yB(e,t,n)}function vB(e,t,n){var i=Kh(e,t,n);return i.unshift(e),i.push(t),t0(i)}function xB(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=ZR(r,"straight")[0]||"h:h",s=pB[a]||0,c=$n(e,t,s),l=RB(c,a);n=n||nt(e),i=i||nt(t);var u=l.split(":"),p=e0(n,e,u[0],CB(c)),d=e0(i,t,u[1],c);return vB(p,d,l)}function bB(e,t,n,i,o,r){et(n)&&(o=n,r=i,n=nt(e),i=nt(t)),r=te({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&_B(e,t,n,i,r),c||(c=r.connectionEnd&&SB(t,e,i,o),c)||(c=r.connectionStart&&EB(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:xB(e,t,n,i,r)}function wB(e,t,n){return e>=t&&e<=n}function J_(e,t,n){var i={x:"width",y:"height"};return wB(t[e],n[e],n[e]+n[i[e]])}function _B(e,t,n,i,o){var r={},a,s;return s=$n(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?J_(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:J_(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 EB(e,t,n,i){return Xh(e,t,n,i)}function SB(e,t,n,i){var o=i.slice().reverse();return o=Xh(e,t,n,o),o?o.reverse():null}function Xh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Ht(u,function(p,d){var f=u[d-1];return f&&js(p,f)<3})}function r(u,p,d){var f=To(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(_x(u[f],p,K_)||_x(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=Xh(e,t,n,l)),c&&To(c)?null:c}function RB(e,t){if(Q_(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 MB(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Q_(e){return e&&/t|r|b|l/.test(e)}function CB(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 e0(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 t0(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return ff(o,r,n,0)||t.push(n),t},[])}var AB=-10,PB=40,TB={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},kB={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},Zh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},yc={top:"t",right:"r",bottom:"b",left:"l"};function Fu(e){this._elementRegistry=e}je(Fu,Y_),Fu.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=n0(o&&o[0],n)),a||(a=n0(o&&o[o.length-1],i)),(P(e,"bpmn:Association")||P(e,"bpmn:DataAssociation"))&&o&&!i0(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=hb(n,s)?TB:kB;return P(e,"bpmn:MessageFlow")?c=DB(n,i,u):(P(e,"bpmn:SequenceFlow")||i0(n,i))&&(n===i?c={preferredLayouts:FB(n,e,u)}:P(n,"bpmn:BoundaryEvent")?c={preferredLayouts:jB(n,i,a,u)}:vc(n)||vc(i)?c={preferredLayouts:u.subProcess,preserveDocking:IB(n)}:P(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:P(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=te(c,t),l=t0(bB(n,i,r,a,o,c))),l||[r,a]};function OB(e){var t=e.host;return $n(nt(e),t,AB)}function DB(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:LB(e,t)}}function LB(e,t){return P(t,"bpmn:Participant")?"source":P(e,"bpmn:Participant")?"target":vc(t)?"source":vc(e)||P(t,"bpmn:Event")?"target":P(e,"bpmn:Event")?"source":null}function IB(e){return vc(e)?"target":"source"}function n0(e,t){return e?e.original||e:nt(t)}function i0(e,t){return P(t,"bpmn:Activity")&&P(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function vc(e){return P(e,"bpmn:SubProcess")&&xt(e)}function oa(e,t){return e===t}function BB(e,t){return t.indexOf(e)!==-1}function Xa(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 o0(e,t){return Zh[e]===t}function NB(e,t){var n=Xa(e),i=Zh[n];return t.indexOf(i)!==-1}function $B(e,t){var n=Za(e),i=Zh[n];return t.indexOf(i)!==-1}function r0(e){return e==="right"||e==="left"}function FB(e,t,n){var i=t.waypoints,o=i&&i.length&&$n(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function jB(e,t,n,i){var o=nt(e),r=nt(t),a=OB(e),s,c,l=oa(e.host,t),u=BB(a,["top","right","bottom","left"]),p=$n(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?HB(a,u,e,t,n,i):(s=GB(a,p,u,i.isHorizontal),c=zB(a,p,u,i.isHorizontal),[s+":"+c])}function HB(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Za(e):Xa(e),s=yc[a],c;return t?r0(e)?c=a0("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=a0("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function a0(e,t,n,i){var o=PB;return!(Jh(e,i,n,o)||Jh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Jh(e,i,nt(t),o))}function Jh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function GB(e,t,n,i){if(n)return yc[e];var o=Za(e),r=Xa(e),a=Za(t),s=Xa(t);if(i){if(oa(o,a)||o0(r,s))return yc[o]}else if(oa(r,s)||o0(o,a))return yc[r];return yc[i?r:o]}function zB(e,t,n,i){if(n)return r0(e)?NB(e,t)||oa(e,t)?"h":"v":$B(e,t)||oa(e,t)?"v":"h";var o=Za(e),r=Xa(e),a=Za(t),s=Xa(t);return a&&!s?"v":s&&!a?"h":i?oa(o,a)?"h":"v":oa(r,s)?"v":"h"}Fu.$inject=["elementRegistry"];function s0(e){return te({original:e.point.original||e.point},e.actual)}function Er(e,t){this._elementRegistry=e,this._graphicsFactory=t}Er.$inject=["elementRegistry","graphicsFactory"],Er.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(s0(i)),r.push(s0(o)),r},Er.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},Er.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Hs(i,o,n)},Er.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Er.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Er.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Qh={__init__:["modeling","bpmnUpdater"],__depends__:[cL,SL,ML,CL,x_,AI,TI,BI,Oi,Bh,R_],bpmnFactory:["type",Li],bpmnUpdater:["type",fi],elementFactory:["type",br],modeling:["type",Hn],layouter:["type",Fu],connectionDocking:["type",Er]};var VB=10,c0=50,WB=250;function eg(e,t,n,i){for(var o;o=UB(e,n,t);)n=i(t,n,o);return n}function tg(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 UB(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=YB(e);return Ht(o,function(r){if(r===n)return!1;var a=$n(r,i,VB);return a==="intersect"})}function qB(e,t){t||(t={});function n(y){return y.source===e?1:-1}var i=t.defaultDistance||c0,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||WB,c=t.reference||"start";r||(r=ZB);function l(y,h){return o==="n"?c==="start"?Ze(y).top-Ze(h).bottom:c==="center"?Ze(y).top-nt(h).y:Ze(y).top-Ze(h).top:o==="w"?c==="start"?Ze(y).left-Ze(h).right:c==="center"?Ze(y).left-nt(h).x:Ze(y).left-Ze(h).left:o==="s"?c==="start"?Ze(h).top-Ze(y).bottom:c==="center"?nt(h).y-Ze(y).bottom:Ze(h).bottom-Ze(y).bottom:c==="start"?Ze(h).left-Ze(y).right:c==="center"?nt(h).x-Ze(y).right:Ze(h).right-Ze(y).right}var u=e.incoming.filter(r).map(function(y){var h=a(y),m=h<0?l(y.source,e):l(e,y.source);return{id:y.source.id,distance:m,weight:h}}),p=e.outgoing.filter(r).map(function(y){var h=a(y),m=h>0?l(e,y.target):l(y.target,e);return{id:y.target.id,distance:m,weight:h}}),d=u.concat(p).reduce(function(y,h){return y[h.id+"__weight_"+h.weight]=h,y},{}),f=ai(d,function(y,h){var m=h.distance,w=h.weight;return m<0||m>s||(y[String(m)]||(y[String(m)]=0),y[String(m)]+=1*w,(!y.distance||y[y.distance]<y[String(m)])&&(y.distance=m)),y},{});return f.distance||i}function YB(e){var t=ng(e);return e.host&&(t=t.concat(ng(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ng(i))},[]))),t}function ng(e){return XB(e).concat(KB(e))}function KB(e){return e.incoming.map(function(t){return t.source})}function XB(e){return e.outgoing.map(function(t){return t.target})}function ZB(){return!0}var JB=100;function l0(e,t,n){e.on("autoPlace",JB,function(i){var o=i.shape,r=i.source;return QB(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}}l0.$inject=["eventBus","modeling","canvas"];function QB(e,t,n){n||(n={});var i=n.defaultDistance||c0,o=nt(e),r=Ze(e);return{x:r.right+i+t.width/2,y:o.y}}function u0(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}u0.$inject=["eventBus","selection"];const eN={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",l0],autoPlaceSelectionBehavior:["type",u0]};function p0(e,t,n){var i=hb(e,n);if(P(t,"bpmn:TextAnnotation"))return nN(e,t,i);if(ht(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return iN(e,t,i);if(P(t,"bpmn:FlowNode"))return tN(e,t,i)}function tN(e,t,n){var i=Ze(e),o=nt(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=qB(e,{filter:function(f){return P(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;P(e,"bpmn:BoundaryEvent")&&(l=$n(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+d0(l,c,r)}:{x:o.x+d0(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return eg(e,t,u,tg(d))}function d0(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function nN(e,t,n){var i=Ze(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};$t(e)&&(o=nt(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 eg(e,t,o,tg(a))}function iN(e,t,n){var i=Ze(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 eg(e,t,o,tg(a))}function f0(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return p0(o,i,t)})}f0.$inject=["eventBus","elementRegistry"];const ju={__depends__:[eN],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",f0]};function jo(e,t,n,i){we.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=Up(xa(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ba(s,function(p){return p.parent.id});K(u,function(p,d){et(l)&&(p=p.filter(function(f){return Ht(l,wa({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)})}jo.$inject=["eventBus","elementRegistry","modeling","rules"],je(jo,we),jo.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ze(mn(e)),r=Ze(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),Dl(te({},r,a))},jo.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(oN(i,t)){var o=rN(Vi(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},jo.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},jo.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},jo.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function oN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function rN(e,t){var n="";return e=Ze(e),t=Ze(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 Hu(e){e.invoke(jo,this)}Hu.$inject=["injector"],je(Hu,jo),Hu.prototype.resize=function(e,t,n){P(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function xc(e){ki.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}xc.$inject=["eventBus"],je(xc,ki),xc.prototype.canResize=function(e,t){return!1};function Gu(e,t){xc.call(this,e),this._modeling=t}je(Gu,xc),Gu.$inject=["eventBus","modeling"],Gu.prototype.canResize=function(e,t){if(P(t.di,"bpmndi:BPMNPlane")||!P(t,"bpmn:Participant")&&!P(t,"bpmn:Lane")&&!P(t,"bpmn:SubProcess"))return!1;var n=!0;return K(e,function(i){if(P(i,"bpmn:Lane")||ft(i)){n=!1;return}}),n};const h0={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Hu],bpmnAutoResizeProvider:["type",Gu]},aN=1500;class g0{constructor(t){t.on("moddleCopy.canCopyProperties",aN,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Fr)))return;const o=Bn(n);o!==void 0&&i.set("xml:lang",o)})}}pn(g0,"$inject",["eventBus"]);const m0={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",g0]},sN=500,zu=1,y0=(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-zu||n>e.x+e.width+zu||i<e.y-zu||i>e.y+e.height+zu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class v0{constructor(t){t.on("bpmnElement.added",sN,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(y0(n.source,i[0]),y0(n.target,i[i.length-1]))})}}pn(v0,"$inject",["eventBus"]);const x0={__init__:["annotationImportDocking"],annotationImportDocking:["type",v0]},ig=[db,qs,Qh,ju,h0,nd,m0,x0,Rv];function cN(e={}){ry(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Kr({container:t,moddleExtensions:e.moddleExtensions??Es,additionalModules:[...ig,...e.additionalModules??[]]})}const b0={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","merge-before-predecessor":"연결","edge-crosses-own-endpoint":"연결","message-detours-own-pool-shape":"연결","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":"풀"},lN={이:["이","가"],을:["을","를"],와:["과","와"]};function uN(e,t){const[n,i]=lN[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 pN={"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":"연관선"},dN="요소";function og(e){return(e&&pN[e.type])??dN}const w0=20;function fN(e){const t=e.replace(/\s+/g," ").trim();return t.length>w0?`${t.slice(0,w0)}…`:t}function Vu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:fN(o.name),a=r===void 0?i+og(o):r,s=r===void 0?a:`「${r}」`;return n?s+uN(a,n).slice(a.length):s}function hN(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&&og(r)===og(a);return[Vu(e,t,i),Vu(e,n,o,s?"다른 ":"")]}function gN(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 mN(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];case"edge-crosses-own-endpoint":return[e.edge,e.shape];case"message-detours-own-pool-shape":return[e.edge,e.shape]}}const Wu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function yN(e,t){const n=(o,r)=>Vu(t,o,r),i=(o,r,a,s)=>hN(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)}의 ${Wu[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)}의 ${Wu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Wu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Wu[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,"이")} 거꾸로 들어갑니다.`;case"edge-crosses-own-endpoint":return`${n(e.edge,"이")} 자기가 이어진 ${n(e.shape)} 안을 지나 도형을 꿰뚫어 보입니다.`;case"message-detours-own-pool-shape":return`${n(e.edge,"이")} 같은 열에 놓인 ${n(e.shape,"을")} 피해 돌아갑니다.`}}function vN(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Vu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const _0="기타",rg={error:0,warning:1,info:2};function E0(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:gN(i),targetRefs:mN(i),category:b0[i.kind]??_0,message:yN(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:b0[i.ruleId]??_0,message:vN(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 Ja(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function ag(e,t){if(t===void 0||e.length===0)return!1;const n=Ja(e[0],t);return e.some(i=>Ja(i,t)!==n)}function R0(e,t){const n=ag(e,t);return e.slice().sort((i,o)=>(n?Number(Ja(o,t))-Number(Ja(i,t)):0)||rg[i.severity]-rg[o.severity])}const M0="i18n-untranslated",C0="i18n-review-requested",bc="i18nDisplay.redrawn",A0=[["untranslated",M0],["reviewRequested",C0]];class sg{constructor(t,n,i,o,r,a,s,c){pn(this,"config");pn(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,y)=>this.withDisplayText(f,()=>l(d,f,y),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,y,h)=>{const m=this.resolve(d);if(!m||m.native)return p(d,f,y,h);(f??"").trim()!==(y??"").trim()&&i.execute(Jc,{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:y,oldLabel:h}=d.context;(y??"")!==(h??"")&&i.execute(Jc,{element:f.labelTarget??f,locale:this.displayLocale,text:y??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=jr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Ko(n).filter(p=>Bn(p)),s=p=>p.body??"",c=a.find(p=>Bn(p)===o&&s(p)),l=Xo(n).some(p=>p.locale===o)?"reviewRequested":"ok";return r?Zc(r,a,this.config.designLocale,this.rootLang()).includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1}:c?{text:s(c),status:l,native:!1}:void 0}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,y]of A0)r.toggle(y,(o==null?void 0:o.status)===f);if(!o||o.native)return n();const{target:a,key:s}=jr((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 A0)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(bc)}}pn(sg,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const P0={__depends__:[nd],__init__:["i18nDisplay"],i18nDisplay:["type",sg]};var xN=2e3;function cg(e,t,n){e.on("autoPlace",xN,function(i){var o=i.source,r=nt(o),a=i.shape,s=p0(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],P(a,"bpmn:TextAnnotation")&&(bN(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}cg.$inject=["eventBus","gridSnapping","elementRegistry"];function bN(e){return e==="x"}var wN=3e3;function Qa(e,t,n){we.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],wN,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||_N(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Qa.$inject=["eventBus","gridSnapping","modeling"],je(Qa,we),Qa.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=RN(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function _N(e){return e.length>3}function EN(e){return e==="h"}function SN(e){return e==="v"}function RN(e,t,n){var i=To(t,n),o={};return EN(i)&&(o.y=e.snapValue(t.y)),SN(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=te({},t,o),n=te({},n,o)),[t,n]}function MN(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Vr(e,t),fontBoundingBoxAscent:t*oo.ascentEm,fontBoundingBoxDescent:t*oo.descentEm,actualBoundingBoxAscent:t*oo.ascentEm,actualBoundingBoxDescent:t*oo.descentEm}}class lg{constructor(t,n,i,o,r,a){pn(this,"active",!1);pn(this,"shadow");pn(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=MN),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(Xx(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 y=(u[f]??[]).map(a).filter(Boolean),h=p[f];h&&y.length===h.length&&y.every(m=>h.includes(m))&&y.forEach((m,w)=>h[w]=m)}}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(y=>!d.includes(y)&&y.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&&li(n);if(!i)return!1;const o=this.textRenderer.getExternalLabelBounds(ob(wt(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(bc)}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(bc)}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 Kr({container:t,moddleExtensions:Es,additionalModules:[...ig]}),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}}pn(lg,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function T0(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 ug(e,t,n,i){cg.call(this,T0(e,i),t,n)}ug.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function Uu(e,t,n,i){Qa.call(this,T0(e,i),t,n)}Uu.prototype=Object.create(Qa.prototype),Uu.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function CN(e){return e instanceof ug||e instanceof Uu}const k0={__init__:["headlessReplay"],headlessReplay:["type",lg],gridSnappingAutoPlaceBehavior:["type",ug],gridSnappingLayoutConnectionBehavior:["type",Uu]};function ra(e){return CSS.escape(e)}var AN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function O0(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return AN[t]})}var qu=50,PN=new ta,D0={min:.2,max:4},TN=10,kN=.1,ON=250,DN=100,LN=2e3;function Gn(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=PN.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||Ku(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=Yu({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);pg(p,r._canvas),r._update()}function s(u){return function(d){var f=dg(d);(!r._state._svgClientRect||Ku(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var y=Yu({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=BN(y,h),w=r._viewportDom.getBoundingClientRect(),g={x:f.x-w.left+1,y:f.y-w.top+1};te(r._state,{cachedViewbox:h,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:m,offsetViewportDom:g,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Ke.bind(document,"mousemove",c),Ke.bind(document,"mouseup",l)}}function c(u){var p=dg(u);if(r._state.isDragging){(!r._state._svgClientRect||Ku(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,y=r._state.parentClientRect;te(r._viewportDom.style,{top:p.y-d.y-y.top+"px",left:p.x-d.x-y.left+"px"});var h=I0(y,{top:p.y-d.y-y.top,left:p.x-d.x-y.left,width:f.width,height:f.height});te(r._overlay.style,{clipPath:h});var m=Yu({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);pg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=dg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),te(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Ke.unbind(document,"mousemove",c),Ke.unbind(document,"mouseup",l))}Ke.bind(this._viewportDom,"mousedown",s(!1)),Ke.bind(this._svg,"mousedown",s(!0)),Ke.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||Ku(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!HN(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*GN(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>kN){var f=d>0?1:-1,y=Math.log(i.zoom())/Math.log(10),h=zN(D0,TN*2),m=Math.round(y/h)*h;m+=h*f;var w=Math.pow(10,m);i.zoom(VN(D0,w),g),r._state.zoomDelta=0;var g=Yu({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);pg(g,r._canvas),r._update()}}}),Ke.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",ON,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)})}Gn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Gn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Dt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Dt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Dt(o).add("map"),n.appendChild(o);var r=this._svg=We("svg");Le(r,{width:"100%",height:"100%"}),ot(o,r);var a=this._elementsGroup=We("g");ot(r,a);var s=this._viewportGroup=We("g");ot(r,s);var c=this._viewport=We("rect");vt(c).add("viewport"),ot(s,c),Ke.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Dt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Dt(u).add("overlay"),this._parent.appendChild(u)},Gn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=tt(this._config.debounceDelay)?this._config.debounceDelay:DN,n=tt(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:LN,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)}},Gn.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)})}},Gn.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(B0(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-qu,o=o-qu,r=r+qu*2,a=a+qu*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};te(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=I0(l,p);te(this._overlay.style,{clipPath:d})}}},Gn.prototype.open=function(){te(this._state,{isOpen:!0}),Dt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};kn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Gn.prototype.close=function(){te(this._state,{isOpen:!1}),Dt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};kn(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Gn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},Gn.prototype.isOpen=function(){return this._state.isOpen},Gn.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)}},Gn.prototype._updateElementId=function(e,t){try{var n=kt("#"+ra(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Gn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Gn.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=kt("#"+ra(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=$N(e);return s!==-1?a?FN(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),IN(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}}},Gn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&gn(t)},Gn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=ur(t),n)){var i=WN(tf(n));return Le(i,{id:this._prefixId(e.id)}),i}},Gn.prototype._clear=function(){Ls(this._elementsGroup)},Gn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function IN(e){return e.waypoints}function BN(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 Yu(e,t,n){var i=t.getBoundingClientRect(),o=NN(n,i.width/i.height),r=L0(e.x,0,i.width,o.x,o.x+o.width),a=L0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function pg(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 NN(e,t){var n=e.width/e.height,i=te({},{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;te(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;te(i,{x:s,width:a})}return i}function L0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function $N(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function FN(e,t,n){var i=jN(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function jN(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function Ku(e){return e.width===0&&e.height===0}function HN(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var GN=Math.sign||function(e){return e>=0?1:-1};function zN(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 VN(e,t){return Math.max(e.min,Math.min(e.max,t))}function I0(e,t){var n=[go(t.left,t.top),go(t.left+t.width,t.top),go(t.left+t.width,t.top+t.height),go(t.left,t.top+t.height),go(t.left,e.height),go(e.width,e.height),go(e.width,0),go(0,0),go(0,e.height),go(t.left,e.height)].join(", ");return"polygon("+n+")"}function go(e,t){return e+"px "+t+"px"}function B0(e){return qo(e,function(t){return En(t)?B0(t):tt(t)&&isFinite(t)})}function dg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function WN(e){return Ds("[id]",e).forEach(function(t){t.remove()}),e}var UN={__init__:["minimap"],minimap:["type",Gn]};const N0={closed:"미니맵",open:"접기"};class $0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(bc,()=>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?N0.open:N0.closed)}}pn($0,"$inject",["eventBus","minimap","canvas"]);const F0=[P0,{__depends__:[UN],__init__:["minimapI18n"],minimapI18n:["type",$0]},m0,x0,Rv,k0];var qN=new ta("ov"),YN=500;function On(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=qN,this._overlayDefaults=te({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=KN(n.getContainer()),this._init()}On.$inject=["config.overlays","eventBus","canvas","elementRegistry"],On.prototype.get=function(e){if(oi(e)&&(e={id:e}),oi(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?gt(t.overlays,wa({type:e.type})):t.overlays.slice():[]}else return e.type?gt(this._overlays,wa({type:e.type})):e.id?this._overlays[e.id]:null},On.prototype.add=function(e,t,n){if(En(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=te({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},On.prototype.remove=function(e){var t=this.get(e)||[];et(t)||(t=[t]);var n=this;K(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(ao(i.html),ao(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)}})},On.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},On.prototype.show=function(){Xu(this._overlayRoot)},On.prototype.hide=function(){Xu(this._overlayRoot,!1)},On.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Ml(this._overlayRoot)},On.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=mn(t);i=r.x,o=r.y}j0(n,i,o),kn(e.html,"data-container-id",t.id)},On.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=mn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=mn(i).height:s=i.height,r=t.bottom*-1+s}j0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},On.prototype._createOverlayContainer=function(e){var t=Wt('<div class="djs-overlays" />');Zn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},On.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";H0(this._overlayRoot,n)},On.prototype._getOverlayContainer=function(e,t){var n=Ht(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},On.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)),oi(i)&&(i=Wt(i)),r=this._getOverlayContainer(n),o=Wt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Zn(o,{position:"absolute"}),o.appendChild(i),e.type&&Dt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Xu(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())},On.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&&(_n(o)&&o>t.scale||_n(r)&&r<t.scale))&&(c=!1),Xu(a,c),this._updateOverlayScale(e,t)},On.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),_n(i)&&t.scale<i&&(a=(1/t.scale||1)*i),_n(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),_n(a)&&(s="scale("+a+","+a+")"),H0(r,s)},On.prototype._updateOverlaysVisibilty=function(e){var t=this;K(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},On.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});K(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){ao(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",YN,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(K(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&&Dt(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 KN(e){var t=Wt('<div class="djs-overlay-container" />');return Zn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function j0(e,t,n){Zn(e,{left:t+"px",top:n+"px"})}function Xu(e,t){e.style.display=t===!1?"none":""}function H0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Zu={__init__:["overlays"],overlays:["type",On]};function fg(e,t){t.invoke(we,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)})}je(fg,we),fg.$inject=["canvas","injector"];const XN={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",fg]};var ZN="bjs-breadcrumbs-shown";function G0(e,t,n){var i=Wt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Dt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=Ee(l),p=Ht(a,function(d){return d===u});p&&s()});function s(c){c&&(a=JN(c));var l=a.flatMap(function(p){var d=n.findRoot(po(p))||n.findRoot(p.id);if(!d&&P(p,"bpmn:Process")){var f=t.find(function(m){var w=Ee(m);return w&&w.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var y=O0(p.name||p.id),h=Wt('<li><span class="bjs-crumb"><a title="'+y+'">'+y+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(d)}),h});i.innerHTML="";var u=l.length>1;r.toggle(ZN,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}G0.$inject=["eventBus","elementRegistry","canvas"];function JN(e){for(var t=Ee(e),n=[],i=t;i;i=i.$parent)(P(i,"bpmn:SubProcess")||P(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function z0(e,t){var n=null,i=new QN;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,!(!P(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})}z0.$inject=["eventBus","canvas"];function QN(){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 V0={x:180,y:160};function aa(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}aa.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)})}},aa.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;P(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),t$(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},aa.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=e$(e),i={x:n.x-V0.x,y:n.y-V0.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)})},aa.prototype._moveToDiPlane=function(e,t){var n=W0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},aa.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},aa.$inject=["eventBus","moddle"];function W0(e){return P(e,"bpmndi:BPMNDiagram")?e:W0(e.$parent)}function e$(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=Ze(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Dl(t)}function t$(e,t){var n=e.$parent;return!(!P(n,"bpmn:SubProcess")||n===t.bpmnElement||ht(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Ju=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>',i$="bjs-drilldown-empty";function Sr(e,t,n,i,o){we.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",Ju,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Ju,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Ju,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"],Ju,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)})})}je(Sr,we),Sr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Sr.prototype._canDrillDown=function(e){var t=this._canvas;return P(e,"bpmn:SubProcess")&&t.findRoot(po(e))},Sr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ee(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Dt(i.html).toggle(i$,!o)}},Sr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Ee(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Wt('<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(po(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},Sr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Sr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const o$={__depends__:[Zu,Bh,XN],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",G0],drilldownCentering:["type",z0],drilldownOverlayBehavior:["type",Sr],subprocessCompatibility:["type",aa]};function Rr(e){Xt.call(this,e)}je(Rr,Xt),Rr.prototype._modules=[db,o$,Zu,Oi,qs],Rr.prototype._moddleExtensions={};var Qu="keyboard.keydown",r$="keyboard.keyup",a$=1e3,U0="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 Jn(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(U0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Jn.$inject=["config.keyboard","eventBus"],Jn.prototype._keydownHandler=function(e){this._keyHandler(e,Qu)},Jn.prototype._keyupHandler=function(e){this._keyHandler(e,r$)},Jn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Qu,i),n&&e.preventDefault()}},Jn.prototype._isEventIgnored=function(e){return!1},Jn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(U0)),this.unbind(),e=this._node=this._target,Ke.bind(e,"keydown",this._keydownHandler),Ke.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Jn.prototype.getBinding=function(){return this._node},Jn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ke.unbind(e,"keydown",this._keydownHandler),Ke.unbind(e,"keyup",this._keyupHandler)),this._node=null},Jn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Jn.prototype.addListener=function(e,t,n){Cn(e)&&(n=t,t=e,e=a$),this._eventBus.on(n||Qu,e,t)},Jn.prototype.removeListener=function(e,t){this._eventBus.off(t||Qu,e)},Jn.prototype.hasModifier=jL,Jn.prototype.isCmd=pi,Jn.prototype.isShift=Rh,Jn.prototype.isKey=Rn;var s$=500;function es(e,t){var n=this;e.on("editorActions.init",s$,function(i){var o=i.editorActions;n.registerBindings(t,o)})}es.$inject=["eventBus","keyboard"],es.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(WL(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(UL(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(HL(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(GL(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(zL(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(VL(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(Rn(["+","Add","="],o)&&pi(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(Rn(["-","Subtract"],o)&&pi(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(Rn("0",o)&&pi(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(Rn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const hg={__init__:["keyboard","keyboardBindings"],keyboard:["type",Jn],keyboardBindings:["type",es]};var c$={moveSpeed:50,moveSpeedAccelerated:200};function q0(e,t,n){var i=this;this._config=te({},c$,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})}}q0.$inject=["config.keyboardMove","keyboard","canvas"];const Y0={__depends__:[hg],__init__:["keyboardMove"],keyboardMove:["type",q0]};var l$=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=Jr(s),p=Zi(u,c);if(!n.dragging&&u$(p)>l$&&(n.dragging=!0,l===0&&Jw(e),yu("grab")),n.dragging){var d=n.last||n.start;p=Zi(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Ke.unbind(document,"mousemove",o),Ke.unbind(document,"mouseup",r),n=null,Zw()}function a(s){if(!Ur(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Jr(s)},Ke.bind(document,"mousemove",o),Ke.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}K0.$inject=["eventBus","canvas"];function u$(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const X0={__init__:["moveCanvas"],moveCanvas:["type",K0]};function Z0(e,t){var n=_f(e.min),i=_f(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function p$(e,t){return Math.max(e.min,Math.min(e.max,t))}var d$=Math.sign||function(e){return e>=0?1:-1},gg={min:.2,max:4},J0=10,f$=.1,h$=.75;function mo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=ei(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||h$;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}mo.$inject=["config.zoomScroll","eventBus","canvas"],mo.prototype.scroll=function(t){this._canvas.scroll(t)},mo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},mo.prototype.zoom=function(t,n){var i=Z0(gg,J0*2);this._totalDelta+=t,Math.abs(this._totalDelta)>f$&&(this._zoom(t,n,i),this._totalDelta=0)},mo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||rw()&&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))*d$(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)}},mo.prototype.stepZoom=function(t,n){var i=Z0(gg,J0);this._zoom(t,n,i)},mo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=_f(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(p$(gg,s),t)},mo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Ke[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},mo.prototype._init=function(e){this.toggle(e)};const Q0={__init__:["zoomScroll"],zoomScroll:["type",mo]};function wc(e){Rr.call(this,e)}je(wc,Rr),wc.prototype._navigationModules=[Y0,X0,Q0],wc.prototype._modules=[].concat(Rr.prototype._modules,wc.prototype._navigationModules);function mg(e){return e&&e[e.length-1]}function eE(e){return e.y}function tE(e){return e.x}var g$={left:tE,center:tE,right:function(e){return e.x+e.width},top:eE,middle:eE,bottom:function(e){return e.y+e.height}};function ts(e,t){this._modeling=e,this._rules=t}ts.$inject=["modeling","rules"],ts.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}},ts.prototype._isType=function(e,t){return t.indexOf(e)!==-1},ts.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=mg(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(K(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=to(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=mg(c).center,r;l=t[0],t=to(t,function(d){return d[i]+d[o]}),u=mg(t),r[e]=p(l,u)}return r},ts.prototype.trigger=function(e,t){var n=this._modeling,i,o=gt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),et(i)&&(o=i),!(o.length<2||!i)){var r=g$[t],a=to(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const m$={__init__:["alignElements"],alignElements:["type",ts]},y$=new ta;function ns(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ns.$inject=["eventBus"],ns.prototype.schedule=function(e,t=y$.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ns.prototype._schedule=function(e,t){const n=v$();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}},ns.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ns.prototype._cancel=function(e){clearTimeout(e.executionId)};function v$(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const x$={scheduler:["type",ns]};var b$="djs-element-hidden",ep=".entry",w$=1e3,nE=8,_$=300;function vn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}vn.$inject=["canvas","elementRegistry","eventBus","scheduler"],vn.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=et(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=et(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},vn.prototype._createContainer=function(){var e=Wt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},vn.prototype.registerProvider=function(e,t){t||(t=e,e=w$),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},vn.prototype.getEntries=function(e){var t=this._getProviders(),n=et(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return K(t,function(o){if(Cn(o[n])){var r=o[n](e);Cn(r)?i=r(i):K(r,function(a,s){i[s]=a})}}),i},vn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=kn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},_$);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},vn.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(Cn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},vn.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))}},vn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},vn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;K(t,function(o,r){var a=o.group||"default",s=Wt(o.html||'<div class="entry" draggable="true"></div>'),c;kn(s,"data-action",r),c=kt("[data-group="+ra(a)+"]",n),c||(c=Wt('<div class="group"></div>'),kn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&E$(s,o.className),o.title&&kn(s,"title",o.title),o.imageUrl&&(i=Wt("<img>"),kn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Dt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},vn.prototype._createHtml=function(e){var t=this,n=Wt('<div class="djs-context-pad"></div>');return si.bind(n,ep,"click",function(i){t.trigger("click",i)}),si.bind(n,ep,"dragstart",function(i){t.trigger("dragstart",i)}),si.bind(n,ep,"mouseover",function(i){t.trigger("mouseover",i)}),si.bind(n,ep,"mouseout",function(i){t.trigger("mouseout",i)}),Ke.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},vn.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()&&R$(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},vn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},vn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return et(e)!==et(n)?!1:et(e)?e.length===n.length&&qo(e,function(i){return n.includes(i)}):n===e},vn.prototype.isShown=function(){return this.isOpen()&&Dt(this._current.html).has("open")},vn.prototype.show=function(){this.isOpen()&&(Dt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},vn.prototype.hide=function(){this.isOpen()&&(Dt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},vn.prototype._getPosition=function(e){if(!et(e)&&$t(e)){var t=this._canvas.viewbox(),n=S$(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+nE*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+nE*this._canvas.zoom(),top:s.top-a.top}},vn.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")},vn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=et(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,b$)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},vn.prototype._getTargetBounds=function(e){var t=this,n=et(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 E$(e,t){var n=Dt(e);t=et(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function S$(e){return e.waypoints[e.waypoints.length-1]}function R$(e,t){return e=et(e)?e:[e],t=et(t)?t:[t],e.length===t.length&&qo(e,function(n){return t.includes(n)})}const iE={__depends__:[mu,x$,Zu],contextPad:["type",vn]};var tp,Jt,oE,Mr,rE,aE,sE,yg,np,_c,cE,vg,xg,bg,ip={},op=[],M$=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,rp=Array.isArray;function Ho(e,t){for(var n in t)e[n]=t[n];return e}function wg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function lE(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?tp.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 ap(e,a,i,o,null)}function ap(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??++oE,__i:-1,__u:0};return o==null&&Jt.vnode!=null&&Jt.vnode(r),r}function sp(e){return e.children}function cp(e,t){this.props=e,this.context=t}function sa(e,t){if(t==null)return e.__?sa(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"?sa(e):null}function C$(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Ho({},t);r.__v=t.__v+1,Jt.vnode&&Jt.vnode(r),_g(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??sa(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,yE(i,r,o),t.__e=t.__=null,r.__e!=n&&uE(r)}}function uE(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}),uE(e)}function pE(e){(!e.__d&&(e.__d=!0)&&Mr.push(e)&&!lp.__r++||rE!=Jt.debounceRendering)&&((rE=Jt.debounceRendering)||aE)(lp)}function lp(){try{for(var e,t=1;Mr.length;)Mr.length>t&&Mr.sort(sE),e=Mr.shift(),t=Mr.length,C$(e)}finally{Mr.length=lp.__r=0}}function dE(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,y,h,m,w=i&&i.__k||op,g=t.length;for(c=A$(n,t,w,c,g),p=0;p<g;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&w[f.__i]||ip,f.__i=p,m=_g(e,f,d,o,r,a,s,c,l,u),y=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&Eg(d.ref,null,f),u.push(f.ref,f.__c||y,f)),h==null&&y!=null&&(h=y),4&f.__u?(c=fE(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&m!==void 0?c=m:y&&(c=y.nextSibling),f.__u&=-7);return n.__e=h,c}function A$(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]=ap(null,a,null,null,null):rp(a)?a=e.__k[r]=ap(sp,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=ap(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=P$(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=sa(s)),xE(s,s));return i}function fE(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=fE(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=sa(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function P$(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 hE(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||M$.test(t)?n:n+"px"}function up(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||hE(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||hE(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(cE,"$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[_c]=i[_c]:(n[_c]=vg,e.addEventListener(t,r?bg:xg,r)):e.removeEventListener(t,r?bg:xg,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 gE(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[np]==null)t[np]=vg++;else if(t[np]<n[_c])return;return n(Jt.event?Jt.event(t):t)}}}function _g(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,y,h,m,w,g,v,b,E,M,B,A,L,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Jt.__b)&&u(t);e:if(typeof H=="function"){p=a.length;try{if(g=t.props,v=H.prototype&&H.prototype.render,b=(u=H.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?w=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new H(g,E):(t.__c=d=new cp(g,E),d.constructor=H,d.render=k$),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&&H.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Ho({},d.__s)),Ho(d.__s,H.getDerivedStateFromProps(g,d.__s))),y=d.props,h=d.state,d.__v=t,f)v&&H.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&H.getDerivedStateFromProps==null&&g!==y&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(g,E),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(g,d.__s,E)===!1){t.__v!=n.__v&&(d.props=g,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(V){V&&(V.__=t)}),op.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=sa(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(g,d.__s,E),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(y,h,m)})}if(d.context=E,d.props=g,d.__P=e,d.__e=!1,M=Jt.__r,B=0,v)d.state=d.__s,d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),op.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=Ho(Ho({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(y,h)),A=u!=null&&u.type===sp&&u.key==null?vE(u.props.children):u,s=dE(e,rp(A)?A:[A],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),w&&(d.__E=d.__=null)}catch(V){if(a.length=p,t.__v=null,c||r!=null){if(V.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(L=r.length;L--;)wg(r[L])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),V.then||mE(t),Jt.__e(V,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=T$(n.__e,t,n,i,o,r,a,c,l);return(u=Jt.diffed)&&u(t),128&t.__u?void 0:s}function mE(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(mE))}function yE(e,t,n){for(var i=0;i<n.length;i++)Eg(n[i],n[++i],n[++i]);Jt.__c&&Jt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Jt.__e(r,o.__v)}})}function vE(e){return typeof e!="object"||e==null||e.__b>0?e:rp(e)?e.map(vE):e.constructor!==void 0?null:Ho({},e)}function T$(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,y,h,m=n.props||ip,w=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="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==!!g&&(g?f.localName==g:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(w);e=document.createElementNS(o,g,w.is&&w),s&&(Jt.__m&&Jt.__m(t,r),s=!1),r=null}if(g==null)m===w||s&&e.data==w||(e.data=w);else{if(r=g=="textarea"&&w.defaultValue!=null?null:r&&tp.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(f=e.attributes[l]).name]=f.value;for(l in m)f=m[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||up(e,l,null,f,o);for(l in w)f=w[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?y=f:l=="checked"?h=f:s&&typeof f!="function"||m[l]===f||up(e,l,f,m[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=""),dE(t.type=="template"?e.content:e,rp(d)?d:[d],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&sa(n,0),s,c),r!=null)for(l=r.length;l--;)wg(r[l]);s&&g!="textarea"||(l="value",g=="progress"&&y==null?e.removeAttribute("value"):y!=null&&(y!==e[l]||g=="progress"&&!y||g=="option"&&y!=m[l])&&up(e,l,y,m[l],o),l="checked",h!=null&&h!=e[l]&&up(e,l,h,m[l],o))}return e}function Eg(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){Jt.__e(o,n)}}function xE(e,t,n){var i,o;if(Jt.unmount&&Jt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Eg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Jt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&xE(i[o],t,n||typeof e.type!="function");n||wg(e.__e),e.__c=e.__=e.__e=void 0}function k$(e,t,n){return this.constructor(e,n)}function bE(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Jt.__&&Jt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],_g(t,e=t.__k=lE(sp,null,[e]),o||ip,ip,t.namespaceURI,o?null:t.firstChild?tp.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),yE(r,e,a),e.props.children=null}tp=op.slice,Jt={__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}},oE=0,cp.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ho({},this.state),typeof e=="function"&&(e=e(Ho({},n),this.props)),e&&Ho(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),pE(this))},cp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),pE(this))},cp.prototype.render=sp,Mr=[],aE=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sE=function(e,t){return e.__v.__b-t.__v.__b},lp.__r=0,yg=Math.random().toString(8),np="__d"+yg,_c="__a"+yg,cE=/(PointerCapture)$|Capture$/i,vg=0,xg=gE(!1),bg=gE(!0);var wE=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,wE(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},_E=new Map;function O$(e){var t=_E.get(this);return t||(t=new Map,_E.set(this,t)),(t=wE(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 jt=O$.bind(lE),is,xn,Sg,EE,Ec=0,SE=[],Mn=Jt,RE=Mn.__b,ME=Mn.__r,CE=Mn.diffed,AE=Mn.__c,PE=Mn.unmount,TE=Mn.__;function pp(e,t){Mn.__h&&Mn.__h(xn,e,Ec||t),Ec=0;var n=xn.__H||(xn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Rg(e){return Ec=1,D$(OE,e)}function D$(e,t,n){var i=pp(is++,2);if(i.t=e,!i.__c&&(i.__=[OE(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=xn,!xn.__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 y=f.__[0];f.__=f.__N,f.__N=void 0,y!==f.__[0]&&(p=!0)}}),r){var d=r.call(this,s,c,l);return u?d||p:d}return!u||p};xn.__f=!0;var r=xn.shouldComponentUpdate,a=xn.componentWillUpdate;xn.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)},xn.shouldComponentUpdate=o}return i.__N||i.__}function dp(e,t){var n=pp(is++,3);!Mn.__s&&Ag(n.__H,t)&&(n.__=e,n.u=t,xn.__H.__h.push(n))}function Mg(e,t){var n=pp(is++,4);!Mn.__s&&Ag(n.__H,t)&&(n.__=e,n.u=t,xn.__h.push(n))}function fp(e){return Ec=5,Go(function(){return{current:e}},[])}function Go(e,t){var n=pp(is++,7);return Ag(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Sc(e,t){return Ec=8,Go(function(){return e},t)}function L$(){for(var e;e=SE.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(hp),t.__h.some(Cg),t.__h=[]}catch(n){t.__h=[],Mn.__e(n,e.__v)}}}Mn.__b=function(e){xn=null,RE&&RE(e)},Mn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),TE&&TE(e,t)},Mn.__r=function(e){ME&&ME(e),is=0;var t=(xn=e.__c).__H;t&&(Sg===xn?(t.__h=[],xn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(hp),t.__h.some(Cg),t.__h=[],is=0)),Sg=xn},Mn.diffed=function(e){CE&&CE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(SE.push(t)!==1&&EE===Mn.requestAnimationFrame||((EE=Mn.requestAnimationFrame)||I$)(L$)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Sg=xn=null},Mn.__c=function(e,t){t.some(function(n){try{n.__h.some(hp),n.__h=n.__h.filter(function(i){return!i.__||Cg(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Mn.__e(i,n.__v)}}),AE&&AE(e,t)},Mn.unmount=function(e){PE&&PE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{hp(i)}catch(o){t=o}}),n.__H=void 0,t&&Mn.__e(t,n.__v))};var kE=typeof requestAnimationFrame=="function";function I$(e){var t,n=function(){clearTimeout(i),kE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);kE&&(t=requestAnimationFrame(n))}function hp(e){var t=xn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),xn=t}function Cg(e){var t=xn;e.__c=e.__(),xn=t}function Ag(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function OE(e,t){return typeof t=="function"?t(e):t}function B$(e){const{navigationStack:t,setNavigationStack:n}=e,i=Go(()=>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 jt`
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}},Xt.prototype._setDefinitions=function(e){this._definitions=e},Xt.prototype.getModules=function(){return this._modules},Xt.prototype.clear=function(){this.getDefinitions()&&fr.prototype.clear.call(this)},Xt.prototype.destroy=function(){fr.prototype.destroy.call(this),so(this._container)},Xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Xt.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=kt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Xt.prototype.getDefinitions=function(){return this._definitions},Xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Xt.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=te(io(n,["additionalModules"]),{canvas:te({},n.canvas,{container:e}),modules:a});fr.call(this,s),n&&n.container&&this.attachTo(n.container)},Xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Xt.prototype._createContainer=function(e){const t=Wt('<div class="bjs-container"></div>');return Zn(t,{width:ib(e.width),height:ib(e.height),position:e.position}),t},Xt.prototype._createModdle=function(e){const t=te({},this._moddleExtensions,e.moddleExtensions);return new ny(t)},Xt.prototype._modules=[];function Fl(e,t){return e.warnings=t,e}function M2(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 C2={width:"100%",height:"100%",position:"relative"};function ib(e){return e+(tt(e)?"px":"")}function A2(e,t){return t&&Ht(e.diagrams,function(n){return n.id===t})||null}function T2(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Qx+"</a>",i=Wt(n);Zn(kt("svg",i),eb),Zn(i,tb,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ke.bind(i,"click",function(o){R2(),o.preventDefault()})}function Kr(e){Xt.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)}je(Kr,Xt),Kr.prototype._createModdle=function(e){var t=Xt.prototype._createModdle.call(this,e);return t.ids=new ao([32,36,1]),t},Kr.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 xt(e,t){return T(e,"bpmn:CallActivity")?!1:T(e,"bpmn:SubProcess")?(t=t||wt(e),t&&T(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):T(e,"bpmn:Participant")?!!Ee(e).processRef:!0}function Tn(e){if(!(!T(e,"bpmn:Participant")&&!T(e,"bpmn:Lane"))){var t=wt(e).isHorizontal;return t===void 0?!0:t}}function P2(e){return e&&Ee(e).isInterrupting!==!1}function Kn(e){return e&&!!Ee(e).triggeredByEvent}function Ba(e,t){var n=Ee(e).eventDefinitions;return Xo(n,function(i){return T(i,t)})}function k2(e){return Ba(e,"bpmn:ErrorEventDefinition")}function O2(e){return Ba(e,"bpmn:EscalationEventDefinition")}function D2(e){return Ba(e,"bpmn:CompensateEventDefinition")}var Xr={width:90,height:20},ob=15;function po(e){return T(e,"bpmn:Event")||T(e,"bpmn:Gateway")||T(e,"bpmn:DataStoreReference")||T(e,"bpmn:DataObjectReference")||T(e,"bpmn:DataInput")||T(e,"bpmn:DataOutput")||T(e,"bpmn:SequenceFlow")||T(e,"bpmn:MessageFlow")||T(e,"bpmn:Group")}function jl(e){return ft(e.label)}function L2(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=I2(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-=ob:a+=ob,{x:a,y:s}}function I2(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 vf(e){return e.waypoints?L2(e.waypoints):T(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Xr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Xr.height/2}}function xf(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Xr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=vf(t),i=Xr),te({x:n.x-i.width/2,y:n.y-i.height/2},i)}function rb(e){if(T(e,"bpmn:FlowElement")||T(e,"bpmn:Participant")||T(e,"bpmn:Lane")||T(e,"bpmn:SequenceFlow")||T(e,"bpmn:MessageFlow")||T(e,"bpmn:DataInput")||T(e,"bpmn:DataOutput"))return"name";if(T(e,"bpmn:TextAnnotation"))return"text";if(T(e,"bpmn:Group"))return"categoryValueRef"}function B2(e){var t=e.categoryValueRef;return t&&t.value||""}function ni(e){var t=e.businessObject,n=rb(t);if(n)return n==="categoryValueRef"?B2(t):t[n]||""}function N2(e,t){var n=e.businessObject,i=rb(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function $2(e){return ft(e)&&po(e.labelTarget)}var Na=7;function ab(e){let t=[];return K(e.incoming,n=>{T(n,"bpmn:Association")&&T(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),K(e.outgoing,n=>{T(n,"bpmn:Association")&&T(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ws(e){const t=new Map;return K(pf(e),n=>{K(ab(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 bf="hsl(225, 10%, 15%)",F2="white";function fo(e,t){return Xo(e.eventDefinitions,function(n){return n.$type===t})}function j2(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function H2(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function yt(e,t,n){var i=wt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||F2}function Ne(e,t,n){var i=wt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||bf}function Us(e,t,n,i){var o=wt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Ne(e,n)}function sb(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 qr(o)}function wf(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 qr(a)}function G2(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 qr(s)}function z2(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 qr(r)}function qs(e,t={}){return{width:Ai(e,t),height:ui(e,t)}}function Ai(e,t={}){return ai(t,"width")?t.width:e.width}function ui(e,t={}){return ai(t,"height")?t.height:e.height}var V2=new ao,W2=10,Hl=3,U2=1.5,Gl=10,q2=4,$a=.95,Y2=1,K2=.25;function Zr(e,t,n,i,o,r,a){ko.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(j){return n.computeStyle(j,{strokeLinecap:"round",strokeLinejoin:"round",stroke:bf,strokeWidth:2,fill:"white"})}function p(j){return n.computeStyle(j,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:bf,strokeWidth:2})}function d(j,C){var{ref:R={x:0,y:0},scale:Z=1,element:ne,parentGfx:ge=o._svg}=C,$e=We("marker",{id:j,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*Z,markerHeight:20*Z,orient:"auto"});ot($e,ne);var rt=kt(":scope > defs",ge);rt||(rt=We("defs"),ot(ge,rt)),ot(rt,$e)}function f(j,C,R,Z){var ne=V2.nextPrefixed("marker-");return y(j,ne,C,R,Z),"url(#"+ne+")"}function y(j,C,R,Z,ne){if(R==="sequenceflow-end"){var ge=We("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:ne,stroke:ne,strokeWidth:1})});d(C,{element:ge,ref:{x:11,y:10},scale:.5,parentGfx:j})}if(R==="messageflow-start"){var $e=We("circle",{cx:6,cy:6,r:3.5,...u({fill:Z,stroke:ne,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:$e,ref:{x:6,y:6},parentGfx:j})}if(R==="messageflow-end"){var rt=We("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:Z,stroke:ne,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:rt,ref:{x:8.5,y:5},parentGfx:j})}if(R==="association-start"){var ut=We("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:ne,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:ut,ref:{x:1,y:10},scale:.5,parentGfx:j})}if(R==="association-end"){var pn=We("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:ne,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:pn,ref:{x:11,y:10},scale:.5,parentGfx:j})}if(R==="conditional-flow-marker"){var bt=We("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:Z,stroke:ne})});d(C,{element:bt,ref:{x:-1,y:10},scale:.5,parentGfx:j})}if(R==="conditional-default-flow-marker"){var qt=We("path",{d:"M 6 4 L 10 16",...u({stroke:ne,fill:"none"})});d(C,{element:qt,ref:{x:0,y:10},scale:.5,parentGfx:j})}}function h(j,C,R,Z,ne={}){Sn(Z)&&(ne=Z,Z=0),Z=Z||0,ne=u(ne);var ge=C/2,$e=R/2,rt=We("circle",{cx:ge,cy:$e,r:Math.round((C+R)/4-Z),...ne});return ot(j,rt),rt}function m(j,C,R,Z,ne,ge){Sn(ne)&&(ge=ne,ne=0),ne=ne||0,ge=u(ge);var $e=We("rect",{x:ne,y:ne,width:C-ne*2,height:R-ne*2,rx:Z,ry:Z,...ge});return ot(j,$e),$e}function w(j,C,R,Z){var ne=C/2,ge=R/2,$e=[{x:ne,y:0},{x:C,y:ge},{x:ne,y:R},{x:0,y:ge}],rt=$e.map(function(pn){return pn.x+","+pn.y}).join(" ");Z=u(Z);var ut=We("polygon",{...Z,points:rt});return ot(j,ut),ut}function g(j,C,R,Z){R=p(R);var ne=$s(C,R,Z);return ot(j,ne),ne}function v(j,C,R){return g(j,C,R,5)}function b(j,C,R){R=p(R);var Z=We("path",{...R,d:C});return ot(j,Z),Z}function E(j,C,R,Z){return b(C,R,te({"data-marker":j},Z))}function M(j){return Ae[j]}function B(j){return function(C,R,Z){return M(j)(C,R,Z)}}var A={"bpmn:MessageEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill),$e=Z?yt(C,s,R.fill):Ne(C,c,R.stroke),rt=b(j,ne,{fill:ge,stroke:$e,strokeWidth:1});return rt},"bpmn:TimerEventDefinition":function(j,C,R={}){var Z=R.width||C.width,ne=R.height||C.height,ge=R.width?1:2,$e=h(j,Z,ne,.2*ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:ge}),rt=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:Z,containerHeight:ne,position:{mx:.5,my:.5}});b(j,rt,{stroke:Ne(C,c,R.stroke),strokeWidth:ge});for(var ut=0;ut<12;ut++){var pn=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:Z,containerHeight:ne,position:{mx:.5,my:.5}}),bt=Z/2,qt=ne/2;b(j,pn,{strokeWidth:1,stroke:Ne(C,c,R.stroke),transform:"rotate("+ut*30+","+qt+","+bt+")"})}return $e},"bpmn:EscalationEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(j,C,R={}){var Z=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(j,Z,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(j,C,R={},Z){var ne=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}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ge=Z?Ne(C,c,R.stroke):"none",$e=b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1});return Xx($e,45),$e},"bpmn:CompensateEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(j,C,R={},Z){var ne=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{strokeWidth:1,fill:ge,stroke:Ne(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(j,C,R={},Z){var ne=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}}),ge=Z?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(j,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(j,C,R={}){var Z=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(j,Z,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(j,C,R={}){var Z=h(j,C.width,C.height,8,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:4});return Z}};function L(j,C,R={},Z){var ne=Ee(j),ge=j2(ne),$e=Z||j;return ne.get("eventDefinitions")&&ne.get("eventDefinitions").length>1?ne.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](C,$e,R,ge):A["bpmn:MultipleEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](C,$e,R,ge):fo(ne,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](C,$e,R,ge):null}var H={ParticipantMultiplicityMarker:function(j,C,R={}){var Z=Ai(C,R),ne=ui(C,R),ge=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:(Z/2-6)/Z,my:(ne-15)/ne}});E("participant-multiplicity",j,ge,{strokeWidth:2,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},SubProcessMarker:function(j,C,R={}){var Z=m(j,14,14,0,{strokeWidth:1,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)});Fn(Z,C.width/2-7.5,C.height-20);var ne=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",j,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},ParallelMarker:function(j,C,R){var Z=Ai(C,R),ne=ui(C,R),ge=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:(Z/2+R.parallel)/Z,my:(ne-20)/ne}});E("parallel",j,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},SequentialMarker:function(j,C,R){var Z=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",j,Z,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},CompensationMarker:function(j,C,R){var Z=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",j,Z,{strokeWidth:1,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},LoopMarker:function(j,C,R){var Z=Ai(C,R),ne=ui(C,R),ge=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:(Z/2+R.loop)/Z,my:(ne-7)/ne}});E("loop",j,ge,{strokeWidth:1.5,fill:"none",stroke:Ne(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(j,C,R){var Z=Ai(C,R),ne=ui(C,R),ge=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:(Z/2+R.adhoc)/Z,my:(ne-15)/ne}});E("adhoc",j,ge,{strokeWidth:1,fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke)})}};function V(j,C,R,Z){H[j](C,R,Z)}function G(j,C,R=[],Z={}){Z={fill:Z.fill,stroke:Z.stroke,width:Ai(C,Z),height:ui(C,Z)};var ne=Ee(C),ge=R.includes("SubProcessMarker");ge?Z={...Z,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:Z={...Z,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},ne.get("isForCompensation")&&R.push("CompensationMarker"),T(ne,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),ge||te(Z,{compensation:Z.compensation-18}));var $e=ne.get("loopCharacteristics"),rt=$e&&$e.get("isSequential");$e&&(te(Z,{compensation:Z.compensation-18}),R.includes("AdhocMarker")&&te(Z,{seq:-23,loop:-18,parallel:-24}),rt===void 0&&R.push("LoopMarker"),rt===!1&&R.push("ParallelMarker"),rt===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&te(Z,{compensation:-8}),K(R,function(ut){V(ut,j,C,Z)})}function ie(j,C,R={}){R=te({size:{width:100}},R);var Z=r.createText(C||"",R);return vt(Z).add("djs-label"),ot(j,Z),Z}function pe(j,C,R,Z={}){var ne=Ee(C),ge=qs({x:C.x,y:C.y,width:C.width,height:C.height},Z);return ie(j,ne.name,{align:R,box:ge,padding:7,style:{fill:Us(C,l,c,Z.stroke)}})}function q(j,C,R={}){var Z={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return ie(j,ni(C),{box:Z,style:te({},r.getExternalStyle(),{fill:Us(C,l,c,R.stroke)})})}function Te(j,C,R,Z={}){var ne=Tn(R),ge=ie(j,C,{box:{height:30,width:ne?ui(R,Z):Ai(R,Z)},align:"center-middle",style:{fill:Us(R,l,c,Z.stroke)}});if(ne){var $e=-1*ui(R,Z);Nl(ge,0,-$e,270)}}function Pe(j,C,R={}){var{width:Z,height:ne}=qs(C,R);return m(j,Z,ne,Gl,{...R,fill:yt(C,s,R.fill),fillOpacity:$a,stroke:Ne(C,c,R.stroke)})}function ke(j,C,R={}){var Z=Ee(C),ne=yt(C,s,R.fill),ge=Ne(C,c,R.stroke);return(Z.get("associationDirection")==="One"||Z.get("associationDirection")==="Both")&&(R.markerEnd=f(j,"association-end",ne,ge)),Z.get("associationDirection")==="Both"&&(R.markerStart=f(j,"association-start",ne,ge)),R=Et(R,["markerStart","markerEnd"]),v(j,C.waypoints,{...R,stroke:ge,strokeDasharray:"0, 5"})}function ve(j,C,R={}){var Z=yt(C,s,R.fill),ne=Ne(C,c,R.stroke),ge=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),$e=b(j,ge,{fill:Z,fillOpacity:$a,stroke:ne}),rt=Ee(C);if(H2(rt)){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(j,ut,{strokeWidth:2,fill:Z,stroke:ne})}return $e}function U(j,C,R={}){return h(j,C.width,C.height,{fillOpacity:$a,...R,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})}function de(j,C,R={}){return w(j,C.width,C.height,{fill:yt(C,s,R.fill),fillOpacity:$a,stroke:Ne(C,c,R.stroke)})}function z(j,C,R={}){var Z=m(j,Ai(C,R),ui(C,R),0,{fill:yt(C,s,R.fill),fillOpacity:R.fillOpacity||$a,stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),ne=Ee(C);if(T(ne,"bpmn:Lane")){var ge=ne.get("name");Te(j,ge,C,R)}return Z}function Q(j,C,R={}){var Z=Pe(j,C,R),ne=xt(C);if(Kn(C)&&(Le(Z,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!ne)){var ge=Ee(C).flowElements||[],$e=ge.filter(rt=>T(rt,"bpmn:StartEvent"));$e.length===1&&he($e[0],j,R,C)}return pe(j,C,ne?"center-top":"center-middle",R),ne?G(j,C,void 0,R):G(j,C,["SubProcessMarker"],R),Z}function he(j,C,R,Z){var ne=22,ge={fill:yt(Z,s,R.fill),stroke:Ne(Z,c,R.stroke),width:ne,height:ne},$e=Ee(j).isInterrupting,rt=$e?0:3,ut=$e?1:1.2,pn=20,bt=(ne-pn)/2,qt="translate("+bt+","+bt+")";h(C,pn,pn,{fill:ge.fill,stroke:ge.stroke,strokeWidth:ut,strokeDasharray:rt,transform:qt}),L(j,C,ge,Z)}function se(j,C,R={}){var Z=Pe(j,C,R);return pe(j,C,"center-middle",R),G(j,C,void 0,R),Z}var Ae=this.handlers={"bpmn:AdHocSubProcess":function(j,C,R={}){return xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]),Q(j,C,R)},"bpmn:Association":function(j,C,R={}){return R=Et(R,["fill","stroke"]),ke(j,C,R)},"bpmn:BoundaryEvent":function(j,C,R={}){var{renderIcon:Z=!0}=R;R=Et(R,["fill","stroke"]);var ne=Ee(C),ge=ne.get("cancelActivity");R={strokeWidth:1.5,fill:yt(C,s,R.fill),fillOpacity:Y2,stroke:Ne(C,c,R.stroke)},ge||(R.strokeDasharray="6");var $e=U(j,C,R);return h(j,C.width,C.height,Hl,{...R,fill:"none"}),Z&&L(C,j,R),$e},"bpmn:BusinessRuleTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ge=b(j,ne);Le(ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1});var $e=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),rt=b(j,$e);return Le(rt,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:CallActivity":function(j,C,R={}){return R=Et(R,["fill","stroke"]),Q(j,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=de(j,C,R),ne=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(j,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:DataInput":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=i.getRawPath("DATA_ARROW"),ne=ve(j,C,R);return b(j,Z,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1}),ne},"bpmn:DataInputAssociation":function(j,C,R={}){return R=Et(R,["fill","stroke"]),ke(j,C,{...R,markerEnd:f(j,"association-end",yt(C,s,R.fill),Ne(C,c,R.stroke))})},"bpmn:DataObject":function(j,C,R={}){return R=Et(R,["fill","stroke"]),ve(j,C,R)},"bpmn:DataObjectReference":B("bpmn:DataObject"),"bpmn:DataOutput":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=i.getRawPath("DATA_ARROW"),ne=ve(j,C,R);return b(j,Z,{strokeWidth:1,fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke)}),ne},"bpmn:DataOutputAssociation":function(j,C,R={}){return R=Et(R,["fill","stroke"]),ke(j,C,{...R,markerEnd:f(j,"association-end",yt(C,s,R.fill),Ne(C,c,R.stroke))})},"bpmn:DataStoreReference":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(j,Z,{fill:yt(C,s,R.fill),fillOpacity:$a,stroke:Ne(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(j,C,R={}){var{renderIcon:Z=!0}=R;R=Et(R,["fill","stroke"]);var ne=U(j,C,{...R,strokeWidth:4});return Z&&L(C,j,R),ne},"bpmn:EventBasedGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=Ee(C),ne=de(j,C,R);h(j,C.width,C.height,C.height*.2,{fill:yt(C,"none",R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1});var ge=Z.get("eventGatewayType"),$e=!!Z.get("instantiate");function rt(){var pn=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(j,pn,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:2})}if(ge==="Parallel"){var ut=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(j,ut,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1})}else ge==="Exclusive"&&($e||h(j,C.width,C.height,C.height*.26,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1}),rt());return ne},"bpmn:ExclusiveGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=de(j,C,R),ne=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ge=wt(C);return ge.get("isMarkerVisible")&&b(j,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:Gateway":function(j,C,R={}){return R=Et(R,["fill","stroke"]),de(j,C,R)},"bpmn:Group":function(j,C,R={}){return R=Et(R,["fill","stroke","width","height"]),m(j,C.width,C.height,Gl,{stroke:Ne(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ai(C,R),height:ui(C,R)})},"bpmn:InclusiveGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=de(j,C,R);return h(j,C.width,C.height,C.height*.24,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:2.5}),Z},"bpmn:IntermediateEvent":function(j,C,R={}){var{renderIcon:Z=!0}=R;R=Et(R,["fill","stroke"]);var ne=U(j,C,{...R,strokeWidth:1.5});return h(j,C.width,C.height,Hl,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),Z&&L(C,j,R),ne},"bpmn:IntermediateCatchEvent":B("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":B("bpmn:IntermediateEvent"),"bpmn:Lane":function(j,C,R={}){return R=Et(R,["fill","stroke","width","height"]),z(j,C,{...R,fillOpacity:K2})},"bpmn:ManualTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(j,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5}),Z},"bpmn:MessageFlow":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=Ee(C),ne=wt(C),ge=yt(C,s,R.fill),$e=Ne(C,c,R.stroke),rt=v(j,C.waypoints,{markerEnd:f(j,"messageflow-end",ge,$e),markerStart:f(j,"messageflow-start",ge,$e),stroke:$e,strokeDasharray:"10, 11",strokeWidth:1.5});if(Z.get("messageRef")){var ut=rt.getPointAtLength(rt.getTotalLength()/2),pn=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ut.x,y:ut.y}}),bt={strokeWidth:1};ne.get("messageVisibleKind")==="initiating"?(bt.fill=ge,bt.stroke=$e):(bt.fill=$e,bt.stroke=ge);var qt=b(j,pn,bt),Kt=Z.get("messageRef"),Ln=Kt.get("name"),Bt=ie(j,Ln,{align:"center-top",fitBox:!0,style:{fill:$e}}),sn=qt.getBBox(),zn=Bt.getBBox(),pa=ut.x-zn.width/2,oi=ut.y+sn.height/2+W2;Nl(Bt,pa,oi,0)}return rt},"bpmn:ParallelGateway":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=de(j,C,R),ne=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(j,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:Participant":function(j,C,R={}){R=Et(R,["fill","stroke","width","height"]);var Z=z(j,C,R),ne=xt(C),ge=Tn(C),$e=Ee(C),rt=$e.get("name");if(ne){var ut=ge?[{x:30,y:0},{x:30,y:ui(C,R)}]:[{x:0,y:30},{x:Ai(C,R),y:30}];g(j,ut,{stroke:Ne(C,c,R.stroke),strokeWidth:U2}),Te(j,rt,C,R)}else{var pn=qs(C,R);ge||(pn.height=Ai(C,R),pn.width=ui(C,R));var bt=ie(j,rt,{box:pn,align:"center-middle",style:{fill:Us(C,l,c,R.stroke)}});if(!ge){var qt=-1*ui(C,R);Nl(bt,0,-qt,270)}}return $e.get("participantMultiplicity")&&V("ParticipantMultiplicityMarker",j,C,R),Z},"bpmn:ReceiveTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=Ee(C),ne=se(j,C,R),ge;return Z.get("instantiate")?(h(j,28,28,20*.22,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),ge=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ge=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(j,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),ne},"bpmn:ScriptTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(j,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:SendTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(j,ne,{fill:Ne(C,c,R.stroke),stroke:yt(C,s,R.fill),strokeWidth:1}),Z},"bpmn:SequenceFlow":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=yt(C,s,R.fill),ne=Ne(C,c,R.stroke),ge=v(j,C.waypoints,{markerEnd:f(j,"sequenceflow-end",Z,ne),stroke:ne}),$e=Ee(C),{source:rt}=C;if(rt){var ut=Ee(rt);$e.get("conditionExpression")&&T(ut,"bpmn:Activity")&&Le(ge,{markerStart:f(j,"conditional-flow-marker",Z,ne)}),ut.get("default")&&(T(ut,"bpmn:Gateway")||T(ut,"bpmn:Activity"))&&ut.get("default")===$e&&Le(ge,{markerStart:f(j,"conditional-default-flow-marker",Z,ne)})}return ge},"bpmn:ServiceTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R);h(j,10,10,{fill:yt(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var ne=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(j,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),h(j,10,10,{fill:yt(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var ge=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(j,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),Z},"bpmn:StartEvent":function(j,C,R={}){var{renderIcon:Z=!0}=R;R=Et(R,["fill","stroke"]);var ne=Ee(C);ne.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var ge=U(j,C,R);return Z&&L(C,j,R),ge},"bpmn:SubProcess":function(j,C,R={}){return xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]),Q(j,C,R)},"bpmn:Task":function(j,C,R={}){return R=Et(R,["fill","stroke"]),se(j,C,R)},"bpmn:TextAnnotation":function(j,C,R={}){R=Et(R,["fill","stroke"]);var{width:Z,height:ne}=qs(C,R),ge=m(j,Z,ne,0,0,{fill:"none",stroke:"none"}),$e=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:Z,containerHeight:ne,position:{mx:0,my:0}});b(j,$e,{stroke:Ne(C,c,R.stroke)});var rt=Ee(C),ut=rt.get("text")||"";return ie(j,ut,{align:"left-top",box:qs(C,R),padding:Na,style:{fill:Us(C,l,c,R.stroke)}}),ge},"bpmn:Transaction":function(j,C,R={}){xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]);var Z=Q(j,C,{strokeWidth:1.5,...R}),ne=n.style(["no-fill","no-events"],{stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),ge=xt(C);return ge||(R={}),m(j,Ai(C,R),ui(C,R),Gl-Hl,Hl,ne),Z},"bpmn:UserTask":function(j,C,R={}){R=Et(R,["fill","stroke"]);var Z=se(j,C,R),ne=15,ge=12,$e=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:ne,y:ge}});b(j,$e,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5});var rt=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:ne,y:ge}});b(j,rt,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5});var ut=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:ne,y:ge}});return b(j,ut,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:.5}),Z},label:function(j,C,R={}){return q(j,C,R)}};this._drawPath=b,this._renderer=M}je(Zr,ko),Zr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Zr.prototype.canRender=function(e){return T(e,"bpmn:BaseElement")},Zr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Zr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Zr.prototype.getShapePath=function(e){return ft(e)?wf(e,q2):T(e,"bpmn:Event")?sb(e):T(e,"bpmn:Activity")?wf(e,Gl):T(e,"bpmn:Gateway")?G2(e):z2(e)};function Et(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var X2=0,Z2={width:150,height:50};function J2(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Q2(e){return Sn(e)?te({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var _f=null;function eO(){return _f||(_f=document.createElement("canvas").getContext("2d")),_f}function tO(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(cb(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function cb(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function nO(e,t){var n=eO();if(!n)return{width:0,height:0};n.font=tO(t),"letterSpacing"in n&&(n.letterSpacing=cb(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 iO(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=nO(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return oO(e,o,i,r);o=aO(o,r.width,t)}}function oO(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 lb="­";function rO(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===lb)&&o.pop();break}var a=o[o.length-1];return a&&a===lb&&(o[o.length-1]="-"),o.join("")}function aO(e,t,n){var i=Math.max(e.length*(n/t),1),o=rO(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function zl(e){this._config=te({},{size:Z2,padding:X2,style:{},align:"center-top"},e||{})}zl.prototype.createText=function(e,t){return this.layoutText(e,t).element},zl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},zl.prototype.layoutText=function(e,t){for(var n=te({},this._config.size,t.box),i=te({},this._config.style,t.style),o=J2(t.align||this._config.align),r=Q2(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=sO(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(iO(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=si(l,function(m,w,g){return m+(s||w.height)},0)+r.top+r.bottom,d=si(l,function(m,w,g){return w.width>m?w.width:m},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var y=We("text");Le(y,i),K(l,function(m){var w;switch(f+=s||m.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?d:u)-r.right-m.width;break;default:w=Math.max(((a?d:u)-m.width)/2+r.left,0)}var g=We("tspan");Le(g,{x:w,y:f}),g.textContent=m.text,ot(y,g)});var h={width:d,height:p};return{dimensions:h,element:y}};function sO(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var cO=12,lO=1.2,uO=40;function ub(e){var t=te({fontFamily:"Arial, sans-serif",fontSize:cO,fontWeight:"normal",lineHeight:lO},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=te({},t,{fontSize:n},e&&e.externalStyle||{}),o=new zl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Xr.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:Na});return{x:a.x,y:a.y,width:a.width,height:Math.max(uO,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,te({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}ub.$inject=["config.textRenderer"];function pO(){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=gO(i.d,{mx:o,my:r,e:a});return p}}var dO=/\{([^{}]+)\}/g,fO=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function hO(e,t,n){var i=n;return t.replace(fO,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 gO(e,t){return String(e).replace(dO,function(n,i){return hO(n,i,t)})}const mO={__init__:["bpmnRenderer"],bpmnRenderer:["type",Zr],textRenderer:["type",ub],pathMap:["type",pO]};function yO(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ys={translate:["value",yO]};function Vl(e,t,n){return te({id:e.id,type:e.$type,businessObject:e,di:t},n)}function vO(e,t,n){var i=e.waypoint;return!i||i.length<2?[nt(t),nt(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function pb(e,t,n){return new Error(`element ${Yn(t)} referenced by ${Yn(e)}#${n} not yet drawn`)}function Io(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Io.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Io.prototype.add=function(e,t,n){var i,o,r;if(T(t,"bpmndi:BPMNPlane")){var a=T(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Vl(e,t,a)),this._canvas.addRootElement(i)}else if(T(t,"bpmndi:BPMNShape")){var s=!xt(e,t),c=bO(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Vl(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})),T(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),T(e,"bpmn:Lane")&&(r=0),T(e,"bpmn:DataStoreReference")&&(xO(n,nt(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(T(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Vl(e,t,{hidden:o,source:u,target:p,waypoints:vO(t,u,p)})),T(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Yn(t)} for element ${Yn(e)}`);return po(e)&&ni(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Io.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Yn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw pb(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Io.prototype.addLabel=function(e,t,n){var i,o,r;return i=xf(t,n),o=ni(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Vl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ni(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)},Io.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?pb(e,i,t+"Ref"):new Error(`${Yn(e)}#${t} Ref not specified`)},Io.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Io.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Io.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function xO(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 bO(e){return T(e,"bpmn:Group")}const db={__depends__:[mO,{__depends__:[Ys],bpmnImporter:["type",Io]}]};function Ks(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ji(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ef(e){return Math.log(e)/Math.log(10)}var wO=1e3;function we(e){this._eventBus=e}we.$inject=["eventBus"];function _O(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}we.prototype.on=function(e,t,n,i,o,r){if((An(t)||tt(t))&&(r=o,o=i,i=n,n=t,t=null),An(n)&&(r=o,o=i,i=n,n=wO),Sn(o)&&(r=o,o=!1),!An(i))throw new Error("handlerFn must be a function");et(e)||(e=[e]);var a=this._eventBus;K(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?_O(i,r):i,r)})},we.prototype.canExecute=Bo("canExecute"),we.prototype.preExecute=Bo("preExecute"),we.prototype.preExecuted=Bo("preExecuted"),we.prototype.execute=Bo("execute"),we.prototype.executed=Bo("executed"),we.prototype.postExecute=Bo("postExecute"),we.prototype.postExecuted=Bo("postExecuted"),we.prototype.revert=Bo("revert"),we.prototype.reverted=Bo("reverted");function Bo(e){return function(n,i,o,r,a){(An(n)||tt(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Sf=["top","bottom","left","right"],Wl=10;function Rf(e,t){we.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(jl(o)&&!$t(o)){var r=RO(o);r&&i(o,r)}}function i(o,r){var a=nt(o),s=o.label,c=nt(s);if(s.parent){var l=Ze(o),u;switch(r){case"top":u={x:a.x,y:l.top-Wl-s.height/2};break;case"left":u={x:l.left-Wl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Wl+s.height/2};break;case"right":u={x:l.right+Wl+s.width/2,y:a.y};break}var p=Ji(u,c);t.moveShape(s,p)}}}je(Rf,we),Rf.$inject=["eventBus","modeling"];function EO(e){var t=e.host,n=nt(e),i=$n(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Sf.filter(function(a){return o.indexOf(a)===-1});return r}function SO(e){var t=nt(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 fb(t,i)});return n}function RO(e){var t=nt(e.label),n=nt(e),i=fb(n,t);if(MO(i)){var o=SO(e);if(e.host){var r=EO(e);o=o.concat(r)}var a=Sf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?$n(e.label,e)!=="intersect"?void 0:i:a[0]}}function fb(e,t){return $n(t,e,5)}function MO(e){return Sf.indexOf(e)!==-1}function Mf(e){we.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(T(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)}je(Mf,we),Mf.$inject=["eventBus"];var CO=1500;function Cf(e,t,n){e.invoke(we,this),this.preExecute("elements.delete",CO,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=gt(o,l=>T(l,"bpmn:Participant")||T(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>T(l,"bpmn:Artifact"))),c=new Set;return K(r,l=>{const u=new Set(xa(Da(Array.from(s),yn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}je(Cf,we),Cf.$inject=["injector","eventBus","canvas"];function Af(e,t){e.invoke(we,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=gt(o.incoming.concat(o.outgoing),function(a){return T(a,"bpmn:Association")});K(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}je(Af,we),Af.$inject=["injector","modeling"];function Fa(e,t){for(ri(t)&&(t=[t]);e=e.parent;)if(ht(e,t))return e;return null}function hb(e,t){var n=Fa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Fa(e,i),n)return Tn(n);if(ht(e,i))return Tn(e);var o;for(o=Ee(e);o&&!T(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=Ee(a);return s&&s.get("processRef")===o});return r?Tn(r):!0}var gb=500;function Ul(e,t){t.invoke(we,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",gb,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return mb(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",gb,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];mb(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}Ul.$inject=["bpmnReplace","injector"],je(Ul,we),Ul.prototype._replaceShape=function(e,t){var n=AO(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function AO(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function mb(e,t){return!ft(e)&&ht(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Tf(e,t){we.call(this,e);function n(i){return gt(i.attachers,function(o){return T(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);T(o,"bpmn:EventBasedGateway")&&T(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;T(o,"bpmn:Gateway")&&T(r,"bpmn:EventBasedGateway")&&K(r.outgoing,function(a){var s=a.target,c=n(s);T(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Tf.$inject=["eventBus","modeling"],je(Tf,we);function yb(e){return e.create("bpmn:Category")}function TO(e){return e.create("bpmn:CategoryValue")}function vb(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=TO(e)),n.$parent||(n.$parent=yb(e)),n}function PO(e,t,n){return un(t.get("categoryValue"),e),e.$parent=t,un(n.get("rootElements"),t),t.$parent=n,e}function kO(e){var t=e.$parent;return t&&(an(t.get("categoryValue"),e),e.$parent=null),e}function OO(e){var t=e.$parent;return t&&(an(t.get("rootElements"),e),e.$parent=null),e}var DO=500;function Pf(e,t,n){n.invoke(we,this);function i(c){return t.filter(function(l){return T(l,"bpmn:Group")&&!l.labelTarget}).map(Ee).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&&PO(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&OO(l),c&&!o(c,u)&&kO(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!T(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;!T(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.executed(["shape.move","shape.resize"],DO,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,Ee(l))},!0),this.executed("group.updateRefs",function(c){xb(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){xb(c).forEach(function(l){s(l.categoryValue,l.category,Ee(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!T(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!T(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Pf.$inject=["bpmnjs","elementRegistry","injector"],je(Pf,we);function xb(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function kf(e,t,n){we.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(m){const w=m.source,g=m.target;ja(w)&&Xs(g)&&u(g)}function o(m){const w=m.connection,g=m.source,v=m.target;ja(g)&&ql(v)&&(l(v),d(g,[w]))}function r(m){const w=m.newTarget,g=m.oldSource,v=m.oldTarget;if(v!==w){const b=g;Xs(v)&&u(v),ja(b)&&ql(w)&&l(w)}}function a(m){const{element:w}=m;Xs(w)?(p(w),f(w)):ql(w)&&y(w)}function s(m){const{newData:w,oldShape:g}=m;if(ja(m.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const v=g.outgoing.find(({target:b})=>Xs(b));v&&v.target&&(m._connectionTarget=v.target)}else if(!ja(m.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const v=g.outgoing.find(({target:b})=>ql(b));v&&v.target&&(m._connectionTarget=v.target),h(g)}}function c(m){const{_connectionTarget:w,newShape:g}=m;w&&t.connect(g,w)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const w of m.incoming)n.canConnect(w.source,m)||t.removeConnection(w);for(const w of m.outgoing)n.canConnect(m,w.target)||t.removeConnection(w)}function d(m,w){m.outgoing.filter(b=>T(b,"bpmn:Association")).filter(b=>Xs(b.target)&&!w.includes(b)).forEach(b=>t.removeConnection(b))}function f(m){const w=m.attachers.slice();w.length&&t.removeElements(w)}function y(m){const w=m.incoming.filter(g=>ja(g.source));t.removeElements(w)}function h(m){const w=m.outgoing.filter(g=>T(g,"bpmn:SequenceFlow"));t.removeElements(w)}}je(kf,we),kf.$inject=["eventBus","modeling","bpmnRules"];function Xs(e){const t=Ee(e);return t&&t.get("isForCompensation")}function ja(e){return e&&T(e,"bpmn:BoundaryEvent")&&Ba(e,"bpmn:CompensateEventDefinition")}function ql(e){return e&&T(e,"bpmn:Activity")&&!Kn(e)}function Of(e){e.invoke(we,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;T(i,"bpmn:Lane")&&!T(o,"bpmn:Lane")&&(n.parent=Fa(i,"bpmn:Participant"))})}Of.$inject=["injector"],je(Of,we);function Df(e,t){we.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(T(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}})}Df.$inject=["eventBus","bpmnFactory"],je(Df,we);var Lf=20,If=20,bb=30,Yl=2e3;function Bf(e,t,n){we.call(this,t),t.on(["create.start","shape.move.start"],Yl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!T(a,"bpmn:Participant")||!T(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!T(p,"bpmn:Group")&&!ft(p)&&!$t(p)});if(c.length){var l=yn(c),u=LO(a,l);te(a,u),r.createConstraints=IO(a,l)}}}),t.on("create.start",Yl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}T(a,"bpmn:Participant")&&T(s,"bpmn:Process")&&(t.on("element.hover",Yl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return T(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",Yl,function(o){var r=o.elements,a=o.parent,s=BO(r),c;s&&T(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=Ee(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;T(a,"bpmn:Participant")&&T(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=Ee(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)&&Ee(s).set("processRef",Ee(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)&&Ee(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)}Bf.$inject=["canvas","eventBus","modeling"],je(Bf,we);function LO(e,t){t={width:t.width+Lf*2+bb,height:t.height+If*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 IO(e,t){return t=Ze(t),{bottom:t.top+e.height/2-If,left:t.right-e.width/2+Lf,top:t.bottom-e.height/2+If,right:t.left+e.width/2-Lf-bb}}function BO(e){return Ht(e,function(t){return T(t,"bpmn:Participant")})}var wb="__targetRef_placeholder";function Nf(e,t){we.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],_b(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],_b(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Ht(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Ht(c,function(u){return u.name===wb});return!l&&s&&(l=t.create("bpmn:Property",{name:wb}),un(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||an(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,y=s.oldTarget||s.target,h=y&&y.businessObject,m=c.businessObject,w;h&&h!==p&&o(h,l),f&&f!==p&&o(f,l),p?(w=i(p,!0),m.targetRef=w):m.targetRef=null}}Nf.$inject=["eventBus","bpmnFactory"],je(Nf,we);function _b(e){return function(t){var n=t.context,i=n.connection;if(T(i,"bpmn:DataInputAssociation"))return e(t)}}function Kl(e){this._bpmnUpdater=e}Kl.$inject=["bpmnUpdater"],Kl.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),[]},Kl.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 $f(e,t,n,i){we.call(this,i),t.registerHandler("dataStore.updateContainment",Kl);function o(){return n.filter(function(s){return T(s,"bpmn:Participant")&&Ee(s).processRef})[0]}function r(s){return s.children.filter(function(c){return T(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:wt(s),newSemanticParent:u.processRef||u,newDiParent:wt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;T(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 T(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!T(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;T(l,"bpmn:DataStoreReference")&&l.type!=="label"&&T(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(!T(u,"bpmn:Collaboration")&&T(l,"bpmn:DataStoreReference")&&l.type!=="label"&&T(p,"bpmn:Collaboration")){var d=T(u,"bpmn:Participant")?u:$O(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();ht(l,["bpmn:Participant","bpmn:SubProcess"])&&T(u,"bpmn:Collaboration")&&r(u).filter(function(p){return NO(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){T(u,"bpmn:Process")&&a(d,u)})})}$f.$inject=["canvas","commandStack","elementRegistry","eventBus"],je($f,we);function NO(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 $O(e,t){for(;e.parent;){if(T(e.parent,t))return e.parent;e=e.parent}}var Xl=Math.max,Zl=Math.min,FO=20;function Eb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function jO(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 HO(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 Jl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return tt(o)&&(i=(/top|left/.test(e)?Zl:Xl)(i,o)),tt(r)&&(i=(/top|left/.test(e)?Xl:Zl)(i,r)),i}function GO(e,t){if(!t)return e;var n=Ze(e);return Ll({top:Jl("top",n,t),right:Jl("right",n,t),bottom:Jl("bottom",n,t),left:Jl("left",n,t)})}function zO(e,t,n,i){var o=Ze(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?Ze(i):r,s={top:Zl(r.top,a.top),left:Zl(r.left,a.left),bottom:Xl(r.bottom,a.bottom),right:Xl(r.right,a.right)};return Ll(s)}function Zs(e,t){return typeof e<"u"?e:FO}function VO(e,t){var n,i,o,r;return typeof t=="object"?(n=Zs(t.left),i=Zs(t.right),o=Zs(t.top),r=Zs(t.bottom)):n=i=o=r=Zs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function WO(e){return!(e.waypoints||e.type==="label")}function Sb(e,t){var n;if(e.length===void 0?n=gt(e.children,WO):n=e,n.length)return VO(yn(n),t)}var hr=Math.abs;function UO(e,t){return Eb(Ze(t),Ze(e))}var qO=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Ti=30;function Ql(e,t){return t=t||[],e.children.filter(function(n){T(n,"bpmn:Lane")&&(Ql(n,t),t.push(n))}),t}function gr(e){return e.children.filter(function(t){return T(t,"bpmn:Lane")})}function Pi(e){return Fa(e,qO)||e}function YO(e,t){var n=Pi(e),i=T(n,"bpmn:Process")?[]:[n],o=Ql(n,i),r=Ze(e),a=Ze(t),s=UO(e,t),c=[],l=Tn(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,y=l?s.left:0,h=Ze(u);s.top&&(hr(h.bottom-r.top)<10&&(f=a.top-h.bottom),hr(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(hr(h.right-r.left)<10&&(d=a.left-h.right),hr(h.left-r.left)<5&&(y=a.left-h.left)),s.bottom&&(hr(h.top-r.bottom)<10&&(p=a.bottom-h.top),hr(h.bottom-r.bottom)<5&&(f=a.bottom-h.bottom)),s.right&&(hr(h.left-r.right)<10&&(y=a.right-h.left),hr(h.right-r.right)<5&&(d=a.right-h.right)),(p||d||f||y)&&c.push({shape:u,newBounds:HO(u,{top:p,right:d,bottom:f,left:y})})}}),c}var KO=500;function Ff(e,t){we.call(this,e);function n(i,o){var r=Tn(i),a=gr(o),s=[],c=[],l=[],u=[];if(Yr(a,function(m){return r?m.y>i.y?c.push(m):s.push(m):m.x>i.x?u.push(m):l.push(m),m.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,y,h;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&&(y=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(y.movingShapes,y.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",KO,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;T(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Ff.$inject=["eventBus","spaceTool"],je(Ff,we);var Rb=500;function eu(e,t){t.invoke(we,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Rb,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Mb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Rb,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Mb(a,ZO(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}eu.$inject=["bpmnReplace","injector"],je(eu,we),eu.prototype._replaceShape=function(e){var t=XO(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function XO(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function Mb(e,t){return!ft(e)&&T(e,"bpmn:BoundaryEvent")&&!t}function ZO(e,t){return e.indexOf(t)!==-1}var tu=Math.round,JO=Math.max;function QO(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 eD(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Cb=10;function tD(e,t){var n,i;for(n=0;i=e[n];n++)if(Hs(i,t)<=Cb)return{point:e[n],bendpoint:!0,index:n};return null}function nD(e,t){var n=kx(QO(t,Cb),eD(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=JO(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:tu(i.x+o.x)/2,y:tu(i.y+o.y)/2},index:i.segment2}:{point:{x:tu(i.x),y:tu(i.y)},index:i.segment2}:null}function jf(e,t){return tD(e,t)||nD(e,t)}function Hf(e,t,n){we.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,y,h=o.outgoing.slice(),m=o.incoming.slice(),w;tt(a.width)?w=nt(a):w=a;var g=jf(s,w);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:w,(c.length===1||!Ab(o,c[c.length-1]))&&c.push(Tb(u)),(l.length===1||!Ab(o,l[0]))&&l.unshift(Tb(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||w),f=r),t.canConnect(o,d,r)&&(f?y=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),y=r));var v=[].concat(f&&gt(m,function(b){return b.source===f.source})||[],y&&gt(h,function(b){return b.target===y.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=nt(c),u={x:l.x+s.x,y:l.y+s.y},p=Ht(r.children,function(d){var f=t.canInsert(a,d);return f&&jf(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)}je(Hf,we),Hf.$inject=["eventBus","bpmnRules","modeling"];function Ab(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 Tb(e){return te({},e)}function Gf(e,t){we.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)&&Ha(o)){var c=[];T(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Ha(l)):c=a.incoming.filter(l=>l!==o&&Ha(l)&&T(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(T(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Ha).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Ha).forEach(function(s){const c=a.incoming.filter(Ha).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}Gf.$inject=["eventBus","modeling"],je(Gf,we);function Ha(e){return T(e,"bpmn:SequenceFlow")}var nu=1500,Pb=2e3;function kb(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"],nu,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;T(a,"bpmn:Lane")&&!ht(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Pi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||ht(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"],nu,function(i){var o=i.hover;T(o,"bpmn:Lane")&&(i.hover=Pi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],nu,function(i){var o=i.context,r=i.hover,a=o.type;T(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Pi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],nu,function(i){var o=i.context,r=o.start;T(r,"bpmn:Lane")&&(o.start=Pi(r)||r)}),t.on("shape.move.start",Pb,function(i){var o=i.shape;T(o,"bpmn:Lane")&&(i.shape=Pi(o)||o)}),t.on("spaceTool.move",Pb,function(i){var o=i.hover;o&&T(o,"bpmn:Lane")&&(i.hover=Pi(o))})}kb.$inject=["elementRegistry","eventBus","canvas"];var Ob=770;function zf(e,t,n,i){n.invoke(we,this);function o(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef;u||(u=vb(e,l));var p=c.category||u.$parent||yb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=Ee(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;T(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;T(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=Ee(l);if(!(!T(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(!(!T(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=Ee(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!T(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!T(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!T(l,"bpmn:Group")||l.labelTarget||Ee(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!T(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",Ob,function(s){var c=s.descriptor,l=s.element;if(!(!T(l,"bpmn:Group")||l.labelTarget)){var u=Ee(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",Ob,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})}zf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],je(zf,we);function Vf(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 Db(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=Vf(i,o,r,a),l=Vf(i,o,r,s),u;c&&l?Lb(c,r)>Lb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],nt(i.source)),t(o[o.length-1],o[o.length-2],nt(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Db.$inject=["eventBus"];function Lb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wf(e){we.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=Ee(i),r=wt(i);if(ht(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}Wf.$inject=["eventBus"],je(Wf,we);function Ib(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Bb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function iD(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 oD(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 Uf(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=oD([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 Nb(e,t){var n=Uf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Ib(i)}function Js(e,t){return Ib({x:e.x-t.x,y:e.y-t.y})}var $b=Math.sqrt,Fb=Math.min,rD=Math.max,jb=Math.abs;function Hb(e){return Math.pow(e,2)}function Qs(e,t){return $b(Hb(e.x-t.x)+Hb(e.y-t.y))}function aD(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],zb(i,o)?l=[i]:(r=Qs(e,i),a=Qs(e,o),c=Fb(r,a),l=sD(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:zb(i,l[0])?n:n+1}),l.length===2&&(s=lD(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Qs(i,s)/Qs(i,o)}),p=Qs(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function sD(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 y=$b(f),h=-p+y,m=-p-y,w={x:e.x-o*h,y:e.y-r*h};if(f===0)return[w];var g={x:e.x-o*m,y:e.y-r*m};return[w,g].filter(function(v){return cD(v,e,t)})}function cD(e,t,n){return Gb(e.x,t.x,n.x)&&Gb(e.y,t.y,n.y)}function Gb(e,t,n){return e>=Fb(t,n)-iu&&e<=rD(t,n)+iu}function lD(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var iu=.1;function zb(e,t){return jb(e.x-t.x)<=iu&&jb(e.y-t.y)<=iu}function uD(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=Wb(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 Vb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=aD(e,n),c=s.segmentIndex,l=uD(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Ub(n,c),p=Ub(t,l),d=s.position,f=dD(u,d),y=pD(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,w=n[m];if(t.indexOf(w)!==-1)return a;if(h===0){var g=t[m];return o=g.x-s.position.x,r=g.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&m!==0&&m<n.length-1&&(f=Wb(n,m))}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=iD({x:e.x-d.x,y:e.y-d.y},y);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:Do(v),delta:Do({x:o,y:r})}}function Wb(e,t){var n=Js(e[t-1],e[t]),i=Js(e[t],e[t+1]),o=n/(n+i);return o}function pD(e,t){var n=Bb(e),i=Bb(t);return i-n}function Ub(e,t){return[e[t],e[t+1]]}function dD(e,t){var n=Js(e[0],e[1]),i=Js(e[0],t);return n===0?0:i/n}function fD(e,t,n,i){var o=nt(e);return Vb(o,t,n,i).delta}function ec(e,t,n){var i=Ks(t),o=Ks(n),r=Ji(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return Do({x:o.x+a.x,y:o.y+a.y})}function qb(e,t,n){var i=Ks(e),o=Ks(t),r=Ks(n),a=Ji(e,i),s=Ji(i,o),c=hD(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 Do({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function hD(e,t,n){var i=Ze(t),o=Ze(n);if(gD(i,o))return null;var r=$n(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=$n(n,s),c!==r?null:a}function gD(e,t){return mD(e,t)||yD(e,t)}function mD(e,t){return e.right!==t.right&&e.left!==t.left}function yD(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Yb="name",Kb="text";function qf(e,t,n,i){we.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{Ee(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Yb in l&&t.updateLabel(c,l[Yb]),Kb in l&&T(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;ft(l)||!po(l)||ni(l)&&t.updateLabel(l,ni(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=te({},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),fD(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=Ee(c);u&&po(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(!(!ft(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(ni(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,y=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?y-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(jl(c)){var p=c.label,d=nt(p),f=bD(u),y=xD(d,f),h=vD(y,u,l);t.moveShape(p,h)}})}je(qf,we),qf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function vD(e,t,n){var i=ec(e,t,n);return Do(Ji(i,e))}function xD(e,t){if(t.length){var n=wD(e,t);return Uf(e,n)}}function bD(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 wD(e,t){var n=t.map(function(o){return{line:o,distance:Nb(e,o)}}),i=no(n,"distance");return i[0].line}function _D(e,t,n,i){return Vb(e,t,n,i).point}function Yf(e,t){we.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=te({},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),_D(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)})})}je(Yf,we),Yf.$inject=["eventBus","modeling"];function ou(e,t,n){var i=au(e),o=Zb(i,t),r=i[0];return o.length?o[o.length-1]:ec(r.original||r,n,t)}function ru(e,t,n){var i=au(e),o=Zb(i,t),r=i[i.length-1];return o.length?o[0]:ec(r.original||r,n,t)}function Kf(e,t,n){var i=au(e),o=Xb(t,n),r=i[0];return ec(r.original||r,o,t)}function Xf(e,t,n){var i=au(e),o=Xb(t,n),r=i[i.length-1];return ec(r.original||r,o,t)}function Xb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function au(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Zb(e,t){var n=Wn(e,SD);return gt(n,function(i){return ED(i,t)})}function ED(e,t){return $n(t,e,1)==="intersect"}function SD(e){return e.original||e}function Zf(e,t){we.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(RD(i,o)){var r=MD(i);r.incoming.forEach(function(a){var s=ru(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=ou(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Zf.$inject=["eventBus","modeling"],je(Zf,we);function RD(e,t){return T(e,"bpmn:Participant")&&xt(e)&&T(t,"bpmn:Participant")&&!xt(t)}function MD(e){var t=Fs([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){T(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){T(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const CD=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Jb(e){const t=Ee(e);if(!T(t,"bpmn:BoundaryEvent")&&!(T(t,"bpmn:StartEvent")&&Kn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:CD.some(i=>T(n[0],i))}function Qb(e){return T(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Jf(e,t){e.invoke(we,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Jb(o))return;const a=Qb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=Ee(i).get(a),l=Ee(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Jf.$inject=["injector","modeling"],je(Jf,we);function Qf(e,t){we.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=wt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}je(Qf,we),Qf.$inject=["eventBus","modeling"];function eh(e,t,n){we.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(!(!T(r,"bpmn:SequenceFlow")||!T(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=AD(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}je(eh,we),eh.$inject=["eventBus","bpmnRules","modeling"];function Ga(e){return e.original||e}function AD(e,t){var n=Vf(Ga(e[e.length-2]),Ga(e[e.length-1]),Ga(t[1]),Ga(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ga(e[0]),Ga(t[t.length-1])]}function th(e,t){we.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;T(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)}th.$inject=["eventBus","modeling"],je(th,we);function nh(e,t,n,i){we.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;T(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),T(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,y;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(y=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=y,o&&s(u,y))}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;K(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=Ht(p.outgoing,wa({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})})}je(nh,we),nh.$inject=["eventBus","modeling","bpmnRules","injector"];function su(e,t,n,i,o,r){i.invoke(we,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=si(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=[];K(s.closure.topLevel,function(d){Kn(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})})}je(su,we),su.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;K(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)},su.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var TD=1500,PD={width:140,height:120},ih={width:300,height:60},oh={width:60,height:300},cu={width:300,height:150},lu={width:150,height:300},ew={width:140,height:120},tw={width:100,height:40};function nw(e){e.on("resize.start",TD,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(T(i,"bpmn:Lane")||T(i,"bpmn:Participant"))&&(n.resizeConstraints=ID(i,o,r)),T(i,"bpmn:SubProcess")&&xt(i)&&(n.minDimensions=ew),T(i,"bpmn:TextAnnotation")&&(n.minDimensions=tw)})}nw.$inject=["eventBus"];var mr=Math.abs,kD=Math.min,OD=Math.max;function iw(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function za(e,t,n){return iw(e,t,n,kD)}function Va(e,t,n){return iw(e,t,n,OD)}var DD={top:20,left:50,right:20,bottom:20},LD={top:50,left:20,right:20,bottom:20};function ID(e,t,n){var i=Pi(e),o=!0,r=!0,a=Ql(i,[i]),s=Ze(e),c={},l={},u=Tn(e),p=u?ih:oh;/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(y){var h=Ze(y);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&mr(s.top-h.bottom)<10&&Va(c,"top",h.top+p.height),mr(s.top-h.top)<5&&za(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&mr(s.right-h.left)<10&&za(c,"right",h.right-p.width),mr(s.right-h.right)<5&&Va(l,"right",h.left+p.width)),/s/.test(t)&&(n&&mr(s.bottom-h.top)<10&&za(c,"bottom",h.bottom-p.height),mr(s.bottom-h.bottom)<5&&Va(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&mr(s.left-h.right)<10&&Va(c,"left",h.left+p.width),mr(s.left-h.left)<5&&za(l,"left",h.right-p.width))});var d=i.children.filter(function(y){return!y.hidden&&!y.waypoints&&(T(y,"bpmn:FlowElement")||T(y,"bpmn:Artifact"))}),f=u?DD:LD;return d.forEach(function(y){var h=Ze(y);/n/.test(t)&&(!u||o)&&za(l,"top",h.top-f.top),/e/.test(t)&&(u||r)&&Va(l,"right",h.right+f.right),/s/.test(t)&&(!u||r)&&Va(l,"bottom",h.bottom+f.bottom),/w/.test(t)&&(u||o)&&za(l,"left",h.left-f.left)}),{min:l,max:c}}function ow(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Wa(e){return e.originalEvent||e.srcEvent}function rh(e){ow(e),ow(Wa(e))}function Jr(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 rw(){return/mac/i.test(navigator.platform)}function aw(e,t){return(Wa(e)||e).button===t}function yr(e){return aw(e,0)}function BD(e){return aw(e,1)}function tc(e){var t=Wa(e)||e;return yr(e)?rw()?t.metaKey:t.ctrlKey:!1}function uu(e){var t=Wa(e)||e;return yr(e)&&t.shiftKey}var sw=1001;function cw(e,t){e.on("resize.start",sw+500,function(n){var i=n.context,o=i.shape;(T(o,"bpmn:Lane")||T(o,"bpmn:Participant"))&&(i.balanced=!tc(n))}),e.on("resize.end",sw,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(T(o,"bpmn:Lane")||T(o,"bpmn:Participant"))return r&&(a=Bx(a),t.resizeLane(o,a,i.balanced)),!1})}cw.$inject=["eventBus","modeling"];var ND=500;function ah(e,t,n,i,o){n.invoke(we,this);function r(u){return ht(u,["bpmn:ReceiveTask","bpmn:SendTask"])||$D(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!Ht(d,wa({id:u.id}))}function s(u){if(T(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(T(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(T(u,"bpmn:MessageEventDefinition"))return"messageRef";if(T(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(ht(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(ht(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=Ee(p),f=c(d),y;f&&!a(f)&&(y=e.getDefinitions().get("rootElements"),un(y,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");an(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=Ee(d),y=c(f);y&&(p.referencedRootElement=y)}}),t.on("copyPaste.pasteElement",ND,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)})}ah.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],je(ah,we);function $D(e,t){return et(t)||(t=[t]),Xo(t,function(n){return Ba(e,n)})}var lw=Math.max;function uw(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return K(n,function(a){var s=a.id;T(a,"bpmn:Participant")&&(r[s]=jD(a,i,o)),T(a,"bpmn:Lane")&&(r[s]=Tn(a)?ih:oh),T(a,"bpmn:SubProcess")&&xt(a)&&(r[s]=ew),T(a,"bpmn:TextAnnotation")&&(r[s]=tw),T(a,"bpmn:Group")&&(r[s]=PD)}),r})}uw.$inject=["eventBus"];function FD(e){return e==="x"}function jD(e,t,n){var i=Tn(e);if(!zD(e))return i?cu:lu;var o=FD(t),r={};return o?i?r=cu:r={width:GD(e,n,o),height:lu.height}:i?r={width:cu.width,height:HD(e,n,o)}:r=lu,r}function HD(e,t,n){var i;return i=VD(e,t,n),lw(cu.height,i)}function GD(e,t,n){var i;return i=WD(e,t,n),lw(lu.width,i)}function zD(e){return!!gr(e).length}function VD(e,t,n){var i=gr(e),o;return o=sh(i,t,n),e.height-o.height+ih.height}function WD(e,t,n){var i=gr(e),o;return o=sh(i,t,n),e.width-o.width+oh.width}function sh(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=gr(o),r.length?sh(r,t,n):o}var pw="_plane";function dw(e){var t=e.id;return UD(t)}function ho(e){var t=e.id;return T(e,"bpmn:SubProcess")?fw(t):t}function Qr(e){return fw(e)}function pu(e){var t=wt(e);return T(t,"bpmndi:BPMNPlane")}function fw(e){return e+pw}function UD(e){return e.replace(new RegExp(pw+"$"),"")}var hw=400,qD=600,gw={x:180,y:160};function No(e,t,n,i,o,r,a){we.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 T(p,"bpmn:SubProcess")&&!xt(p)}function l(p){var d=p.shape,f=p.newRootElement,y=Ee(d);f=s._addDiagram(f||y),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=Ee(d);s._removeDiagram(f);var y=p.newRootElement=a.get(ho(f));e.removeRootElement(y)}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;K(d,function(f){if(c(f)){var y=a.get(ho(f));if(!(!y||!f.children||!f.children.length)){var h=mw(f);s._showRecursively(h),s._moveChildrenToShape(h,y)}}})},!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;!T(d,"bpmn:SubProcess")||!xt(d)||K(Ws([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(ho(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(ho(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,y=e.findRoot(ho(d));if(!(!f||!y)){var h=f.children;n.moveElements(h,{x:0,y:0},y)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(T(d,"bpmn:SubProcess")){var f=p.properties,y=p.oldProperties,h=y.id,m=f.id;if(h!==m){if(pu(d)){a.updateId(d,Qr(m)),a.updateId(h,m);return}var w=a.get(Qr(h));w&&a.updateId(Qr(h),Qr(m))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(T(d,"bpmn:SubProcess")){var f=p.properties,y=p.oldProperties,h=y.id,m=f.id;if(h!==m){if(pu(d)){a.updateId(d,Qr(h)),a.updateId(m,h);return}var w=a.get(Qr(m));w&&a.updateId(w,Qr(h))}}},!0),t.on("element.changed",function(p){var d=p.element;if(pu(d)){var f=d,y=a.get(dw(f));!y||y===f||t.fire("element.changed",{element:y})}}),this.executed("shape.toggleCollapse",hw,function(p){var d=p.shape;T(d,"bpmn:SubProcess")&&(xt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",hw,function(p){var d=p.shape;T(d,"bpmn:SubProcess")&&(xt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",qD,function(p){var d=p.shape;if(T(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(xt(d))s._moveChildrenToShape(f.children.slice(),d),K(Ws(d.children),h=>{n.moveShape(h.annotation,{x:0,y:0},d.parent),K(h.associations,m=>{n.moveConnection(m,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var y=mw(d);s._moveChildrenToShape(y,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var y=ho(d),h=a.get(y);h&&f.push.apply(f,h.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,y=p.elements,h=f.parent,m=T(wt(h),"bpmndi:BPMNPlane");if(m){var w=dw(h),g=Ht(y,function(v){return v.id===w});g&&(d.parent=g.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}je(No,we),No.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=yn(i),r;if(!t.x)r={x:gw.x-o.x,y:gw.y-o.y};else{var a=nt(t),s=nt(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},No.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(ab(e).map(i=>i.annotation));n.size&&K(Ws(e.children),i=>{n.has(i.annotation)&&K(i.associations,o=>{t.removeConnection(o)})})},No.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},No.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},No.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:ho(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},No.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ht(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},No.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function YD(e){var t=[];return K(Ws(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function mw(e){return e.children.slice().concat(YD(e.children)).concat(KD(e))}function KD(e){return pf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function ch(e,t){e.invoke(we,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!T(o,"bpmn:SubProcess")||T(o,"bpmn:AdHocSubProcess")||!(T(i,"bpmn:Task")||T(i,"bpmn:CallActivity"))||!xt(o))){var r=XD(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}ch.$inject=["injector","modeling"],je(ch,we);function XD(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function lh(e,t){we.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;T(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&&T(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(!(!T(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,ni(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}}})}je(lh,we),lh.$inject=["eventBus","textRenderer"];function uh(e,t){we.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(xt(i))return;var o=Fs(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();K(s,function(l){r(l,!0)}),K(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||T(a,"bpmn:Association")&&(T(a.source,"bpmn:TextAnnotation")||T(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,nt(i)):t.reconnectStart(a,i,nt(i)))}},!0)}je(uh,we),uh.$inject=["eventBus","modeling"];var ph=500;function dh(e,t,n){we.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=ZD(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"],ph,function(a){var s=a.context,c=s.shape;T(c,"bpmn:SubProcess")&&(c.collapsed?wt(c).isExpanded=!1:(i(c.children),wt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ph,function(a){var s=a.context,c=s.shape;c.collapsed?wt(c).isExpanded=!1:wt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ph,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"})})}je(dh,we),dh.$inject=["eventBus","elementFactory","modeling"];function ZD(e){return e.filter(function(t){return!t.hidden})}function fh(e,t,n,i){t.invoke(we,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;ft(a)||(T(a,"bpmn:Participant")&&xt(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;T(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}je(fh,we),fh.$inject=["canvas","injector","moddle","modeling"];function hh(e,t){we.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;JD(o,r)&&t.updateProperties(r,{default:null})})}je(hh,we),hh.$inject=["eventBus","modeling"];function JD(e,t){if(!T(e,"bpmn:SequenceFlow"))return!1;var n=Ee(t),i=Ee(e);return n.get("default")===i}var QD=500,eL=5e3,yw=["shape.create","shape.delete","shape.move","shape.resize"],vw=[...yw,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function gh(e,t){we.call(this,e);var n;function i(){return n=n||new tL,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(vw,eL,function(){i()}),this.postExecuted(vw,QD,function(){r()}),this.preExecute(yw,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(T(c,"bpmn:Lane")&&l.addLane(c),T(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}gh.$inject=["eventBus","modeling"],je(gh,we);function tL(){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 nL=500,iL=5e3,xw=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],bw=[...xw,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function mh(e,t){we.call(this,e);var n;function i(){return n=n||new oL,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(bw,iL,function(){i()}),this.postExecuted(bw,nL,function(){r()}),this.preExecute(xw,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(T(s,"bpmn:FlowElement")&&c.addFlowElement(s),T(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;T(s,"bpmn:Group")&&o().addGroup(s)})}mh.$inject=["eventBus","modeling"],je(mh,we);function oL(){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 yh(e,t){we.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)rL(r)&&!sL(r)&&t.updateProperties(r,{isForCompensation:void 0})})}je(yh,we),yh.$inject=["eventBus","modeling"];function rL(e){const t=Ee(e);return t&&t.isForCompensation}function aL(e){return e&&T(e,"bpmn:BoundaryEvent")&&Ba(e,"bpmn:CompensateEventDefinition")}function sL(e){return e.incoming.filter(n=>aL(n.source)).length>0}const cL={__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",Rf],appendBehavior:["type",Mf],associationBehavior:["type",Af],attachEventBehavior:["type",Ul],artifactBehavior:["type",Cf],boundaryEventBehavior:["type",Tf],categoryRootElementReferenceBehavior:["type",Pf],compensateBoundaryEventBehaviour:["type",kf],createBehavior:["type",Of],createDataObjectBehavior:["type",Df],createParticipantBehavior:["type",Bf],dataInputAssociationBehavior:["type",Nf],dataStoreBehavior:["type",$f],deleteLaneBehavior:["type",Ff],detachEventBehavior:["type",eu],dropOnFlowBehavior:["type",Hf],eventBasedGatewayBehavior:["type",Gf],fixHoverBehavior:["type",kb],groupBehavior:["type",zf],importDockingFix:["type",Db],isHorizontalFix:["type",Wf],labelBehavior:["type",qf],layoutConnectionBehavior:["type",Yf],messageFlowBehavior:["type",Zf],nonInterruptingBehavior:["type",Jf],removeElementBehavior:["type",eh],removeEmbeddedLabelBoundsBehavior:["type",Qf],removeParticipantBehavior:["type",th],replaceConnectionBehavior:["type",nh],replaceElementBehaviour:["type",su],resizeBehavior:["type",nw],resizeLaneBehavior:["type",cw],rootElementReferenceBehavior:["type",ah],spaceToolBehavior:["type",uw],subProcessPlaneBehavior:["type",No],subProcessStartEventBehavior:["type",ch],textAnnotationBehavior:["type",lh],toggleCollapseConnectionBehaviour:["type",uh],toggleElementCollapseBehaviour:["type",dh],unclaimIdBehavior:["type",fh],unsetDefaultFlowBehavior:["type",hh],updateFlowNodeRefsBehavior:["type",gh],updateCategoryValueRefsBehavior:["type",mh],setCompensationActivityAfterPasteBehavior:["type",yh]};function vh(e){this._commandStack=e.get("commandStack",!1)}vh.$inject=["injector"],vh.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const go={__init__:["rules"],rules:["type",vh]};function ki(e){we.call(this,e),this.init()}ki.$inject=["eventBus"],je(ki,we),ki.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)})},ki.prototype.init=function(){};function ww(e,t){var n=$n(e,t,-15);return n!=="intersect"?n:null}function jn(e){ki.call(this,e)}je(jn,ki),jn.$inject=["eventBus"],jn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return lL(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 fu(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return fu(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 Lw(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return $t(i)&&!hu(t,i)?!1:Ko(t,function(o){return $t(o)?fu(o.source,o.target,o):o.host?nc(o,o.host,null,n):_h(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 Aw(a)&&!n.includes(a.host)})?!1:nc(n,t,null,i)||Ow(n,t,i)||Dw(n,t)||hu(n,t)}),this.addRule("shape.create",function(e){return _h(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return nc(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Fw(n,t)})},jn.prototype.canConnectMessageFlow=Nw,jn.prototype.canConnectSequenceFlow=$w,jn.prototype.canConnectDataAssociation=Eh,jn.prototype.canConnectAssociation=Iw,jn.prototype.canConnectCompensationAssociation=Bw,jn.prototype.canMove=Dw,jn.prototype.canAttach=nc,jn.prototype.canReplace=Ow,jn.prototype.canDrop=Ua,jn.prototype.canInsert=hu,jn.prototype.canCreate=_h,jn.prototype.canConnect=fu,jn.prototype.canResize=Lw,jn.prototype.canCopy=Fw;function lL(e){return xh(e)?null:ht(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function xh(e){return!e||ft(e)}function _w(e){do{if(T(e,"bpmn:Process"))return Ee(e);if(T(e,"bpmn:Participant"))return Ee(e).processRef||Ee(e)}while(e=e.parent)}function bh(e){return T(e,"bpmn:TextAnnotation")}function wh(e){return T(e,"bpmn:Group")&&!e.labelTarget}function Ew(e){return T(e,"bpmn:BoundaryEvent")&&mo(e,"bpmn:CompensateEventDefinition")}function du(e){return Ee(e).isForCompensation}function uL(e,t){var n=_w(e),i=_w(t);return n===i}function pL(e){return T(e,"bpmn:InteractionNode")&&!T(e,"bpmn:BoundaryEvent")&&(!T(e,"bpmn:Event")||T(e,"bpmn:ThrowEvent")&&Mw(e,"bpmn:MessageEventDefinition"))}function dL(e){return T(e,"bpmn:InteractionNode")&&!du(e)&&(!T(e,"bpmn:Event")||T(e,"bpmn:CatchEvent")&&Mw(e,"bpmn:MessageEventDefinition"))&&!(T(e,"bpmn:BoundaryEvent")&&!mo(e,"bpmn:MessageEventDefinition"))}function Sw(e){for(var t=e;t=t.parent;){if(T(t,"bpmn:FlowElementsContainer"))return Ee(t);if(T(t,"bpmn:Participant"))return Ee(t).processRef}return null}function Rw(e,t){var n=Sw(e),i=Sw(t);return n===i}function mo(e,t){var n=Ee(e);return!!Ht(n.eventDefinitions||[],function(i){return T(i,t)})}function Mw(e,t){var n=Ee(e);return(n.eventDefinitions||[]).every(function(i){return T(i,t)})}function fL(e){return T(e,"bpmn:FlowNode")&&!T(e,"bpmn:EndEvent")&&!Kn(e)&&!(T(e,"bpmn:IntermediateThrowEvent")&&mo(e,"bpmn:LinkEventDefinition"))&&!Ew(e)&&!du(e)}function hL(e){return T(e,"bpmn:FlowNode")&&!T(e,"bpmn:StartEvent")&&!T(e,"bpmn:BoundaryEvent")&&!Kn(e)&&!(T(e,"bpmn:IntermediateCatchEvent")&&mo(e,"bpmn:LinkEventDefinition"))&&!du(e)}function gL(e){return T(e,"bpmn:ReceiveTask")||T(e,"bpmn:IntermediateCatchEvent")&&(mo(e,"bpmn:MessageEventDefinition")||mo(e,"bpmn:TimerEventDefinition")||mo(e,"bpmn:ConditionalEventDefinition")||mo(e,"bpmn:SignalEventDefinition"))}function mL(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Cw(e,t){var n=mL(t);return n.indexOf(e)!==-1}function fu(e,t,n){if(xh(e)||xh(t))return null;if(!T(n,"bpmn:DataAssociation")){if(Nw(e,t))return{type:"bpmn:MessageFlow"};if($w(e,t))return{type:"bpmn:SequenceFlow"}}var i=Eh(e,t);return i||(Bw(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Iw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ua(e,t){return ft(e)||wh(e)?!0:T(t,"bpmn:Participant")&&!xt(t)?!1:T(e,"bpmn:Participant")?T(t,"bpmn:Process")||T(t,"bpmn:Collaboration"):ht(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:T(e,"bpmn:Lane")?T(t,"bpmn:Participant")||T(t,"bpmn:Lane"):T(e,"bpmn:BoundaryEvent")&&!yL(e)?!1:T(e,"bpmn:FlowElement")&&!T(e,"bpmn:DataStoreReference")?T(t,"bpmn:FlowElementsContainer")?xt(t):ht(t,["bpmn:Participant","bpmn:Lane"]):T(e,"bpmn:DataStoreReference")&&T(t,"bpmn:Collaboration")?Xo(Ee(t).get("participants"),function(n){return!!n.get("processRef")}):ht(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ht(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):T(e,"bpmn:MessageFlow")?T(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function yL(e){return Ee(e).cancelActivity&&(Tw(e)||Pw(e))}function Aw(e){return!ft(e)&&T(e,"bpmn:BoundaryEvent")}function vL(e){return T(e,"bpmn:Lane")}function xL(e){return Aw(e)||T(e,"bpmn:IntermediateThrowEvent")&&Tw(e)?!0:T(e,"bpmn:IntermediateCatchEvent")&&Pw(e)}function Tw(e){var t=Ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Pw(e){return kw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function kw(e,t){return t.some(function(n){return mo(e,n)})}function bL(e){return T(e,"bpmn:ReceiveTask")&&Ht(e.incoming,function(t){return T(t.source,"bpmn:EventBasedGateway")})}function nc(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return ft(o)||!xL(o)||Kn(t)||!T(t,"bpmn:Activity")||du(t)||i&&!ww(i,t)||bL(t)?!1:"attach"}function Ow(e,t,n){if(!t)return!1;var i={replacements:[]};return K(e,function(o){Kn(t)||T(o,"bpmn:StartEvent")&&o.type!=="label"&&Ua(o,t)&&(P2(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(k2(o)||O2(o)||D2(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),kw(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&T(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),T(t,"bpmn:Transaction")||mo(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(T(o,"bpmn:EndEvent")&&Ua(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),T(o,"bpmn:BoundaryEvent")&&nc(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Dw(e,t){return Xo(e,vL)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ua(n,t)})}function _h(e,t,n,i){return t?ft(e)||wh(e)?!0:Ua(e,t)||hu(e,t):!1}function Lw(e,t,n){return T(e,"bpmn:SubProcess")?xt(e)&&(!t||t.width>=100&&t.height>=80):T(e,"bpmn:Lane")||T(e,"bpmn:Participant")?!0:bh(e)?n?n==="e"||n==="w":!0:wh(e)?!0:ft(e)?n?n==="e"||n==="w":!0:!1}function wL(e,t){var n=bh(e),i=bh(t);return(n||i)&&n!==i}function Iw(e,t){return Cw(t,e)||Cw(e,t)?!1:wL(e,t)?!0:!!Eh(e,t)}function Bw(e,t){return Rw(e,t)&&Ew(e)&&T(t,"bpmn:Activity")&&!EL(t,e)&&!Kn(t)}function Nw(e,t){return Hw(e)&&!Hw(t)?!1:pL(e)&&dL(t)&&!uL(e,t)}function $w(e,t){return fL(e)&&hL(t)&&Rw(e,t)&&!(T(e,"bpmn:EventBasedGateway")&&!gL(t))}function Eh(e,t){return ht(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ht(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ht(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ht(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function hu(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:ht(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ft(t)&&T(e,"bpmn:FlowNode")&&!T(e,"bpmn:BoundaryEvent")&&Ua(e,t.parent)}function Sh(e,t){return e&&t&&e.indexOf(t)!==-1}function Fw(e,t){return ft(t)?!0:!(T(t,"bpmn:Lane")&&!Sh(e,t.parent)||T(t,"bpmn:MessageFlow")&&!_L(e,t))}function _L(e,t){var n=jw(t.source),i=jw(t.target);return Sh(e,n)&&Sh(e,i)}function jw(e){for(;e;e=e.parent)if(T(e,"bpmn:Participant"))return e;return null}function Hw(e){return Fa(e,"bpmn:Process")||Fa(e,"bpmn:Collaboration")}function EL(e,t){return e.attachers.includes(t)}const SL={__depends__:[go],__init__:["bpmnRules"],bpmnRules:["type",jn]};var RL=2e3;function Gw(e,t){e.on("saveXML.start",RL,n);function n(){var i=t.getRootElements();K(i,function(o){var r=wt(o),a,s;a=Fs([o]),a=gt(a,function(c){return c!==o&&!c.labelTarget}),s=Wn(a,wt),r.set("planeElement",s)})}}Gw.$inject=["eventBus","canvas"];const ML={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Gw]};function gu(e){we.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)})}gu.prototype.getOrdering=function(e,t){return null},je(gu,we);function Rh(e,t){gu.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=Ht(n,function(c){return ht(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&&!ht(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||T(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=Lm(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}}}Rh.$inject=["eventBus","canvas"],je(Rh,gu);const CL={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Rh]};function ic(){}ic.prototype.get=function(){return this._data},ic.prototype.set=function(e){this._data=e},ic.prototype.clear=function(){var e=this._data;return delete this._data,e},ic.prototype.isEmpty=function(){return!this._data};const AL={clipboard:["type",ic]};var zw=1500;function Vw(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",zw,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",zw,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=Jr(a),c=document.elementFromPoint(s.x,s.y),TL(c)}}Vw.$inject=["elementRegistry","eventBus","injector"];function TL(e){return Ur(e,"svg, .djs-element",!0)}const PL={__init__:["hoverFix"],hoverFix:["type",Vw]};function kL(e){return!0}function mu(e){return yr(e)||BD(e)}var Ww=500;function Uw(e,t,n){var i=this;function o(A,L,H){if(!s(A,L)){var V,G,ie;H?G=t.getGraphics(H):(V=L.delegateTarget||L.target,V&&(G=V,H=t.get(G))),!(!G||!H)&&(ie=e.fire(A,{element:H,gfx:G,originalEvent:L}),ie===!1&&(L.stopPropagation(),L.preventDefault()))}}var r={};function a(A){return r[A]}function s(A,L){var H=l[A]||yr;return!H(L)}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":kL,"element.mousedown":mu,"element.mouseup":mu,"element.click":mu,"element.dblclick":mu};function u(A,L,H){var V=c[A];if(!V)throw new Error("unmapped DOM event name <"+A+">");return o(V,L,H)}var p="svg, .djs-element";function d(A,L,H,V){var G=r[H]=function(ie){o(H,ie)};V&&(l[H]=V),G.$delegate=ci.bind(A,p,L,G)}function f(A,L,H){var V=a(H);V&&ci.unbind(A,L,V.$delegate)}function y(A){K(c,function(L,H){d(A,H,L)})}function h(A){K(c,function(L,H){f(A,H,L)})}e.on("canvas.destroy",function(A){h(A.svg)}),e.on("canvas.init",function(A){y(A.svg)}),e.on(["shape.added","connection.added"],function(A){var L=A.element,H=A.gfx;e.fire("interactionEvents.createHit",{element:L,gfx:H})}),e.on(["shape.changed","connection.changed"],Ww,function(A){var L=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:L,gfx:H})}),e.on("interactionEvents.createHit",Ww,function(A){var L=A.element,H=A.gfx;i.createDefaultHit(L,H)}),e.on("interactionEvents.updateHit",function(A){var L=A.element,H=A.gfx;i.updateDefaultHit(L,H)});var m=E("djs-hit djs-hit-stroke"),w=E("djs-hit djs-hit-click-stroke"),g=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),b={all:g,"click-stroke":w,stroke:m,"no-move":v};function E(A,L){return L=te({stroke:"white",strokeWidth:15},L||{}),n.cls(A,["no-fill","no-border"],L)}function M(A,L){var H=b[L];if(!H)throw new Error("invalid hit type <"+L+">");return Le(A,H),A}function B(A,L){ot(A,L)}this.removeHits=function(A){var L=Ls(".djs-hit",A);K(L,mn)},this.createDefaultHit=function(A,L){var H=A.waypoints,V=A.isFrame,G;return H?this.createWaypointsHit(L,H):(G=V?"stroke":"all",this.createBoxHit(L,G,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,L){var H=$s(L);return M(H,"stroke"),B(A,H),H},this.createBoxHit=function(A,L,H){H=te({x:0,y:0},H);var V=We("rect");return M(V,L),Le(V,H),B(A,V),V},this.updateDefaultHit=function(A,L){var H=kt(".djs-hit",L);if(H)return A.waypoints?uf(H,A.waypoints):Le(H,{width:A.width,height:A.height}),H},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}Uw.$inject=["eventBus","elementRegistry","styles"];const yu={__init__:["interactionEvents"],interactionEvents:["type",Uw]};function qa(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)})}qa.$inject=["eventBus","canvas"],qa.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()})}},qa.prototype.get=function(){return Array.from(this._selectedElements)},qa.prototype.isSelected=function(e){return this._selectedElements.has(e)},qa.prototype.select=function(e,t){var n=this.get();et(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?K(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var qw="hover",Yw="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,qw)}),t.on("element.out",function(o){i(o.element,qw)}),t.on("selection.changed",function(o){function r(l){i(l,Yw)}function a(l){n(l,Yw)}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 Xw(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;et(l)?t.select(l):t.select(s.filter(OL))}}),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=Ht(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(yr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=uu(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Xw.$inject=["eventBus","selection","canvas","elementRegistry"];function OL(e){return!e.hidden}const Oi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[yu],selection:["type",qa],selectionVisuals:["type",Kw],selectionBehavior:["type",Xw]};var DL=/^djs-cursor-.*$/;function vu(e){var t=Dt(document.body);t.removeMatching(DL),e&&t.add("djs-cursor-"+e)}function Zw(){vu(null)}var LL=5e3;function Jw(e,t){t=t||"element.click";function n(){return!1}return e.once(t,LL,n),function(){e.off(t,n)}}var IL=["c","C"],BL=["v","V"],NL=["d","D"],$L=["x","X"],FL=["y","Y"],Qw=["z","Z"];function jL(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function pi(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Mn(e,t){return e=et(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Mh(e){return e.shiftKey}function HL(e){return pi(e)&&Mn(IL,e)}function GL(e){return pi(e)&&Mn(BL,e)}function zL(e){return pi(e)&&Mn(NL,e)}function VL(e){return pi(e)&&Mn($L,e)}function WL(e){return pi(e)&&!Mh(e)&&Mn(Qw,e)}function UL(e){return pi(e)&&(Mn(FL,e)||Mn(Qw,e)&&Mh(e))}var Ya=Math.round,e_="djs-drag-active";function ea(e){e.preventDefault()}function qL(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function YL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function t_(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(te({},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,A=Jr(v),L=Ji(A,B),H=r.localStart,V=a(A),G=Ji(V,H);if(!r.active&&(b||YL(L)>r.threshold)){if(te(E,{x:Ya(H.x+M.x),y:Ya(H.y+M.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&vu(r.cursor),t.addMarker(t.getRootElement(),e_)}rh(v),r.active&&(te(E,{x:Ya(V.x+M.x),y:Ya(V.y+M.y),dx:Ya(G.x),dy:Ya(G.y)},{originalEvent:v}),s("move"))}function u(v){var b,E=!0;r.active&&(v&&(r.payload.originalEvent=v,rh(v)),E=s("end")),E===!1&&s("rejected"),b=w(E!==!0),s("ended",b)}function p(v){Mn("Escape",v)&&(ea(v),m())}function d(v){var b;r.active&&(b=Jw(e),setTimeout(b,400),ea(v)),u(v)}function f(v){l(v)}function y(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function h(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function m(v){var b;if(r){var E=r.active;E&&s("cancel"),b=w(v),E&&s("canceled",b)}}function w(v){var b,E;s("cleanup"),Zw(),r.trapClick?E=d:E=u,Ke.unbind(document,"mousemove",l),Ke.unbind(document,"dragstart",ea),Ke.unbind(document,"selectstart",ea),Ke.unbind(document,"mousedown",E,!0),Ke.unbind(document,"mouseup",E,!0),Ke.unbind(document,"keyup",p),Ke.unbind(document,"touchstart",f,!0),Ke.unbind(document,"touchcancel",m,!0),Ke.unbind(document,"touchmove",l,!0),Ke.unbind(document,"touchend",u,!0),e.off("element.hover",y),e.off("element.out",h),t.removeMarker(t.getRootElement(),e_);var M=r.payload.previousSelection;return v!==!1&&M&&!n.get().length&&c(M),b=r,r=null,b}function g(v,b,E,M){r&&m(!1),typeof b=="string"&&(M=E,E=b,b=null),M=te({},o,M||{});var B=M.data||{},A,L,H,V,G;if(M.trapClick?V=d:V=u,v?(A=Wa(v)||v,L=Jr(v),rh(v),A.type==="dragstart"&&ea(A)):(A=null,L={x:0,y:0}),H=a(L),b||(b=H),G=qL(A),r=te({prefix:E,data:B,payload:{},globalStart:L,displacement:Ji(b,H),localStart:H,isTouch:G},M),M.manual||(G?(Ke.bind(document,"touchstart",f,!0),Ke.bind(document,"touchcancel",m,!0),Ke.bind(document,"touchmove",l,!0),Ke.bind(document,"touchend",u,!0)):(Ke.bind(document,"mousemove",l),Ke.bind(document,"dragstart",ea),Ke.bind(document,"selectstart",ea),Ke.bind(document,"mousedown",V,!0),Ke.bind(document,"mouseup",V,!0)),Ke.bind(document,"keyup",p),e.on("element.hover",y),e.on("element.out",h)),s("init")===!1)return m(),!1;M.autoActivate&&l(v,!0)}e.on("diagram.destroy",m),this.init=g,this.move=l,this.hover=y,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(v){te(o,v)}}t_.$inject=["eventBus","canvas","selection","elementRegistry"];const $o={__depends__:[PL,Oi],dragging:["type",t_]};function ta(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ta.prototype.next=function(){return this._prefix+ ++this._counter};const KL=new ta("ps");var XL=["marker-start","marker-mid","marker-end"],ZL=["circle","ellipse","line","path","polygon","polyline","path","rect"];function vr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}vr.$inject=["elementRegistry","eventBus","canvas","styles"],vr.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")},vr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},vr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=tf(n);return this._cloneMarkers(dr(o),i),Le(o,this._styles.cls(i,[])),ot(t,o),Le(o,"data-preview-support-element-id",e.id),o},vr.prototype.addFrame=function(e,t){var n=We("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ot(t,n),Le(n,"data-preview-support-element-id",e.id),n},vr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),tI(e)&&XL.forEach(function(o){if(Le(e,o)){var r=JL(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},vr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,KL.next()].join("-"),a=kt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||tf(n);s.id=r,vt(s).add(o);var c=kt(":scope > defs",e);c||(c=We("defs"),ot(e,c)),ot(c,s);var l=eI(s.id);Le(t,i,l)};function JL(e,t,n){var i=QL(Le(e,t));return kt("marker#"+i,n||document)}function QL(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function eI(e){return"url(#"+e+")"}function tI(e){return ZL.indexOf(e.nodeName)!==-1}const Ka={__init__:["previewSupport"],previewSupport:["type",vr]};var nI="drop-ok",n_="drop-not-ok",i_="attach-ok",o_="new-parent",r_="create",iI=2e3;function a_(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=gt(c,function(g){var v=g.labelTarget;return!g.parent&&!(ft(g)&&c.indexOf(v)!==-1)});var f=Ht(c,function(g){return!$t(g)}),y=!1,h=!1,m=!1;c_(c)&&(y=o.allowed("shape.attach",{position:u,shape:f,target:l})),y||(c_(c)?m=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var w=d.connectionTarget;return m||y?(f&&p&&(h=o.allowed("connection.create",{source:w===p?f:p,target:w===p?p:f,hints:{targetParent:l,targetAttach:y}})),{attach:y,connect:h}):m===null||y===null?null:!1}function a(c,l){[i_,nI,n_,o_].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}s_(c);var y={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,y,d,f);p&&h!==null&&(l.target=p,h&&h.attach?a(p,i_):a(p,h?o_:n_))}),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,y=l.canExecute,h=y&&y.attach,m=y&&y.connect,w=l.hints||{};if(y===!1||!f)return!1;s_(c);var g={x:c.x,y:c.y};m?p=i.appendShape(u,p,g,f,{attach:h,connection:m===!0?{}:m,connectionTarget:w.connectionTarget}):(d=i.createElements(d,g,f,te({},w,{attach:h})),p=Ht(d,function(v){return!$t(v)})),te(l,{elements:d,shape:p}),te(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===r_&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],iI,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){et(l)||(l=[l]);var p=Ht(l,function(y){return!$t(y)});if(p){u=te({elements:l,hints:{},shape:p},u||{}),K(l,function(y){tt(y.x)||(y.x=0),tt(y.y)||(y.y=0)});var d=gt(l,function(y){return!y.hidden}),f=yn(d);K(l,function(y){$t(y)&&(y.waypoints=Wn(y.waypoints,function(h){return{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2}})),te(y,{x:y.x-f.x-f.width/2,y:y.y-f.y-f.height/2})}),t.init(c,r_,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}a_.$inject=["canvas","dragging","eventBus","modeling","rules"];function s_(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 c_(e){return e&&e.length===1&&!$t(e[0])}var oI=750;function l_(e,t,n,i,o){function r(a){var s=We("g");Le(s,o.cls("djs-drag-group",["no-events"]));var c=We("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(dr(u),l)):(u=n._createContainer("shape",c),n.drawShape(dr(u),l),Fn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",oI,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(),ot(p,u)),Fn(u,a.x,a.y)):mn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&mn(c)})}l_.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const xu={__depends__:[$o,Ka,go,Oi],__init__:["create","createPreview"],create:["type",a_],createPreview:["type",l_]};function Ch(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)})}Ch.$inject=["eventBus"],Ch.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||rI(0,0)};function rI(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 oc={__init__:["mouse"],mouse:["type",Ch]};var u_=2e3;function di(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),aI(u)&&(l.priority=2,l.host=u.host.id),$t(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=sI(u)),ft(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),K(["x","y","width","height"],function(d){tt(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",u_,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",u_,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;te(l,{createElementsBehavior:!1})})}di.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],di.prototype.copy=function(e,t={}){var n,i;return et(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(et(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},di.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})}}},di.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},di.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},di.prototype._getElementIdsFromTree=function(e){var t={};return K(e,function(n){K(n,function(i){i.id&&(t[i.id]=!0)})}),t},di.prototype._paste=function(e,t,n,i){K(e,function(r){tt(r.x)||(r.x=0),tt(r.y)||(r.y=0)});var o=yn(e);return K(e,function(r){$t(r)&&(r.waypoints=Wn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),te(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,te({},i))},di.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return K(e,function(r,a){r=no(r,"priority"),K(r,function(s){var c=te({},io(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if($t(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(ft(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},di.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(io(e,["id"]));return t},di.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(io(e,["id"]));return t},di.prototype.createShape=function(e){var t=this._elementFactory.createShape(io(e,["id"]));return t},di.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!($t(e)&&(!n.has(e.source)||!n.has(e.target))||ft(e)&&!n.has(e.labelTarget))},di.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=kl(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 y={element:p,depth:d};o.push(y),r.set(p,y);return}if(f.depth<d){o=l(f,o);var h={element:f.element,depth:d};o.push(h),r.set(p,h)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}Yr(a,function(p,d,f){if(ft(p))return;K(p.labels,function(m){c(m,f)});function y(m){m&&m.length&&K(m,function(w){K(w.labels,function(g){c(g,f)}),c(w,f)})}K([p.attachers,p.incoming,p.outgoing],y),c(p,f);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Wn(o,function(p){return p.element});var u=new Set(e);return o=Wn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=no(o,function(p){return p.descriptor.priority}),e=Wn(o,function(p){return p.element}),K(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){d_(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){d_(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function aI(e){return!!e.host}function sI(e){return Wn(e.waypoints,function(t){return t=p_(t),t.original&&(t.original=p_(t.original)),t})}function p_(e){return te({},e)}function d_(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const cI={__depends__:[AL,xu,oc,go],__init__:["copyPaste"],copyPaste:["type",di]};function Ah(e,t,n){et(n)||(n=[n]),K(n,function(i){Fr(e[i])||(t[i]=e[i])})}var Th=750;function f_(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Th,function(c){var l=c.descriptor,u=c.element,p=Ee(u);if(ft(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(wt(u),!0);f.bpmnElement=d,Ah(d,l,"name"),Ah(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=Ee(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(Ee(c).attachedToRef=Ee(l[c.host])),io(u,si(u,function(d,f,y){var h=f.element,m=f.property;return y===c.id&&(h.set(m,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(ft(u)){u.businessObject=Ee(l[u.labelTarget]),u.di=wt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,Ah(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Th,function(c){var l=c.descriptor,u=c.element;if(T(u,"bpmn:Participant")){var p=Ee(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;T(l,"bpmn:SubProcess")&&K(Ws(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Th,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}f_.$inject=["bpmnFactory","eventBus","moddleCopy"];const lI=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],uI=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function rc(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 no(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=Sn(o)&&o.$descriptor;if(a&&uI.includes(a))return r;if(a&&lI.includes(a)||a&&s&&!Ht(s.properties,wa({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(T(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}rc.$inject=["eventBus","bpmnFactory","moddle"],rc.prototype.copyElement=function(e,t,n,i=!1){n&&!et(n)&&(n=[n]),n=n||Ph(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(et(o)&&(n=o),K(n,r=>{let a;ai(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!En(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},rc.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 Sn(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):et(e)?si(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Sn(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},rc.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 Ph(e,t){return si(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const h_={__depends__:[cI],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",f_],moddleCopy:["type",rc]};var g_=Math.round;function kh(e,t){this._modeling=e,this._eventBus=t}kh.$inject=["modeling","eventBus"],kh.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=g_(s+r/2),u=g_(c+a/2),p=i.replaceShape(e,te({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function m_(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}m_.$inject=["selection","eventBus"];const pI={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",m_],replace:["type",kh]};function dI(e,t,n){et(n)||(n=[n]),K(n,function(i){Fr(e[i])||(t[i]=e[i])})}var fI=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function hI(e,t){var n=e&&ai(e,"collapsed")?e.collapsed:!xt(e),i;return t&&(ai(t,"collapsed")||ai(t,"isExpanded"))?i=ai(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function y_(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(bu(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&hI(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),dI(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var y=Ph(p.$descriptor),h=Ph(d.$descriptor,!0),m=gI(y,h);te(d,Vi(c,fI));var w=gt(m,function(b){return b==="eventDefinitions"?v_(s,c.eventDefinitionType):b==="loopCharacteristics"?!Kn(d):ai(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Kn(d):!0});if(d=n.copyElement(p,d,w),c.eventDefinitionType&&(v_(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),T(p,"bpmn:Activity")){if(bu(p))f.isExpanded=xt(s);else if(c&&ai(c,"isExpanded")){f.isExpanded=c.isExpanded;var g=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=g.width,f.height=g.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}xt(s)&&!T(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(bu(p)&&!bu(d)&&(l.moveChildren=!1),T(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=Tn(s);wt(s).isHorizontal||(wt(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,ht(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ht(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!T(p,"bpmn:BoundaryEvent")&&T(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}y_.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function bu(e){return T(e,"bpmn:SubProcess")}function v_(e,t){var n=Ee(e);return t&&n.get("eventDefinitions").some(function(i){return T(i,t)})}function gI(e,t){return e.filter(function(n){return t.includes(n)})}const x_={__depends__:[h_,pI,Oi],bpmnReplace:["type",y_]};var mI=250;function na(e){this._eventBus=e,this._tools=[],this._active=null}na.$inject=["eventBus"],na.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)},na.prototype.isActive=function(e){return e&&this._active===e},na.prototype.length=function(e){return this._tools.length},na.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},na.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),K(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,mI,function(o){this._active&&(yI(o)||this.setActive(null))},this)};function yI(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Ur(t,'.group[data-group="tools"]')}const wu={__depends__:[$o],__init__:["toolManager"],toolManager:["type",na]};function vI(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 xI(e,t){var n=[],i=new Set(e);K(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;K(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 bI(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 Oh=Math.abs,wI=Math.round,Fo={x:"width",y:"height"},b_="crosshair",xr={n:"top",w:"left",s:"bottom",e:"right"},_I=1500,_u={n:"s",w:"e",s:"n",e:"w"},Eu=20;function Di(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",_I,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&__(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,y=l.start;if(l.initialized){__(c);var h={x:0,y:0};h[u]=wI(c["d"+u]),s.makeSpace(d,f,h,p,y),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Di.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Di.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:b_,data:{context:{reactivate:n}},trapClick:!1})},Di.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:b_,data:{context:{}}})},Di.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Di.prototype.init=function(e,t){var n=Oh(e.dx)>Oh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Oh(i)<5)return!1;i<0&&(i*=-1),tc(e)&&(i*=-1);var r=vI(n,i),a=this._canvas.getRootElement();!uu(e)&&e.hover&&(a=e.hover);var s=[...Fs(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=EI(c,n,r,o,l);return te(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),vu("resize-"+(n==="x"?"ew":"ns")),!0},Di.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 y=f.label;y&&!s.has(y)&&(s.add(y),r.push(y))}function d(f){c.has(f)||(c.add(f),a.push(f))}return K(e,function(f){if(!(!f.parent||ft(f))){if($t(f)){u.push(f);return}var y=f[t],h=y+f[Fo[t]];if(SI(f)&&(n>0&&nt(f)[t]>i||n<0&&nt(f)[t]<i)){l.push(f);return}if(n>0&&y>i||n<0&&h<i){p(f);return}if(y<i&&h>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),K(r,function(f){var y=f.attachers;y&&K(y,function(h){p(h)})}),K(l,function(f){var y=f.host;(s.has(y)||c.has(y))&&p(f)}),K(u,function(f){var y=f.source,h=f.target,m=f.label;(s.has(y)||c.has(y))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:r,resizingShapes:a}},Di.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Di.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function w_(e){return{top:e.top-Eu,right:e.right+Eu,bottom:e.bottom+Eu,left:e.left-Eu}}function __(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;tt(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),tt(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),tt(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),tt(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function EI(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 K(a,function(d){var f=d.attachers,y=d.children,h=Ze(d),m=gt(y,function(G){return!$t(G)&&!ft(G)&&!u.has(G)&&!p.has(G)}),w=gt(y,function(G){return!$t(G)&&!ft(G)&&u.has(G)}),g,v,b,E=[],M=[],B,A,L,H;m.length&&(v=w_(Ze(yn(m))),g=i-h[xr[n]]+v[xr[n]],n==="n"?s.bottom=l=tt(l)?Math.min(l,g):g:n==="w"?s.right=l=tt(l)?Math.min(l,g):g:n==="s"?s.top=c=tt(c)?Math.max(c,g):g:n==="e"&&(s.left=c=tt(c)?Math.max(c,g):g)),w.length&&(b=w_(Ze(yn(w))),g=i-b[xr[_u[n]]]+h[xr[_u[n]]],n==="n"?s.bottom=l=tt(l)?Math.min(l,g):g:n==="w"?s.right=l=tt(l)?Math.min(l,g):g:n==="s"?s.top=c=tt(c)?Math.max(c,g):g:n==="e"&&(s.left=c=tt(c)?Math.max(c,g):g)),f&&f.length&&(f.forEach(function(G){u.has(G)?E.push(G):M.push(G)}),E.length&&(B=Ze(yn(E.map(nt))),A=h[xr[_u[n]]]-(B[xr[_u[n]]]-i)),M.length&&(L=Ze(yn(M.map(nt))),H=L[xr[n]]-(h[xr[n]]-i)),n==="n"?(g=Math.min(A||1/0,H||1/0),s.bottom=l=tt(l)?Math.min(l,g):g):n==="w"?(g=Math.min(A||1/0,H||1/0),s.right=l=tt(l)?Math.min(l,g):g):n==="s"?(g=Math.max(A||-1/0,H||-1/0),s.top=c=tt(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(A||-1/0,H||-1/0),s.left=c=tt(c)?Math.max(c,g):g));var V=o&&o[d.id];V&&(n==="n"?(g=i+d[Fo[t]]-V[Fo[t]],s.bottom=l=tt(l)?Math.min(l,g):g):n==="w"?(g=i+d[Fo[t]]-V[Fo[t]],s.right=l=tt(l)?Math.min(l,g):g):n==="s"?(g=i-d[Fo[t]]+V[Fo[t]],s.top=c=tt(c)?Math.max(c,g):g):n==="e"&&(g=i-d[Fo[t]]+V[Fo[t]],s.left=c=tt(c)?Math.max(c,g):g))}),s}}function SI(e){return!!e.host}var Dh="djs-dragging",E_="djs-resizing",RI=250,Su=Math.max;function S_(e,t,n,i,o){function r(a,s){K(a,function(c){o.addDragger(c,s),n.addMarker(c,Dh)})}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=We("g");Le(u,i.cls("djs-crosshair-group",["no-events"])),ot(s,u);var p=We("path");Le(p,"d",l.x),vt(p).add("djs-crosshair"),ot(u,p);var d=We("path");Le(d,"d",l.y),vt(d).add("djs-crosshair"),ot(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Fn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&mn(c)}),e.on("spaceTool.move",RI,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=We("path"),Le(c,"d","M0,0 L0,0"),vt(c).add("djs-crosshair"),ot(d,c),s.line=c;var f=We("g");Le(f,i.cls("djs-drag-group",["no-events"])),ot(n.getActiveLayer(),f),r(u,f);var y=new Set(u);K(p,function(M){y.add(M)});var h=new Set,m=s.movingConnections=[];y.forEach(function(M){K(M.outgoing,function(B){h.has(B)||!$t(B)||!y.has(B.target)||(h.add(B),m.push(B))})}),r(m,f),s.dragGroup=f}if(!s.frameGroup){var w=We("g");Le(w,i.cls("djs-frame-group",["no-events"])),ot(n.getActiveLayer(),w);var g=[];K(p,function(M){var B=o.addFrame(M,w),A=B.getBBox();g.push({element:B,initialBounds:A}),n.addMarker(M,E_)}),s.frameGroup=w,s.frames=g}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,Fn(s.dragGroup,E.x,E.y),K(s.frames,function(M){var B=M.element,A=M.initialBounds,L,H;s.direction==="e"?Le(B,{width:Su(A.width+E.x,5)}):(L=Su(A.width-E.x,5),Le(B,{width:L,x:A.x+A.width-L})),s.direction==="s"?Le(B,{height:Su(A.height+E.y,5)}):(H=Su(A.height-E.y,5),Le(B,{height:H,y:A.y+A.height-H}))})}}),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;K(c,function(y){n.removeMarker(y,Dh)}),K(l,function(y){n.removeMarker(y,Dh)}),d&&(mn(p),mn(d)),K(u,function(y){n.removeMarker(y,E_)}),f&&mn(f)})}S_.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const MI={__init__:["spaceToolPreview"],__depends__:[$o,go,wu,Ka,oc],spaceTool:["type",Di],spaceToolPreview:["type",S_]};function Ru(e,t){e.invoke(Di,this),this._canvas=t}Ru.$inject=["injector","canvas"],je(Ru,Di),Ru.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=xa(Da(o.children.filter(l=>T(l,"bpmn:Artifact")),yn(r))));const s=[...e,...a];var c=Di.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(T(l,"bpmn:TextAnnotation")||CI(l)&&(t==="y"&&Tn(l)||t==="x"&&!Tn(l)))}),c};function CI(e){return T(e,"bpmn:Participant")&&!Ee(e).processRef}const R_={__depends__:[MI],spaceTool:["type",Ru]};function Zt(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)}Zt.$inject=["eventBus","injector"],Zt.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()},Zt.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},Zt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Zt.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()}},Zt.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()}},Zt.prototype.register=function(e,t){this._setHandler(e,t)},Zt.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)},Zt.prototype.canUndo=function(){return!!this._getUndoAction()},Zt.prototype.canRedo=function(){return!!this._getRedoAction()},Zt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Zt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Zt.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)})},Zt.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},Zt.prototype._createId=function(){return this._uid++},Zt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Zt.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()},Zt.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)},Zt.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:Im("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Zt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=et(e)?e:[e],t.dirty=t.dirty.concat(e))},Zt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Zt.prototype._revertedAction=function(e){this._stackIdx--},Zt.prototype._getHandler=function(e){return this._handlerMap[e]},Zt.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 AI={commandStack:["type",Zt]};function br(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 TI=250,M_=1400;function Lh(e,t,n){we.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",M_,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=C_(a),r.validatedShapes=C_(s)}),i&&t.on("shape.move.start",TI,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",M_,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];K(s,function(l){K(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;br(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=df(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&&(un(s.labels,a,c),a.labelTarget=s)})}je(Lh,we),Lh.$inject=["injector","eventBus","modeling"];function C_(e){var t=new Set(e);return gt(e,function(n){return!t.has(n.labelTarget)})}const PI={__init__:["labelSupport"],labelSupport:["type",Lh]};var kI=251,A_=1401,T_="attach-ok";function Ih(e,t,n,i,o){we.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",A_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=OI(c),s.validatedShapes=DI(l)}),r&&t.on("shape.move.start",kI,function(a){var s=a.context,c=s.shapes,l=Bh(c);K(l,function(u){r.makeDraggable(s,u,!0),K(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,T_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,T_)}))}}),this.preExecuted("elements.move",A_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Bh(l);K(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=gt(c,function(p){var d=p.host;return LI(p)&&!II(c,d)}),K(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;K(s,function(c){K(c.attachers,function(l){K(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),K(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;br(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&&K(l.attachers,function(u){var p=qb(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&&K(p,function(f){var y=qb(f,l,u);o.moveShape(f,y,f.parent),K(f.labels,function(h){o.moveShape(h,y,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;br(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}je(Ih,we),Ih.$inject=["injector","eventBus","canvas","rules","modeling"];function Bh(e){return qp(Wn(e,function(t){return t.attachers||[]}))}function OI(e){var t=Bh(e);return QR("id",e,t)}function DI(e){var t=ba(e,"id");return gt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function LI(e){return!!e.host}function II(e,t){return e.indexOf(t)!==-1}const BI={__depends__:[go],__init__:["attachSupport"],attachSupport:["type",Ih]};function P_(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(wx(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)})}P_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Nh={__init__:["changeSupport"],changeSupport:["type",P_]};function Li(e){this._model=e}Li.$inject=["moddle"],Li.prototype._needsId=function(e){return ht(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"])},Li.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;T(e,"bpmn:Activity")?t="Activity":T(e,"bpmn:Event")?t="Event":T(e,"bpmn:Gateway")?t="Gateway":ht(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))},Li.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Li.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Li.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",te({bpmnElement:e,bounds:this.createDiBounds()},t))},Li.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Li.prototype.createDiWaypoints=function(e){var t=this;return Wn(e,function(n){return t.createDiWaypoint(n)})},Li.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Vi(e,["x","y"]))},Li.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",te({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Li.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",te({bpmnElement:e},t))};function fi(e,t,n){we.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var y=f.context,h=y.hints||{},m;!y.cropped&&h.createElementsBehavior!==!1&&(m=y.connection,m.waypoints=n.getCroppedWaypoints(m),y.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var y=f.context;i.updateParent(y.shape||y.connection,y.oldParent)}function a(f){var y=f.context,h=y.shape||y.connection,m=y.parent||y.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],hi(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],hi(a));function s(f){var y=f.context,h=y.oldRoot,m=h.children;K(m,function(w){T(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var y=f.context.shape;T(y,"bpmn:BaseElement")&&i.updateBounds(y)}this.executed(["shape.move","shape.create","shape.resize"],hi(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],hi(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"],hi(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],hi(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],hi(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],hi(u)),this.executed("connection.reconnect",hi(function(f){var y=f.context,h=y.connection,m=y.oldSource,w=y.newSource,g=Ee(h),v=Ee(m),b=Ee(w);g.conditionExpression&&!ht(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(y.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),m!==w&&v.default===g&&(y.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",hi(function(f){var y=f.context,h=y.connection,m=y.oldSource,w=y.newSource,g=Ee(h),v=Ee(m),b=Ee(w);y.oldConditionExpression&&(g.conditionExpression=y.oldConditionExpression),y.oldDefault&&(v.default=y.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],hi(p)),this.reverted(["element.updateAttachment"],hi(p)),this.executed("element.updateLabel",hi(d)),this.reverted("element.updateLabel",hi(d));function d(f){const{element:y}=f.context,h=ni(y),m=wt(y),w=m&&m.get("label");po(y)||pu(y)||(h&&!w?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&m.set("label",void 0))}}je(fi,we),fi.$inject=["eventBus","bpmnFactory","connectionDocking"],fi.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},fi.prototype.updateParent=function(e,t){if(!ft(e)&&!(T(e,"bpmn:DataStoreReference")&&e.parent&&T(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=wt(e),r=n&&n.businessObject,a=wt(n);T(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),T(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),T(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),T(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},fi.prototype.updateBounds=function(e){var t=wt(e),n=$I(e);if(n){var i=Ji(n,t.get("bounds"));te(n,{x:e.x+i.x,y:e.y+i.y})}var o=ft(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),te(r,{x:e.x,y:e.y,width:e.width,height:e.height})},fi.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;T(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),an(i,e)),T(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),un(o,e))}},fi.prototype.updateDiConnection=function(e,t,n){var i=wt(e),o=wt(t),r=wt(n);i.sourceElement&&i.sourceElement.bpmnElement!==Ee(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==Ee(n)&&(i.targetElement=n&&r)},fi.prototype.updateDiParent=function(e,t){if(t&&!T(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(an(n,e),e.$parent=null)}};function NI(e){for(;e&&!T(e,"bpmn:Definitions");)e=e.$parent;return e}fi.prototype.getLaneSet=function(e){var t,n;return T(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(T(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)},fi.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((T(e,"bpmn:DataInput")||T(e,"bpmn:DataOutput"))&&(T(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(T(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(T(e,"bpmn:FlowElement")){if(t){if(T(t,"bpmn:Participant"))t=t.processRef;else if(T(t,"bpmn:Lane"))do t=t.$parent.$parent;while(T(t,"bpmn:Lane"))}i="flowElements"}else if(T(e,"bpmn:Artifact")){for(;t&&!T(t,"bpmn:Process")&&!T(t,"bpmn:SubProcess")&&!T(t,"bpmn:Collaboration");)if(T(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(T(e,"bpmn:MessageFlow"))i="messageFlows";else if(T(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=NI(e.$parent||t),e.$parent&&(an(r.get("rootElements"),o),o.$parent=null),t&&(un(r.get("rootElements"),o),o.$parent=r))}else T(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":T(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),an(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);an(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},fi.prototype.updateConnectionWaypoints=function(e){var t=wt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},fi.prototype.updateConnection=function(e){var t=e.connection,n=Ee(t),i=t.source,o=Ee(i),r=t.target,a=Ee(t.target),s;if(T(n,"bpmn:DataAssociation"))T(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):T(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=T(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(an(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(an(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)},fi.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function hi(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;T(i,"bpmn:BaseElement")&&e(t)}}function $I(e){if(T(e,"bpmn:Activity")){var t=wt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function wr(e,t){Lo.call(this),this._bpmnFactory=e,this._moddle=t}je(wr,Lo),wr.$inject=["bpmnFactory","moddle"],wr.prototype._baseCreate=Lo.prototype.create,wr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,te({type:"label",di:n},Xr,t))}return this.createElement(e,t)},wr.prototype.createElement=function(e,t){t=te({},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(!jI(o)){var r=te({},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)}T(i,"bpmn:Group")&&(t=te({isFrame:!0},t)),t=FI(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=$h(o,t,"isExpanded")),ht(i,["bpmn:Lane","bpmn:Participant"])&&(t=$h(o,t,"isHorizontal")),T(i,"bpmn:SubProcess")&&(t.collapsed=!xt(i,o)),T(i,"bpmn:ExclusiveGateway")&&(ai(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),En(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),En(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=te({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},wr.prototype.getDefaultSize=function(e,t){var n=Ee(e);if(t=t||wt(e),T(n,"bpmn:SubProcess"))return xt(n,t)?{width:350,height:200}:{width:100,height:80};if(T(n,"bpmn:Task"))return{width:100,height:80};if(T(n,"bpmn:Gateway"))return{width:50,height:50};if(T(n,"bpmn:Event"))return{width:36,height:36};if(T(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return xt(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return T(n,"bpmn:Lane")?{width:400,height:100}:T(n,"bpmn:DataObjectReference")?{width:36,height:50}:T(n,"bpmn:DataStoreReference")?{width:50,height:50}:T(n,"bpmn:TextAnnotation")?{width:100,height:40}:T(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},wr.prototype.createParticipantShape=function(e){return Sn(e)||(e={isExpanded:e}),e=te({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function FI(e,t,n){return K(n,function(i){t=$h(e,t,i)}),t}function $h(e,t,n){return t[n]===void 0?t:(e[n]=t[n],io(t,[n]))}function jI(e){return ht(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Mu(e,t){this._modeling=e,this._canvas=t}Mu.$inject=["modeling","canvas"],Mu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;K(n,function(o){var r={x:0,y:0};En(i.left)?r.x=i.left-o.x:En(i.right)?r.x=i.right-o.width-o.x:En(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:En(i.top)?r.y=i.top-o.y:En(i.bottom)?r.y=i.bottom-o.height-o.y:En(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},Mu.prototype.postExecute=function(e){};function Cu(e){this._modeling=e}Cu.$inject=["modeling"],Cu.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},Cu.prototype.postExecute=function(e){var t=e.hints||{};HI(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 HI(e,t){return Xo(e.outgoing,function(n){return n.target===t})}function Au(e,t){this._canvas=e,this._layouter=t}Au.$inject=["canvas","layouter"],Au.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},Au.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Tu=Math.round;function Fh(e){this._modeling=e}Fh.$inject=["modeling"],Fh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;K(t,function(p){tt(p.x)||(p.x=0),tt(p.y)||(p.y=0)});var s=gt(t,function(p){return!p.hidden}),c=yn(s);K(t,function(p){$t(p)&&(p.waypoints=Wn(p.waypoints,function(d){return{x:Tu(d.x-c.x-c.width/2+o.x),y:Tu(d.y-c.y-c.height/2+o.y)}})),te(p,{x:Tu(p.x-c.x-c.width/2+o.x),y:Tu(p.y-c.y-c.height/2+o.y)})});var l=new Set(kl(t)),u={};K(t,function(p){if($t(p)){u[p.id]=tt(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=te({},r);l.has(p)||(d.autoResize=!1),ft(p)&&(d=io(d,["attach"])),u[p.id]=tt(i)?a.createShape(p,Vi(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,Vi(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=xa(u)};var k_=Math.round;function _r(e){this._canvas=e}_r.$inject=["canvas"],_r.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?te(t,n):te(t,{x:n.x-k_(t.width/2),y:n.y-k_(t.height/2)}),this._canvas.addShape(t,i,o),t},_r.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ac(e){_r.call(this,e)}je(ac,_r),ac.$inject=["canvas"];var GI=_r.prototype.execute;ac.prototype.execute=function(e){var t=e.shape;return VI(t),t.labelTarget=e.labelTarget,GI.call(this,e)};var zI=_r.prototype.revert;ac.prototype.revert=function(e){return e.shape.labelTarget=null,zI.call(this,e)};function VI(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function sc(e,t){this._canvas=e,this._modeling=t}sc.$inject=["canvas","modeling"],sc.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;br(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),br(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},sc.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=df(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},sc.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,un(n.children,t,i),this._canvas.addConnection(t,n),t};function jh(e,t){this._modeling=e,this._elementRegistry=t}jh.$inject=["modeling","elementRegistry"],jh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;K(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function cc(e,t){this._canvas=e,this._modeling=t}cc.$inject=["canvas","modeling"],cc.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;br(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),br(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),br(n.children,function(i){$t(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},cc.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=df(i.children,n),t.removeShape(n),n},cc.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return un(i.children,n,o),t.addShape(n,i),n};function Pu(e){this._modeling=e}Pu.$inject=["modeling"];var O_={x:"y",y:"x"};Pu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,w){m.range.min=Math.min(w[i],m.range.min),m.range.max=Math.max(w[i]+w[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,w){var g={y:0};g[i]=m-a(w),g[i]&&(g[O_[i]]=0,t.moveElements([w],g,w.parent))}var u=n[0],p=s(n),d=n[p],f,y,h=0;K(n,function(m,w){var g,v,b;if(m.elements.length<2){w&&w!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}g=no(m.elements,i),v=g[0],w===p&&(v=g[s(g)]),b=a(v),m.range=null,K(g,function(E){if(l(b,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),w&&w!==n.length-1&&(h+=c(m.range))}),y=Math.abs(d.range.min-u.range.max),f=Math.round((y-h)/(n.length-1)),!(f<n.length-1)&&K(n,function(m,w){var g={},v;m===u||m===d||(v=n[w-1],m.range.max=0,K(m.elements,function(b,E){g[O_[i]]=0,g[i]=v.range.max-b[i]+f,m.range.min!==b[i]&&(g[i]+=b[i]-m.range.min),g[i]&&t.moveElements([b],g,b.parent),m.range.max=Math.max(b[i]+b[o],E?m.range.max:0)}))})},Pu.prototype.postExecute=function(e){};function ku(e,t){this._layouter=e,this._canvas=t}ku.$inject=["layouter","canvas"],ku.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return te(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},ku.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Hh(){}Hh.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=an(r.children,t),un(i.children,t,o),t.parent=i,K(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Hh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return an(n.children,t),un(i.children,t,o),t.parent=i,K(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 Gh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Gh.prototype.add=function(e,t){return this.addAll([e],t)},Gh.prototype.addAll=function(e,t){var n=_k(e,!!t,this);return te(this,n),this};function lc(e){this._modeling=e}lc.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},lc.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),K(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),K(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&&Kf(p,p.source,t),connectionEnd:f&&Xf(p,p.target,t)})})},lc.prototype.getClosure=function(e){return new Gh().addAll(e,!0)};function Ou(e){this._helper=new lc(e)}Ou.$inject=["modeling"],Ou.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ou.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 ia(e){this._modeling=e,this._helper=new lc(e)}ia.$inject=["modeling"],ia.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=Vi(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=an(r.children,t),un(i.children,t,o),te(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},ia.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(K(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:Xf(r,t,n)})}),K(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Kf(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},ia.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return un(n.children,t,i),te(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},ia.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},ia.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function uc(e){this._modeling=e}uc.$inject=["modeling"],uc.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 et(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},uc.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||D_(et(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||D_(et(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},uc.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 D_(e){return e.original||e}function jo(e,t){this._modeling=e,this._rules=t}jo.$inject=["modeling","rules"],jo.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(y,h,m){return i.allowed("connection.reconnect",{connection:m,source:y,target:h})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var d=o.incoming.slice(),f=o.outgoing.slice();K(d,function(y){var h=y.source,m=c(h,s,y);m&&t.reconnectEnd(y,s,ru(y,s,u),a)}),K(f,function(y){var h=y.target,m=c(s,h,y);m&&t.reconnectStart(y,s,ou(y,s,u),a)})},jo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},jo.prototype.execute=function(e){},jo.prototype.revert=function(e){},jo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},jo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},jo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function pc(e){this._modeling=e}pc.$inject=["modeling"],pc.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},te(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},pc.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(K(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:ru(r,n,i)})}),K(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:ou(r,n,i)})}))},pc.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return te(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Er(e){this._modeling=e}Er.$inject=["modeling"],Er.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),K(o,function(s){a[s.id]=UI(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(xI(i,o),t,n,r,i,o,a)},Er.prototype.execute=function(){},Er.prototype.revert=function(){},Er.prototype.moveShapes=function(e,t){var n=this;K(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Er.prototype.resizeShapes=function(e,t,n){var i=this;K(e,function(o){var r=bI(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Er.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);K(e,function(u){var p=u.source,d=u.target,f=WI(u),y=I_(n),h={},m=c.has(p)||l.has(p),w=c.has(d)||l.has(d);m&&w?(f=Wn(f,function(g){return B_(g,i,n)&&(g[y]=g[y]+t[y]),g.original&&B_(g.original,i,n)&&(g.original[y]=g.original[y]+t[y]),g}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(m||w)&&(c.has(p)?h.connectionStart=Kf(u,p,t):c.has(d)?h.connectionEnd=Xf(u,d,t):l.has(p)?h.connectionStart=ou(u,p,a[p.id]):l.has(d)&&(h.connectionEnd=ru(u,d,a[d.id])),s._modeling.layoutConnection(u,h))})};function L_(e){return te({},e)}function WI(e){return Wn(e.waypoints,function(t){return t=L_(t),t.original&&(t.original=L_(t.original)),t})}function I_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function B_(e,t,n){var i=I_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function UI(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Du(e){this._modeling=e}Du.$inject=["modeling"],Du.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=N_(n),t.collapsed=!t.collapsed;var i=$_(n,t.collapsed);return[t].concat(i)},Du.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=F_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function N_(e){var t={};return K(e,function(n){t[n.id]=n.hidden,n.children&&(t=te({},t,N_(n.children)))}),t}function $_(e,t){var n=[];return K(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat($_(i.children,i.collapsed||t)))}),n}function F_(e,t){var n=[];return K(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(F_(i.children,t)))}),n}function Lu(e){this._modeling=e}Lu.$inject=["modeling"],Lu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=j_(i,t),H_(n,t),t.host=n,t},Lu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,j_(n,t),H_(i,t,o),t};function j_(e,t){return an(e&&e.attachers,t)}function H_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),un(i,t,n)}}function zh(){}zh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},zh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ft(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ft.$inject=["eventBus","elementFactory","commandStack"],Ft.prototype.getHandlers=function(){return{"shape.append":Cu,"shape.create":_r,"shape.delete":cc,"shape.move":ia,"shape.resize":pc,"shape.replace":jo,"shape.toggleCollapse":Du,spaceTool:Er,"label.create":ac,"connection.create":Au,"connection.delete":sc,"connection.move":Hh,"connection.layout":ku,"connection.updateWaypoints":zh,"connection.reconnect":uc,"elements.create":Fh,"elements.move":Ou,"elements.delete":jh,"elements.distribute":Pu,"elements.align":Mu,"element.updateAttachment":Lu}},Ft.prototype.registerHandlers=function(e){K(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ft.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)},Ft.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ft.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)},Ft.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)},Ft.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ft.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},Ft.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},Ft.prototype.createElements=function(e,t,n,i,o){et(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},Ft.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},Ft.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},Ft.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ft.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ft.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ft.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ft.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ft.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ft.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Ft.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)},Ft.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ft.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)},Ft.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,te(i,{docking:"source"}))},Ft.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,te(i,{docking:"target"}))},Ft.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ft.prototype._create=function(e,t){return s2(t)?t:this._elementFactory.create(e,t)},Ft.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function dc(e){this._elementRegistry=e}dc.$inject=["elementRegistry"],dc.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||qI(n,Xc(i));return G_(n,i),e.oldProperties=r,e.changed=o,o},dc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return G_(n,t),i},dc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return T(e,"bpmn:DataObject")?YI(e,t):[]};function qI(e,t){return si(t,function(n,i){return n[i]=e.get(i),n},{})}function G_(e,t){K(t,function(n,i){e.set(i,n)})}function YI(e,t){return t.filter(function(n){return T(n,"bpmn:DataObjectReference")&&Ee(n).dataObjectRef===e})}var fc="default",Ho="id",z_="di",KI={width:0,height:0};function hc(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}hc.$inject=["elementRegistry","moddle","modeling","textRenderer"],hc.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=eB(e.properties),s=e.oldProperties||XI(t,a);return V_(a,r)&&(o.unclaim(r[Ho]),i.updateId(t,a[Ho]),o.claim(a[Ho],r)),fc in a&&(a[fc]&&n.push(i.get(a[fc].id)),r[fc]&&n.push(i.get(r[fc].id))),W_(t,a),e.oldProperties=s,e.changed=n,n},hc.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Ee(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,KI)}},hc.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 W_(t,i),V_(n,o)&&(a.unclaim(n[Ho]),r.updateId(t,i[Ho]),a.claim(i[Ho],o)),e.changed};function V_(e,t){return Ho in e&&e[Ho]!==t[Ho]}function XI(e,t){var n=Xc(t),i=e.businessObject,o=wt(e);return si(n,function(r,a){return a!==z_?r[a]=i.get(a):r[a]=ZI(o,Xc(t.di)),r},{})}function ZI(e,t){return si(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function W_(e,t){var n=e.businessObject,i=wt(e);K(t,function(o,r){r!==z_?n.set(r,o):i&&JI(i,o)})}function JI(e,t){K(t,function(n,i){e.set(i,n)})}var QI=["default"];function eB(e){var t=te({},e);return QI.forEach(function(n){n in e&&(t[n]=Ee(t[n]))}),t}function Iu(e,t){this._canvas=e,this._modeling=t}Iu.$inject=["canvas","modeling"],Iu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=wt(o);return t.setRootElement(n),t.removeRootElement(o),un(a.rootElements,i),i.$parent=a,an(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},Iu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=wt(n);return t.setRootElement(o),t.removeRootElement(n),an(a.rootElements,i),i.$parent=null,un(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function Vh(e,t){this._modeling=e,this._spaceTool=t}Vh.$inject=["modeling","spaceTool"],Vh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Pi(i),a=r===i,s=a?i:i.parent,c=gr(s),l=Tn(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+Ti,y:i.y,width:i.width-Ti,height:i.height}:{x:i.x,y:i.y+Ti,width:i.width,height:i.height-Ti};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Yr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:gt(b.children,function(E){return E!==i})});var d,f,y,h,m;o==="top"?(d=-120,f=i.y,y=f+10,h="n",m="y"):o==="left"?(d=-120,f=i.x,y=f+10,h="w",m="x"):o==="bottom"?(d=120,f=i.y+i.height,y=f-10,h="s",m="y"):o==="right"&&(d=120,f=i.x+i.width,y=f-10,h="e",m="x");var w=t.calculateAdjustments(p,m,d,y),g=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,g,h,y);var v=l?{x:i.x+(a?Ti:0),y:f-(o==="top"?120:0),width:i.width-(a?Ti:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Ti:0),width:120,height:i.height-(a?Ti:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function Wh(e){this._modeling=e}Wh.$inject=["modeling"],Wh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=gr(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=Tn(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+Ti,y:n.y+d*c,width:n.width-Ti,height:l}:{x:n.x+d*c,y:n.y+Ti,width:l,height:n.height-Ti},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function gc(e,t){this._modeling=e,this._spaceTool=t}gc.$inject=["modeling","spaceTool"],gc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},gc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=YO(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},gc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ze(e),o=Ze(t),r=Eb(o,i),a=Pi(e),s=[],c=[];Yr(a,function(y){return s.push(y),(T(y,"bpmn:Lane")||T(y,"bpmn:Participant"))&&c.push(y),y.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 mc="flowNodeRef",Uh="lanes";function Bu(){}Bu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=Ze(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=Pi(u);return o[p.id]||(o[p.id]=Ql(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=Pi(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return T(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get(Uh),f=d.slice(),y=l(u);i.push({flowNode:p,remove:f,add:y})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(mc).forEach(function(d){i.push({flowNode:d,remove:[p],add:[]})})}),i},Bu.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(Uh);n.remove.forEach(function(r){an(o,r),an(r.get(mc),i)}),n.add.forEach(function(r){un(o,r),un(r.get(mc),i)})}),[]},Bu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(Uh);n.add.forEach(function(r){an(o,r),an(r.get(mc),i)}),n.remove.forEach(function(r){un(o,r),un(r.get(mc),i)})}),[]};var qh="categoryValueRef";function yc(e,t){this._bpmnFactory=e,this._elementRegistry=t}yc.$inject=["bpmnFactory","elementRegistry"],yc.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(g,v,b){if(v){var E=a.get(g);E||(E={},a.set(g,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:v,root:Yh(g)}:E.past={categoryValue:v}))}}function c(g){o.set(g,Ee(g))}function l(){n.filter(function(g){return T(g,"bpmn:FlowElement")&&!ft(g)&&g.parent}).forEach(c)}function u(g){var v=Ee(g),b=v.get("categoryValueRef");return b||(b=vb(i,v),r.push(tB(g,b))),b}function p(g){return g.reduce(function(v,b){var E=Yh(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(g){return T(g,"bpmn:Group")&&!ft(g)&&g.parent}).forEach(function(g){var v=Ee(g).get("categoryValueRef");if(!v){var b=Yh(g),E=d.get(b)||[],M=Da(E,g),B=Object.keys(M).length>0;B&&(v=u(g))}s(g,v,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),y=Array.from(a.values()).reduce(function(g,v){return v.present&&g.add(v.present.categoryValue),v.past&&g.add(v.past.categoryValue),g},new Set),h=new Map,m=p(f);a.forEach(function(g,v){var b=g.present;if(b){var E=m.get(b.root)||[],M=Da(E,v);E.forEach(function(B){if(M[B.id]){var A=h.get(B);A||(A=new Set,h.set(B,A)),A.add(b.categoryValue)}})}});var w=f.reduce(function(g,v){var b=o.get(v),E=b.get(qh),M=new Set(E),B=h.get(v)||new Set,A=Array.from(B).filter(function(H){return!M.has(H)}),L=E.filter(function(H){return y.has(H)&&!B.has(H)});return(A.length||L.length)&&g.push({businessObject:b,categoryValuesToAdd:A,categoryValuesToRemove:L}),g},[]);return{flowElements:w,groups:r}},yc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),nB(t.groups),oB(t.flowElements),[]},yc.prototype.revert=function(e){var t=e.updates;return rB(t.flowElements),iB(t.groups),[]};function tB(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function nB(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function iB(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=null})}function oB(e){e.forEach(function(t){var n=t.businessObject,i=n.get(qh);t.categoryValuesToRemove.forEach(function(o){an(i,o)}),t.categoryValuesToAdd.forEach(function(o){un(i,o,!0)})})}function rB(e){e.forEach(function(t){var n=t.businessObject,i=n.get(qh);t.categoryValuesToAdd.forEach(function(o){an(i,o)}),t.categoryValuesToRemove.forEach(function(o){un(i,o,!0)})})}function Yh(e){for(;e.parent;)e=e.parent;return e}function Nu(e){this._moddle=e}Nu.$inject=["moddle"],Nu.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),[]},Nu.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 aB={fill:void 0,stroke:void 0};function Kh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ri(t)){var n=sB(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Kh.$inject=["commandStack"],Kh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||aB,i=this,o={};"fill"in n&&te(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&te(o,{"border-color":this._normalizeColor(n.stroke)}),K(t,function(r){var a=$t(r)?Vi(o,["border-color"]):o,s=wt(r);if(cB(a),ft(r)){if(!s||!T(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!ht(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function sB(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 cB(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var lB={width:0,height:0};function U_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return N2(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!ft(l)&&po(l)&&!jl(l)&&!q_(p)){var d=7,f=vf(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=ni(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(!(!ft(u)&&!T(u,"bpmn:TextAnnotation"))){if(ft(u)&&q_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var y=ni(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,y)),d&&e.resizeShape(u,d,lB)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}U_.$inject=["modeling","textRenderer","bpmnFactory"];function q_(e){return!e||!e.trim()}function Hn(e,t,n,i){Ft.call(this,e,t,n),this._bpmnRules=i}je(Hn,Ft),Hn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Hn.prototype.getHandlers=function(){var e=Ft.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=dc,e["element.updateProperties"]=hc,e["canvas.updateRoot"]=Iu,e["lane.add"]=Vh,e["lane.resize"]=gc,e["lane.split"]=Wh,e["lane.updateRefs"]=Bu,e["group.updateRefs"]=yc,e["id.updateClaim"]=Nu,e["element.setColor"]=Kh,e["element.updateLabel"]=U_,e},Hn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Hn.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)},Hn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Hn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Hn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Hn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Hn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Hn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Hn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Hn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Hn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Hn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Hn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Hn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Y_(){}Y_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||nt(t.source||e.source),t.connectionEnd||nt(t.target||e.target)]};var $u=20,uB=5,Fu=Math.round,K_=20,pB={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function dB(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function fB(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function X_(e,t,n){var i=$n(t,e,uB),o=n.split(":")[0],r=Fu((t.x-e.x)/2+e.x),a=Fu((t.y-e.y)/2+e.y),s,c,l=fB(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=dB(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+$u*(/l/.test(o)?-1:1),y:d?a+$u:a}):(d=r===e.x,s={x:d?r+$u:r,y:e.y+$u*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Xh(e,s,c).concat(s),directions:c,turnNextDirections:d}}function hB(e,t,n){return X_(e,t,n)}function gB(e,t,n){var i=X_(t,e,Z_(n));return{waypoints:i.waypoints.slice().reverse(),directions:Z_(i.directions),turnNextDirections:i.turnNextDirections}}function mB(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=Xh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function Z_(e){return e.split(":").reverse().join(":")}function yB(e,t,n){var i=Fu((t.x-e.x)/2+e.x),o=Fu((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 Xh(e,t,n){if(n=n||"h:h",!MB(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Q_(n)){var i=hB(e,t,n),o=gB(e,t,n),r=mB(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return yB(e,t,n)}function vB(e,t,n){var i=Xh(e,t,n);return i.unshift(e),i.push(t),t0(i)}function xB(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=ZR(r,"straight")[0]||"h:h",s=pB[a]||0,c=$n(e,t,s),l=RB(c,a);n=n||nt(e),i=i||nt(t);var u=l.split(":"),p=e0(n,e,u[0],CB(c)),d=e0(i,t,u[1],c);return vB(p,d,l)}function bB(e,t,n,i,o,r){et(n)&&(o=n,r=i,n=nt(e),i=nt(t)),r=te({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&_B(e,t,n,i,r),c||(c=r.connectionEnd&&SB(t,e,i,o),c)||(c=r.connectionStart&&EB(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:xB(e,t,n,i,r)}function wB(e,t,n){return e>=t&&e<=n}function J_(e,t,n){var i={x:"width",y:"height"};return wB(t[e],n[e],n[e]+n[i[e]])}function _B(e,t,n,i,o){var r={},a,s;return s=$n(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?J_(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:J_(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 EB(e,t,n,i){return Zh(e,t,n,i)}function SB(e,t,n,i){var o=i.slice().reverse();return o=Zh(e,t,n,o),o?o.reverse():null}function Zh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Ht(u,function(p,d){var f=u[d-1];return f&&Hs(p,f)<3})}function r(u,p,d){var f=Oo(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(Ex(u[f],p,K_)||Ex(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=Zh(e,t,n,l)),c&&Oo(c)?null:c}function RB(e,t){if(Q_(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 MB(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Q_(e){return e&&/t|r|b|l/.test(e)}function CB(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 e0(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 t0(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return ff(o,r,n,0)||t.push(n),t},[])}var AB=-10,TB=40,PB={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},kB={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},Jh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},vc={top:"t",right:"r",bottom:"b",left:"l"};function ju(e){this._elementRegistry=e}je(ju,Y_),ju.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=n0(o&&o[0],n)),a||(a=n0(o&&o[o.length-1],i)),(T(e,"bpmn:Association")||T(e,"bpmn:DataAssociation"))&&o&&!i0(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=hb(n,s)?PB:kB;return T(e,"bpmn:MessageFlow")?c=DB(n,i,u):(T(e,"bpmn:SequenceFlow")||i0(n,i))&&(n===i?c={preferredLayouts:FB(n,e,u)}:T(n,"bpmn:BoundaryEvent")?c={preferredLayouts:jB(n,i,a,u)}:xc(n)||xc(i)?c={preferredLayouts:u.subProcess,preserveDocking:IB(n)}:T(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:T(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=te(c,t),l=t0(bB(n,i,r,a,o,c))),l||[r,a]};function OB(e){var t=e.host;return $n(nt(e),t,AB)}function DB(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:LB(e,t)}}function LB(e,t){return T(t,"bpmn:Participant")?"source":T(e,"bpmn:Participant")?"target":xc(t)?"source":xc(e)||T(t,"bpmn:Event")?"target":T(e,"bpmn:Event")?"source":null}function IB(e){return xc(e)?"target":"source"}function n0(e,t){return e?e.original||e:nt(t)}function i0(e,t){return T(t,"bpmn:Activity")&&T(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function xc(e){return T(e,"bpmn:SubProcess")&&xt(e)}function oa(e,t){return e===t}function BB(e,t){return t.indexOf(e)!==-1}function Xa(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 o0(e,t){return Jh[e]===t}function NB(e,t){var n=Xa(e),i=Jh[n];return t.indexOf(i)!==-1}function $B(e,t){var n=Za(e),i=Jh[n];return t.indexOf(i)!==-1}function r0(e){return e==="right"||e==="left"}function FB(e,t,n){var i=t.waypoints,o=i&&i.length&&$n(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function jB(e,t,n,i){var o=nt(e),r=nt(t),a=OB(e),s,c,l=oa(e.host,t),u=BB(a,["top","right","bottom","left"]),p=$n(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?HB(a,u,e,t,n,i):(s=GB(a,p,u,i.isHorizontal),c=zB(a,p,u,i.isHorizontal),[s+":"+c])}function HB(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Za(e):Xa(e),s=vc[a],c;return t?r0(e)?c=a0("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=a0("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function a0(e,t,n,i){var o=TB;return!(Qh(e,i,n,o)||Qh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Qh(e,i,nt(t),o))}function Qh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function GB(e,t,n,i){if(n)return vc[e];var o=Za(e),r=Xa(e),a=Za(t),s=Xa(t);if(i){if(oa(o,a)||o0(r,s))return vc[o]}else if(oa(r,s)||o0(o,a))return vc[r];return vc[i?r:o]}function zB(e,t,n,i){if(n)return r0(e)?NB(e,t)||oa(e,t)?"h":"v":$B(e,t)||oa(e,t)?"v":"h";var o=Za(e),r=Xa(e),a=Za(t),s=Xa(t);return a&&!s?"v":s&&!a?"h":i?oa(o,a)?"h":"v":oa(r,s)?"v":"h"}ju.$inject=["elementRegistry"];function s0(e){return te({original:e.point.original||e.point},e.actual)}function Sr(e,t){this._elementRegistry=e,this._graphicsFactory=t}Sr.$inject=["elementRegistry","graphicsFactory"],Sr.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(s0(i)),r.push(s0(o)),r},Sr.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}},Sr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Gs(i,o,n)},Sr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Sr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Sr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const eg={__init__:["modeling","bpmnUpdater"],__depends__:[cL,SL,ML,CL,x_,AI,PI,BI,Oi,Nh,R_],bpmnFactory:["type",Li],bpmnUpdater:["type",fi],elementFactory:["type",wr],modeling:["type",Hn],layouter:["type",ju],connectionDocking:["type",Sr]};var VB=10,c0=50,WB=250;function tg(e,t,n,i){for(var o;o=UB(e,n,t);)n=i(t,n,o);return n}function ng(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 UB(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=YB(e);return Ht(o,function(r){if(r===n)return!1;var a=$n(r,i,VB);return a==="intersect"})}function qB(e,t){t||(t={});function n(y){return y.source===e?1:-1}var i=t.defaultDistance||c0,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||WB,c=t.reference||"start";r||(r=ZB);function l(y,h){return o==="n"?c==="start"?Ze(y).top-Ze(h).bottom:c==="center"?Ze(y).top-nt(h).y:Ze(y).top-Ze(h).top:o==="w"?c==="start"?Ze(y).left-Ze(h).right:c==="center"?Ze(y).left-nt(h).x:Ze(y).left-Ze(h).left:o==="s"?c==="start"?Ze(h).top-Ze(y).bottom:c==="center"?nt(h).y-Ze(y).bottom:Ze(h).bottom-Ze(y).bottom:c==="start"?Ze(h).left-Ze(y).right:c==="center"?nt(h).x-Ze(y).right:Ze(h).right-Ze(y).right}var u=e.incoming.filter(r).map(function(y){var h=a(y),m=h<0?l(y.source,e):l(e,y.source);return{id:y.source.id,distance:m,weight:h}}),p=e.outgoing.filter(r).map(function(y){var h=a(y),m=h>0?l(e,y.target):l(y.target,e);return{id:y.target.id,distance:m,weight:h}}),d=u.concat(p).reduce(function(y,h){return y[h.id+"__weight_"+h.weight]=h,y},{}),f=si(d,function(y,h){var m=h.distance,w=h.weight;return m<0||m>s||(y[String(m)]||(y[String(m)]=0),y[String(m)]+=1*w,(!y.distance||y[y.distance]<y[String(m)])&&(y.distance=m)),y},{});return f.distance||i}function YB(e){var t=ig(e);return e.host&&(t=t.concat(ig(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ig(i))},[]))),t}function ig(e){return XB(e).concat(KB(e))}function KB(e){return e.incoming.map(function(t){return t.source})}function XB(e){return e.outgoing.map(function(t){return t.target})}function ZB(){return!0}var JB=100;function l0(e,t,n){e.on("autoPlace",JB,function(i){var o=i.shape,r=i.source;return QB(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}}l0.$inject=["eventBus","modeling","canvas"];function QB(e,t,n){n||(n={});var i=n.defaultDistance||c0,o=nt(e),r=Ze(e);return{x:r.right+i+t.width/2,y:o.y}}function u0(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}u0.$inject=["eventBus","selection"];const eN={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",l0],autoPlaceSelectionBehavior:["type",u0]};function p0(e,t,n){var i=hb(e,n);if(T(t,"bpmn:TextAnnotation"))return nN(e,t,i);if(ht(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return iN(e,t,i);if(T(t,"bpmn:FlowNode"))return tN(e,t,i)}function tN(e,t,n){var i=Ze(e),o=nt(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=qB(e,{filter:function(f){return T(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;T(e,"bpmn:BoundaryEvent")&&(l=$n(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+d0(l,c,r)}:{x:o.x+d0(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return tg(e,t,u,ng(d))}function d0(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function nN(e,t,n){var i=Ze(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};$t(e)&&(o=nt(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 tg(e,t,o,ng(a))}function iN(e,t,n){var i=Ze(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 tg(e,t,o,ng(a))}function f0(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return p0(o,i,t)})}f0.$inject=["eventBus","elementRegistry"];const Hu={__depends__:[eN],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",f0]};function Go(e,t,n,i){we.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=qp(xa(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ba(s,function(p){return p.parent.id});K(u,function(p,d){et(l)&&(p=p.filter(function(f){return Ht(l,wa({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)})}Go.$inject=["eventBus","elementRegistry","modeling","rules"],je(Go,we),Go.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ze(yn(e)),r=Ze(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),Ll(te({},r,a))},Go.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(oN(i,t)){var o=rN(Vi(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Go.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Go.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Go.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function oN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function rN(e,t){var n="";return e=Ze(e),t=Ze(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 Gu(e){e.invoke(Go,this)}Gu.$inject=["injector"],je(Gu,Go),Gu.prototype.resize=function(e,t,n){T(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function bc(e){ki.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}bc.$inject=["eventBus"],je(bc,ki),bc.prototype.canResize=function(e,t){return!1};function zu(e,t){bc.call(this,e),this._modeling=t}je(zu,bc),zu.$inject=["eventBus","modeling"],zu.prototype.canResize=function(e,t){if(T(t.di,"bpmndi:BPMNPlane")||!T(t,"bpmn:Participant")&&!T(t,"bpmn:Lane")&&!T(t,"bpmn:SubProcess"))return!1;var n=!0;return K(e,function(i){if(T(i,"bpmn:Lane")||ft(i)){n=!1;return}}),n};const h0={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Gu],bpmnAutoResizeProvider:["type",zu]},aN=1500;class g0{constructor(t){t.on("moddleCopy.canCopyProperties",aN,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,jr)))return;const o=ln(n);o!==void 0&&i.set("xml:lang",o)})}}on(g0,"$inject",["eventBus"]);const m0={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",g0]},sN=500,Vu=1,y0=(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-Vu||n>e.x+e.width+Vu||i<e.y-Vu||i>e.y+e.height+Vu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class v0{constructor(t){t.on("bpmnElement.added",sN,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(y0(n.source,i[0]),y0(n.target,i[i.length-1]))})}}on(v0,"$inject",["eventBus"]);const x0={__init__:["annotationImportDocking"],annotationImportDocking:["type",v0]},og=[db,Ys,eg,Hu,h0,nd,m0,x0,Mv];function cN(e={}){ay(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Kr({container:t,moddleExtensions:e.moddleExtensions??Ss,additionalModules:[...og,...e.additionalModules??[]]})}const b0={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","merge-before-predecessor":"연결","edge-crosses-own-endpoint":"연결","message-detours-own-pool-shape":"연결","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":"풀"},lN={이:["이","가"],을:["을","를"],와:["과","와"]};function uN(e,t){const[n,i]=lN[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 pN={"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":"연관선"},dN="요소";function rg(e){return(e&&pN[e.type])??dN}const w0=20;function fN(e){const t=e.replace(/\s+/g," ").trim();return t.length>w0?`${t.slice(0,w0)}…`:t}function Wu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:fN(o.name),a=r===void 0?i+rg(o):r,s=r===void 0?a:`「${r}」`;return n?s+uN(a,n).slice(a.length):s}function hN(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&&rg(r)===rg(a);return[Wu(e,t,i),Wu(e,n,o,s?"다른 ":"")]}function gN(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 mN(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];case"edge-crosses-own-endpoint":return[e.edge,e.shape];case"message-detours-own-pool-shape":return[e.edge,e.shape]}}const Uu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function yN(e,t){const n=(o,r)=>Wu(t,o,r),i=(o,r,a,s)=>hN(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)}의 ${Uu[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)}의 ${Uu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Uu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Uu[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,"이")} 거꾸로 들어갑니다.`;case"edge-crosses-own-endpoint":return`${n(e.edge,"이")} 자기가 이어진 ${n(e.shape)} 안을 지나 도형을 꿰뚫어 보입니다.`;case"message-detours-own-pool-shape":return`${n(e.edge,"이")} 같은 열에 놓인 ${n(e.shape,"을")} 피해 돌아갑니다.`}}function vN(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Wu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const _0="기타",ag={error:0,warning:1,info:2};function E0(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:gN(i),targetRefs:mN(i),category:b0[i.kind]??_0,message:yN(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:b0[i.ruleId]??_0,message:vN(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 Ja(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function sg(e,t){if(t===void 0||e.length===0)return!1;const n=Ja(e[0],t);return e.some(i=>Ja(i,t)!==n)}function R0(e,t){const n=sg(e,t);return e.slice().sort((i,o)=>(n?Number(Ja(o,t))-Number(Ja(i,t)):0)||ag[i.severity]-ag[o.severity])}const M0="i18n-untranslated",C0="i18n-review-requested",wc="i18nDisplay.redrawn",A0=[["untranslated",M0],["reviewRequested",C0]];class cg{constructor(t,n,i,o,r,a,s,c,l){on(this,"config");on(this,"displayLocale");on(this,"fallbackLabels",new Set);on(this,"labelDeleteTarget");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c,this.elementFactory=l;const u=o.drawShape.bind(o);o.drawShape=(f,y,h)=>this.withDisplayText(y,()=>u(f,y,h),f,!0);const p=r.activate.bind(r);r.activate=f=>this.withDisplayText(f,()=>p(f));const d=r.update.bind(r);r.update=(f,y,h,m)=>{const w=this.resolve(f);if(!w||w.native)return d(f,y,h,m);if((y??"").trim()===(h??"").trim())return;const g=f.labelTarget??f;!(y??"").trim()&&!this.ownText(g)||i.execute(Jc,{element:g,locale:this.displayLocale,text:y,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.shape.delete.preExecute",f=>{const{shape:y,hints:h}=f.context;y!=null&&y.labelTarget&&!(h!=null&&h.nested)&&(this.labelDeleteTarget=y.labelTarget)}),t.on("commandStack.shape.delete.postExecuted",f=>{f.context.labelTarget&&f.context.labelTarget===this.labelDeleteTarget&&(this.labelDeleteTarget=void 0)}),t.on("commandStack.element.updateLabel.preExecute",f=>{if(!this.config)return;const y=f.context,h=y.element.labelTarget??y.element;h!==this.labelDeleteTarget&&((y.newLabel??"").trim()||po(h.businessObject)&&this.remainingTextsAfterClear(h).length&&(y.hints={...y.hints??{},removeShape:!1}))}),t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:y,newLabel:h,oldLabel:m}=f.context,w=y.labelTarget??y;if(w===this.labelDeleteTarget){i.execute(Qc,{element:w,texts:null,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),before:{texts:{},requests:[]}});return}(h??"")!==(m??"")&&i.execute(Jc,{element:w,locale:this.displayLocale,text:h??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:m??""})}),t.on("import.done",()=>{this.fallbackLabels.clear(),this.config&&this.syncFallbackLabels()})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.syncFallbackLabels(),this.rerenderAll())}syncFallbackLabels(){if(!this.config){for(const t of this.fallbackLabels)this.elementRegistry.get(t.id)&&this.canvas.removeShape(t);this.fallbackLabels.clear();return}for(const t of this.elementRegistry.getAll()){if(t.type==="label"||t.labelTarget||t.label||!t.di)continue;const n=t.businessObject;if(!n||!po(n)||ni(t)||!this.docTexts(n).length)continue;const i=xf(t.di,t),o=this.elementFactory.createLabel({id:`${n.id}_label`,type:"label",businessObject:n,di:t.di,labelTarget:t,x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)});this.canvas.addShape(o,t.parent),this.fallbackLabels.add(o)}}docTexts(t){const n=Wi(t);return this.locales().map(i=>n.find(o=>ln(o)===i&&o.body)).filter(Boolean)}ownText(t){var i;const n=this.displayLocale;return(i=Wi(t.businessObject).find(o=>ln(o)===n&&o.body))==null?void 0:i.body}remainingTextsAfterClear(t){const n=t.businessObject,i=Zo(n),o=i?i.target[i.key]??"":"",r=Wi(n).filter(c=>ln(c)),a=o?bs(o,r,this.config.designLocale,this.rootLang()):[],s=this.displayLocale;return this.docTexts(n).filter(c=>{const l=ln(c)??"";return!a.includes(l)&&l!==s})}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=Zo(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Wi(n).filter(p=>ln(p)),s=p=>p.body??"",c=a.find(p=>ln(p)===o&&s(p)),l=Jo(n).some(p=>p.locale===o)?"reviewRequested":"ok";if(!r){if(c)return{text:s(c),status:l,native:!1};const p=this.docTexts(n)[0];return p?{text:s(p),status:l==="reviewRequested"?l:"untranslated",native:!1,fallbackLocale:ln(p)}:void 0}const u=bs(r,a,this.config.designLocale,this.rootLang());return u.includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1,fallbackLocale:u[0]}}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,o=!1){var h;if(!this.config)return n();const r=this.resolve(t),a=(h=i==null?void 0:i.parentNode)==null?void 0:h.classList;if(a)for(const[m,w]of A0)a.toggle(w,(r==null?void 0:r.status)===m);if(!r||r.native)return n();const c=o&&r.fallbackLocale&&(this.config.fallbackLocaleTag??!0)?`${r.text} [${r.fallbackLocale}]`:r.text,{target:l,key:u}=Zo((t.labelTarget??t).businessObject),p=Object.prototype.hasOwnProperty.call(l,u),d=l[u];if(d===c)return n();l[u]=c;const f=this.config.adaptiveExternalLabel??!0,y=t.type==="label"&&f?this.widen(t,c):void 0;try{const m=n();return y&&(m!=null&&m.setAttribute)&&m.setAttribute("transform",`translate(${y.dx}, 0)`),m}finally{p?l[u]=d:delete l[u],y==null||y.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 A0)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(wc)}}on(cg,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory","elementFactory"]);const T0={__depends__:[nd],__init__:["i18nDisplay"],i18nDisplay:["type",cg]};var xN=2e3;function lg(e,t,n){e.on("autoPlace",xN,function(i){var o=i.source,r=nt(o),a=i.shape,s=p0(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],T(a,"bpmn:TextAnnotation")&&(bN(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}lg.$inject=["eventBus","gridSnapping","elementRegistry"];function bN(e){return e==="x"}var wN=3e3;function Qa(e,t,n){we.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],wN,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||_N(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Qa.$inject=["eventBus","gridSnapping","modeling"],je(Qa,we),Qa.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=RN(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function _N(e){return e.length>3}function EN(e){return e==="h"}function SN(e){return e==="v"}function RN(e,t,n){var i=Oo(t,n),o={};return EN(i)&&(o.y=e.snapValue(t.y)),SN(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=te({},t,o),n=te({},n,o)),[t,n]}function MN(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Vr(e,t),fontBoundingBoxAscent:t*ro.ascentEm,fontBoundingBoxDescent:t*ro.descentEm,actualBoundingBoxAscent:t*ro.ascentEm,actualBoundingBoxDescent:t*ro.descentEm}}class ug{constructor(t,n,i,o,r,a){on(this,"active",!1);on(this,"shadow");on(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=MN),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(Zx(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 y=(u[f]??[]).map(a).filter(Boolean),h=p[f];h&&y.length===h.length&&y.every(m=>h.includes(m))&&y.forEach((m,w)=>h[w]=m)}}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(y=>!d.includes(y)&&y.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&&ni(n);if(!i)return!1;const o=this.textRenderer.getExternalLabelBounds(xf(wt(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(wc)}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(wc)}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 Kr({container:t,moddleExtensions:Ss,additionalModules:[...og]}),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}}on(ug,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function P0(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 pg(e,t,n,i){lg.call(this,P0(e,i),t,n)}pg.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function qu(e,t,n,i){Qa.call(this,P0(e,i),t,n)}qu.prototype=Object.create(Qa.prototype),qu.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function CN(e){return e instanceof pg||e instanceof qu}const k0={__init__:["headlessReplay"],headlessReplay:["type",ug],gridSnappingAutoPlaceBehavior:["type",pg],gridSnappingLayoutConnectionBehavior:["type",qu]};function ra(e){return CSS.escape(e)}var AN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function O0(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return AN[t]})}var Yu=50,TN=new ta,D0={min:.2,max:4},PN=10,kN=.1,ON=250,DN=100,LN=2e3;function Gn(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=TN.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||Xu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=Ku({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);dg(p,r._canvas),r._update()}function s(u){return function(d){var f=fg(d);(!r._state._svgClientRect||Xu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var y=Ku({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=BN(y,h),w=r._viewportDom.getBoundingClientRect(),g={x:f.x-w.left+1,y:f.y-w.top+1};te(r._state,{cachedViewbox:h,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:m,offsetViewportDom:g,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Ke.bind(document,"mousemove",c),Ke.bind(document,"mouseup",l)}}function c(u){var p=fg(u);if(r._state.isDragging){(!r._state._svgClientRect||Xu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,y=r._state.parentClientRect;te(r._viewportDom.style,{top:p.y-d.y-y.top+"px",left:p.x-d.x-y.left+"px"});var h=I0(y,{top:p.y-d.y-y.top,left:p.x-d.x-y.left,width:f.width,height:f.height});te(r._overlay.style,{clipPath:h});var m=Ku({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);dg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=fg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),te(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Ke.unbind(document,"mousemove",c),Ke.unbind(document,"mouseup",l))}Ke.bind(this._viewportDom,"mousedown",s(!1)),Ke.bind(this._svg,"mousedown",s(!0)),Ke.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||Xu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!HN(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*GN(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>kN){var f=d>0?1:-1,y=Math.log(i.zoom())/Math.log(10),h=zN(D0,PN*2),m=Math.round(y/h)*h;m+=h*f;var w=Math.pow(10,m);i.zoom(VN(D0,w),g),r._state.zoomDelta=0;var g=Ku({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);dg(g,r._canvas),r._update()}}}),Ke.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",ON,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)})}Gn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Gn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Dt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Dt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Dt(o).add("map"),n.appendChild(o);var r=this._svg=We("svg");Le(r,{width:"100%",height:"100%"}),ot(o,r);var a=this._elementsGroup=We("g");ot(r,a);var s=this._viewportGroup=We("g");ot(r,s);var c=this._viewport=We("rect");vt(c).add("viewport"),ot(s,c),Ke.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Dt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Dt(u).add("overlay"),this._parent.appendChild(u)},Gn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=tt(this._config.debounceDelay)?this._config.debounceDelay:DN,n=tt(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:LN,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)}},Gn.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)})}},Gn.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(B0(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-Yu,o=o-Yu,r=r+Yu*2,a=a+Yu*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};te(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=I0(l,p);te(this._overlay.style,{clipPath:d})}}},Gn.prototype.open=function(){te(this._state,{isOpen:!0}),Dt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};On(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Gn.prototype.close=function(){te(this._state,{isOpen:!1}),Dt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};On(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Gn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},Gn.prototype.isOpen=function(){return this._state.isOpen},Gn.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)}},Gn.prototype._updateElementId=function(e,t){try{var n=kt("#"+ra(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Gn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Gn.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=kt("#"+ra(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=$N(e);return s!==-1?a?FN(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),IN(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}}},Gn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&mn(t)},Gn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=dr(t),n)){var i=WN(tf(n));return Le(i,{id:this._prefixId(e.id)}),i}},Gn.prototype._clear=function(){Is(this._elementsGroup)},Gn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function IN(e){return e.waypoints}function BN(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 Ku(e,t,n){var i=t.getBoundingClientRect(),o=NN(n,i.width/i.height),r=L0(e.x,0,i.width,o.x,o.x+o.width),a=L0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function dg(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 NN(e,t){var n=e.width/e.height,i=te({},{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;te(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;te(i,{x:s,width:a})}return i}function L0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function $N(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function FN(e,t,n){var i=jN(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function jN(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function Xu(e){return e.width===0&&e.height===0}function HN(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var GN=Math.sign||function(e){return e>=0?1:-1};function zN(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 VN(e,t){return Math.max(e.min,Math.min(e.max,t))}function I0(e,t){var n=[yo(t.left,t.top),yo(t.left+t.width,t.top),yo(t.left+t.width,t.top+t.height),yo(t.left,t.top+t.height),yo(t.left,e.height),yo(e.width,e.height),yo(e.width,0),yo(0,0),yo(0,e.height),yo(t.left,e.height)].join(", ");return"polygon("+n+")"}function yo(e,t){return e+"px "+t+"px"}function B0(e){return Ko(e,function(t){return Sn(t)?B0(t):tt(t)&&isFinite(t)})}function fg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function WN(e){return Ls("[id]",e).forEach(function(t){t.remove()}),e}var UN={__init__:["minimap"],minimap:["type",Gn]};const N0={closed:"미니맵",open:"접기"};class $0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(wc,()=>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?N0.open:N0.closed)}}on($0,"$inject",["eventBus","minimap","canvas"]);const F0=[T0,{__depends__:[UN],__init__:["minimapI18n"],minimapI18n:["type",$0]},m0,x0,Mv,k0];var qN=new ta("ov"),YN=500;function Dn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=qN,this._overlayDefaults=te({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=KN(n.getContainer()),this._init()}Dn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Dn.prototype.get=function(e){if(ri(e)&&(e={id:e}),ri(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?gt(t.overlays,wa({type:e.type})):t.overlays.slice():[]}else return e.type?gt(this._overlays,wa({type:e.type})):e.id?this._overlays[e.id]:null},Dn.prototype.add=function(e,t,n){if(Sn(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=te({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Dn.prototype.remove=function(e){var t=this.get(e)||[];et(t)||(t=[t]);var n=this;K(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(so(i.html),so(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)}})},Dn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Dn.prototype.show=function(){Zu(this._overlayRoot)},Dn.prototype.hide=function(){Zu(this._overlayRoot,!1)},Dn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Cl(this._overlayRoot)},Dn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=yn(t);i=r.x,o=r.y}j0(n,i,o),On(e.html,"data-container-id",t.id)},Dn.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=yn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=yn(i).height:s=i.height,r=t.bottom*-1+s}j0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Dn.prototype._createOverlayContainer=function(e){var t=Wt('<div class="djs-overlays" />');Zn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Dn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";H0(this._overlayRoot,n)},Dn.prototype._getOverlayContainer=function(e,t){var n=Ht(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Dn.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)),ri(i)&&(i=Wt(i)),r=this._getOverlayContainer(n),o=Wt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Zn(o,{position:"absolute"}),o.appendChild(i),e.type&&Dt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Zu(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())},Dn.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&&(En(o)&&o>t.scale||En(r)&&r<t.scale))&&(c=!1),Zu(a,c),this._updateOverlayScale(e,t)},Dn.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),En(i)&&t.scale<i&&(a=(1/t.scale||1)*i),En(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),En(a)&&(s="scale("+a+","+a+")"),H0(r,s)},Dn.prototype._updateOverlaysVisibilty=function(e){var t=this;K(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Dn.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});K(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){so(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",YN,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(K(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&&Dt(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 KN(e){var t=Wt('<div class="djs-overlay-container" />');return Zn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function j0(e,t,n){Zn(e,{left:t+"px",top:n+"px"})}function Zu(e,t){e.style.display=t===!1?"none":""}function H0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Ju={__init__:["overlays"],overlays:["type",Dn]};function hg(e,t){t.invoke(we,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)})}je(hg,we),hg.$inject=["canvas","injector"];const XN={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",hg]};var ZN="bjs-breadcrumbs-shown";function G0(e,t,n){var i=Wt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Dt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=Ee(l),p=Ht(a,function(d){return d===u});p&&s()});function s(c){c&&(a=JN(c));var l=a.flatMap(function(p){var d=n.findRoot(ho(p))||n.findRoot(p.id);if(!d&&T(p,"bpmn:Process")){var f=t.find(function(m){var w=Ee(m);return w&&w.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var y=O0(p.name||p.id),h=Wt('<li><span class="bjs-crumb"><a title="'+y+'">'+y+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(d)}),h});i.innerHTML="";var u=l.length>1;r.toggle(ZN,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}G0.$inject=["eventBus","elementRegistry","canvas"];function JN(e){for(var t=Ee(e),n=[],i=t;i;i=i.$parent)(T(i,"bpmn:SubProcess")||T(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function z0(e,t){var n=null,i=new QN;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,!(!T(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})}z0.$inject=["eventBus","canvas"];function QN(){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 V0={x:180,y:160};function aa(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}aa.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)})}},aa.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;T(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),t$(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},aa.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=e$(e),i={x:n.x-V0.x,y:n.y-V0.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)})},aa.prototype._moveToDiPlane=function(e,t){var n=W0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},aa.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},aa.$inject=["eventBus","moddle"];function W0(e){return T(e,"bpmndi:BPMNDiagram")?e:W0(e.$parent)}function e$(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=Ze(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ll(t)}function t$(e,t){var n=e.$parent;return!(!T(n,"bpmn:SubProcess")||n===t.bpmnElement||ht(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Qu=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>',i$="bjs-drilldown-empty";function Rr(e,t,n,i,o){we.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",Qu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Qu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Qu,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"],Qu,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)})})}je(Rr,we),Rr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Rr.prototype._canDrillDown=function(e){var t=this._canvas;return T(e,"bpmn:SubProcess")&&t.findRoot(ho(e))},Rr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ee(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Dt(i.html).toggle(i$,!o)}},Rr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Ee(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Wt('<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(ho(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},Rr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Rr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const o$={__depends__:[Ju,Nh,XN],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",G0],drilldownCentering:["type",z0],drilldownOverlayBehavior:["type",Rr],subprocessCompatibility:["type",aa]};function Mr(e){Xt.call(this,e)}je(Mr,Xt),Mr.prototype._modules=[db,o$,Ju,Oi,Ys],Mr.prototype._moddleExtensions={};var ep="keyboard.keydown",r$="keyboard.keyup",a$=1e3,U0="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 Jn(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(U0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Jn.$inject=["config.keyboard","eventBus"],Jn.prototype._keydownHandler=function(e){this._keyHandler(e,ep)},Jn.prototype._keyupHandler=function(e){this._keyHandler(e,r$)},Jn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||ep,i),n&&e.preventDefault()}},Jn.prototype._isEventIgnored=function(e){return!1},Jn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(U0)),this.unbind(),e=this._node=this._target,Ke.bind(e,"keydown",this._keydownHandler),Ke.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Jn.prototype.getBinding=function(){return this._node},Jn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ke.unbind(e,"keydown",this._keydownHandler),Ke.unbind(e,"keyup",this._keyupHandler)),this._node=null},Jn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Jn.prototype.addListener=function(e,t,n){An(e)&&(n=t,t=e,e=a$),this._eventBus.on(n||ep,e,t)},Jn.prototype.removeListener=function(e,t){this._eventBus.off(t||ep,e)},Jn.prototype.hasModifier=jL,Jn.prototype.isCmd=pi,Jn.prototype.isShift=Mh,Jn.prototype.isKey=Mn;var s$=500;function es(e,t){var n=this;e.on("editorActions.init",s$,function(i){var o=i.editorActions;n.registerBindings(t,o)})}es.$inject=["eventBus","keyboard"],es.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(WL(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(UL(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(HL(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(GL(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(zL(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(VL(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(Mn(["+","Add","="],o)&&pi(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(Mn(["-","Subtract"],o)&&pi(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(Mn("0",o)&&pi(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(Mn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const gg={__init__:["keyboard","keyboardBindings"],keyboard:["type",Jn],keyboardBindings:["type",es]};var c$={moveSpeed:50,moveSpeedAccelerated:200};function q0(e,t,n){var i=this;this._config=te({},c$,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})}}q0.$inject=["config.keyboardMove","keyboard","canvas"];const Y0={__depends__:[gg],__init__:["keyboardMove"],keyboardMove:["type",q0]};var l$=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=Jr(s),p=Ji(u,c);if(!n.dragging&&u$(p)>l$&&(n.dragging=!0,l===0&&Jw(e),vu("grab")),n.dragging){var d=n.last||n.start;p=Ji(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Ke.unbind(document,"mousemove",o),Ke.unbind(document,"mouseup",r),n=null,Zw()}function a(s){if(!Ur(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Jr(s)},Ke.bind(document,"mousemove",o),Ke.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}K0.$inject=["eventBus","canvas"];function u$(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const X0={__init__:["moveCanvas"],moveCanvas:["type",K0]};function Z0(e,t){var n=Ef(e.min),i=Ef(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function p$(e,t){return Math.max(e.min,Math.min(e.max,t))}var d$=Math.sign||function(e){return e>=0?1:-1},mg={min:.2,max:4},J0=10,f$=.1,h$=.75;function vo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=ei(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||h$;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vo.$inject=["config.zoomScroll","eventBus","canvas"],vo.prototype.scroll=function(t){this._canvas.scroll(t)},vo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vo.prototype.zoom=function(t,n){var i=Z0(mg,J0*2);this._totalDelta+=t,Math.abs(this._totalDelta)>f$&&(this._zoom(t,n,i),this._totalDelta=0)},vo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||rw()&&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))*d$(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)}},vo.prototype.stepZoom=function(t,n){var i=Z0(mg,J0);this._zoom(t,n,i)},vo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Ef(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(p$(mg,s),t)},vo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Ke[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vo.prototype._init=function(e){this.toggle(e)};const Q0={__init__:["zoomScroll"],zoomScroll:["type",vo]};function _c(e){Mr.call(this,e)}je(_c,Mr),_c.prototype._navigationModules=[Y0,X0,Q0],_c.prototype._modules=[].concat(Mr.prototype._modules,_c.prototype._navigationModules);function yg(e){return e&&e[e.length-1]}function eE(e){return e.y}function tE(e){return e.x}var g$={left:tE,center:tE,right:function(e){return e.x+e.width},top:eE,middle:eE,bottom:function(e){return e.y+e.height}};function ts(e,t){this._modeling=e,this._rules=t}ts.$inject=["modeling","rules"],ts.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}},ts.prototype._isType=function(e,t){return t.indexOf(e)!==-1},ts.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=yg(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(K(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=no(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=yg(c).center,r;l=t[0],t=no(t,function(d){return d[i]+d[o]}),u=yg(t),r[e]=p(l,u)}return r},ts.prototype.trigger=function(e,t){var n=this._modeling,i,o=gt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),et(i)&&(o=i),!(o.length<2||!i)){var r=g$[t],a=no(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const m$={__init__:["alignElements"],alignElements:["type",ts]},y$=new ta;function ns(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ns.$inject=["eventBus"],ns.prototype.schedule=function(e,t=y$.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ns.prototype._schedule=function(e,t){const n=v$();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}},ns.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ns.prototype._cancel=function(e){clearTimeout(e.executionId)};function v$(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const x$={scheduler:["type",ns]};var b$="djs-element-hidden",tp=".entry",w$=1e3,nE=8,_$=300;function xn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}xn.$inject=["canvas","elementRegistry","eventBus","scheduler"],xn.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=et(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=et(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},xn.prototype._createContainer=function(){var e=Wt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},xn.prototype.registerProvider=function(e,t){t||(t=e,e=w$),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},xn.prototype.getEntries=function(e){var t=this._getProviders(),n=et(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return K(t,function(o){if(An(o[n])){var r=o[n](e);An(r)?i=r(i):K(r,function(a,s){i[s]=a})}}),i},xn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=On(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},_$);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},xn.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(An(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},xn.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))}},xn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},xn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;K(t,function(o,r){var a=o.group||"default",s=Wt(o.html||'<div class="entry" draggable="true"></div>'),c;On(s,"data-action",r),c=kt("[data-group="+ra(a)+"]",n),c||(c=Wt('<div class="group"></div>'),On(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&E$(s,o.className),o.title&&On(s,"title",o.title),o.imageUrl&&(i=Wt("<img>"),On(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Dt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},xn.prototype._createHtml=function(e){var t=this,n=Wt('<div class="djs-context-pad"></div>');return ci.bind(n,tp,"click",function(i){t.trigger("click",i)}),ci.bind(n,tp,"dragstart",function(i){t.trigger("dragstart",i)}),ci.bind(n,tp,"mouseover",function(i){t.trigger("mouseover",i)}),ci.bind(n,tp,"mouseout",function(i){t.trigger("mouseout",i)}),Ke.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},xn.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()&&R$(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},xn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},xn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return et(e)!==et(n)?!1:et(e)?e.length===n.length&&Ko(e,function(i){return n.includes(i)}):n===e},xn.prototype.isShown=function(){return this.isOpen()&&Dt(this._current.html).has("open")},xn.prototype.show=function(){this.isOpen()&&(Dt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},xn.prototype.hide=function(){this.isOpen()&&(Dt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},xn.prototype._getPosition=function(e){if(!et(e)&&$t(e)){var t=this._canvas.viewbox(),n=S$(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+nE*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+nE*this._canvas.zoom(),top:s.top-a.top}},xn.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")},xn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=et(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,b$)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},xn.prototype._getTargetBounds=function(e){var t=this,n=et(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 E$(e,t){var n=Dt(e);t=et(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function S$(e){return e.waypoints[e.waypoints.length-1]}function R$(e,t){return e=et(e)?e:[e],t=et(t)?t:[t],e.length===t.length&&Ko(e,function(n){return t.includes(n)})}const iE={__depends__:[yu,x$,Ju],contextPad:["type",xn]};var np,Jt,oE,Cr,rE,aE,sE,vg,ip,Ec,cE,xg,bg,wg,op={},rp=[],M$=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ap=Array.isArray;function zo(e,t){for(var n in t)e[n]=t[n];return e}function _g(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function lE(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?np.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 sp(e,a,i,o,null)}function sp(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??++oE,__i:-1,__u:0};return o==null&&Jt.vnode!=null&&Jt.vnode(r),r}function cp(e){return e.children}function lp(e,t){this.props=e,this.context=t}function sa(e,t){if(t==null)return e.__?sa(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"?sa(e):null}function C$(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=zo({},t);r.__v=t.__v+1,Jt.vnode&&Jt.vnode(r),Eg(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??sa(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,yE(i,r,o),t.__e=t.__=null,r.__e!=n&&uE(r)}}function uE(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}),uE(e)}function pE(e){(!e.__d&&(e.__d=!0)&&Cr.push(e)&&!up.__r++||rE!=Jt.debounceRendering)&&((rE=Jt.debounceRendering)||aE)(up)}function up(){try{for(var e,t=1;Cr.length;)Cr.length>t&&Cr.sort(sE),e=Cr.shift(),t=Cr.length,C$(e)}finally{Cr.length=up.__r=0}}function dE(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,y,h,m,w=i&&i.__k||rp,g=t.length;for(c=A$(n,t,w,c,g),p=0;p<g;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&w[f.__i]||op,f.__i=p,m=Eg(e,f,d,o,r,a,s,c,l,u),y=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&Sg(d.ref,null,f),u.push(f.ref,f.__c||y,f)),h==null&&y!=null&&(h=y),4&f.__u?(c=fE(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&m!==void 0?c=m:y&&(c=y.nextSibling),f.__u&=-7);return n.__e=h,c}function A$(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]=sp(null,a,null,null,null):ap(a)?a=e.__k[r]=sp(cp,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=sp(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=T$(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=sa(s)),xE(s,s));return i}function fE(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=fE(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=sa(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function T$(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 hE(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||M$.test(t)?n:n+"px"}function pp(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||hE(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||hE(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(cE,"$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[Ec]=i[Ec]:(n[Ec]=xg,e.addEventListener(t,r?wg:bg,r)):e.removeEventListener(t,r?wg:bg,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 gE(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ip]==null)t[ip]=xg++;else if(t[ip]<n[Ec])return;return n(Jt.event?Jt.event(t):t)}}}function Eg(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,y,h,m,w,g,v,b,E,M,B,A,L,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Jt.__b)&&u(t);e:if(typeof H=="function"){p=a.length;try{if(g=t.props,v=H.prototype&&H.prototype.render,b=(u=H.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?w=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new H(g,E):(t.__c=d=new lp(g,E),d.constructor=H,d.render=k$),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&&H.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=zo({},d.__s)),zo(d.__s,H.getDerivedStateFromProps(g,d.__s))),y=d.props,h=d.state,d.__v=t,f)v&&H.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&H.getDerivedStateFromProps==null&&g!==y&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(g,E),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(g,d.__s,E)===!1){t.__v!=n.__v&&(d.props=g,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(V){V&&(V.__=t)}),rp.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=sa(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(g,d.__s,E),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(y,h,m)})}if(d.context=E,d.props=g,d.__P=e,d.__e=!1,M=Jt.__r,B=0,v)d.state=d.__s,d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),rp.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=zo(zo({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(y,h)),A=u!=null&&u.type===cp&&u.key==null?vE(u.props.children):u,s=dE(e,ap(A)?A:[A],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),w&&(d.__E=d.__=null)}catch(V){if(a.length=p,t.__v=null,c||r!=null){if(V.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(L=r.length;L--;)_g(r[L])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),V.then||mE(t),Jt.__e(V,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=P$(n.__e,t,n,i,o,r,a,c,l);return(u=Jt.diffed)&&u(t),128&t.__u?void 0:s}function mE(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(mE))}function yE(e,t,n){for(var i=0;i<n.length;i++)Sg(n[i],n[++i],n[++i]);Jt.__c&&Jt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Jt.__e(r,o.__v)}})}function vE(e){return typeof e!="object"||e==null||e.__b>0?e:ap(e)?e.map(vE):e.constructor!==void 0?null:zo({},e)}function P$(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,y,h,m=n.props||op,w=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="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==!!g&&(g?f.localName==g:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(w);e=document.createElementNS(o,g,w.is&&w),s&&(Jt.__m&&Jt.__m(t,r),s=!1),r=null}if(g==null)m===w||s&&e.data==w||(e.data=w);else{if(r=g=="textarea"&&w.defaultValue!=null?null:r&&np.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(f=e.attributes[l]).name]=f.value;for(l in m)f=m[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||pp(e,l,null,f,o);for(l in w)f=w[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?y=f:l=="checked"?h=f:s&&typeof f!="function"||m[l]===f||pp(e,l,f,m[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=""),dE(t.type=="template"?e.content:e,ap(d)?d:[d],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&sa(n,0),s,c),r!=null)for(l=r.length;l--;)_g(r[l]);s&&g!="textarea"||(l="value",g=="progress"&&y==null?e.removeAttribute("value"):y!=null&&(y!==e[l]||g=="progress"&&!y||g=="option"&&y!=m[l])&&pp(e,l,y,m[l],o),l="checked",h!=null&&h!=e[l]&&pp(e,l,h,m[l],o))}return e}function Sg(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){Jt.__e(o,n)}}function xE(e,t,n){var i,o;if(Jt.unmount&&Jt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Sg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Jt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&xE(i[o],t,n||typeof e.type!="function");n||_g(e.__e),e.__c=e.__=e.__e=void 0}function k$(e,t,n){return this.constructor(e,n)}function bE(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Jt.__&&Jt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Eg(t,e=t.__k=lE(cp,null,[e]),o||op,op,t.namespaceURI,o?null:t.firstChild?np.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),yE(r,e,a),e.props.children=null}np=rp.slice,Jt={__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}},oE=0,lp.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zo({},this.state),typeof e=="function"&&(e=e(zo({},n),this.props)),e&&zo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),pE(this))},lp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),pE(this))},lp.prototype.render=cp,Cr=[],aE=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sE=function(e,t){return e.__v.__b-t.__v.__b},up.__r=0,vg=Math.random().toString(8),ip="__d"+vg,Ec="__a"+vg,cE=/(PointerCapture)$|Capture$/i,xg=0,bg=gE(!1),wg=gE(!0);var wE=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,wE(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},_E=new Map;function O$(e){var t=_E.get(this);return t||(t=new Map,_E.set(this,t)),(t=wE(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 jt=O$.bind(lE),is,bn,Rg,EE,Sc=0,SE=[],Cn=Jt,RE=Cn.__b,ME=Cn.__r,CE=Cn.diffed,AE=Cn.__c,TE=Cn.unmount,PE=Cn.__;function dp(e,t){Cn.__h&&Cn.__h(bn,e,Sc||t),Sc=0;var n=bn.__H||(bn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Mg(e){return Sc=1,D$(OE,e)}function D$(e,t,n){var i=dp(is++,2);if(i.t=e,!i.__c&&(i.__=[OE(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=bn,!bn.__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 y=f.__[0];f.__=f.__N,f.__N=void 0,y!==f.__[0]&&(p=!0)}}),r){var d=r.call(this,s,c,l);return u?d||p:d}return!u||p};bn.__f=!0;var r=bn.shouldComponentUpdate,a=bn.componentWillUpdate;bn.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)},bn.shouldComponentUpdate=o}return i.__N||i.__}function fp(e,t){var n=dp(is++,3);!Cn.__s&&Tg(n.__H,t)&&(n.__=e,n.u=t,bn.__H.__h.push(n))}function Cg(e,t){var n=dp(is++,4);!Cn.__s&&Tg(n.__H,t)&&(n.__=e,n.u=t,bn.__h.push(n))}function hp(e){return Sc=5,Vo(function(){return{current:e}},[])}function Vo(e,t){var n=dp(is++,7);return Tg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Rc(e,t){return Sc=8,Vo(function(){return e},t)}function L$(){for(var e;e=SE.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(gp),t.__h.some(Ag),t.__h=[]}catch(n){t.__h=[],Cn.__e(n,e.__v)}}}Cn.__b=function(e){bn=null,RE&&RE(e)},Cn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),PE&&PE(e,t)},Cn.__r=function(e){ME&&ME(e),is=0;var t=(bn=e.__c).__H;t&&(Rg===bn?(t.__h=[],bn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(gp),t.__h.some(Ag),t.__h=[],is=0)),Rg=bn},Cn.diffed=function(e){CE&&CE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(SE.push(t)!==1&&EE===Cn.requestAnimationFrame||((EE=Cn.requestAnimationFrame)||I$)(L$)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Rg=bn=null},Cn.__c=function(e,t){t.some(function(n){try{n.__h.some(gp),n.__h=n.__h.filter(function(i){return!i.__||Ag(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Cn.__e(i,n.__v)}}),AE&&AE(e,t)},Cn.unmount=function(e){TE&&TE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{gp(i)}catch(o){t=o}}),n.__H=void 0,t&&Cn.__e(t,n.__v))};var kE=typeof requestAnimationFrame=="function";function I$(e){var t,n=function(){clearTimeout(i),kE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);kE&&(t=requestAnimationFrame(n))}function gp(e){var t=bn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),bn=t}function Ag(e){var t=bn;e.__c=e.__(),bn=t}function Tg(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function OE(e,t){return typeof t=="function"?t(e):t}function B$(e){const{navigationStack:t,setNavigationStack:n}=e,i=Vo(()=>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 jt`
11
11
  <div class="djs-popup-breadcrumbs">
12
12
  ${o&&jt`
13
13
  <button
@@ -40,7 +40,7 @@
40
40
  </span>
41
41
  `}
42
42
  </div>
43
- `}function DE(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=DE(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function gp(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=DE(e))&&(i&&(i+=" "),i+=t);return i}function N$(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Go(()=>$$(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return jt`
43
+ `}function DE(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=DE(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function mp(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=DE(e))&&(i&&(i+=" "),i+=t);return i}function N$(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Vo(()=>$$(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return jt`
44
44
  <div class="djs-popup-header">
45
45
  <h3 class="djs-popup-title" title=${r}>${r}</h3>
46
46
  ${a.map(l=>jt`
@@ -69,9 +69,9 @@
69
69
  </ul>
70
70
  `)}
71
71
  </div>
72
- `}function $$(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 F$(e,t){return gp("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function LE(e,t){return`${e}-entry-${t.id}`}function j$(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 jt`
72
+ `}function $$(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 F$(e,t){return mp("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function LE(e,t){return`${e}-entry-${t.id}`}function j$(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 jt`
73
73
  <li
74
- class=${gp("entry",{selected:i,disabled:n.disabled})}
74
+ class=${mp("entry",{selected:i,disabled:n.disabled})}
75
75
  data-id=${n.id}
76
76
  id=${LE(t,n)}
77
77
  role="option"
@@ -87,7 +87,7 @@
87
87
  >
88
88
  <div class="djs-popup-entry-content">
89
89
  <span
90
- class=${gp("djs-popup-entry-name",n.className)}
90
+ class=${mp("djs-popup-entry-name",n.className)}
91
91
  >
92
92
  ${n.imageUrl&&jt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&jt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
93
 
@@ -130,7 +130,7 @@
130
130
  </div>
131
131
  `}
132
132
  </li>
133
- `}function H$(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=fp();Mg(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&G$(m)},[t]);const d=()=>{o.current=!1},f=h=>{o.current||n(h)},y=()=>{o.current||n(null)};return jt`
133
+ `}function H$(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=hp();Cg(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&G$(m)},[t]);const d=()=>{o.current=!1},f=h=>{o.current||n(h)},y=()=>{o.current||n(null)};return jt`
134
134
  <div
135
135
  class="djs-popup-results"
136
136
  ref=${p}
@@ -167,7 +167,7 @@
167
167
  </ul>
168
168
  `)}
169
169
  </div>
170
- `}function IE(e,t){return`${e}-group-${t.id}`}function G$(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const z$=new ta("djs-popup");function V$(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:y}=e,[h,m]=Rg([]);dp(()=>{m([])},[d]);const[w,g]=Rg(""),v=w.trim().length>0,b=Go(()=>q$(d),[d]),E=Go(()=>_n(l)?b.length>5:!1,[l,b]),M=Go(()=>{const z=h.length?h[h.length-1].entries:d;return E?v?p(b.filter(({searchable:Q})=>Q!==!1),w,{keys:["label","search","description"]}).map(({item:Q})=>Q):z.filter(({rank:Q=0})=>Q>=0):z},[E,v,b,w,p,h,d]),B=Go(()=>v?M.length?[{id:"default",entries:M}]:[]:Y$(M),[M,v]),[A,L]=Rg(M[0]),H=fp(null),V=fp(!1),G=Go(()=>z$.next(),[]),ie=`${G}-results`,pe=A&&LE(G,A);dp(()=>{const z=H.current;z&&M.includes(z)?L(z):L(M[0]),H.current=null},[M]);const q=Sc(z=>{const Q=U$(B);let se=Q.indexOf(A)+z;se<0&&(se=Q.length-1),se>=Q.length&&(se=0),V.current=!0,L(Q[se])},[B,A]),Pe=Sc(z=>{z>0&&A&&A.entries&&(V.current=!0,m(Q=>[...Q,A])),z<0&&h.length>0&&(V.current=!0,H.current=h[h.length+z],m(Q=>Q.slice(0,z)))},[A,h]),Te=Sc((z,Q,he)=>{if(!(!Q||Q.disabled))return Q.entries?(z.preventDefault(),Pe(1)):n(z,Q,he)},[n,Pe]),ke=Sc(z=>{if(z.key==="Enter"&&A){const Q=z.target;return!!Ur(Q,"a, button",!0)||A.disabled?void 0:Te(z,A)}if(z.key==="Backspace"){const Q=z.target;if(!(Qd(Q,"input")&&Q.value!==""))return Pe(-1),z.preventDefault()}if(z.key==="ArrowUp")return q(-1),z.preventDefault();if(z.key==="ArrowDown")return q(1),z.preventDefault();if(z.key==="ArrowRight")return Pe(1),z.preventDefault();if(z.key==="ArrowLeft")return Pe(-1),z.preventDefault()},[A,q,Pe,Te]),ve=Sc(z=>{Qd(z.target,"input")&&g(()=>z.target.value)},[g]);dp(()=>(f(),()=>{y()}),[]);const U=!v&&h.length>0,de=(a||o.length>0)&&!U;return jt`
170
+ `}function IE(e,t){return`${e}-group-${t.id}`}function G$(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const z$=new ta("djs-popup");function V$(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:y}=e,[h,m]=Mg([]);fp(()=>{m([])},[d]);const[w,g]=Mg(""),v=w.trim().length>0,b=Vo(()=>q$(d),[d]),E=Vo(()=>En(l)?b.length>5:!1,[l,b]),M=Vo(()=>{const z=h.length?h[h.length-1].entries:d;return E?v?p(b.filter(({searchable:Q})=>Q!==!1),w,{keys:["label","search","description"]}).map(({item:Q})=>Q):z.filter(({rank:Q=0})=>Q>=0):z},[E,v,b,w,p,h,d]),B=Vo(()=>v?M.length?[{id:"default",entries:M}]:[]:Y$(M),[M,v]),[A,L]=Mg(M[0]),H=hp(null),V=hp(!1),G=Vo(()=>z$.next(),[]),ie=`${G}-results`,pe=A&&LE(G,A);fp(()=>{const z=H.current;z&&M.includes(z)?L(z):L(M[0]),H.current=null},[M]);const q=Rc(z=>{const Q=U$(B);let se=Q.indexOf(A)+z;se<0&&(se=Q.length-1),se>=Q.length&&(se=0),V.current=!0,L(Q[se])},[B,A]),Te=Rc(z=>{z>0&&A&&A.entries&&(V.current=!0,m(Q=>[...Q,A])),z<0&&h.length>0&&(V.current=!0,H.current=h[h.length+z],m(Q=>Q.slice(0,z)))},[A,h]),Pe=Rc((z,Q,he)=>{if(!(!Q||Q.disabled))return Q.entries?(z.preventDefault(),Te(1)):n(z,Q,he)},[n,Te]),ke=Rc(z=>{if(z.key==="Enter"&&A){const Q=z.target;return!!Ur(Q,"a, button",!0)||A.disabled?void 0:Pe(z,A)}if(z.key==="Backspace"){const Q=z.target;if(!(Qd(Q,"input")&&Q.value!==""))return Te(-1),z.preventDefault()}if(z.key==="ArrowUp")return q(-1),z.preventDefault();if(z.key==="ArrowDown")return q(1),z.preventDefault();if(z.key==="ArrowRight")return Te(1),z.preventDefault();if(z.key==="ArrowLeft")return Te(-1),z.preventDefault()},[A,q,Te,Pe]),ve=Rc(z=>{Qd(z.target,"input")&&g(()=>z.target.value)},[g]);fp(()=>(f(),()=>{y()}),[]);const U=!v&&h.length>0,de=(a||o.length>0)&&!U;return jt`
171
171
  <${BE}
172
172
  onClose=${t}
173
173
  onKeyup=${ve}
@@ -225,7 +225,7 @@
225
225
  selectedEntry=${A}
226
226
  setSelectedEntry=${L}
227
227
  keyboardSelection=${V}
228
- onAction=${Te}
228
+ onAction=${Pe}
229
229
  idPrefix=${G}
230
230
  id=${ie}
231
231
  ariaLabel=${a||"Results"}
@@ -254,12 +254,12 @@
254
254
  </div>
255
255
  `}
256
256
  ${u&&M.length===0&&jt`
257
- <div class="djs-popup-no-results">${Cn(u)?u(w):u}</div>
257
+ <div class="djs-popup-no-results">${An(u)?u(w):u}</div>
258
258
  `}
259
259
  </${BE}>
260
- `}function BE(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=fp();return Mg(()=>{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]),Mg(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),dp(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Ur(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)}},[]),jt`
260
+ `}function BE(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=hp();return Cg(()=>{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]),Cg(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),fp(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Ur(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)}},[]),jt`
261
261
  <div
262
- class=${gp("djs-popup",o)}
262
+ class=${mp("djs-popup",o)}
263
263
  style=${W$(e)}
264
264
  onKeydown=${n}
265
265
  onKeyup=${i}
@@ -268,7 +268,7 @@
268
268
  >
269
269
  ${r}
270
270
  </div>
271
- `}function W$(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:_n(t)?n:void 0,maxWidth:_n(t)?"unset":void 0,"transform-origin":"top left"}}function U$(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function q$(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function Y$(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 K$="data-id",NE=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],X$=1e3;function Qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=_n(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()})}Qt.$inject=["config.popupMenu","eventBus","canvas","search"],Qt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=$E(n),s=Object.entries(i).map(([d,f])=>({id:d,...f})),c=e&&(d=>this._ensureVisible(d,e)),l=this._updateScale(this._current.container);bE(jt`
271
+ `}function W$(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:En(t)?n:void 0,maxWidth:En(t)?"unset":void 0,"transform-origin":"top left"}}function U$(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function q$(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function Y$(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 K$="data-id",NE=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],X$=1e3;function Qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=En(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()})}Qt.$inject=["config.popupMenu","eventBus","canvas","search"],Qt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=$E(n),s=Object.entries(i).map(([d,f])=>({id:d,...f})),c=e&&(d=>this._ensureVisible(d,e)),l=this._updateScale(this._current.container);bE(jt`
272
272
  <${V$}
273
273
  onClose=${d=>this.close(d)}
274
274
  onSelect=${(d,f,y)=>this.trigger(d,f,y)}
@@ -283,7 +283,7 @@
283
283
  searchFn=${this._search}
284
284
  ...${{...r}}
285
285
  />
286
- `,this._current.container)},Qt.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()},Qt.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()},Qt.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)}},Qt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Qt.prototype.reset=function(){const e=this._current.container;bE(null,e),ao(e)},Qt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Qt.prototype._onOpened=function(){this._emit("opened")},Qt.prototype._onClosed=function(){this._emit("closed")},Qt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Wt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Qt.prototype._bindAutoClose=function(){this._eventBus.once(NE,this.close,this)},Qt.prototype._unbindAutoClose=function(){this._eventBus.off(NE,this.close,this)},Qt.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),_n(n)&&e<n&&(o=n),_n(i)&&e>i&&(o=i)),o},Qt.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}},Qt.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},Qt.prototype.registerProvider=function(e,t,n){n||(n=t,t=X$),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Qt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Qt.prototype._getEntries=function(e,t){var n={};return K(t,function(i){if(!i.getPopupMenuEntries){K(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=no(r,["id"])});return}var o=i.getPopupMenuEntries(e);Cn(o)?n=o(n):K(o,function(r,a){n[a]=r})}),n},Qt.prototype._getHeaderEntries=function(e,t){var n={};return K(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;K(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=no(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);Cn(o)?n=o(n):K(o,function(r,a){n[a]=r})}),n},Qt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Cn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Qt.prototype.isOpen=function(){return!!this._current},Qt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Ur(e.delegateTarget||e.target,".entry",!0),r=kn(o,K$);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Cn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Qt.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 $E(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=$E(o.entries,[...t,...FE(o.search)]):t.length&&(o.search=[...t,...FE(o.search)]),o})}function FE(e){return e?et(e)?e:[e]:[]}function Z$(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=J$(r,o,i);return a?{item:r,tokens:a}:[]}).sort(Q$(i))}function J$(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=et(s)?s.reduce((u,p)=>{const{tokens:d,matchedWords:f}=VE(p,t);return{tokens:[...u.tokens,d],matchedWords:{...u.matchedWords,...f}}},{matchedWords:{},tokens:[]}):VE(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function Q$(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=e5(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=jE;continue}const s=t5(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=jE;continue}}return i}}function e5(e,t){return HE(t)-HE(e)}const jE=.5,os={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function HE(e){const t=e.reduce((s,c)=>s+GE(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 GE(e){if(et(e))return Math.max(...e.map(GE));const t=Math.log(e.value.length);return e.match?(e.start?e.end?os.FULL:e.wordEnd?os.START_FULL_WORD:os.START_WORD_PART:e.wordStart?os.WORD_START:os.WORD_PART)*t:os.NO_MATCH*t}function zE(e=""){return et(e)?e.join(", "):e}function t5(e,t){return zE(e).localeCompare(zE(t))}function VE(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(n5),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,y=d===e.length,h=!!((l=s.groups)!=null&&l.all),m=f||/\s/.test(e.charAt(p-1)),w=y||/\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:m,wordEnd:w,start:f,end:y,all:h});const g=h?t:[u];for(const v of g)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 n5(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const WE={search:["value",Z$]},Pg={__depends__:[WE],__init__:["popupMenu"],popupMenu:["type",Qt]};var UE={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
286
+ `,this._current.container)},Qt.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()},Qt.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()},Qt.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)}},Qt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Qt.prototype.reset=function(){const e=this._current.container;bE(null,e),so(e)},Qt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Qt.prototype._onOpened=function(){this._emit("opened")},Qt.prototype._onClosed=function(){this._emit("closed")},Qt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Wt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Qt.prototype._bindAutoClose=function(){this._eventBus.once(NE,this.close,this)},Qt.prototype._unbindAutoClose=function(){this._eventBus.off(NE,this.close,this)},Qt.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),En(n)&&e<n&&(o=n),En(i)&&e>i&&(o=i)),o},Qt.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}},Qt.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},Qt.prototype.registerProvider=function(e,t,n){n||(n=t,t=X$),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Qt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Qt.prototype._getEntries=function(e,t){var n={};return K(t,function(i){if(!i.getPopupMenuEntries){K(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=io(r,["id"])});return}var o=i.getPopupMenuEntries(e);An(o)?n=o(n):K(o,function(r,a){n[a]=r})}),n},Qt.prototype._getHeaderEntries=function(e,t){var n={};return K(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;K(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=io(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);An(o)?n=o(n):K(o,function(r,a){n[a]=r})}),n},Qt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>An(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Qt.prototype.isOpen=function(){return!!this._current},Qt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Ur(e.delegateTarget||e.target,".entry",!0),r=On(o,K$);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(An(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Qt.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 $E(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=$E(o.entries,[...t,...FE(o.search)]):t.length&&(o.search=[...t,...FE(o.search)]),o})}function FE(e){return e?et(e)?e:[e]:[]}function Z$(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=J$(r,o,i);return a?{item:r,tokens:a}:[]}).sort(Q$(i))}function J$(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=et(s)?s.reduce((u,p)=>{const{tokens:d,matchedWords:f}=VE(p,t);return{tokens:[...u.tokens,d],matchedWords:{...u.matchedWords,...f}}},{matchedWords:{},tokens:[]}):VE(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function Q$(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=e5(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=jE;continue}const s=t5(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=jE;continue}}return i}}function e5(e,t){return HE(t)-HE(e)}const jE=.5,os={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function HE(e){const t=e.reduce((s,c)=>s+GE(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 GE(e){if(et(e))return Math.max(...e.map(GE));const t=Math.log(e.value.length);return e.match?(e.start?e.end?os.FULL:e.wordEnd?os.START_FULL_WORD:os.START_WORD_PART:e.wordStart?os.WORD_START:os.WORD_PART)*t:os.NO_MATCH*t}function zE(e=""){return et(e)?e.join(", "):e}function t5(e,t){return zE(e).localeCompare(zE(t))}function VE(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(n5),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,y=d===e.length,h=!!((l=s.groups)!=null&&l.all),m=f||/\s/.test(e.charAt(p-1)),w=y||/\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:m,wordEnd:w,start:f,end:y,all:h});const g=h?t:[u];for(const v of g)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 n5(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const WE={search:["value",Z$]},Pg={__depends__:[WE],__init__:["popupMenu"],popupMenu:["type",Qt]};var UE={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>`},i5=900;function rs(e,t,n,i){e.registerProvider(i5,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}rs.$inject=["contextPad","popupMenu","translate","canvas"],rs.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},rs.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},rs.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${UE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);te(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},rs.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 o5=["left","center","right","top","middle","bottom"];function Rc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Rc.$inject=["popupMenu","alignElements","translate","rules"],Rc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},Rc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Rc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return K(o5,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:UE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function mp(e){ki.call(this,e)}mp.$inject=["eventBus"],je(mp,ki),mp.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=gt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Tl(n),n.length<2?!1:n})};const r5={__depends__:[m$,iE,Pg],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",rs],alignElementsMenuProvider:["type",Rc],bpmnAlignElements:["type",mp]};function as(e,t,n){this._canvas=n,this._opts=te({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()})}as.$inject=["config.autoScroll","eventBus","canvas"],as.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++)a5(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 a5(e,t,n){return t<e&&e<n}as.prototype.stopScroll=function(){clearTimeout(this._scrolling)},as.prototype.setOptions=function(e){this._opts=te({},this._opts,e)},as.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Jr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const s5={__depends__:[Bo],__init__:["autoScroll"],autoScroll:["type",as]};var qE="djs-bendpoint",YE="djs-segment-dragger";function c5(e,t){var n=Jr(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 Tg(e,t,n){var i=c5(e,n),o=Ff(t,i);return o}function kg(e,t){var n=We("g");vt(n).add(qE),ot(e,n);var i=We("circle");Le(i,{cx:0,cy:0,r:4}),vt(i).add("djs-visual"),ot(n,i);var o=We("circle");return Le(o,{cx:0,cy:0,r:10}),vt(o).add("djs-hit"),ot(n,o),t&&vt(n).add(t),n}function l5(e,t,n,i){var o=We("g");ot(e,o);var r=18,a=6,s=11,c=p5(t,n,i),l=a+s,u=We("rect");Le(u,{x:-r/2,y:-a/2,width:r,height:a}),vt(u).add("djs-visual"),ot(o,u);var p=We("rect");return Le(p,{x:-c/2,y:-l/2,width:c,height:l}),vt(p).add("djs-hit"),ot(o,p),Kx(o,i==="v"?90:0),o}function KE(e,t,n){var i=We("g"),o=hf(t,n),r=To(t,n);return ot(e,i),l5(i,t,n,r),vt(i).add(YE),vt(i).add(r==="h"?"horizontal":"vertical"),Fn(i,o.x,o.y),i}function Og(e){return Math.abs(Math.round(e*2/3))}function u5(e,t){var n=d5(e,t);return Wf(e,n)}function p5(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Og(n==="h"?i:o)}function d5(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=Nb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function XE(e,t,n,i,o){function r(v,b,E){var M=v.index,B=v.point,A,L,H,V,G,ie;return M<=0||v.bendpoint?!1:(A=b[M-1],L=b[M],H=hf(A,L),V=To(A,L),G=Math.abs(B.x-H.x),ie=Math.abs(B.y-H.y),V&&G<=E&&ie<=E)}function a(v,b){var E=v.waypoints,M,B,A,L;return b.index<=0||b.bendpoint||(M={start:E[b.index-1],end:E[b.index]},B=To(M.start,M.end),!B)?null:(B==="h"?A=M.end.x-M.start.x:A=M.end.y-M.start.y,L=Og(A)/2,L)}function s(v,b){var E=b.waypoints,M=Tg(t,E,v),B;if(M){B=a(b,M);var A;if(r(M,E,B)?A=o.start(v,b,M.index):A=i.start(v,b,M.index,!M.bendpoint),A!==!1)return!0}}function c(v,b,E){Ke.bind(v,b,function(M){n.triggerMouseEvent(b,M,E),M.stopPropagation()})}function l(v,b){var E=t.getLayer("overlays"),M=kt('.djs-bendpoints[data-element-id="'+ra(v.id)+'"]',E);return!M&&b&&(M=We("g"),Le(M,{"data-element-id":v.id}),vt(M).add("djs-bendpoints"),ot(E,M),c(M,"mousedown",v),c(M,"click",v),c(M,"dblclick",v)),M}function u(v,b){return kt('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(E,M){var B=kg(v);ot(v,B),Fn(B,E.x,E.y)}),kg(v,"floating")}function d(v,b){for(var E=b.waypoints,M,B,A,L=1;L<E.length;L++)M=E[L-1],B=E[L],To(M,B)&&(A=KE(v,M,B),Le(A,{"data-segment-idx":L}),c(A,"mousemove",b))}function f(v){K(Ds("."+qE,v),function(b){gn(b)})}function y(v){K(Ds("."+YE,v),function(b){gn(b)})}function h(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function m(v){var b=l(v);b&&(y(b),f(b),d(b,v),p(b,v))}function w(v,b){var E=kt(".floating",v),M=b.point;E&&(Fn(E,M.x,M.y),vt(E).add("positioned"))}function g(v,b,E){var M=u(b.index,v),B=E[b.index-1],A=E[b.index],L=b.point,H=hf(B,A),V=To(B,A),G,ie;M&&(G=f5(M),ie={x:L.x-H.x,y:L.y-H.y},V==="v"&&(ie={x:ie.y,y:ie.x}),Fn(G,ie.x,ie.y))}e.on("connection.changed",function(v){m(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&gn(b)}),e.on("element.marker.update",function(v){var b=v.element,E;b.waypoints&&(E=h(b),v.add?vt(E).add(v.marker):vt(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=Tg(t,E,v.originalEvent),!B)return;w(M,B),B.bendpoint||g(M,B,E)}}),e.on("element.mousedown",function(v){if(mr(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&&h(E)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&h(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var E=l(b);if(E){var M=kt(".floating",E);M&&vt(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=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}XE.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function f5(e){return kt(".djs-visual",e)}var ZE=Math.round,ca="reconnectStart",la="reconnectEnd",Mc="updateWaypoints";function Dg(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,y;!l&&c===0?y=ca:!l&&c===f.length-1?y=la:y=Mc;var h=y===Mc?"connection.updateWaypoints":"connection.reconnect",m=o.allowed(h,{connection:s,source:p,target:d});if(m===!1&&(m=o.allowed(h,{connection:s,source:d,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target:d,insert:l,type:y}}})},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 y=d===Mc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(y,{connection:c,source:d===ca?p:l,target:d===la?p:u}),f){s.source=d===ca?p:l,s.target=d===la?p:u;return}f===!1&&(f=s.allowed=o.allowed(y,{connection:c,source:d===la?p:u,target:d===ca?p:l})),f&&(s.source=d===la?p:u,s.target=d===ca?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!==Mc&&(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,y=s.target,h=s.type,m=s.hints||{},w={x:ZE(a.x),y:ZE(a.y)};if(!c)return!1;h===Mc?(p?d.splice(l,0,w):d[l]=w,m.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,Yk(d),m)):(h===ca?(m.docking="source",yp(s)&&(m.docking="target",m.newWaypoints=d.reverse())):h===la&&(m.docking="target",yp(s)&&(m.docking="source",m.newWaypoints=d.reverse())),r.reconnect(u,f,y,w,m))},this)}Dg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Dg.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 yp(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===ca)return t&&i&&t===i&&n!==i;if(o===la)return t&&n&&t===n&&n!==i}var h5="reconnectStart",g5="reconnectEnd",JE="updateWaypoints",Cc="connect-ok",vp="connect-not-ok",QE="connect-hover",eS="djs-updating",tS="djs-dragging",nS=1100;function iS(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=kg(i.getLayer("overlays"));vt(d).add("djs-dragging"),i.addMarker(c,tS),i.addMarker(c,eS)}),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,QE),l===JE)return;s?(i.removeMarker(c,vp),i.addMarker(c,Cc)):s===!1&&(i.removeMarker(c,Cc),i.addMarker(c,vp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],nS,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,QE),i.removeMarker(s,c?Cc:vp))}),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,y=d.target,h=d.waypoints.slice(),m={x:r.x,y:r.y},w=a.hints||{},g={};o&&(w.connectionStart&&(g.connectionStart=w.connectionStart),w.connectionEnd&&(g.connectionEnd=w.connectionEnd),p===h5?yp(a)?(g.connectionEnd=g.connectionEnd||m,g.source=y,g.target=u||f,h=h.reverse()):(g.connectionStart=g.connectionStart||m,g.source=u||f,g.target=y):p===g5?yp(a)?(g.connectionStart=g.connectionStart||m,g.source=u||y,g.target=f,h=h.reverse()):(g.connectionEnd=g.connectionEnd||m,g.source=f,g.target=u||y):(g.noCropping=!0,g.noLayout=!0,h[c]=m),p===JE&&(h=e.cropWaypoints(d,h)),g.waypoints=h,o.drawPreview(a,s,g)),Fn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],nS,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,gn(c),i.removeMarker(s,eS),i.removeMarker(s,tS),l&&(i.removeMarker(l,Cc),i.removeMarker(l,u?Cc:vp)),o&&o.cleanUp(a)})}iS.$inject=["bendpointMove","injector","eventBus","canvas"];var oS="connect-hover",rS="djs-updating";function aS(e,t,n){return Lg(e,t,e[t]+n)}function Lg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function m5(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 Lg(t,i,s)}function sS(e){return e==="x"?"y":"x"}function cS(e,t,n){var i,o;return e.original?e.original:(i=nt(t),o=sS(n),Lg(e,o,i[o]))}function lS(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var y,h=n.getGraphics(d),m=f-1,w=f,g=d.waypoints,v=g[m],b=g[w],E=Tg(n,g,p),M,B,A;if(M=To(v,b),!!M)return B=M==="v"?"x":"y",m===0&&(v=cS(v,d.source,B)),w===g.length-1&&(b=cS(b,d.target,B)),E?A=E.point:A={x:(v.x+b.x)/2,y:(v.y+b.y)/2},y={connection:d,segmentStartIndex:m,segmentEndIndex:w,segmentStart:v,segmentEnd:b,axis:B,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:h,context:y}})};function s(p,d){if(!a)return d;var f=p.waypoints,y;return p.waypoints=d,y=a.getCroppedWaypoints(p),p.waypoints=f,y}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var y=p.newWaypoints,h=p.segmentStartIndex+d,m=y[h],w=p.segmentEndIndex+d,g=y[w],v=sS(p.axis),b=m5(f,m,g,v);Fn(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,y=p.filter(function(h,m){return ff(p[m-1],p[m+1],h)?(f=m<=d?f-1:f,!1):!0});return{waypoints:y,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,y=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=KE(y,d.segmentStart,d.segmentEnd),vt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,rS)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,y=d.segmentStartIndex,h=d.segmentEndIndex,m=d.segmentStart,w=d.segmentEnd,g=d.axis,v=d.originalWaypoints.slice(),b=aS(m,g,p["d"+g]),E=aS(w,g,p["d"+g]),M=v.length,B=0;v[y]=b,v[h]=E;var A,L;y<2&&(A=$n(f.source,b),y===1?A==="intersect"&&(v.shift(),v[0]=b,B--):A!=="intersect"&&(v.unshift(m),B++)),h>M-3&&(L=$n(f.target,E),h===M-2?L==="intersect"&&(v.pop(),v[v.length-1]=E):L!=="intersect"&&v.push(w)),d.newWaypoints=f.waypoints=s(f,v),l(d,B,p),d.newSegmentStartIndex=y+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,oS)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,oS)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&gn(d.draggerGfx),n.removeMarker(f,rS)}),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,y=d.newWaypoints,h=d.newSegmentStartIndex;y=y.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(y,h),w=m.waypoints,g=s(f,w),v=m.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(f,g,b)})}lS.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var y5=Math.abs,uS=Math.round;function v5(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],y5(o-e)<=n)return o}function pS(e){return{x:e.x,y:e.y}}function dS(e){return{x:e.x+e.width,y:e.y+e.height}}function Ii(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:uS(e.x+e.width/2),y:uS(e.y+e.height/2)}}function ss(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function bn(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 fS(e){return e.children||[]}var x5=Math.abs,hS=Math.round,Ig=10;function gS(e){function t(r,a){if(et(r)){for(var s=r.length;s--;)if(x5(r[s]-a)<=Ig)return r[s]}else{r=+r;var c=a%r;if(c<Ig)return a-c;if(c>r-Ig)return a-c+r}return a}function n(r,a){if(r.waypoints)return u5(a,r);if(r.width)return{x:hS(r.width/2+r.x),y:hS(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,y=a.axis;if(s)return s;var h=[l[p-1],u,d,l[f+1]];return p<2&&h.unshift(n(c.source,r)),f>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},K(h,function(m){m&&(m=m.original||m,y==="y"&&s.horizontal.push(m.y),y==="x"&&s.vertical.push(m.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;te(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&bn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&bn(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:[]},K(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);!$t(s)||!c||!c.x||!c.y||(bn(r,"x",c.x),bn(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 y=u-d,h=p-f;te(r,{dx:r.dx-y,dy:r.dy-h,x:r.x-y,y:r.y-h}),(y||s.vertical.indexOf(u)!==-1)&&bn(r,"x",d),(h||s.horizontal.indexOf(p)!==-1)&&bn(r,"y",f)}})}gS.$inject=["eventBus"];const b5={__depends__:[Bo,fo],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",XE],bendpointMove:["type",Dg],bendpointMovePreview:["type",iS],connectionSegmentMove:["type",lS],bendpointSnapping:["type",gS]};function mS(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),!va(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!va(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,y={connectionStart:Bg(s)?u:l,connectionEnd:Bg(s)?l:u};En(c)&&(f=c),s.connection=n.connect(p,d,f,y)}),this.start=function(a,s,c,l){En(c)||(l=c,c=nt(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}mS.$inject=["eventBus","dragging","modeling","rules"];function Bg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var w5=1100,_5=900,yS="connect-ok",vS="connect-not-ok";function xS(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},y=d,h=f;Bg(r)&&(y=f,h=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:y,connectionEnd:h})}),t.on("connect.hover",_5,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?yS:vS)}),t.on(["connect.out","connect.cleanup"],w5,function(o){var r=o.hover;r&&(n.removeMarker(r,yS),n.removeMarker(r,vS))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}xS.$inject=["injector","eventBus","canvas"];const Ng={__depends__:[Oi,fo,Bo],__init__:["connectPreview"],connect:["type",mS],connectPreview:["type",xS]};var E5="djs-dragger";function zo(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)}zo.$inject=["injector","canvas","graphicsFactory","elementFactory"],zo.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,y=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ls(i),o||(o=e.getConnection=S5(function(h,m,w){return y.getConnection(h,m,w)})),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?nt(r):c,a?nt(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)"})},zo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||nt(n),r=t.connectionEnd||nt(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);ot(e,s)},zo.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&&Hs(r,s,!0)||e,t=i&&Hs(a,s,!1)||t,[e,t]},zo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&gn(e.connectionPreviewGfx)},zo.prototype.getConnection=function(e){var t=R5(e);return this._elementFactory.createConnection(t)},zo.prototype.createConnectionPreviewGfx=function(){var e=We("g");return Le(e,{pointerEvents:"none"}),vt(e).add(E5),ot(this._canvas.getActiveLayer(),e),e},zo.prototype.createNoopConnection=function(e,t){return Ns([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function S5(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 R5(e){return En(e)?e:{}}const M5={__init__:["connectionPreview"],connectionPreview:["type",zo]},xp="complex-preview";class bS{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(xp);n.filter(s=>!C5(s)).forEach(s=>{let c;$t(s)?(c=this._graphicsFactory._createContainer("connection",We("g")),this._graphicsFactory.drawConnection(ur(c),s)):(c=this._graphicsFactory._createContainer("shape",We("g")),this._graphicsFactory.drawShape(ur(c),s),Fn(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);$t(s)?Fn(l,c.x,c.y):Fn(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",We("g"));this._graphicsFactory.drawShape(ur(l),s,{width:c.width,height:c.height}),Fn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Ls(this._canvas.getLayer(xp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(xp)}hide(){this._canvas.hideLayer(xp)}}bS.$inject=["canvas","graphicsFactory","previewSupport"];function C5(e){return e.hidden}const A5={__depends__:[Ka],__init__:["complexPreview"],complexPreview:["type",bS]},wS=Math.round;function bp(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}bp.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(te({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;te(l,{x:u.x-wS(l.width/2),y:u.y-wS(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=>!va(f))})},bp.prototype.cleanUp=function(){this._complexPreview.cleanUp()},bp.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const P5={__depends__:[ju,A5,Qh],__init__:["appendPreview"],appendPreview:["type",bp]};var _S=Math.min,ES=Math.max;function $g(e){e.preventDefault()}function Ac(e){e.stopPropagation()}function T5(e){return e.nodeType===Node.TEXT_NODE}function k5(e){return[].slice.call(e)}function Ji(e){this.container=e.container,this.parent=Wt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=kt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=ei(this.autoResize,this),this.handlePaste=ei(this.handlePaste,this)}Ji.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=Vi(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);te(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=Vi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return te(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&te(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ke.bind(a,"keydown",this.keyHandler),Ke.bind(a,"mousedown",Ac),Ke.bind(a,"paste",o.handlePaste),Ke.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ke.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Ji.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)}},Ji.prototype.insertText=function(e){e=O5(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Ji.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=k5(a.childNodes),c,l;if(T5(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(y,h){h===d?y.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>d&&h<=f&&ao(y)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Ji.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})}},Ji.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=Wt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(y){$g(y),Ac(y),s=y.clientX,c=y.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ke.bind(document,"mousemove",d),Ke.bind(document,"mouseup",f)},d=function(y){$g(y),Ac(y);var h=_S(ES(l+y.clientX-s,i),r),m=_S(ES(u+y.clientY-c,o),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:l,height:u,dx:y.clientX-s,dy:y.clientY-c})},f=function(y){$g(y),Ac(y),Ke.unbind(document,"mousemove",d,!1),Ke.unbind(document,"mouseup",f,!1)};Ke.bind(n,"mousedown",p)}te(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)},Ji.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ke.unbind(t,"keydown",this.keyHandler),Ke.unbind(t,"mousedown",Ac),Ke.unbind(t,"input",this.autoResize),Ke.unbind(t,"paste",this.handlePaste),Ke.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),ao(n)),ao(e)},Ji.prototype.getValue=function(){return this.content.innerText.trim()},Ji.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Ji.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 O5(e){return e.replace(/\r\n|\r|\n/g,`
315
- `)}function gi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ji({container:t.getContainer(),keyHandler:ei(this._handleKey,this),resizeHandler:ei(this._handleResize,this),focusoutHandler:ei(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}gi.$inject=["eventBus","canvas"],gi.prototype.registerProvider=function(e){this._providers.push(e)},gi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},gi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},gi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},gi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},gi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},gi.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()}},gi.prototype.getValue=function(){return this._textbox.getValue()},gi.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()},gi.prototype._handleResize=function(e){this._fire("resize",e)},gi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},gi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ht(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 SS={__depends__:[mu],__init__:["directEditing"],directEditing:["type",gi]};function D5(e){return function(t){var n=t.target,i=Ee(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===xt(e);return!r||!a||!s||!c}}const L5={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 be(e,t={}){var n=L5[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var I5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start")],B5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"})],N5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-intermediate-catch"),be("message-intermediate-throw"),be("timer-intermediate-catch"),be("escalation-intermediate-throw"),be("conditional-intermediate-catch"),be("link-intermediate-catch"),be("link-intermediate-throw"),be("compensation-intermediate-throw"),be("signal-intermediate-catch"),be("signal-intermediate-throw")],$5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-end"),be("escalation-end"),be("error-end"),be("cancel-end"),be("compensation-end"),be("signal-end"),be("terminate-end")],F5=[be("exclusive-gateway"),be("parallel-gateway"),be("inclusive-gateway"),be("complex-gateway"),be("event-based-gateway")],j5=[be("transaction"),be("event-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("collapsed-subprocess")],H5=[be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("transaction"),be("event-subprocess"),be("collapsed-ad-hoc-subprocess")],RS=[be("transaction"),be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("event-subprocess")],G5=RS,MS=[be("task"),be("user-task"),be("service-task"),be("send-task"),be("receive-task"),be("manual-task"),be("rule-task"),be("script-task"),be("call-activity"),be("collapsed-subprocess"),be("expanded-subprocess"),be("collapsed-ad-hoc-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],z5=[be("data-store-reference")],V5=[be("data-object-reference")],W5=[be("message-boundary"),be("timer-boundary"),be("escalation-boundary"),be("conditional-boundary"),be("error-boundary"),be("cancel-boundary"),be("signal-boundary"),be("compensation-boundary"),be("non-interrupting-message-boundary"),be("non-interrupting-timer-boundary"),be("non-interrupting-escalation-boundary"),be("non-interrupting-conditional-boundary"),be("non-interrupting-signal-boundary")],U5=[be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start"),be("error-start"),be("escalation-start"),be("compensation-start"),be("non-interrupting-message-start"),be("non-interrupting-timer-start"),be("non-interrupting-conditional-start"),be("non-interrupting-signal-start"),be("non-interrupting-escalation-start")],q5=[{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"}],Y5=[be("expanded-pool"),be("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],K5={"bpmn:MessageEventDefinition":[be("message-start"),be("message-intermediate-catch"),be("message-intermediate-throw"),be("message-end")],"bpmn:TimerEventDefinition":[be("timer-start"),be("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[be("conditional-start"),be("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[be("signal-start"),be("signal-intermediate-catch"),be("signal-intermediate-throw"),be("signal-end")],"bpmn:ErrorEventDefinition":[be("error-start"),be("error-end")],"bpmn:EscalationEventDefinition":[be("escalation-start"),be("escalation-intermediate-throw"),be("escalation-end")],"bpmn:CompensateEventDefinition":[be("compensation-start"),be("compensation-intermediate-throw"),be("compensation-end")]};const CS={"start-event-non-interrupting":`
314
+ </svg>`},i5=900;function rs(e,t,n,i){e.registerProvider(i5,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}rs.$inject=["contextPad","popupMenu","translate","canvas"],rs.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},rs.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},rs.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${UE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);te(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},rs.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 o5=["left","center","right","top","middle","bottom"];function Mc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Mc.$inject=["popupMenu","alignElements","translate","rules"],Mc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},Mc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Mc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return K(o5,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:UE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function yp(e){ki.call(this,e)}yp.$inject=["eventBus"],je(yp,ki),yp.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=gt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=kl(n),n.length<2?!1:n})};const r5={__depends__:[m$,iE,Pg],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",rs],alignElementsMenuProvider:["type",Mc],bpmnAlignElements:["type",yp]};function as(e,t,n){this._canvas=n,this._opts=te({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()})}as.$inject=["config.autoScroll","eventBus","canvas"],as.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++)a5(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 a5(e,t,n){return t<e&&e<n}as.prototype.stopScroll=function(){clearTimeout(this._scrolling)},as.prototype.setOptions=function(e){this._opts=te({},this._opts,e)},as.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Jr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const s5={__depends__:[$o],__init__:["autoScroll"],autoScroll:["type",as]};var qE="djs-bendpoint",YE="djs-segment-dragger";function c5(e,t){var n=Jr(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 kg(e,t,n){var i=c5(e,n),o=jf(t,i);return o}function Og(e,t){var n=We("g");vt(n).add(qE),ot(e,n);var i=We("circle");Le(i,{cx:0,cy:0,r:4}),vt(i).add("djs-visual"),ot(n,i);var o=We("circle");return Le(o,{cx:0,cy:0,r:10}),vt(o).add("djs-hit"),ot(n,o),t&&vt(n).add(t),n}function l5(e,t,n,i){var o=We("g");ot(e,o);var r=18,a=6,s=11,c=p5(t,n,i),l=a+s,u=We("rect");Le(u,{x:-r/2,y:-a/2,width:r,height:a}),vt(u).add("djs-visual"),ot(o,u);var p=We("rect");return Le(p,{x:-c/2,y:-l/2,width:c,height:l}),vt(p).add("djs-hit"),ot(o,p),Xx(o,i==="v"?90:0),o}function KE(e,t,n){var i=We("g"),o=hf(t,n),r=Oo(t,n);return ot(e,i),l5(i,t,n,r),vt(i).add(YE),vt(i).add(r==="h"?"horizontal":"vertical"),Fn(i,o.x,o.y),i}function Dg(e){return Math.abs(Math.round(e*2/3))}function u5(e,t){var n=d5(e,t);return Uf(e,n)}function p5(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Dg(n==="h"?i:o)}function d5(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=Nb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function XE(e,t,n,i,o){function r(v,b,E){var M=v.index,B=v.point,A,L,H,V,G,ie;return M<=0||v.bendpoint?!1:(A=b[M-1],L=b[M],H=hf(A,L),V=Oo(A,L),G=Math.abs(B.x-H.x),ie=Math.abs(B.y-H.y),V&&G<=E&&ie<=E)}function a(v,b){var E=v.waypoints,M,B,A,L;return b.index<=0||b.bendpoint||(M={start:E[b.index-1],end:E[b.index]},B=Oo(M.start,M.end),!B)?null:(B==="h"?A=M.end.x-M.start.x:A=M.end.y-M.start.y,L=Dg(A)/2,L)}function s(v,b){var E=b.waypoints,M=kg(t,E,v),B;if(M){B=a(b,M);var A;if(r(M,E,B)?A=o.start(v,b,M.index):A=i.start(v,b,M.index,!M.bendpoint),A!==!1)return!0}}function c(v,b,E){Ke.bind(v,b,function(M){n.triggerMouseEvent(b,M,E),M.stopPropagation()})}function l(v,b){var E=t.getLayer("overlays"),M=kt('.djs-bendpoints[data-element-id="'+ra(v.id)+'"]',E);return!M&&b&&(M=We("g"),Le(M,{"data-element-id":v.id}),vt(M).add("djs-bendpoints"),ot(E,M),c(M,"mousedown",v),c(M,"click",v),c(M,"dblclick",v)),M}function u(v,b){return kt('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(E,M){var B=Og(v);ot(v,B),Fn(B,E.x,E.y)}),Og(v,"floating")}function d(v,b){for(var E=b.waypoints,M,B,A,L=1;L<E.length;L++)M=E[L-1],B=E[L],Oo(M,B)&&(A=KE(v,M,B),Le(A,{"data-segment-idx":L}),c(A,"mousemove",b))}function f(v){K(Ls("."+qE,v),function(b){mn(b)})}function y(v){K(Ls("."+YE,v),function(b){mn(b)})}function h(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function m(v){var b=l(v);b&&(y(b),f(b),d(b,v),p(b,v))}function w(v,b){var E=kt(".floating",v),M=b.point;E&&(Fn(E,M.x,M.y),vt(E).add("positioned"))}function g(v,b,E){var M=u(b.index,v),B=E[b.index-1],A=E[b.index],L=b.point,H=hf(B,A),V=Oo(B,A),G,ie;M&&(G=f5(M),ie={x:L.x-H.x,y:L.y-H.y},V==="v"&&(ie={x:ie.y,y:ie.x}),Fn(G,ie.x,ie.y))}e.on("connection.changed",function(v){m(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&mn(b)}),e.on("element.marker.update",function(v){var b=v.element,E;b.waypoints&&(E=h(b),v.add?vt(E).add(v.marker):vt(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=kg(t,E,v.originalEvent),!B)return;w(M,B),B.bendpoint||g(M,B,E)}}),e.on("element.mousedown",function(v){if(yr(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&&h(E)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&h(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var E=l(b);if(E){var M=kt(".floating",E);M&&vt(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=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}XE.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function f5(e){return kt(".djs-visual",e)}var ZE=Math.round,ca="reconnectStart",la="reconnectEnd",Cc="updateWaypoints";function Lg(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,y;!l&&c===0?y=ca:!l&&c===f.length-1?y=la:y=Cc;var h=y===Cc?"connection.updateWaypoints":"connection.reconnect",m=o.allowed(h,{connection:s,source:p,target:d});if(m===!1&&(m=o.allowed(h,{connection:s,source:d,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target:d,insert:l,type:y}}})},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 y=d===Cc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(y,{connection:c,source:d===ca?p:l,target:d===la?p:u}),f){s.source=d===ca?p:l,s.target=d===la?p:u;return}f===!1&&(f=s.allowed=o.allowed(y,{connection:c,source:d===la?p:u,target:d===ca?p:l})),f&&(s.source=d===la?p:u,s.target=d===ca?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!==Cc&&(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,y=s.target,h=s.type,m=s.hints||{},w={x:ZE(a.x),y:ZE(a.y)};if(!c)return!1;h===Cc?(p?d.splice(l,0,w):d[l]=w,m.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,Yk(d),m)):(h===ca?(m.docking="source",vp(s)&&(m.docking="target",m.newWaypoints=d.reverse())):h===la&&(m.docking="target",vp(s)&&(m.docking="source",m.newWaypoints=d.reverse())),r.reconnect(u,f,y,w,m))},this)}Lg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Lg.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 vp(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===ca)return t&&i&&t===i&&n!==i;if(o===la)return t&&n&&t===n&&n!==i}var h5="reconnectStart",g5="reconnectEnd",JE="updateWaypoints",Ac="connect-ok",xp="connect-not-ok",QE="connect-hover",eS="djs-updating",tS="djs-dragging",nS=1100;function iS(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=Og(i.getLayer("overlays"));vt(d).add("djs-dragging"),i.addMarker(c,tS),i.addMarker(c,eS)}),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,QE),l===JE)return;s?(i.removeMarker(c,xp),i.addMarker(c,Ac)):s===!1&&(i.removeMarker(c,Ac),i.addMarker(c,xp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],nS,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,QE),i.removeMarker(s,c?Ac:xp))}),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,y=d.target,h=d.waypoints.slice(),m={x:r.x,y:r.y},w=a.hints||{},g={};o&&(w.connectionStart&&(g.connectionStart=w.connectionStart),w.connectionEnd&&(g.connectionEnd=w.connectionEnd),p===h5?vp(a)?(g.connectionEnd=g.connectionEnd||m,g.source=y,g.target=u||f,h=h.reverse()):(g.connectionStart=g.connectionStart||m,g.source=u||f,g.target=y):p===g5?vp(a)?(g.connectionStart=g.connectionStart||m,g.source=u||y,g.target=f,h=h.reverse()):(g.connectionEnd=g.connectionEnd||m,g.source=f,g.target=u||y):(g.noCropping=!0,g.noLayout=!0,h[c]=m),p===JE&&(h=e.cropWaypoints(d,h)),g.waypoints=h,o.drawPreview(a,s,g)),Fn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],nS,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,mn(c),i.removeMarker(s,eS),i.removeMarker(s,tS),l&&(i.removeMarker(l,Ac),i.removeMarker(l,u?Ac:xp)),o&&o.cleanUp(a)})}iS.$inject=["bendpointMove","injector","eventBus","canvas"];var oS="connect-hover",rS="djs-updating";function aS(e,t,n){return Ig(e,t,e[t]+n)}function Ig(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function m5(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 Ig(t,i,s)}function sS(e){return e==="x"?"y":"x"}function cS(e,t,n){var i,o;return e.original?e.original:(i=nt(t),o=sS(n),Ig(e,o,i[o]))}function lS(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var y,h=n.getGraphics(d),m=f-1,w=f,g=d.waypoints,v=g[m],b=g[w],E=kg(n,g,p),M,B,A;if(M=Oo(v,b),!!M)return B=M==="v"?"x":"y",m===0&&(v=cS(v,d.source,B)),w===g.length-1&&(b=cS(b,d.target,B)),E?A=E.point:A={x:(v.x+b.x)/2,y:(v.y+b.y)/2},y={connection:d,segmentStartIndex:m,segmentEndIndex:w,segmentStart:v,segmentEnd:b,axis:B,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:h,context:y}})};function s(p,d){if(!a)return d;var f=p.waypoints,y;return p.waypoints=d,y=a.getCroppedWaypoints(p),p.waypoints=f,y}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var y=p.newWaypoints,h=p.segmentStartIndex+d,m=y[h],w=p.segmentEndIndex+d,g=y[w],v=sS(p.axis),b=m5(f,m,g,v);Fn(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,y=p.filter(function(h,m){return ff(p[m-1],p[m+1],h)?(f=m<=d?f-1:f,!1):!0});return{waypoints:y,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,y=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=KE(y,d.segmentStart,d.segmentEnd),vt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,rS)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,y=d.segmentStartIndex,h=d.segmentEndIndex,m=d.segmentStart,w=d.segmentEnd,g=d.axis,v=d.originalWaypoints.slice(),b=aS(m,g,p["d"+g]),E=aS(w,g,p["d"+g]),M=v.length,B=0;v[y]=b,v[h]=E;var A,L;y<2&&(A=$n(f.source,b),y===1?A==="intersect"&&(v.shift(),v[0]=b,B--):A!=="intersect"&&(v.unshift(m),B++)),h>M-3&&(L=$n(f.target,E),h===M-2?L==="intersect"&&(v.pop(),v[v.length-1]=E):L!=="intersect"&&v.push(w)),d.newWaypoints=f.waypoints=s(f,v),l(d,B,p),d.newSegmentStartIndex=y+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,oS)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,oS)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&mn(d.draggerGfx),n.removeMarker(f,rS)}),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,y=d.newWaypoints,h=d.newSegmentStartIndex;y=y.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(y,h),w=m.waypoints,g=s(f,w),v=m.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(f,g,b)})}lS.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var y5=Math.abs,uS=Math.round;function v5(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],y5(o-e)<=n)return o}function pS(e){return{x:e.x,y:e.y}}function dS(e){return{x:e.x+e.width,y:e.y+e.height}}function Ii(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:uS(e.x+e.width/2),y:uS(e.y+e.height/2)}}function ss(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function wn(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 fS(e){return e.children||[]}var x5=Math.abs,hS=Math.round,Bg=10;function gS(e){function t(r,a){if(et(r)){for(var s=r.length;s--;)if(x5(r[s]-a)<=Bg)return r[s]}else{r=+r;var c=a%r;if(c<Bg)return a-c;if(c>r-Bg)return a-c+r}return a}function n(r,a){if(r.waypoints)return u5(a,r);if(r.width)return{x:hS(r.width/2+r.x),y:hS(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,y=a.axis;if(s)return s;var h=[l[p-1],u,d,l[f+1]];return p<2&&h.unshift(n(c.source,r)),f>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},K(h,function(m){m&&(m=m.original||m,y==="y"&&s.horizontal.push(m.y),y==="x"&&s.vertical.push(m.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;te(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&wn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&wn(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:[]},K(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);!$t(s)||!c||!c.x||!c.y||(wn(r,"x",c.x),wn(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 y=u-d,h=p-f;te(r,{dx:r.dx-y,dy:r.dy-h,x:r.x-y,y:r.y-h}),(y||s.vertical.indexOf(u)!==-1)&&wn(r,"x",d),(h||s.horizontal.indexOf(p)!==-1)&&wn(r,"y",f)}})}gS.$inject=["eventBus"];const b5={__depends__:[$o,go],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",XE],bendpointMove:["type",Lg],bendpointMovePreview:["type",iS],connectionSegmentMove:["type",lS],bendpointSnapping:["type",gS]};function mS(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),!va(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!va(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,y={connectionStart:Ng(s)?u:l,connectionEnd:Ng(s)?l:u};Sn(c)&&(f=c),s.connection=n.connect(p,d,f,y)}),this.start=function(a,s,c,l){Sn(c)||(l=c,c=nt(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}mS.$inject=["eventBus","dragging","modeling","rules"];function Ng(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var w5=1100,_5=900,yS="connect-ok",vS="connect-not-ok";function xS(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},y=d,h=f;Ng(r)&&(y=f,h=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:y,connectionEnd:h})}),t.on("connect.hover",_5,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?yS:vS)}),t.on(["connect.out","connect.cleanup"],w5,function(o){var r=o.hover;r&&(n.removeMarker(r,yS),n.removeMarker(r,vS))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}xS.$inject=["injector","eventBus","canvas"];const $g={__depends__:[Oi,go,$o],__init__:["connectPreview"],connect:["type",mS],connectPreview:["type",xS]};var E5="djs-dragger";function Wo(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)}Wo.$inject=["injector","canvas","graphicsFactory","elementFactory"],Wo.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,y=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Is(i),o||(o=e.getConnection=S5(function(h,m,w){return y.getConnection(h,m,w)})),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?nt(r):c,a?nt(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)"})},Wo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||nt(n),r=t.connectionEnd||nt(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);ot(e,s)},Wo.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&&Gs(r,s,!0)||e,t=i&&Gs(a,s,!1)||t,[e,t]},Wo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&mn(e.connectionPreviewGfx)},Wo.prototype.getConnection=function(e){var t=R5(e);return this._elementFactory.createConnection(t)},Wo.prototype.createConnectionPreviewGfx=function(){var e=We("g");return Le(e,{pointerEvents:"none"}),vt(e).add(E5),ot(this._canvas.getActiveLayer(),e),e},Wo.prototype.createNoopConnection=function(e,t){return $s([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function S5(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 R5(e){return Sn(e)?e:{}}const M5={__init__:["connectionPreview"],connectionPreview:["type",Wo]},bp="complex-preview";class bS{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(bp);n.filter(s=>!C5(s)).forEach(s=>{let c;$t(s)?(c=this._graphicsFactory._createContainer("connection",We("g")),this._graphicsFactory.drawConnection(dr(c),s)):(c=this._graphicsFactory._createContainer("shape",We("g")),this._graphicsFactory.drawShape(dr(c),s),Fn(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);$t(s)?Fn(l,c.x,c.y):Fn(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",We("g"));this._graphicsFactory.drawShape(dr(l),s,{width:c.width,height:c.height}),Fn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Is(this._canvas.getLayer(bp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(bp)}hide(){this._canvas.hideLayer(bp)}}bS.$inject=["canvas","graphicsFactory","previewSupport"];function C5(e){return e.hidden}const A5={__depends__:[Ka],__init__:["complexPreview"],complexPreview:["type",bS]},wS=Math.round;function wp(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}wp.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(te({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;te(l,{x:u.x-wS(l.width/2),y:u.y-wS(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=>!va(f))})},wp.prototype.cleanUp=function(){this._complexPreview.cleanUp()},wp.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const T5={__depends__:[Hu,A5,eg],__init__:["appendPreview"],appendPreview:["type",wp]};var _S=Math.min,ES=Math.max;function Fg(e){e.preventDefault()}function Tc(e){e.stopPropagation()}function P5(e){return e.nodeType===Node.TEXT_NODE}function k5(e){return[].slice.call(e)}function Qi(e){this.container=e.container,this.parent=Wt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=kt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=ei(this.autoResize,this),this.handlePaste=ei(this.handlePaste,this)}Qi.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=Vi(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);te(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=Vi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return te(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&te(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ke.bind(a,"keydown",this.keyHandler),Ke.bind(a,"mousedown",Tc),Ke.bind(a,"paste",o.handlePaste),Ke.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ke.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Qi.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)}},Qi.prototype.insertText=function(e){e=O5(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Qi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=k5(a.childNodes),c,l;if(P5(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(y,h){h===d?y.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>d&&h<=f&&so(y)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Qi.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})}},Qi.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=Wt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(y){Fg(y),Tc(y),s=y.clientX,c=y.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ke.bind(document,"mousemove",d),Ke.bind(document,"mouseup",f)},d=function(y){Fg(y),Tc(y);var h=_S(ES(l+y.clientX-s,i),r),m=_S(ES(u+y.clientY-c,o),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:l,height:u,dx:y.clientX-s,dy:y.clientY-c})},f=function(y){Fg(y),Tc(y),Ke.unbind(document,"mousemove",d,!1),Ke.unbind(document,"mouseup",f,!1)};Ke.bind(n,"mousedown",p)}te(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)},Qi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ke.unbind(t,"keydown",this.keyHandler),Ke.unbind(t,"mousedown",Tc),Ke.unbind(t,"input",this.autoResize),Ke.unbind(t,"paste",this.handlePaste),Ke.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),so(n)),so(e)},Qi.prototype.getValue=function(){return this.content.innerText.trim()},Qi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Qi.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 O5(e){return e.replace(/\r\n|\r|\n/g,`
315
+ `)}function gi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Qi({container:t.getContainer(),keyHandler:ei(this._handleKey,this),resizeHandler:ei(this._handleResize,this),focusoutHandler:ei(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}gi.$inject=["eventBus","canvas"],gi.prototype.registerProvider=function(e){this._providers.push(e)},gi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},gi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},gi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},gi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},gi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},gi.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()}},gi.prototype.getValue=function(){return this._textbox.getValue()},gi.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()},gi.prototype._handleResize=function(e){this._fire("resize",e)},gi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},gi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ht(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 SS={__depends__:[yu],__init__:["directEditing"],directEditing:["type",gi]};function D5(e){return function(t){var n=t.target,i=Ee(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===xt(e);return!r||!a||!s||!c}}const L5={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 be(e,t={}){var n=L5[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var I5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start")],B5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"})],N5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-intermediate-catch"),be("message-intermediate-throw"),be("timer-intermediate-catch"),be("escalation-intermediate-throw"),be("conditional-intermediate-catch"),be("link-intermediate-catch"),be("link-intermediate-throw"),be("compensation-intermediate-throw"),be("signal-intermediate-catch"),be("signal-intermediate-throw")],$5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-end"),be("escalation-end"),be("error-end"),be("cancel-end"),be("compensation-end"),be("signal-end"),be("terminate-end")],F5=[be("exclusive-gateway"),be("parallel-gateway"),be("inclusive-gateway"),be("complex-gateway"),be("event-based-gateway")],j5=[be("transaction"),be("event-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("collapsed-subprocess")],H5=[be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("transaction"),be("event-subprocess"),be("collapsed-ad-hoc-subprocess")],RS=[be("transaction"),be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("event-subprocess")],G5=RS,MS=[be("task"),be("user-task"),be("service-task"),be("send-task"),be("receive-task"),be("manual-task"),be("rule-task"),be("script-task"),be("call-activity"),be("collapsed-subprocess"),be("expanded-subprocess"),be("collapsed-ad-hoc-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],z5=[be("data-store-reference")],V5=[be("data-object-reference")],W5=[be("message-boundary"),be("timer-boundary"),be("escalation-boundary"),be("conditional-boundary"),be("error-boundary"),be("cancel-boundary"),be("signal-boundary"),be("compensation-boundary"),be("non-interrupting-message-boundary"),be("non-interrupting-timer-boundary"),be("non-interrupting-escalation-boundary"),be("non-interrupting-conditional-boundary"),be("non-interrupting-signal-boundary")],U5=[be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start"),be("error-start"),be("escalation-start"),be("compensation-start"),be("non-interrupting-message-start"),be("non-interrupting-timer-start"),be("non-interrupting-conditional-start"),be("non-interrupting-signal-start"),be("non-interrupting-escalation-start")],q5=[{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"}],Y5=[be("expanded-pool"),be("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],K5={"bpmn:MessageEventDefinition":[be("message-start"),be("message-intermediate-catch"),be("message-intermediate-throw"),be("message-end")],"bpmn:TimerEventDefinition":[be("timer-start"),be("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[be("conditional-start"),be("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[be("signal-start"),be("signal-intermediate-catch"),be("signal-intermediate-throw"),be("signal-end")],"bpmn:ErrorEventDefinition":[be("error-start"),be("error-end")],"bpmn:EscalationEventDefinition":[be("escalation-start"),be("escalation-intermediate-throw"),be("escalation-end")],"bpmn:CompensateEventDefinition":[be("compensation-start"),be("compensation-intermediate-throw"),be("compensation-end")]};const CS={"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 Bi(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()}Bi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Bi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Bi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(et(e)||!n.allowed("shape.replace",{element:e}))return{};var a=D5(e);return P(t,"bpmn:DataObjectReference")?this._createEntries(e,z5):P(t,"bpmn:DataStoreReference")&&!P(e.parent,"bpmn:Collaboration")?this._createEntries(e,V5):(P(t,"bpmn:Event")&&!P(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=K5[o]||[],!Kn(t.$parent)&&P(t.$parent,"bpmn:SubProcess")&&(i=gt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),P(t,"bpmn:StartEvent")&&!P(t.$parent,"bpmn:SubProcess")?(r=gt(I5.concat(i),a),this._createEntries(e,r)):P(t,"bpmn:Participant")?(r=gt(Y5,function(c){return xt(e)!==c.target.isExpanded}),this._createEntries(e,r)):P(t,"bpmn:StartEvent")&&Kn(t.$parent)?(r=gt(U5.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)):P(t,"bpmn:StartEvent")&&!Kn(t.$parent)&&P(t.$parent,"bpmn:SubProcess")?(r=gt(B5.concat(i),a),this._createEntries(e,r)):P(t,"bpmn:EndEvent")?(r=gt($5.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!P(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):P(t,"bpmn:BoundaryEvent")?(r=gt(W5,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!P(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)):P(t,"bpmn:IntermediateCatchEvent")||P(t,"bpmn:IntermediateThrowEvent")?(r=gt(N5.concat(i),a),this._createEntries(e,r)):P(t,"bpmn:Gateway")?(r=gt(F5,a),this._createEntries(e,r)):P(t,"bpmn:Transaction")?(r=gt(RS,a),this._createEntries(e,r)):Kn(t)&&xt(e)?(r=gt(G5,a),this._createEntries(e,r)):P(t,"bpmn:AdHocSubProcess")&&xt(e)?(r=gt(H5,a),this._createEntries(e,r)):P(t,"bpmn:SubProcess")&&xt(e)?(r=gt(j5,a),this._createEntries(e,r)):P(t,"bpmn:SubProcess")&&!xt(e)?(r=gt(MS,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):P(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,q5):P(t,"bpmn:FlowNode")?(r=gt(MS,a),this._createEntries(e,r)):{})},Bi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return P(e,"bpmn:Activity")&&!Kn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),P(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),P(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Jb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Bi.prototype._createEntries=function(e,t){var n={},i=this;return K(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Bi.prototype._createSequenceFlowEntries=function(e,t){var n=Ee(e),i={},o=this._modeling,r=this._moddle,a=this;return K(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(P(n.sourceRef,"bpmn:ExclusiveGateway")||P(n.sourceRef,"bpmn:InclusiveGateway")||P(n.sourceRef,"bpmn:ComplexGateway")||P(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&&P(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:P(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(P(n.sourceRef,"bpmn:ExclusiveGateway")||P(n.sourceRef,"bpmn:InclusiveGateway")||P(n.sourceRef,"bpmn:ComplexGateway")||P(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},Bi.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}},Bi.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&&P(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=Ee(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"}}}},Bi.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}}},Bi.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}}},Bi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ee(e),i=this,o=Qb(e),r=P(e,"bpmn:BoundaryEvent")?CS["intermediate-event-non-interrupting"]:CS["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 X5={__depends__:[Pg,x_,ju],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Bi]};function Pc(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 y=f.context,h=y.shape;if(!(!ec(f)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(f,h)}}),n.on("contextPad.close",function(){d.cleanUp()})}Pc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Pc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&te(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},Pc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return et(t)?qo(e,n=>t.includes(n)):t},Pc.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])&&te(u,y()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function y(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function h(v){var b=5,E=t.getPad(v).html,M=E.getBoundingClientRect(),B={x:M.left,y:M.bottom+b};return B}function m(v,b,E,M){function B(H,V){var G=i.createShape(te({type:v},M));r.start(H,G,{source:V})}var A=s?function(H,V){var G=i.createShape(te({type:v},M));s.append(V,G)}:B,L=s?function(H,V){return l.create(V,v,M),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:B,click:A,hover:L}}}function w(v){return function(b,E){n.splitLane(E,v),t.open(E,!0)}}if(ht(p,["bpmn:Lane","bpmn:Participant"])&&xt(e)){var g=hr(e);te(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")}}}}),g.length<2&&((An(e)?e.height>=120:e.width>=120)&&te(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(An(e)?e.height>=180:e.width>=180)&&te(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),te(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 P(p,"bpmn:FlowNode")&&(P(p,"bpmn:EventBasedGateway")?te(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):AS(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?te(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!P(p,"bpmn:EndEvent")&&!p.isForCompensation&&!AS(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Kn(p)&&te(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||te(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var E=te(h(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})}}}}),P(p,"bpmn:SequenceFlow")&&te(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),P(p,"bpmn:MessageFlow")&&te(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ht(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(u,{"append.text-annotation":m("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}}}),P(p,"bpmn:TextAnnotation")&&te(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),ht(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),P(p,"bpmn:Group")&&te(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&te(u,y()),u};function AS(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return K(r,function(a){a.$type===n&&(o=!0)}),i&&o}const Z5={__depends__:[P5,SS,iE,Oi,Ng,vu,X5],__init__:["contextPadProvider"],contextPadProvider:["type",Pc]};var J5={horizontal:["x","width"],vertical:["y","height"]},PS=5;function Vo(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return et(i)?i:i?n:[]})}Vo.$inject=["modeling","rules"],Vo.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vo.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},Vo.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(K(t,function(r){o=r(o,n,i)}),o):e},Vo.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=to(e,i);return K(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},Vo.prototype._setOrientation=function(e){var t=J5[e];this._axis=t[0],this._dimension=t[1]},Vo.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)},Vo.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+PS,max:t+n-PS}};const Q5={__init__:["distributeElements"],distributeElements:["type",Vo]};function wp(e){ki.call(this,e)}wp.$inject=["eventBus"],je(wp,ki),wp.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=gt(t,function(n){var i=ht(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Tl(t),t.length<3?!1:t})};var TS={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
326
+ </svg>`};function Bi(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()}Bi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Bi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Bi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(et(e)||!n.allowed("shape.replace",{element:e}))return{};var a=D5(e);return T(t,"bpmn:DataObjectReference")?this._createEntries(e,z5):T(t,"bpmn:DataStoreReference")&&!T(e.parent,"bpmn:Collaboration")?this._createEntries(e,V5):(T(t,"bpmn:Event")&&!T(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=K5[o]||[],!Kn(t.$parent)&&T(t.$parent,"bpmn:SubProcess")&&(i=gt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),T(t,"bpmn:StartEvent")&&!T(t.$parent,"bpmn:SubProcess")?(r=gt(I5.concat(i),a),this._createEntries(e,r)):T(t,"bpmn:Participant")?(r=gt(Y5,function(c){return xt(e)!==c.target.isExpanded}),this._createEntries(e,r)):T(t,"bpmn:StartEvent")&&Kn(t.$parent)?(r=gt(U5.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)):T(t,"bpmn:StartEvent")&&!Kn(t.$parent)&&T(t.$parent,"bpmn:SubProcess")?(r=gt(B5.concat(i),a),this._createEntries(e,r)):T(t,"bpmn:EndEvent")?(r=gt($5.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!T(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):T(t,"bpmn:BoundaryEvent")?(r=gt(W5,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!T(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)):T(t,"bpmn:IntermediateCatchEvent")||T(t,"bpmn:IntermediateThrowEvent")?(r=gt(N5.concat(i),a),this._createEntries(e,r)):T(t,"bpmn:Gateway")?(r=gt(F5,a),this._createEntries(e,r)):T(t,"bpmn:Transaction")?(r=gt(RS,a),this._createEntries(e,r)):Kn(t)&&xt(e)?(r=gt(G5,a),this._createEntries(e,r)):T(t,"bpmn:AdHocSubProcess")&&xt(e)?(r=gt(H5,a),this._createEntries(e,r)):T(t,"bpmn:SubProcess")&&xt(e)?(r=gt(j5,a),this._createEntries(e,r)):T(t,"bpmn:SubProcess")&&!xt(e)?(r=gt(MS,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):T(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,q5):T(t,"bpmn:FlowNode")?(r=gt(MS,a),this._createEntries(e,r)):{})},Bi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return T(e,"bpmn:Activity")&&!Kn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),T(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),T(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Jb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Bi.prototype._createEntries=function(e,t){var n={},i=this;return K(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Bi.prototype._createSequenceFlowEntries=function(e,t){var n=Ee(e),i={},o=this._modeling,r=this._moddle,a=this;return K(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(T(n.sourceRef,"bpmn:ExclusiveGateway")||T(n.sourceRef,"bpmn:InclusiveGateway")||T(n.sourceRef,"bpmn:ComplexGateway")||T(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&&T(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:T(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(T(n.sourceRef,"bpmn:ExclusiveGateway")||T(n.sourceRef,"bpmn:InclusiveGateway")||T(n.sourceRef,"bpmn:ComplexGateway")||T(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},Bi.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}},Bi.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&&T(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=Ee(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"}}}},Bi.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}}},Bi.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}}},Bi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ee(e),i=this,o=Qb(e),r=T(e,"bpmn:BoundaryEvent")?CS["intermediate-event-non-interrupting"]:CS["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 X5={__depends__:[Pg,x_,Hu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Bi]};function Pc(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 y=f.context,h=y.shape;if(!(!tc(f)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(f,h)}}),n.on("contextPad.close",function(){d.cleanUp()})}Pc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Pc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&te(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},Pc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return et(t)?Ko(e,n=>t.includes(n)):t},Pc.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])&&te(u,y()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function y(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function h(v){var b=5,E=t.getPad(v).html,M=E.getBoundingClientRect(),B={x:M.left,y:M.bottom+b};return B}function m(v,b,E,M){function B(H,V){var G=i.createShape(te({type:v},M));r.start(H,G,{source:V})}var A=s?function(H,V){var G=i.createShape(te({type:v},M));s.append(V,G)}:B,L=s?function(H,V){return l.create(V,v,M),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:B,click:A,hover:L}}}function w(v){return function(b,E){n.splitLane(E,v),t.open(E,!0)}}if(ht(p,["bpmn:Lane","bpmn:Participant"])&&xt(e)){var g=gr(e);te(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")}}}}),g.length<2&&((Tn(e)?e.height>=120:e.width>=120)&&te(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(Tn(e)?e.height>=180:e.width>=180)&&te(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),te(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 T(p,"bpmn:FlowNode")&&(T(p,"bpmn:EventBasedGateway")?te(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):AS(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?te(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!T(p,"bpmn:EndEvent")&&!p.isForCompensation&&!AS(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Kn(p)&&te(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||te(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var E=te(h(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})}}}}),T(p,"bpmn:SequenceFlow")&&te(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),T(p,"bpmn:MessageFlow")&&te(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ht(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(u,{"append.text-annotation":m("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}}}),T(p,"bpmn:TextAnnotation")&&te(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),ht(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),T(p,"bpmn:Group")&&te(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&te(u,y()),u};function AS(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return K(r,function(a){a.$type===n&&(o=!0)}),i&&o}const Z5={__depends__:[T5,SS,iE,Oi,$g,xu,X5],__init__:["contextPadProvider"],contextPadProvider:["type",Pc]};var J5={horizontal:["x","width"],vertical:["y","height"]},TS=5;function Uo(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return et(i)?i:i?n:[]})}Uo.$inject=["modeling","rules"],Uo.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Uo.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},Uo.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(K(t,function(r){o=r(o,n,i)}),o):e},Uo.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=no(e,i);return K(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},Uo.prototype._setOrientation=function(e){var t=J5[e];this._axis=t[0],this._dimension=t[1]},Uo.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)},Uo.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+TS,max:t+n-TS}};const Q5={__init__:["distributeElements"],distributeElements:["type",Uo]};function _p(e){ki.call(this,e)}_p.$inject=["eventBus"],je(_p,ki),_p.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=gt(t,function(n){var i=ht(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=kl(t),t.length<3?!1:t})};var PS={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>`},e3=900;function Tc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",e3,this)}Tc.$inject=["popupMenu","distributeElements","translate","rules"],Tc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},Tc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Tc.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,o={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:TS.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:TS.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const t3={__depends__:[Pg,Q5],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",wp],distributeElementsMenuProvider:["type",Tc]};var kS="is not a registered action",n3="is already registered";function Ni(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ni.$inject=["eventBus","injector"],Ni.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=et(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&&(et(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)})},Ni.prototype.trigger=function(e,t){if(!this._actions[e])throw Fg(e,kS);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ni.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);K(e,function(i,o){n._registerAction(o,i)})},Ni.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Fg(e,n3);this._actions[e]=t},Ni.prototype.unregister=function(e){if(!this.isRegistered(e))throw Fg(e,kS);this._actions[e]=void 0},Ni.prototype.getActions=function(){return Object.keys(this._actions)},Ni.prototype.isRegistered=function(e){return!!this._actions[e]};function Fg(e,t){return new Error(e+" "+t)}const i3={__init__:["editorActions"],editorActions:["type",Ni]};function _p(e){e.invoke(Ni,this)}je(_p,Ni),_p.$inject=["injector"],_p.prototype._registerDefaultActions=function(e){Ni.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 y=t.getRootElement(),h=n.filter(function(m){return m!==y});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(y){var h=i.get(),m=y.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(y){var h=i.get(),m=[],w=y.type;h.length&&(m=gt(h,function(g){return!P(g,"bpmn:Lane")}),l.trigger(m,w))}),i&&d&&this._registerAction("setColor",function(y){var h=i.get();h.length&&d.setColor(h,y)}),i&&u&&this._registerAction("directEditing",function(){var y=i.get();y.length&&u.activate(y[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&d&&this._registerAction("moveToOrigin",function(){var y=t.getRootElement(),h,m;P(y,"bpmn:Collaboration")?m=n.filter(function(w){return P(w.parent,"bpmn:Collaboration")}):m=n.filter(function(w){return w!==y&&!P(w.parent,"bpmn:SubProcess")}),h=mn(m),d.moveElements(m,{x:-h.x,y:-h.y},y)}),i&&f&&this._registerAction("replaceElement",function(y){f.triggerEntry("replace","click",y)})};const o3={__depends__:[i3],editorActions:["type",_p]};function OS(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ht(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}OS.$inject=["eventBus"];function ua(e,t){we.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;oi(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}ua.$inject=["eventBus","gridSnapping","modeling"],je(ua,we),ua.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},ua.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},ua.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),te(e,r),e},ua.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),te(e,r),e};var r3=2e3;function DS(e,t){e.on(["spaceTool.move","spaceTool.end"],r3,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)}})}DS.$inject=["eventBus","gridSnapping"];const a3={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ua],gridSnappingSpaceToolBehavior:["type",DS]};var Ep=10;function jg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var s3=1200,c3=800;function Cr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",c3,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"],s3,function(r){var a=r.originalEvent;if(!(!o.active||a&&pi(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=u3(r,l,e);p&&(u.offset=p);var d=l3(r,l);d&&te(u,d),ss(r,l)||o.snapEvent(r,l,u)})}})}Cr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);bn(e,t,i)},Cr.prototype.getGridSpacing=function(){return Ep},Cr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=jg(e,Ep);var i,o;return t&&t.min&&(i=t.min,tt(i)&&(i=jg(i+n,Ep,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,tt(o)&&(o=jg(o+n,Ep,"floor"),e=Math.min(e,o))),e-=n,e},Cr.prototype.isActive=function(){return this.active},Cr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Cr.prototype.toggleActive=function(){this.setActive(!this.active)},Cr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function l3(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&&(Sp(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&&(Sp(t)?IS(s)?a.x.max=c.left:a.x.min=c.right:LS(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Sp(t)?IS(s)?a.x.min=l.left:a.x.max=l.right:LS(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function u3(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&tt(s[t])||(s||(s=r.snapOffset={}),tt(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Sp(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 Sp(e){return e==="x"}function LS(e){return e.indexOf("n")!==-1}function IS(e){return e.indexOf("w")!==-1}const p3={__depends__:[a3],__init__:["gridSnapping"],gridSnapping:["type",Cr]};var d3=1750;function BS(e,t,n){t.on(["create.start","shape.move.start"],d3,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!P(r,"bpmn:Participant")||!P(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}))}})}BS.$inject=["canvas","eventBus","gridSnapping"];const f3={__depends__:[p3,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",cg],gridSnappingParticipantBehavior:["type",BS],gridSnappingLayoutConnectionBehavior:["type",Qa]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",OS]};var h3=30,NS=30;function kc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(P(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(P(o,"bpmn:Participant"))return xt(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(P(o,"bpmn:SubProcess"))return xt(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}kc.$inject=["eventBus","interactionEvents"],kc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},kc.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=An(e)?{width:h3,height:e.height}:{width:e.width,height:NS};return this._interactionEvents.createBoxHit(t,"all",n),!0},kc.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:NS}),!0};const g3={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",kc]};function Rp(e){e.invoke(es,this)}je(Rp,es),Rp.$inject=["injector"],Rp.prototype.registerBindings=function(e,t){es.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 m3={__depends__:[hg],__init__:["keyboardBindings"],keyboardBindings:["type",Rp]};var y3={moveSpeed:1,moveSpeedAccelerated:10},v3=1500,$S="left",FS="up",jS="right",HS="down",x3={ArrowLeft:$S,Left:$S,ArrowUp:FS,Up:FS,ArrowRight:jS,Right:jS,ArrowDown:HS,Down:HS},b3={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 GS(e,t,n,i,o){var r=this;this._config=te({},y3,e||{}),t.addListener(v3,function(a){var s=a.keyEvent,c=x3[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=b3[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}GS.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const w3={__depends__:[hg,Oi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",GS]};var zS=10;function Oc(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=jO(u,p,l),c.newBounds=GO(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:Ze(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Ix(p),!_3(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)})}Oc.prototype.canResize=function(e){var t=this._rules,n=Vi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Oc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=te({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,VS(t,r),"resize",{autoActivate:!0,cursor:E3(r),data:{shape:t,context:o}})},Oc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:zS,height:zS},o=Sb(t,e.childrenBoxPadding),zO(n,t,i,o)},Oc.$inject=["eventBus","rules","modeling","dragging"];function _3(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function VS(e,t){var n=nt(e),i=Ze(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 E3(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 WS="djs-resizing",US="resize-not-ok",S3=500;function qS(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,WS)),s.width>5&&Le(c,{x:s.x,width:s.width}),s.height>5&&Le(c,{y:s.y,height:s.height}),r.canExecute?vt(c).remove(US):vt(c).add(US)}function o(r){var a=r.shape,s=r.frame;s&&gn(r.frame),t.removeMarker(a,WS)}e.on("resize.move",S3,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}qS.$inject=["eventBus","canvas","previewSupport"];var Mp=-6,Cp=8,Ap=20,Dc="djs-resizer",R3=["n","w","s","e","nw","ne","se","sw"];function Ar(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&&K(a,ei(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}Ar.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){mr(r)&&i.activate(r,e,n)}Ke.bind(t,"mousedown",o),Ke.bind(t,"touchstart",o)},Ar.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=M3(i),a=We("g");vt(a).add(Dc),vt(a).add(Dc+"-"+e.id),vt(a).add(Dc+"-"+i),ot(o,a);var s=We("rect");Le(s,{x:-Cp/2+r.x,y:-Cp/2+r.y,width:Cp,height:Cp}),vt(s).add(Dc+"-visual"),ot(a,s);var c=We("rect");return Le(c,{x:-Ap/2+r.x,y:-Ap/2+r.y,width:Ap,height:Ap}),vt(c).add(Dc+"-hit"),ot(a,c),Bl(a,t,n),a},Ar.prototype.createResizer=function(e,t){var n=VS(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Ar.prototype.addResizer=function(e){var t=this;$t(e)||K(R3,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Ar.prototype.removeResizers=function(){var e=this._getResizersParent();Ls(e)},Ar.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Ar.$inject=["eventBus","canvas","selection","resize"];function M3(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Mp:e.indexOf("w")!==-1&&(t.x=Mp),e.indexOf("s")!==-1?t.y=-Mp:e.indexOf("n")!==-1&&(t.y=Mp),t}const YS={__depends__:[fo,Bo,Ka],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Oc],resizePreview:["type",qS],resizeHandles:["type",Ar]};var C3=2e3;function Lc(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],C3,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||ht(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Lc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Lc.prototype.activate=function(e){var t=li(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);te(n,i);var o={},r=n.style||{};return te(r,{backgroundColor:null,border:null}),(ht(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||KS(e))&&te(o,{centerVertically:!0}),dr(e)&&(te(o,{resizable:!0,autoResize:!0}),te(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),P(e,"bpmn:TextAnnotation")&&(te(o,{resizable:!0,autoResize:!0}),te(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),te(n,{options:o,style:r}),n}},Lc.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,d=s.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(P(e,"bpmn:Lane")||T3(e)){var y=An(e),h=y?{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};te(r,h),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?"rotate(-90deg)":null})}if(P3(e)){var m=An(e),w=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};te(r,w),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ht(e,["bpmn:Task","bpmn:CallActivity"])||KS(e))&&(te(r,{width:i.width,height:i.height}),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),A3(e)&&(te(r,{width:i.width,x:i.x}),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var g=1,v=i.width+2*g;if(n.labelTarget&&(te(r,{width:v,height:i.height+2*g,x:i.x-g,y:i.y-g}),te(f,{fontSize:l+"px",lineHeight:u})),dr(n)&&!Fl(n)&&!ft(n)){var b=vf(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),M=l,B=Xr.width*a+2*g;te(r,{width:B,height:M+2*g,x:E.x-B/2,y:E.y-M/2-g}),te(f,{fontSize:l+"px",lineHeight:u})}return P(e,"bpmn:TextAnnotation")&&(te(r,{width:i.width+2*g,height:i.height+2*g,x:i.x-g,y:i.y-g,minWidth:30*a,minHeight:10*a}),te(f,{textAlign:"left",paddingTop:Na*a+"px",paddingBottom:Na*a+"px",paddingLeft:Na*a+"px",paddingRight:Na*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Lc.prototype.update=function(e,t,n,i){var o,r;P(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}),k3(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function KS(e){return P(e,"bpmn:SubProcess")&&!xt(e)}function A3(e){return P(e,"bpmn:SubProcess")&&xt(e)}function P3(e){return P(e,"bpmn:Participant")&&!xt(e)}function T3(e){return P(e,"bpmn:Participant")&&xt(e)}function k3(e){return!e||!e.trim()}var XS="djs-element-hidden",ZS="djs-label-hidden";function JS(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,P(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=We("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=We("path");Le(p,{d:u,strokeWidth:2,stroke:O3(r)}),ot(s,p),ot(o,s),Fn(s,r.x,r.y)}P(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,XS):(P(r,"bpmn:Task")||P(r,"bpmn:CallActivity")||P(r,"bpmn:SubProcess")||P(r,"bpmn:Participant")||P(r,"bpmn:Lane"))&&t.addMarker(r,ZS)}),e.on("directEditing.resize",function(c){if(P(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,XS),t.removeMarker(r,ZS)),r=void 0,a=void 0,s&&(gn(s),s=void 0)})}JS.$inject=["eventBus","canvas","pathMap"];function O3(e,t){var n=wt(e);return n.get("stroke")||t||"black"}const D3={__depends__:[Bh,YS,SS],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Lc],labelEditingPreview:["type",JS]};var L3=500,I3=1e3;function yo(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){Vk(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){K(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],L3,function(r){var a=r.element,s=r.gfx,c=kt(".djs-outline",s);c&&i.updateOutline(a,c)})}yo.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=kt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ot(t,n),this.updateOutline(e,n)),n},yo.prototype._createOutlineGfx=function(){var e=We("rect");return Le(e,te({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},yo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},yo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&K(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})},yo.prototype.updateConnectionOutline=function(e,t){var n=mn(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})},yo.prototype.registerProvider=function(e,t){t||(t=e,e=I3),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},yo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},yo.prototype.getOutline=function(e){var t,n=this._getProviders();return K(n,function(i){Cn(i.getOutline)&&(t=t||i.getOutline(e))}),t},yo.$inject=["eventBus","styles","elementRegistry"];var Pp=6;function Hg(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)})}Hg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ls(t);var n=e.length>1,i=this._canvas.getContainer();if(vt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=B3(mn(e)),r=We("rect");Le(r,te({rx:3},o)),vt(r).add("djs-selection-outline"),ot(t,r)}},Hg.$inject=["eventBus","canvas","selection"];function B3(e){return{x:e.x-Pp,y:e.y-Pp,width:e.width+Pp*2,height:e.height+Pp*2}}const Gg={__depends__:[Oi],__init__:["outline","multiSelectionOutline"],outline:["type",yo],multiSelectionOutline:["type",Hg]},QS=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],e1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},N3=15,Tp=2;function t1(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(y=>ht(y,QS));if(d.length===1){const y=d[0];ft(y)?a(y,y.labelTarget):(f=y.labels)!=null&&f.length&&a(y.labels[0],y)}if(d.length===2){const y=d.find(ft),h=d.find(m=>{var w;return(w=m.labels)==null?void 0:w.includes(y)});y&&h&&a(y,h)}}),e.on("shape.changed",function({element:p}){var d;!ht(p,QS)||!u(p)||(ft(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=Ns([nt(d),nt(p)],e1),y=f.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),w=Hs(m,y);if(!w)return;const v=o.isSelected(d)?c(d):l(d),b=Hs(v,y)||nt(d);Zs(b,w)<N3||(uf(f,[b,w]),ot(r,f))}function s(){Ds(`.${e1.class}`,r).forEach(gn)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+Pr(d,"x")-Tp,y:p.y+Pr(d,"y")-Tp,width:Pr(d,"width")+Tp*2,height:Pr(d,"height")+Tp*2};return bf(f,Pr(d,"rx"))}if(d.cx){const f=Pr(d,"r"),y={x:p.x+Pr(d,"cx")-f,y:p.y+Pr(d,"cy")-f,width:f*2,height:f*2};return sb(y)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}t1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Pr(e,t){return parseFloat(Le(e,t)||0)}const $3={__depends__:[Oi,Gg],__init__:["labelLink"],labelLink:["type",t1]};var F3=new ta("tt");function j3(e){var t=Wt('<div class="djs-tooltip-container" />');return Zn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function H3(e,t,n){Zn(e,{left:t+"px",top:n+"px"})}function zg(e,t){e.style.display=t===!1?"none":""}var n1="djs-tooltip",Vg="."+n1;function ni(e,t){this._eventBus=e,this._canvas=t,this._ids=F3,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=j3(t.getContainer());var n=this;si.bind(this._tooltipRoot,Vg,"mousedown",function(i){i.stopPropagation()}),si.bind(this._tooltipRoot,Vg,"mouseover",function(i){n.trigger("mouseover",i)}),si.bind(this._tooltipRoot,Vg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}ni.$inject=["eventBus","canvas"],ni.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=te({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ni.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(kn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},ni.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},ni.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ni.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)}},ni.prototype.remove=function(e){var t=this.get(e);t&&(ao(t.html),ao(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ni.prototype.show=function(){zg(this._tooltipRoot)},ni.prototype.hide=function(){zg(this._tooltipRoot,!1)},ni.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},ni.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)),oi(n)&&(n=Wt(n)),i=Wt('<div data-tooltip-id="'+t+'" class="'+n1+'">'),Zn(i,{position:"absolute"}),i.appendChild(n),e.type&&Dt(i).add("djs-tooltip-"+e.type),e.className&&Dt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},ni.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;H3(n,t.x,t.y)},ni.prototype._updateTooltipVisibilty=function(e){K(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),zg(i,o))})},ni.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 G3={__init__:["tooltips"],tooltips:["type",ni]};var z3="flow elements must be children of pools/participants",V3="Data object must be placed within a pool/participant.";function i1(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;P(s,"bpmn:Collaboration")&&(P(a,"bpmn:FlowNode")?i(o,n(z3)):P(a,"bpmn:DataObjectReference")&&i(o,n(V3)))})}i1.$inject=["eventBus","tooltips","translate"];const W3={__depends__:[G3],__init__:["modelingFeedback"],modelingFeedback:["type",i1]};var U3=500,q3=1250,Y3=1500,kp=Math.round;function K3(e){return{x:e.x+kp(e.width/2),y:e.y+kp(e.height/2)}}function o1(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",Y3,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=X3(u),te(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",q3,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",U3,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=kp(l.x),l.y=kp(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(mr(s)){var c=Wa(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(En(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!vt(s.target).has("djs-hit-no-move")){var p=K3(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}o1.$inject=["eventBus","dragging","modeling","selection","rules"];function X3(e){var t=ba(e,"id");return gt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var r1=499,Wg="djs-dragging",a1="drop-ok",s1="drop-not-ok",c1="new-parent",l1="attach-ok";function u1(e,t,n,i){function o(c){var l=r(c),u=Z3(l);return u}function r(c){var l=$s(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[l1,a1,s1,c1].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,Wg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",r1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=We("g");Le(f,n.cls("djs-drag-group",["no-events"]));var y=t.getActiveLayer();ot(y,f),l.dragGroup=f}d.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Up([p,r(u)]):p=r(u),K(p,function(h){t.addMarker(h,Wg)}),l.allDraggedElements=p,l.differentParents=J3(u)}),e.on("shape.move.move",r1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,l1):l.canExecute&&d&&p.id!==d.id?a(p,c1):a(p,l.canExecute?a1:s1)),Fn(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;K(u,function(d){t.removeMarker(d,Wg)}),p&&gn(p)}),this.makeDraggable=s}u1.$inject=["eventBus","canvas","styles","previewSupport"];function Z3(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=gt(e,function(i){return $t(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function J3(e){return JR(ba(e,function(t){return t.parent&&t.parent.id}))!==1}const Q3={__depends__:[mu,Oi,Gg,fo,Bo,Ka],__init__:["move","movePreview"],move:["type",o1],movePreview:["type",u1]};var p1=".djs-palette-toggle",d1=".entry",eF=p1+", "+d1,Ug="djs-palette-",tF="shown",qg="open",f1="two-column",nF=1e3;function wn(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()})}wn.$inject=["eventBus","canvas"],wn.prototype.registerProvider=function(e,t){t||(t=e,e=nF),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},wn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(oF,{})},wn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},wn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Wt(wn.HTML_MARKUP);n.appendChild(i),Dt(n).add(Ug+tF),si.bind(i,eF,"click",function(o){var r=o.delegateTarget;if(Qd(r,p1))return e.toggle();e.trigger("click",o)}),Ke.bind(i,"mousedown",function(o){o.stopPropagation()}),si.bind(i,d1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},wn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},wn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Dt(n),a=Dt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(f1,o),a.toggle(Ug+f1,o),"open"in e&&(r.toggle(qg,e.open),a.toggle(Ug+qg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},wn.prototype._update=function(){var e=kt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Ml(e),K(t,function(n,i){var o=n.group||"default",r=kt("[data-group="+ra(o)+"]",e);r||(r=Wt('<div class="group"></div>'),kn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Wt(a);if(r.appendChild(s),!n.separator&&(kn(s,"data-action",i),n.title&&kn(s,"title",n.title),n.className&&iF(s,n.className),n.imageUrl)){var c=Wt("<img>");kn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},wn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=kn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},wn.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(Cn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},wn.prototype._layoutChanged=function(){this._toggleState({})},wn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},wn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},wn.prototype.open=function(){this._toggleState({open:!0})},wn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},wn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},wn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=kt(".djs-palette-entries",this._container),this._toolsContainer=kt("[data-group=tools]",t)),n=this._toolsContainer,K(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Dt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},wn.prototype.isOpen=function(){return Dt(this._container).has(qg)},wn.prototype._getParentContainer=function(){return this._canvas.getContainer()},wn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function iF(e,t){var n=Dt(e),i=et(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function oF(e,t){var n=t.getPaletteEntries();return Cn(n)?n(e):(K(n,function(i,o){e[o]=i}),e)}const rF={__init__:["palette"],palette:["type",wn]};var h1="crosshair",g1="selected",aF="djs-dragging-active-lasso";function Tr(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=We("rect");Le(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ot(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 y=p.marked,h=p.lastMarked;if(y&&h){for(const m of h)y.has(m)||t.removeMarker(m,g1);for(const m of y)h.has(m)||t.addMarker(m,g1)}},remove:function(p){this.update(p),p.frame&&gn(p.frame),l(!1)}};function l(p){vt(t.getContainer()).toggle(aF,p)}function u(p){var d=i.getAll();return new Set(xa(Da(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=m1(p),d.add=lu(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=m1(p),y=u(f),h=d.initialMarked.union(y);d.lastMarked=d.marked,d.marked=h,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(lu(p))return s.activateLasso(p.originalEvent),!0})}Tr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Tr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:h1,data:{context:{}},keepSelection:!0})},Tr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:h1,data:{context:{}},keepSelection:!0})},Tr.prototype._select=function(e){this._selection.select(e)},Tr.prototype.select=function(e,t,n=[]){var i=xa(Da(e,t));this._select([...n,...i])},Tr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Tr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function m1(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 sF={__depends__:[bu,ic],__init__:["lassoTool"],lassoTool:["type",Tr]};var Yg=1500,y1="grab";function cs(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",Yg,function(c){if(ec(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Yg,function(c){if(!(!v1(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Yg,function(c){!v1(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!ec(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}cs.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],cs.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:y1,data:{context:n||{}}})},cs.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:y1,data:{context:{reactivate:n}}})},cs.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},cs.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function v1(e){return Rn("Space",e)}const cF={__depends__:[bu,ic],__init__:["handTool"],handTool:["type",cs]};var x1="connect-ok",b1="connect-not-ok";function ls(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?x1:b1))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?x1:b1)}),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})}ls.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ls.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ls.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ls.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ls.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const lF={__depends__:[Ng,fo,Bo,bu,ic],globalConnect:["type",ls]};function Kg(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)}Kg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Kg.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,y,h){function m(w){var g=n.createShape(te({type:p},h));t.start(w,g)}return{group:d,className:f,title:y,action:{dragstart:m,click:m}}}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 te(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 uF={__depends__:[rF,vu,R_,sF,cF,lF,qs],__init__:["paletteProvider"],paletteProvider:["type",Kg]};var pF=250;function Xg(e,t,n,i,o){we.call(this,e);function r(s){var c=s.canExecute.replacements;K(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);te(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var y=kt('[data-element-id="'+ra(d.id)+'"]',s.dragGroup);y&&Le(y,{display:"none"});var h=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;K(c,function(l,u){var p=kt('[data-element-id="'+ra(u)+'"]',s.dragGroup);p&&Le(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",pF,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}Xg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],je(Xg,we);const dF={__depends__:[Ka],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Xg]};var fF=1250,Zg=40,hF=20,gF=10,w1=20,_1=["x","y"],mF=Math.abs;function E1(e){e.on(["connect.hover","connect.move","connect.end"],fF,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&pi(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&yF(t,r,wF(r)),r&&bF(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ii(o),ht(r,["bpmn:Event","bpmn:Gateway"])&&S1(t,Ii(r)),ht(r,["bpmn:Task","bpmn:SubProcess"])&&vF(t,r),P(a,"bpmn:BoundaryEvent")&&s===a.host&&xF(t)):R1(i,"bpmn:MessageFlow")?(P(o,"bpmn:Event")&&(n.connectionStart=Ii(o)),P(r,"bpmn:Event")&&S1(t,Ii(r))):n.connectionStart=n.initialConnectionStart)})}E1.$inject=["eventBus"];function yF(e,t,n){_1.forEach(function(i){var o=M1(i,t);e[i]<t[i]+n?bn(e,i,t[i]+n):e[i]>t[i]+o-n&&bn(e,i,t[i]+o-n)})}function vF(e,t){var n=Ii(t);_1.forEach(function(i){_F(e,t,i)&&bn(e,i,n[i])})}function xF(e){var t=e.context,n=t.source,i=t.target;if(!EF(t)){var o=Ii(n),r=$n(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;mF(c-o[s])<Zg&&(c>o[s]?l=o[s]+Zg:l=o[s]-Zg,bn(e,s,l))})}}function S1(e,t){bn(e,"x",t.x),bn(e,"y",t.y)}function R1(e,t){return e&&e.type===t}function bF(e,t){return Yo(t,function(n){return R1(e,n)})}function M1(e,t){return e==="x"?t.width:t.height}function wF(e){return P(e,"bpmn:Task")?gF:hF}function _F(e,t,n){return e[n]>t[n]+w1&&e[n]<t[n]+M1(n,t)-w1}function EF(e){var t=e.hover,n=e.source;return t&&n&&t===n}function kr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}kr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},kr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},kr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},kr.prototype.getSnapLocations=function(){return this._snapLocations},kr.prototype.setSnapLocations=function(e){this._snapLocations=e},kr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Op,n.initDefaults(this._defaultSnaps)),n};function Op(){this._snapValues={}}Op.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)},Op.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&v5(e[n],o[n],i)},Op.prototype.initDefaults=function(e){var t=this;K(e||{},function(n,i){K(n,function(o){t.add(i,o)})})};var SF=1250;function vo(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"],SF,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&pi(o.originalEvent))&&!(ss(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()})}vo.$inject=["elementRegistry","eventBus","snapping"],vo.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new kr);var r;t.get(i.id)?r=Ii(i,e):r={x:e.x+Ii(i).x,y:e.y+Ii(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}),ft(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},vo.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return K(i,function(o){if(ft(o)){ft(t)&&e.add("mid",Ii(o));return}if($t(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);K(r,function(a){e.add("mid",a)});return}e.add("mid",Ii(o))}),!tt(t.x)||!tt(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ii(t)),e},vo.prototype.getSnapTargets=function(e,t){return fS(t).filter(function(n){return!RF(n)})};function RF(e){return!!e.hidden}var C1=1500;function us(e,t){t.invoke(vo,this),e.on(["create.move","create.end"],C1,PF),e.on(["create.move","create.end","shape.move.move","shape.move.end"],C1,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!ss(n)&&MF(n,r)})}je(us,vo),us.$inject=["eventBus","injector"],us.prototype.initSnap=function(e){var t=vo.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return K(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",P1(r,i,e))}),K(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",P1(r,i,e))}),P(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},us.prototype.addSnapTargetPoints=function(e,t,n){vo.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);K(i,function(r){(AF(r)||CF([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",pS(r)),e.add("bottom-right",dS(r)))});var o=this._elementRegistry;return K(t.incoming,function(r){if(o.get(t.id)){A1(i,r.source)||e.add("mid",nt(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),K(t.outgoing,function(r){if(o.get(t.id)){A1(i,r.target)||e.add("mid",nt(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),P(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},us.prototype.getSnapTargets=function(e,t){return vo.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!P(n,"bpmn:Lane")})};function MF(e,t){var n=Ze(t),i=ww(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=nt(r),/top/.test(i)?bn(e,"y",n.top-a.y):/bottom/.test(i)&&bn(e,"y",n.bottom-a.y),/left/.test(i)?bn(e,"x",n.left-a.x):/right/.test(i)&&bn(e,"x",n.right-a.x)}function CF(e,t){return e.every(function(n){return P(n,t)})}function AF(e){return P(e,"bpmn:SubProcess")&&xt(e)?!0:P(e,"bpmn:Participant")}function PF(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)&&bn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&bn(e,"y",e.y)}}function A1(e,t){return e.indexOf(t)!==-1}function P1(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var TF=1250;function Ic(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],TF,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&pi(i.originalEvent))&&!ss(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),DF(s)&&bn(i,"x",i.x),LF(s)&&bn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ic.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new kr);var r=T1(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Ic.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return K(o,function(r){e.add("corner",dS(r)),e.add("corner",pS(r))}),e.add("corner",T1(t,i)),e},Ic.$inject=["eventBus","snapping"],Ic.prototype.getSnapTargets=function(e,t){return fS(t).filter(function(n){return!kF(n,e)&&!$t(n)&&!OF(n)&&!ft(n)})};function T1(e,t){var n=nt(e),i=Ze(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 kF(e,t){return e.host===t}function OF(e){return!!e.hidden}function DF(e){return e==="n"||e==="s"}function LF(e){return e==="e"||e==="w"}var IF=7,BF=1e3;function Or(e){this._canvas=e,this._asyncHide=Yp(ei(this.hide,this),BF)}Or.$inject=["canvas"],Or.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:ss(e,"x"),y:ss(e,"y")};K(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(K(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,IF),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),K(["x","y"],function(a){var s=r[a];En(s)&&bn(e,a,s.originValue)})},Or.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=We("path");return Le(n,{d:"M0,0 L0,0"}),vt(n).add("djs-snap-line"),ot(t,n),{update:function(i){tt(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"})}}},Or.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Or.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Or.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Or.prototype.hide=function(){K(this._snapLines,function(e){e.update()})};const NF={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",vo],resizeSnapping:["type",Ic],snapping:["type",Or]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",E1],createMoveSnapping:["type",us]};var k1=300;function lt(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=kt(lt.INPUT_SELECTOR,this._container),this._resultsContainer=kt(lt.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}lt.$inject=["canvas","eventBus","selection","translate"],lt.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:si.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,lt.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,lt.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,lt.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,lt.INPUT_SELECTOR,"keydown",function(n){Rn("ArrowUp",n)&&n.preventDefault(),Rn("ArrowDown",n)&&n.preventDefault()}),t(this._container,lt.INPUT_SELECTOR,"keyup",function(n){if(Rn("Escape",n))return e.close();if(Rn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Rn("ArrowUp",n))return e._scrollToDirection(!0);if(Rn("ArrowDown",n))return e._scrollToDirection();Rn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},lt.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){si.unbind(e.el,e.type,e.listener)})},lt.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=kt(lt.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},lt.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},lt.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)}},lt.prototype._clearResults=function(){Ml(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},lt.prototype._getCurrentResult=function(){return kt(lt.RESULT_SELECTED_SELECTOR,this._resultsContainer)},lt.prototype._createResultNode=function(e,t){var n=Wt(lt.RESULT_HTML);return e.primaryTokens.length>0&&O1(n,e.primaryTokens,lt.RESULT_PRIMARY_HTML),O1(n,e.secondaryTokens,lt.RESULT_SECONDARY_HTML),kn(n,lt.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},lt.prototype.registerProvider=function(e){this._searchProvider=e},lt.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,Dt(this._canvas.getContainer()).add("djs-search-open"),Dt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},lt.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,Dt(this._canvas.getContainer()).remove("djs-search-open"),Dt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},lt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},lt.prototype.isOpen=function(){return this._open},lt.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Dt(t).remove(lt.RESULT_SELECTED_CLASS);var n=kn(e,lt.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Dt(e).add(lt.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:k1}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},lt.prototype._select=function(e){var t=kn(e,lt.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:k1}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},lt.prototype._getBoxHtml=function(){const e=Wt(lt.BOX_HTML),t=kt(lt.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function O1(e,t,n){var i=$F(t),o=Wt(n);o.innerHTML=i,e.appendChild(o)}function $F(e){var t="";return e.forEach(function(n){var i=O0(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+lt.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}lt.CONTAINER_SELECTOR=".djs-search-container",lt.INPUT_SELECTOR=".djs-search-input input",lt.RESULTS_CONTAINER_SELECTOR=".djs-search-results",lt.RESULT_SELECTOR=".djs-search-result",lt.RESULT_SELECTED_CLASS="djs-search-result-selected",lt.RESULT_SELECTED_SELECTOR="."+lt.RESULT_SELECTED_CLASS,lt.RESULT_ID_ATTRIBUTE="data-result-id",lt.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",lt.BOX_HTML=`<div class="djs-search-container djs-scrollable">
334
+ </svg>`},e3=900;function kc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",e3,this)}kc.$inject=["popupMenu","distributeElements","translate","rules"],kc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},kc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},kc.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:PS.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:PS.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const t3={__depends__:[Pg,Q5],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",_p],distributeElementsMenuProvider:["type",kc]};var kS="is not a registered action",n3="is already registered";function Ni(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ni.$inject=["eventBus","injector"],Ni.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=et(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&&(et(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)})},Ni.prototype.trigger=function(e,t){if(!this._actions[e])throw jg(e,kS);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ni.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);K(e,function(i,o){n._registerAction(o,i)})},Ni.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw jg(e,n3);this._actions[e]=t},Ni.prototype.unregister=function(e){if(!this.isRegistered(e))throw jg(e,kS);this._actions[e]=void 0},Ni.prototype.getActions=function(){return Object.keys(this._actions)},Ni.prototype.isRegistered=function(e){return!!this._actions[e]};function jg(e,t){return new Error(e+" "+t)}const i3={__init__:["editorActions"],editorActions:["type",Ni]};function Ep(e){e.invoke(Ni,this)}je(Ep,Ni),Ep.$inject=["injector"],Ep.prototype._registerDefaultActions=function(e){Ni.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 y=t.getRootElement(),h=n.filter(function(m){return m!==y});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(y){var h=i.get(),m=y.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(y){var h=i.get(),m=[],w=y.type;h.length&&(m=gt(h,function(g){return!T(g,"bpmn:Lane")}),l.trigger(m,w))}),i&&d&&this._registerAction("setColor",function(y){var h=i.get();h.length&&d.setColor(h,y)}),i&&u&&this._registerAction("directEditing",function(){var y=i.get();y.length&&u.activate(y[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&d&&this._registerAction("moveToOrigin",function(){var y=t.getRootElement(),h,m;T(y,"bpmn:Collaboration")?m=n.filter(function(w){return T(w.parent,"bpmn:Collaboration")}):m=n.filter(function(w){return w!==y&&!T(w.parent,"bpmn:SubProcess")}),h=yn(m),d.moveElements(m,{x:-h.x,y:-h.y},y)}),i&&f&&this._registerAction("replaceElement",function(y){f.triggerEntry("replace","click",y)})};const o3={__depends__:[i3],editorActions:["type",Ep]};function OS(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ht(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}OS.$inject=["eventBus"];function ua(e,t){we.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;ri(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}ua.$inject=["eventBus","gridSnapping","modeling"],je(ua,we),ua.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},ua.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},ua.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),te(e,r),e},ua.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),te(e,r),e};var r3=2e3;function DS(e,t){e.on(["spaceTool.move","spaceTool.end"],r3,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)}})}DS.$inject=["eventBus","gridSnapping"];const a3={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ua],gridSnappingSpaceToolBehavior:["type",DS]};var Sp=10;function Hg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var s3=1200,c3=800;function Ar(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",c3,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"],s3,function(r){var a=r.originalEvent;if(!(!o.active||a&&pi(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=u3(r,l,e);p&&(u.offset=p);var d=l3(r,l);d&&te(u,d),ss(r,l)||o.snapEvent(r,l,u)})}})}Ar.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);wn(e,t,i)},Ar.prototype.getGridSpacing=function(){return Sp},Ar.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Hg(e,Sp);var i,o;return t&&t.min&&(i=t.min,tt(i)&&(i=Hg(i+n,Sp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,tt(o)&&(o=Hg(o+n,Sp,"floor"),e=Math.min(e,o))),e-=n,e},Ar.prototype.isActive=function(){return this.active},Ar.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Ar.prototype.toggleActive=function(){this.setActive(!this.active)},Ar.$inject=["elementRegistry","eventBus","config.gridSnapping"];function l3(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&&(Rp(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&&(Rp(t)?IS(s)?a.x.max=c.left:a.x.min=c.right:LS(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Rp(t)?IS(s)?a.x.min=l.left:a.x.max=l.right:LS(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function u3(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&tt(s[t])||(s||(s=r.snapOffset={}),tt(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Rp(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 Rp(e){return e==="x"}function LS(e){return e.indexOf("n")!==-1}function IS(e){return e.indexOf("w")!==-1}const p3={__depends__:[a3],__init__:["gridSnapping"],gridSnapping:["type",Ar]};var d3=1750;function BS(e,t,n){t.on(["create.start","shape.move.start"],d3,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!T(r,"bpmn:Participant")||!T(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}))}})}BS.$inject=["canvas","eventBus","gridSnapping"];const f3={__depends__:[p3,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",lg],gridSnappingParticipantBehavior:["type",BS],gridSnappingLayoutConnectionBehavior:["type",Qa]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",OS]};var h3=30,NS=30;function Oc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(T(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(T(o,"bpmn:Participant"))return xt(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(T(o,"bpmn:SubProcess"))return xt(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}Oc.$inject=["eventBus","interactionEvents"],Oc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Oc.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=Tn(e)?{width:h3,height:e.height}:{width:e.width,height:NS};return this._interactionEvents.createBoxHit(t,"all",n),!0},Oc.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:NS}),!0};const g3={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Oc]};function Mp(e){e.invoke(es,this)}je(Mp,es),Mp.$inject=["injector"],Mp.prototype.registerBindings=function(e,t){es.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 m3={__depends__:[gg],__init__:["keyboardBindings"],keyboardBindings:["type",Mp]};var y3={moveSpeed:1,moveSpeedAccelerated:10},v3=1500,$S="left",FS="up",jS="right",HS="down",x3={ArrowLeft:$S,Left:$S,ArrowUp:FS,Up:FS,ArrowRight:jS,Right:jS,ArrowDown:HS,Down:HS},b3={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 GS(e,t,n,i,o){var r=this;this._config=te({},y3,e||{}),t.addListener(v3,function(a){var s=a.keyEvent,c=x3[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=b3[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}GS.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const w3={__depends__:[gg,Oi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",GS]};var zS=10;function Dc(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=jO(u,p,l),c.newBounds=GO(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:Ze(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Bx(p),!_3(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)})}Dc.prototype.canResize=function(e){var t=this._rules,n=Vi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Dc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=te({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,VS(t,r),"resize",{autoActivate:!0,cursor:E3(r),data:{shape:t,context:o}})},Dc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:zS,height:zS},o=Sb(t,e.childrenBoxPadding),zO(n,t,i,o)},Dc.$inject=["eventBus","rules","modeling","dragging"];function _3(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function VS(e,t){var n=nt(e),i=Ze(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 E3(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 WS="djs-resizing",US="resize-not-ok",S3=500;function qS(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,WS)),s.width>5&&Le(c,{x:s.x,width:s.width}),s.height>5&&Le(c,{y:s.y,height:s.height}),r.canExecute?vt(c).remove(US):vt(c).add(US)}function o(r){var a=r.shape,s=r.frame;s&&mn(r.frame),t.removeMarker(a,WS)}e.on("resize.move",S3,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}qS.$inject=["eventBus","canvas","previewSupport"];var Cp=-6,Ap=8,Tp=20,Lc="djs-resizer",R3=["n","w","s","e","nw","ne","se","sw"];function Tr(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&&K(a,ei(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}Tr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){yr(r)&&i.activate(r,e,n)}Ke.bind(t,"mousedown",o),Ke.bind(t,"touchstart",o)},Tr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=M3(i),a=We("g");vt(a).add(Lc),vt(a).add(Lc+"-"+e.id),vt(a).add(Lc+"-"+i),ot(o,a);var s=We("rect");Le(s,{x:-Ap/2+r.x,y:-Ap/2+r.y,width:Ap,height:Ap}),vt(s).add(Lc+"-visual"),ot(a,s);var c=We("rect");return Le(c,{x:-Tp/2+r.x,y:-Tp/2+r.y,width:Tp,height:Tp}),vt(c).add(Lc+"-hit"),ot(a,c),Nl(a,t,n),a},Tr.prototype.createResizer=function(e,t){var n=VS(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Tr.prototype.addResizer=function(e){var t=this;$t(e)||K(R3,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Tr.prototype.removeResizers=function(){var e=this._getResizersParent();Is(e)},Tr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Tr.$inject=["eventBus","canvas","selection","resize"];function M3(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Cp:e.indexOf("w")!==-1&&(t.x=Cp),e.indexOf("s")!==-1?t.y=-Cp:e.indexOf("n")!==-1&&(t.y=Cp),t}const YS={__depends__:[go,$o,Ka],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Dc],resizePreview:["type",qS],resizeHandles:["type",Tr]};var C3=2e3;function Ic(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"],C3,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||ht(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ic.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ic.prototype.activate=function(e){var t=ni(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);te(n,i);var o={},r=n.style||{};return te(r,{backgroundColor:null,border:null}),(ht(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||KS(e))&&te(o,{centerVertically:!0}),po(e)&&(te(o,{resizable:!0,autoResize:!0}),te(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),T(e,"bpmn:TextAnnotation")&&(te(o,{resizable:!0,autoResize:!0}),te(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),te(n,{options:o,style:r}),n}},Ic.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(T(e,"bpmn:Lane")||P3(e)){var y=Tn(e),h=y?{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};te(r,h),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?"rotate(-90deg)":null})}if(T3(e)){var m=Tn(e),w=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};te(r,w),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ht(e,["bpmn:Task","bpmn:CallActivity"])||KS(e))&&(te(r,{width:i.width,height:i.height}),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),A3(e)&&(te(r,{width:i.width,x:i.x}),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var g=1,v=i.width+2*g;if(n.labelTarget&&(te(r,{width:v,height:i.height+2*g,x:i.x-g,y:i.y-g}),te(f,{fontSize:l+"px",lineHeight:u})),po(n)&&!jl(n)&&!ft(n)){var b=vf(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),M=l,B=Xr.width*a+2*g;te(r,{width:B,height:M+2*g,x:E.x-B/2,y:E.y-M/2-g}),te(f,{fontSize:l+"px",lineHeight:u})}return T(e,"bpmn:TextAnnotation")&&(te(r,{width:i.width+2*g,height:i.height+2*g,x:i.x-g,y:i.y-g,minWidth:30*a,minHeight:10*a}),te(f,{textAlign:"left",paddingTop:Na*a+"px",paddingBottom:Na*a+"px",paddingLeft:Na*a+"px",paddingRight:Na*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Ic.prototype.update=function(e,t,n,i){var o,r;T(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}),k3(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function KS(e){return T(e,"bpmn:SubProcess")&&!xt(e)}function A3(e){return T(e,"bpmn:SubProcess")&&xt(e)}function T3(e){return T(e,"bpmn:Participant")&&!xt(e)}function P3(e){return T(e,"bpmn:Participant")&&xt(e)}function k3(e){return!e||!e.trim()}var XS="djs-element-hidden",ZS="djs-label-hidden";function JS(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,T(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=We("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=We("path");Le(p,{d:u,strokeWidth:2,stroke:O3(r)}),ot(s,p),ot(o,s),Fn(s,r.x,r.y)}T(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,XS):(T(r,"bpmn:Task")||T(r,"bpmn:CallActivity")||T(r,"bpmn:SubProcess")||T(r,"bpmn:Participant")||T(r,"bpmn:Lane"))&&t.addMarker(r,ZS)}),e.on("directEditing.resize",function(c){if(T(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,XS),t.removeMarker(r,ZS)),r=void 0,a=void 0,s&&(mn(s),s=void 0)})}JS.$inject=["eventBus","canvas","pathMap"];function O3(e,t){var n=wt(e);return n.get("stroke")||t||"black"}const D3={__depends__:[Nh,YS,SS],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ic],labelEditingPreview:["type",JS]};var L3=500,I3=1e3;function xo(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){Vk(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){K(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],L3,function(r){var a=r.element,s=r.gfx,c=kt(".djs-outline",s);c&&i.updateOutline(a,c)})}xo.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=kt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ot(t,n),this.updateOutline(e,n)),n},xo.prototype._createOutlineGfx=function(){var e=We("rect");return Le(e,te({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},xo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},xo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&K(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})},xo.prototype.updateConnectionOutline=function(e,t){var n=yn(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})},xo.prototype.registerProvider=function(e,t){t||(t=e,e=I3),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},xo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},xo.prototype.getOutline=function(e){var t,n=this._getProviders();return K(n,function(i){An(i.getOutline)&&(t=t||i.getOutline(e))}),t},xo.$inject=["eventBus","styles","elementRegistry"];var Pp=6;function Gg(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)})}Gg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Is(t);var n=e.length>1,i=this._canvas.getContainer();if(vt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=B3(yn(e)),r=We("rect");Le(r,te({rx:3},o)),vt(r).add("djs-selection-outline"),ot(t,r)}},Gg.$inject=["eventBus","canvas","selection"];function B3(e){return{x:e.x-Pp,y:e.y-Pp,width:e.width+Pp*2,height:e.height+Pp*2}}const zg={__depends__:[Oi],__init__:["outline","multiSelectionOutline"],outline:["type",xo],multiSelectionOutline:["type",Gg]},QS=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],e1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},N3=15,kp=2;function t1(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(y=>ht(y,QS));if(d.length===1){const y=d[0];ft(y)?a(y,y.labelTarget):(f=y.labels)!=null&&f.length&&a(y.labels[0],y)}if(d.length===2){const y=d.find(ft),h=d.find(m=>{var w;return(w=m.labels)==null?void 0:w.includes(y)});y&&h&&a(y,h)}}),e.on("shape.changed",function({element:p}){var d;!ht(p,QS)||!u(p)||(ft(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=$s([nt(d),nt(p)],e1),y=f.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),w=Gs(m,y);if(!w)return;const v=o.isSelected(d)?c(d):l(d),b=Gs(v,y)||nt(d);Js(b,w)<N3||(uf(f,[b,w]),ot(r,f))}function s(){Ls(`.${e1.class}`,r).forEach(mn)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+Pr(d,"x")-kp,y:p.y+Pr(d,"y")-kp,width:Pr(d,"width")+kp*2,height:Pr(d,"height")+kp*2};return wf(f,Pr(d,"rx"))}if(d.cx){const f=Pr(d,"r"),y={x:p.x+Pr(d,"cx")-f,y:p.y+Pr(d,"cy")-f,width:f*2,height:f*2};return sb(y)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}t1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Pr(e,t){return parseFloat(Le(e,t)||0)}const $3={__depends__:[Oi,zg],__init__:["labelLink"],labelLink:["type",t1]};var F3=new ta("tt");function j3(e){var t=Wt('<div class="djs-tooltip-container" />');return Zn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function H3(e,t,n){Zn(e,{left:t+"px",top:n+"px"})}function Vg(e,t){e.style.display=t===!1?"none":""}var n1="djs-tooltip",Wg="."+n1;function ii(e,t){this._eventBus=e,this._canvas=t,this._ids=F3,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=j3(t.getContainer());var n=this;ci.bind(this._tooltipRoot,Wg,"mousedown",function(i){i.stopPropagation()}),ci.bind(this._tooltipRoot,Wg,"mouseover",function(i){n.trigger("mouseover",i)}),ci.bind(this._tooltipRoot,Wg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}ii.$inject=["eventBus","canvas"],ii.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=te({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ii.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(On(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},ii.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},ii.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ii.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)}},ii.prototype.remove=function(e){var t=this.get(e);t&&(so(t.html),so(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ii.prototype.show=function(){Vg(this._tooltipRoot)},ii.prototype.hide=function(){Vg(this._tooltipRoot,!1)},ii.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},ii.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)),ri(n)&&(n=Wt(n)),i=Wt('<div data-tooltip-id="'+t+'" class="'+n1+'">'),Zn(i,{position:"absolute"}),i.appendChild(n),e.type&&Dt(i).add("djs-tooltip-"+e.type),e.className&&Dt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},ii.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;H3(n,t.x,t.y)},ii.prototype._updateTooltipVisibilty=function(e){K(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Vg(i,o))})},ii.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 G3={__init__:["tooltips"],tooltips:["type",ii]};var z3="flow elements must be children of pools/participants",V3="Data object must be placed within a pool/participant.";function i1(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;T(s,"bpmn:Collaboration")&&(T(a,"bpmn:FlowNode")?i(o,n(z3)):T(a,"bpmn:DataObjectReference")&&i(o,n(V3)))})}i1.$inject=["eventBus","tooltips","translate"];const W3={__depends__:[G3],__init__:["modelingFeedback"],modelingFeedback:["type",i1]};var U3=500,q3=1250,Y3=1500,Op=Math.round;function K3(e){return{x:e.x+Op(e.width/2),y:e.y+Op(e.height/2)}}function o1(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",Y3,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=X3(u),te(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",q3,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",U3,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=Op(l.x),l.y=Op(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(yr(s)){var c=Wa(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(Sn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!vt(s.target).has("djs-hit-no-move")){var p=K3(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}o1.$inject=["eventBus","dragging","modeling","selection","rules"];function X3(e){var t=ba(e,"id");return gt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var r1=499,Ug="djs-dragging",a1="drop-ok",s1="drop-not-ok",c1="new-parent",l1="attach-ok";function u1(e,t,n,i){function o(c){var l=r(c),u=Z3(l);return u}function r(c){var l=Fs(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[l1,a1,s1,c1].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,Ug),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",r1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=We("g");Le(f,n.cls("djs-drag-group",["no-events"]));var y=t.getActiveLayer();ot(y,f),l.dragGroup=f}d.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=qp([p,r(u)]):p=r(u),K(p,function(h){t.addMarker(h,Ug)}),l.allDraggedElements=p,l.differentParents=J3(u)}),e.on("shape.move.move",r1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,l1):l.canExecute&&d&&p.id!==d.id?a(p,c1):a(p,l.canExecute?a1:s1)),Fn(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;K(u,function(d){t.removeMarker(d,Ug)}),p&&mn(p)}),this.makeDraggable=s}u1.$inject=["eventBus","canvas","styles","previewSupport"];function Z3(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=gt(e,function(i){return $t(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function J3(e){return JR(ba(e,function(t){return t.parent&&t.parent.id}))!==1}const Q3={__depends__:[yu,Oi,zg,go,$o,Ka],__init__:["move","movePreview"],move:["type",o1],movePreview:["type",u1]};var p1=".djs-palette-toggle",d1=".entry",eF=p1+", "+d1,qg="djs-palette-",tF="shown",Yg="open",f1="two-column",nF=1e3;function _n(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()})}_n.$inject=["eventBus","canvas"],_n.prototype.registerProvider=function(e,t){t||(t=e,e=nF),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},_n.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(oF,{})},_n.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},_n.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Wt(_n.HTML_MARKUP);n.appendChild(i),Dt(n).add(qg+tF),ci.bind(i,eF,"click",function(o){var r=o.delegateTarget;if(Qd(r,p1))return e.toggle();e.trigger("click",o)}),Ke.bind(i,"mousedown",function(o){o.stopPropagation()}),ci.bind(i,d1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},_n.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},_n.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Dt(n),a=Dt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(f1,o),a.toggle(qg+f1,o),"open"in e&&(r.toggle(Yg,e.open),a.toggle(qg+Yg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},_n.prototype._update=function(){var e=kt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Cl(e),K(t,function(n,i){var o=n.group||"default",r=kt("[data-group="+ra(o)+"]",e);r||(r=Wt('<div class="group"></div>'),On(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Wt(a);if(r.appendChild(s),!n.separator&&(On(s,"data-action",i),n.title&&On(s,"title",n.title),n.className&&iF(s,n.className),n.imageUrl)){var c=Wt("<img>");On(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},_n.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=On(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},_n.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(An(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},_n.prototype._layoutChanged=function(){this._toggleState({})},_n.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},_n.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},_n.prototype.open=function(){this._toggleState({open:!0})},_n.prototype.toggle=function(){this.isOpen()?this.close():this.open()},_n.prototype.isActiveTool=function(e){return e&&this._activeTool===e},_n.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=kt(".djs-palette-entries",this._container),this._toolsContainer=kt("[data-group=tools]",t)),n=this._toolsContainer,K(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Dt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},_n.prototype.isOpen=function(){return Dt(this._container).has(Yg)},_n.prototype._getParentContainer=function(){return this._canvas.getContainer()},_n.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function iF(e,t){var n=Dt(e),i=et(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function oF(e,t){var n=t.getPaletteEntries();return An(n)?n(e):(K(n,function(i,o){e[o]=i}),e)}const rF={__init__:["palette"],palette:["type",_n]};var h1="crosshair",g1="selected",aF="djs-dragging-active-lasso";function kr(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=We("rect");Le(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ot(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 y=p.marked,h=p.lastMarked;if(y&&h){for(const m of h)y.has(m)||t.removeMarker(m,g1);for(const m of y)h.has(m)||t.addMarker(m,g1)}},remove:function(p){this.update(p),p.frame&&mn(p.frame),l(!1)}};function l(p){vt(t.getContainer()).toggle(aF,p)}function u(p){var d=i.getAll();return new Set(xa(Da(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=m1(p),d.add=uu(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=m1(p),y=u(f),h=d.initialMarked.union(y);d.lastMarked=d.marked,d.marked=h,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(uu(p))return s.activateLasso(p.originalEvent),!0})}kr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],kr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:h1,data:{context:{}},keepSelection:!0})},kr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:h1,data:{context:{}},keepSelection:!0})},kr.prototype._select=function(e){this._selection.select(e)},kr.prototype.select=function(e,t,n=[]){var i=xa(Da(e,t));this._select([...n,...i])},kr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},kr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function m1(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 sF={__depends__:[wu,oc],__init__:["lassoTool"],lassoTool:["type",kr]};var Kg=1500,y1="grab";function cs(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",Kg,function(c){if(tc(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Kg,function(c){if(!(!v1(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Kg,function(c){!v1(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!tc(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}cs.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],cs.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:y1,data:{context:n||{}}})},cs.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:y1,data:{context:{reactivate:n}}})},cs.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},cs.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function v1(e){return Mn("Space",e)}const cF={__depends__:[wu,oc],__init__:["handTool"],handTool:["type",cs]};var x1="connect-ok",b1="connect-not-ok";function ls(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?x1:b1))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?x1:b1)}),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})}ls.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ls.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ls.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ls.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ls.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const lF={__depends__:[$g,go,$o,wu,oc],globalConnect:["type",ls]};function Xg(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)}Xg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Xg.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,y,h){function m(w){var g=n.createShape(te({type:p},h));t.start(w,g)}return{group:d,className:f,title:y,action:{dragstart:m,click:m}}}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 te(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 uF={__depends__:[rF,xu,R_,sF,cF,lF,Ys],__init__:["paletteProvider"],paletteProvider:["type",Xg]};var pF=250;function Zg(e,t,n,i,o){we.call(this,e);function r(s){var c=s.canExecute.replacements;K(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);te(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var y=kt('[data-element-id="'+ra(d.id)+'"]',s.dragGroup);y&&Le(y,{display:"none"});var h=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;K(c,function(l,u){var p=kt('[data-element-id="'+ra(u)+'"]',s.dragGroup);p&&Le(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",pF,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}Zg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],je(Zg,we);const dF={__depends__:[Ka],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Zg]};var fF=1250,Jg=40,hF=20,gF=10,w1=20,_1=["x","y"],mF=Math.abs;function E1(e){e.on(["connect.hover","connect.move","connect.end"],fF,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&pi(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&yF(t,r,wF(r)),r&&bF(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ii(o),ht(r,["bpmn:Event","bpmn:Gateway"])&&S1(t,Ii(r)),ht(r,["bpmn:Task","bpmn:SubProcess"])&&vF(t,r),T(a,"bpmn:BoundaryEvent")&&s===a.host&&xF(t)):R1(i,"bpmn:MessageFlow")?(T(o,"bpmn:Event")&&(n.connectionStart=Ii(o)),T(r,"bpmn:Event")&&S1(t,Ii(r))):n.connectionStart=n.initialConnectionStart)})}E1.$inject=["eventBus"];function yF(e,t,n){_1.forEach(function(i){var o=M1(i,t);e[i]<t[i]+n?wn(e,i,t[i]+n):e[i]>t[i]+o-n&&wn(e,i,t[i]+o-n)})}function vF(e,t){var n=Ii(t);_1.forEach(function(i){_F(e,t,i)&&wn(e,i,n[i])})}function xF(e){var t=e.context,n=t.source,i=t.target;if(!EF(t)){var o=Ii(n),r=$n(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;mF(c-o[s])<Jg&&(c>o[s]?l=o[s]+Jg:l=o[s]-Jg,wn(e,s,l))})}}function S1(e,t){wn(e,"x",t.x),wn(e,"y",t.y)}function R1(e,t){return e&&e.type===t}function bF(e,t){return Xo(t,function(n){return R1(e,n)})}function M1(e,t){return e==="x"?t.width:t.height}function wF(e){return T(e,"bpmn:Task")?gF:hF}function _F(e,t,n){return e[n]>t[n]+w1&&e[n]<t[n]+M1(n,t)-w1}function EF(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Or(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Or.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Or.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Or.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Or.prototype.getSnapLocations=function(){return this._snapLocations},Or.prototype.setSnapLocations=function(e){this._snapLocations=e},Or.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Dp,n.initDefaults(this._defaultSnaps)),n};function Dp(){this._snapValues={}}Dp.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)},Dp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&v5(e[n],o[n],i)},Dp.prototype.initDefaults=function(e){var t=this;K(e||{},function(n,i){K(n,function(o){t.add(i,o)})})};var SF=1250;function bo(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"],SF,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&pi(o.originalEvent))&&!(ss(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()})}bo.$inject=["elementRegistry","eventBus","snapping"],bo.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new Or);var r;t.get(i.id)?r=Ii(i,e):r={x:e.x+Ii(i).x,y:e.y+Ii(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}),ft(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},bo.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return K(i,function(o){if(ft(o)){ft(t)&&e.add("mid",Ii(o));return}if($t(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);K(r,function(a){e.add("mid",a)});return}e.add("mid",Ii(o))}),!tt(t.x)||!tt(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ii(t)),e},bo.prototype.getSnapTargets=function(e,t){return fS(t).filter(function(n){return!RF(n)})};function RF(e){return!!e.hidden}var C1=1500;function us(e,t){t.invoke(bo,this),e.on(["create.move","create.end"],C1,TF),e.on(["create.move","create.end","shape.move.move","shape.move.end"],C1,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!ss(n)&&MF(n,r)})}je(us,bo),us.$inject=["eventBus","injector"],us.prototype.initSnap=function(e){var t=bo.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return K(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",T1(r,i,e))}),K(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",T1(r,i,e))}),T(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},us.prototype.addSnapTargetPoints=function(e,t,n){bo.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);K(i,function(r){(AF(r)||CF([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",pS(r)),e.add("bottom-right",dS(r)))});var o=this._elementRegistry;return K(t.incoming,function(r){if(o.get(t.id)){A1(i,r.source)||e.add("mid",nt(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),K(t.outgoing,function(r){if(o.get(t.id)){A1(i,r.target)||e.add("mid",nt(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),T(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},us.prototype.getSnapTargets=function(e,t){return bo.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!T(n,"bpmn:Lane")})};function MF(e,t){var n=Ze(t),i=ww(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=nt(r),/top/.test(i)?wn(e,"y",n.top-a.y):/bottom/.test(i)&&wn(e,"y",n.bottom-a.y),/left/.test(i)?wn(e,"x",n.left-a.x):/right/.test(i)&&wn(e,"x",n.right-a.x)}function CF(e,t){return e.every(function(n){return T(n,t)})}function AF(e){return T(e,"bpmn:SubProcess")&&xt(e)?!0:T(e,"bpmn:Participant")}function TF(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)&&wn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&wn(e,"y",e.y)}}function A1(e,t){return e.indexOf(t)!==-1}function T1(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var PF=1250;function Bc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],PF,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&pi(i.originalEvent))&&!ss(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),DF(s)&&wn(i,"x",i.x),LF(s)&&wn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Bc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new Or);var r=P1(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Bc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return K(o,function(r){e.add("corner",dS(r)),e.add("corner",pS(r))}),e.add("corner",P1(t,i)),e},Bc.$inject=["eventBus","snapping"],Bc.prototype.getSnapTargets=function(e,t){return fS(t).filter(function(n){return!kF(n,e)&&!$t(n)&&!OF(n)&&!ft(n)})};function P1(e,t){var n=nt(e),i=Ze(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 kF(e,t){return e.host===t}function OF(e){return!!e.hidden}function DF(e){return e==="n"||e==="s"}function LF(e){return e==="e"||e==="w"}var IF=7,BF=1e3;function Dr(e){this._canvas=e,this._asyncHide=Kp(ei(this.hide,this),BF)}Dr.$inject=["canvas"],Dr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:ss(e,"x"),y:ss(e,"y")};K(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(K(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,IF),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),K(["x","y"],function(a){var s=r[a];Sn(s)&&wn(e,a,s.originValue)})},Dr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=We("path");return Le(n,{d:"M0,0 L0,0"}),vt(n).add("djs-snap-line"),ot(t,n),{update:function(i){tt(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"})}}},Dr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Dr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Dr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Dr.prototype.hide=function(){K(this._snapLines,function(e){e.update()})};const NF={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bo],resizeSnapping:["type",Bc],snapping:["type",Dr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",E1],createMoveSnapping:["type",us]};var k1=300;function lt(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=kt(lt.INPUT_SELECTOR,this._container),this._resultsContainer=kt(lt.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}lt.$inject=["canvas","eventBus","selection","translate"],lt.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ci.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,lt.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,lt.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,lt.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,lt.INPUT_SELECTOR,"keydown",function(n){Mn("ArrowUp",n)&&n.preventDefault(),Mn("ArrowDown",n)&&n.preventDefault()}),t(this._container,lt.INPUT_SELECTOR,"keyup",function(n){if(Mn("Escape",n))return e.close();if(Mn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Mn("ArrowUp",n))return e._scrollToDirection(!0);if(Mn("ArrowDown",n))return e._scrollToDirection();Mn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},lt.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ci.unbind(e.el,e.type,e.listener)})},lt.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=kt(lt.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},lt.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},lt.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)}},lt.prototype._clearResults=function(){Cl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},lt.prototype._getCurrentResult=function(){return kt(lt.RESULT_SELECTED_SELECTOR,this._resultsContainer)},lt.prototype._createResultNode=function(e,t){var n=Wt(lt.RESULT_HTML);return e.primaryTokens.length>0&&O1(n,e.primaryTokens,lt.RESULT_PRIMARY_HTML),O1(n,e.secondaryTokens,lt.RESULT_SECONDARY_HTML),On(n,lt.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},lt.prototype.registerProvider=function(e){this._searchProvider=e},lt.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,Dt(this._canvas.getContainer()).add("djs-search-open"),Dt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},lt.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,Dt(this._canvas.getContainer()).remove("djs-search-open"),Dt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},lt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},lt.prototype.isOpen=function(){return this._open},lt.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Dt(t).remove(lt.RESULT_SELECTED_CLASS);var n=On(e,lt.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Dt(e).add(lt.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:k1}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},lt.prototype._select=function(e){var t=On(e,lt.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:k1}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},lt.prototype._getBoxHtml=function(){const e=Wt(lt.BOX_HTML),t=kt(lt.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function O1(e,t,n){var i=$F(t),o=Wt(n);o.innerHTML=i,e.appendChild(o)}function $F(e){var t="";return e.forEach(function(n){var i=O0(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+lt.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}lt.CONTAINER_SELECTOR=".djs-search-container",lt.INPUT_SELECTOR=".djs-search-input input",lt.RESULTS_CONTAINER_SELECTOR=".djs-search-results",lt.RESULT_SELECTOR=".djs-search-result",lt.RESULT_SELECTED_CLASS="djs-search-result-selected",lt.RESULT_SELECTED_SELECTOR="."+lt.RESULT_SELECTED_CLASS,lt.RESULT_ID_ATTRIBUTE="data-result-id",lt.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",lt.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>`,lt.RESULT_HTML='<div class="djs-search-result"></div>',lt.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',lt.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const FF={__depends__:[qs,Zu,Oi],searchPad:["type",lt]};function Jg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Jg.$inject=["elementRegistry","searchPad","canvas","search"],Jg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!ft(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:li(i),id:i.id})),e,{keys:["label","id"]}).map(jF)};function jF(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const HF={__depends__:[FF,WE],__init__:["bpmnSearch"],bpmnSearch:["type",Jg]},GF="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",zF="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",VF={width:36,height:50},WF={width:50,height:50};function D1(e,t,n){return We("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const $i=5;function Dp(e,t){this._styles=t,e.registerProvider(this)}Dp.$inject=["outline","styles"],Dp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if($2(e))return n=We("rect"),Le(n,te({x:-$i,y:-$i,rx:4,width:e.width+$i*2,height:e.height+$i*2},t)),n;if(!ft(e))return P(e,"bpmn:Gateway")?(n=We("rect"),te(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Le(n,te({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ht(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=We("rect"),Le(n,te({x:-$i,y:-$i,rx:14,width:e.width+$i*2,height:e.height+$i*2},t))):P(e,"bpmn:EndEvent")?(n=We("circle"),Le(n,te({cx:e.width/2,cy:e.height/2,r:e.width/2+$i+1},t))):P(e,"bpmn:Event")?(n=We("circle"),Le(n,te({cx:e.width/2,cy:e.height/2,r:e.width/2+$i},t))):P(e,"bpmn:DataObjectReference")&&L1(e,"bpmn:DataObjectReference")?n=D1(GF,{x:-6,y:-6},t):P(e,"bpmn:DataStoreReference")&&L1(e,"bpmn:DataStoreReference")&&(n=D1(zF,{x:-6,y:-6},t)),n},Dp.prototype.updateOutline=function(e,t){if(!ft(e))return ht(e,["bpmn:SubProcess","bpmn:Group"])?(Le(t,{width:e.width+$i*2,height:e.height+$i*2}),!0):!!ht(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function L1(e,t){var n;return t==="bpmn:DataObjectReference"?n=VF:t==="bpmn:DataStoreReference"&&(n=WF),e.width===n.width&&e.height===n.height}const UF={__depends__:[Gg],__init__:["outlineProvider"],outlineProvider:["type",Dp]};var qF='<?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 xo(e){Kr.call(this,e)}je(xo,Kr),xo.Viewer=Rr,xo.NavigatedViewer=wc,xo.prototype.createDiagram=function(){return this.importXML(qF)},xo.prototype._interactionModules=[Y0,X0,Q0],xo.prototype._modelingModules=[r5,ju,s5,h0,b5,Ng,M5,Z5,h_,vu,t3,o3,f3,g3,m3,w3,D3,$3,Qh,W3,Q3,uF,dF,YS,NF,HF,UF],xo.prototype._modules=[].concat(Rr.prototype._modules,xo.prototype._interactionModules,xo.prototype._modelingModules);const YF=Ce.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Ce.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=gd(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 Ce.onMounted(async()=>{a=new xo({container:r.value,moddleExtensions:Es,additionalModules:[...F0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Ce.watch(()=>i.xml,l=>{l&&a&&s(l)}),Ce.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Ce.openBlock(),Ce.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),Qg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},KF=Qg(YF,[["__scopeId","data-v-7cfbebdb"]]),XF=["title","aria-expanded"],ZF=["title","onClick"],JF={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},QF={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},e6={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},t6={key:0,class:"bwl-validation__body"},n6={key:0,class:"bwl-validation__empty"},i6={key:1,class:"bwl-validation__empty"},o6={key:2,class:"bwl-validation__list"},r6=["onClick"],a6={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},s6={class:"bwl-validation__msg"},c6=["title"],l6=Qg(Ce.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Ce.computed(()=>E0(n.issues.value,n.describeElement)),o=Ce.computed(()=>S0(i.value)),r=y=>Ja(y,n.changeScope.value),a=Ce.computed(()=>ag(i.value,n.changeScope.value)),s=Ce.ref({error:!0,warning:!0,info:!0}),c=Ce.computed(()=>R0(i.value.filter(y=>s.value[y.severity]),n.changeScope.value)),l=Ce.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(y){if(!l.value){l.value=!0;return}s.value[y]=!s.value[y]}function f(y){const h=y.targetRefs[0];h&&n.requestFocus(h)}return(y,h)=>(Ce.openBlock(),Ce.createElementBlock("section",{class:Ce.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Ce.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[Ce.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Ce.openBlock(),Ce.createElementBlock("svg",{class:Ce.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[Ce.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=Ce.createElementVNode("span",null,"검증",-1))],8,XF),Ce.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=Ce.withModifiers(()=>{},["stop"]))},[(Ce.openBlock(),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(u,m=>Ce.createElementVNode("button",{key:m,type:"button",class:Ce.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>d(m)},[(Ce.openBlock(),Ce.createElementBlock("svg",JF,[h[4]||(h[4]=Ce.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(Ce.openBlock(),Ce.createElementBlock("path",QF)):(Ce.openBlock(),Ce.createElementBlock("path",e6))])),Ce.createElementVNode("span",null,Ce.toDisplayString(o.value[m]),1)],10,ZF)),64))])]),l.value?(Ce.openBlock(),Ce.createElementBlock("div",t6,[i.value.length===0?(Ce.openBlock(),Ce.createElementBlock("p",n6,"발견된 문제가 없습니다.")):c.value.length===0?(Ce.openBlock(),Ce.createElementBlock("p",i6," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Ce.openBlock(),Ce.createElementBlock("ul",o6,[(Ce.openBlock(!0),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(c.value,m=>(Ce.openBlock(),Ce.createElementBlock("li",{key:m.key,class:Ce.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:w=>f(m)},[h[5]||(h[5]=Ce.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(Ce.openBlock(),Ce.createElementBlock("span",a6,"이번 변경")):Ce.createCommentVNode("",!0),Ce.createElementVNode("span",s6,Ce.toDisplayString(m.message),1),Ce.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},Ce.toDisplayString(m.category),9,c6)],10,r6))),128))]))])):Ce.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),u6={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},p6=["aria-checked","title","data-locale","onClick"],d6={class:"bwl-locale__label"},f6={key:0,class:"bwl-locale__badge"},h6=Qg(Ce.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=Ce.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?(Ce.openBlock(),Ce.createElementBlock("div",u6,[(Ce.openBlock(!0),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(o.value,s=>(Ce.openBlock(),Ce.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Ce.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=>Ce.unref(n).setDisplayLocale(s.locale)},[Ce.createElementVNode("span",d6,Ce.toDisplayString(s.label),1),s.pending>0?(Ce.openBlock(),Ce.createElementBlock("span",f6,Ce.toDisplayString(s.pending),1)):Ce.createCommentVNode("",!0)],10,p6))),128))])):Ce.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);le.ADDABLE_FLOW_NODE_TYPES=Vc,le.APPLY_BPMN_OPS_SCHEMA=_M,le.BPMN_EVENT_DEFINITION_TYPES=Uc,le.BPMN_MODDLE_EXTENSIONS=Es,le.BPMN_MODELER_VIEW_MODULES=F0,le.BWL_MODDLE_SCHEMA=Am,le.BWL_NS=Cm,le.BWL_PREFIX=zp,le.BWL_REVIEW_REQUEST_TYPE=Yc,le.BWL_SIDES=Vp,le.BpmnDisplayLocaleSwitcher=h6,le.BpmnModelerView=KF,le.BpmnValidationPanel=l6,le.EDITOR=AT,le.FLOW_LABEL_INDENT=py,le.GROUP_BORDER_MIN_RUN=md,le.GROUP_BORDER_NEAR=Ra,le.HEADLESS_BPMN_MODULES=ig,le.HEADLESS_TEXT_METRICS=oo,le.HeadlessReplay=lg,le.HeadlessReplayModule=k0,le.I18N_DISPLAY_REDRAWN_EVENT=bc,le.I18N_NS=iM,le.I18N_PREFIX=Im,le.I18N_REVIEW_REQUESTED_CLASS=C0,le.I18N_TRANSLATION_TYPE=Fr,le.I18N_UNTRANSLATED_CLASS=M0,le.I18nDisplay=sg,le.I18nDisplayModule=P0,le.IR_EVENT_DEFINITIONS=Wc,le.IR_FLOW_NODE_TYPES=Nr,le.IR_TEXT_LOCALES=qc,le.LABEL_FORK_MARGIN=xd,le.LABEL_SHAPE_MIN_DEPTH=Ey,le.SET_TRANSLATIONS_COMMAND=Jp,le.SEVERITY_ORDER=rg,le.SYMBOLIC_OP_KINDS=Bm,le.SYMBOLIC_OP_SCHEMA=Nm,le.SetTranslationsHandler=Qp,le.TranslationCommands=td,le.TranslationCommandsModule=nd,le.TranslationStateIndex=IT,le.UNDO_EPISODE_COMMAND=Wp,le.UPDATE_TRANSLATION_COMMAND=Jc,le.UpdateTranslationHandler=Zp,le.applyBpmnOpBatch=Xv,le.applyBpmnOps=Wd,le.applyLocaleBackfill=LT,le.applyTranslationLocaleRestore=jT,le.approximateTextWidth=Vr,le.auditBpmnGeometry=My,le.auditBpmnGeometryXml=_A,le.auditBpmnSemantics=qd,le.auditBpmnSemanticsXml=gT,le.auditGeometry=dt,le.auditTargetsOf=fn,le.axisSegmentsOf=dn,le.blackBoxNameRect=yd,le.buildBpmnOpBatch=ET,le.buildRegistryIndex=Ay,le.collectTranslationStates=ox,le.containerBoundarySegments=Aa,le.countBySeverity=S0,le.createBpmnEditorController=PT,le.createBpmnModdle=ny,le.createHeadlessBpmnModeler=cN,le.crossedShapesOf=Tt,le.crossingCost=Tn,le.describeProcess=Gv,le.describeProcessXml=lT,le.diffBpmnElements=Wv,le.diffBpmnElementsXml=wT,le.documentLocalesOf=xs,le.edgeCrossCount=Pa,le.edgeCrossingPairsOf=Si,le.edgeCrossingStatsOf=vy,le.executeAsUndoEpisode=Tm,le.feedGeneratedIds=Kv,le.followMovedEdgeLabels=lv,le.forwardThreePointCandidates=ll,le.geometryFindingKey=ct,le.inferScriptLocale=Rl,le.installHeadlessBpmnDom=ry,le.irEventDefinitionOf=Gp,le.isAddableFlowNodeType=Rm,le.isChangeScopeMixed=ag,le.isEdgeOverlapFinding=vd,le.isGuardedGridSnapping=CN,le.isInChangeScope=Ja,le.isIrEventDefinition=Mm,le.isIrFlowNodeType=Sm,le.isIrTextLocale=qR,le.labelRectsOf=nr,le.labelShapeDepth=Sy,le.labelSlot=jr,le.lineCrossesLabel=Wi,le.lineThroughLabel=fy,le.lineThroughShapeLabel=_y,le.loadBpmnXml=Sa,le.localeTextsOf=Xp,le.lowerOps=Nv,le.mergeUndoSteps=Om,le.nameLocalesOf=Zc,le.oppositeOverlapCount=iA,le.oppositeOverlapOf=uy,le.piercesOwnEndpoint=wd,le.planBackEdgeBoundaryClearance=Uy,le.planCrossPoolRoute=Hy,le.planEdgeRepair=pl,le.planLabelLineClearance=$d,le.planLabelPlacement=rv,le.planLocaleBackfill=DT,le.planMiddleSegmentShifts=Ly,le.planOppositeOverlapRepair=Jy,le.planSegmentDetours=cl,le.planShapeLabelClearance=jd,le.planTranslationLocaleRestore=FT,le.poolOverlapsOf=Ed,le.recordGeneratedIds=Yv,le.redockIntroducedDetachedEndpoints=fv,le.repairIntroducedBoundaryHugging=Yy,le.repairIntroducedCrossings=Cd,le.repairIntroducedEdgeCrossings=By,le.repairIntroducedFakeMerges=ev,le.repairIntroducedLabelLines=uv,le.repairIntroducedOppositeOverlaps=ov,le.repairIntroducedShapeLabelLines=dv,le.repairIntroducedSharedSegmentLabels=pv,le.replayAgentTurn=Zv,le.rerouteIntroducedCrossPoolEdges=Gy,le.resolverServicesOf=Mv,le.reviewRequestValuesOf=ed,le.reviewRequestsOf=Xo,le.rootLangOf=Kp,le.saveBpmnXml=UC,le.sceneCrossingCost=yy,le.sceneFromDefinitions=Ry,le.sceneFromRegistry=Ge,le.segmentShapeClearance=Ao,le.shapesUnderLabel=Ta,le.sharedEndpointCrossingPairsOf=Ri,le.sharedSegmentUnderLabel=Ma,le.sharedSpansOf=sl,le.sortPanelIssues=R0,le.toPanelIssues=E0,le.touchedElements=_T,le.translationLocale=Bn,le.translationsOf=Ko,le.undoStepMark=km,le.unreadableOverlapCount=qn,le.unreadableOverlapOf=tr,le.validateOps=yv,le.warningMessages=gd,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})}));
342
+ </div>`,lt.RESULT_HTML='<div class="djs-search-result"></div>',lt.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',lt.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const FF={__depends__:[Ys,Ju,Oi],searchPad:["type",lt]};function Qg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Qg.$inject=["elementRegistry","searchPad","canvas","search"],Qg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!ft(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:ni(i),id:i.id})),e,{keys:["label","id"]}).map(jF)};function jF(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const HF={__depends__:[FF,WE],__init__:["bpmnSearch"],bpmnSearch:["type",Qg]},GF="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",zF="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",VF={width:36,height:50},WF={width:50,height:50};function D1(e,t,n){return We("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const $i=5;function Lp(e,t){this._styles=t,e.registerProvider(this)}Lp.$inject=["outline","styles"],Lp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if($2(e))return n=We("rect"),Le(n,te({x:-$i,y:-$i,rx:4,width:e.width+$i*2,height:e.height+$i*2},t)),n;if(!ft(e))return T(e,"bpmn:Gateway")?(n=We("rect"),te(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Le(n,te({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ht(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=We("rect"),Le(n,te({x:-$i,y:-$i,rx:14,width:e.width+$i*2,height:e.height+$i*2},t))):T(e,"bpmn:EndEvent")?(n=We("circle"),Le(n,te({cx:e.width/2,cy:e.height/2,r:e.width/2+$i+1},t))):T(e,"bpmn:Event")?(n=We("circle"),Le(n,te({cx:e.width/2,cy:e.height/2,r:e.width/2+$i},t))):T(e,"bpmn:DataObjectReference")&&L1(e,"bpmn:DataObjectReference")?n=D1(GF,{x:-6,y:-6},t):T(e,"bpmn:DataStoreReference")&&L1(e,"bpmn:DataStoreReference")&&(n=D1(zF,{x:-6,y:-6},t)),n},Lp.prototype.updateOutline=function(e,t){if(!ft(e))return ht(e,["bpmn:SubProcess","bpmn:Group"])?(Le(t,{width:e.width+$i*2,height:e.height+$i*2}),!0):!!ht(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function L1(e,t){var n;return t==="bpmn:DataObjectReference"?n=VF:t==="bpmn:DataStoreReference"&&(n=WF),e.width===n.width&&e.height===n.height}const UF={__depends__:[zg],__init__:["outlineProvider"],outlineProvider:["type",Lp]};var qF='<?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 wo(e){Kr.call(this,e)}je(wo,Kr),wo.Viewer=Mr,wo.NavigatedViewer=_c,wo.prototype.createDiagram=function(){return this.importXML(qF)},wo.prototype._interactionModules=[Y0,X0,Q0],wo.prototype._modelingModules=[r5,Hu,s5,h0,b5,$g,M5,Z5,h_,xu,t3,o3,f3,g3,m3,w3,D3,$3,eg,W3,Q3,uF,dF,YS,NF,HF,UF],wo.prototype._modules=[].concat(Mr.prototype._modules,wo.prototype._interactionModules,wo.prototype._modelingModules);const YF=Ce.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Ce.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=gd(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 Ce.onMounted(async()=>{a=new wo({container:r.value,moddleExtensions:Ss,additionalModules:[...F0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Ce.watch(()=>i.xml,l=>{l&&a&&s(l)}),Ce.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Ce.openBlock(),Ce.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),em=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},KF=em(YF,[["__scopeId","data-v-7cfbebdb"]]),XF=["title","aria-expanded"],ZF=["title","onClick"],JF={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},QF={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},ej={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},tj={key:0,class:"bwl-validation__body"},nj={key:0,class:"bwl-validation__empty"},ij={key:1,class:"bwl-validation__empty"},oj={key:2,class:"bwl-validation__list"},rj=["onClick"],aj={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},sj={class:"bwl-validation__msg"},cj=["title"],lj=em(Ce.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Ce.computed(()=>E0(n.issues.value,n.describeElement)),o=Ce.computed(()=>S0(i.value)),r=y=>Ja(y,n.changeScope.value),a=Ce.computed(()=>sg(i.value,n.changeScope.value)),s=Ce.ref({error:!0,warning:!0,info:!0}),c=Ce.computed(()=>R0(i.value.filter(y=>s.value[y.severity]),n.changeScope.value)),l=Ce.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(y){if(!l.value){l.value=!0;return}s.value[y]=!s.value[y]}function f(y){const h=y.targetRefs[0];h&&n.requestFocus(h)}return(y,h)=>(Ce.openBlock(),Ce.createElementBlock("section",{class:Ce.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Ce.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[Ce.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Ce.openBlock(),Ce.createElementBlock("svg",{class:Ce.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[Ce.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=Ce.createElementVNode("span",null,"검증",-1))],8,XF),Ce.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=Ce.withModifiers(()=>{},["stop"]))},[(Ce.openBlock(),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(u,m=>Ce.createElementVNode("button",{key:m,type:"button",class:Ce.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>d(m)},[(Ce.openBlock(),Ce.createElementBlock("svg",JF,[h[4]||(h[4]=Ce.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(Ce.openBlock(),Ce.createElementBlock("path",QF)):(Ce.openBlock(),Ce.createElementBlock("path",ej))])),Ce.createElementVNode("span",null,Ce.toDisplayString(o.value[m]),1)],10,ZF)),64))])]),l.value?(Ce.openBlock(),Ce.createElementBlock("div",tj,[i.value.length===0?(Ce.openBlock(),Ce.createElementBlock("p",nj,"발견된 문제가 없습니다.")):c.value.length===0?(Ce.openBlock(),Ce.createElementBlock("p",ij," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Ce.openBlock(),Ce.createElementBlock("ul",oj,[(Ce.openBlock(!0),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(c.value,m=>(Ce.openBlock(),Ce.createElementBlock("li",{key:m.key,class:Ce.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:w=>f(m)},[h[5]||(h[5]=Ce.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(Ce.openBlock(),Ce.createElementBlock("span",aj,"이번 변경")):Ce.createCommentVNode("",!0),Ce.createElementVNode("span",sj,Ce.toDisplayString(m.message),1),Ce.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},Ce.toDisplayString(m.category),9,cj)],10,rj))),128))]))])):Ce.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),uj={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},pj=["aria-checked","title","data-locale","onClick"],dj={class:"bwl-locale__label"},fj={key:0,class:"bwl-locale__badge"},hj=em(Ce.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=Ce.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?(Ce.openBlock(),Ce.createElementBlock("div",uj,[(Ce.openBlock(!0),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(o.value,s=>(Ce.openBlock(),Ce.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Ce.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=>Ce.unref(n).setDisplayLocale(s.locale)},[Ce.createElementVNode("span",dj,Ce.toDisplayString(s.label),1),s.pending>0?(Ce.openBlock(),Ce.createElementBlock("span",fj,Ce.toDisplayString(s.pending),1)):Ce.createCommentVNode("",!0)],10,pj))),128))])):Ce.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);le.ADDABLE_FLOW_NODE_TYPES=Wc,le.APPLY_BPMN_OPS_SCHEMA=_M,le.BPMN_EVENT_DEFINITION_TYPES=qc,le.BPMN_MODDLE_EXTENSIONS=Ss,le.BPMN_MODELER_VIEW_MODULES=F0,le.BWL_MODDLE_SCHEMA=Tm,le.BWL_NS=Am,le.BWL_PREFIX=Vp,le.BWL_REVIEW_REQUEST_TYPE=Kc,le.BWL_SIDES=Wp,le.BpmnDisplayLocaleSwitcher=hj,le.BpmnModelerView=KF,le.BpmnValidationPanel=lj,le.EDITOR=AP,le.FLOW_LABEL_INDENT=dy,le.GROUP_BORDER_MIN_RUN=md,le.GROUP_BORDER_NEAR=Ra,le.HEADLESS_BPMN_MODULES=og,le.HEADLESS_TEXT_METRICS=ro,le.HeadlessReplay=ug,le.HeadlessReplayModule=k0,le.I18N_DISPLAY_REDRAWN_EVENT=wc,le.I18N_NS=iM,le.I18N_PREFIX=Bm,le.I18N_REVIEW_REQUESTED_CLASS=C0,le.I18N_TRANSLATION_TYPE=jr,le.I18N_UNTRANSLATED_CLASS=M0,le.I18nDisplay=cg,le.I18nDisplayModule=T0,le.IR_EVENT_DEFINITIONS=Uc,le.IR_FLOW_NODE_TYPES=$r,le.IR_TEXT_LOCALES=Yc,le.LABEL_FORK_MARGIN=xd,le.LABEL_SHAPE_MIN_DEPTH=Sy,le.SET_TRANSLATIONS_COMMAND=Qc,le.SEVERITY_ORDER=ag,le.SYMBOLIC_OP_KINDS=Nm,le.SYMBOLIC_OP_SCHEMA=$m,le.SetTranslationsHandler=Qp,le.TranslationCommands=td,le.TranslationCommandsModule=nd,le.TranslationStateIndex=IP,le.UNDO_EPISODE_COMMAND=Up,le.UPDATE_TRANSLATION_COMMAND=Jc,le.UpdateTranslationHandler=Jp,le.applyBpmnOpBatch=Zv,le.applyBpmnOps=Wd,le.applyLocaleBackfill=LP,le.applyTranslationLocaleRestore=jP,le.approximateTextWidth=Vr,le.auditBpmnGeometry=Cy,le.auditBpmnGeometryXml=_A,le.auditBpmnSemantics=qd,le.auditBpmnSemanticsXml=gP,le.auditGeometry=dt,le.auditTargetsOf=hn,le.axisSegmentsOf=fn,le.blackBoxNameRect=yd,le.buildBpmnOpBatch=EP,le.buildRegistryIndex=Ty,le.collectTranslationStates=rx,le.containerBoundarySegments=Aa,le.countBySeverity=S0,le.createBpmnEditorController=TP,le.createBpmnModdle=iy,le.createHeadlessBpmnModeler=cN,le.crossedShapesOf=Pt,le.crossingCost=kn,le.describeProcess=zv,le.describeProcessXml=lP,le.diffBpmnElements=Uv,le.diffBpmnElementsXml=wP,le.documentLocalesOf=xs,le.edgeCrossCount=Ta,le.edgeCrossingPairsOf=Si,le.edgeCrossingStatsOf=xy,le.executeAsUndoEpisode=km,le.feedGeneratedIds=Xv,le.followMovedEdgeLabels=uv,le.forwardThreePointCandidates=ul,le.geometryFindingKey=ct,le.inferScriptLocale=Ml,le.installHeadlessBpmnDom=ay,le.irEventDefinitionOf=zp,le.isAddableFlowNodeType=Mm,le.isChangeScopeMixed=sg,le.isEdgeOverlapFinding=vd,le.isGuardedGridSnapping=CN,le.isInChangeScope=Ja,le.isIrEventDefinition=Cm,le.isIrFlowNodeType=Rm,le.isIrTextLocale=qR,le.labelRectsOf=or,le.labelShapeDepth=Ry,le.labelSlot=Zo,le.lineCrossesLabel=Ui,le.lineThroughLabel=hy,le.lineThroughShapeLabel=Ey,le.loadBpmnXml=Sa,le.localeTextsOf=Zp,le.lowerOps=$v,le.mergeUndoSteps=Dm,le.nameLocalesOf=bs,le.oppositeOverlapCount=iA,le.oppositeOverlapOf=py,le.piercesOwnEndpoint=wd,le.planBackEdgeBoundaryClearance=qy,le.planCrossPoolRoute=Gy,le.planEdgeRepair=dl,le.planLabelLineClearance=$d,le.planLabelPlacement=av,le.planLocaleBackfill=DP,le.planMiddleSegmentShifts=Iy,le.planOppositeOverlapRepair=Qy,le.planSegmentDetours=ll,le.planShapeLabelClearance=jd,le.planTranslationLocaleRestore=FP,le.poolOverlapsOf=Ed,le.recordGeneratedIds=Kv,le.redockIntroducedDetachedEndpoints=hv,le.repairIntroducedBoundaryHugging=Ky,le.repairIntroducedCrossings=Cd,le.repairIntroducedEdgeCrossings=Ny,le.repairIntroducedFakeMerges=tv,le.repairIntroducedLabelLines=pv,le.repairIntroducedOppositeOverlaps=rv,le.repairIntroducedShapeLabelLines=fv,le.repairIntroducedSharedSegmentLabels=dv,le.replayAgentTurn=Jv,le.rerouteIntroducedCrossPoolEdges=zy,le.resolverServicesOf=Cv,le.reviewRequestValuesOf=ed,le.reviewRequestsOf=Jo,le.rootLangOf=Xp,le.saveBpmnXml=UC,le.sceneCrossingCost=vy,le.sceneFromDefinitions=My,le.sceneFromRegistry=Ge,le.segmentShapeClearance=Po,le.shapesUnderLabel=Pa,le.sharedEndpointCrossingPairsOf=Ri,le.sharedSegmentUnderLabel=Ma,le.sharedSpansOf=cl,le.sortPanelIssues=R0,le.toPanelIssues=E0,le.touchedElements=_P,le.translationLocale=ln,le.translationsOf=Wi,le.undoStepMark=Om,le.unreadableOverlapCount=qn,le.unreadableOverlapOf=ir,le.validateOps=vv,le.warningMessages=gd,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})}));