@g1cloud/bpmn-modeler-next 5.0.0-beta.14 → 5.0.0-beta.16
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.
- package/dist/bpmn-modeler.js +7576 -7534
- package/dist/bpmn-modeler.umd.cjs +64 -64
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(Z,he){typeof exports=="object"&&typeof module<"u"?he(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],he):(Z=typeof globalThis<"u"?globalThis:Z||self,he(Z.BpmnModeler={},Z.Vue))})(this,(function(Z,he){"use strict";var p$=Object.defineProperty;var f$=(Z,he,to)=>he in Z?p$(Z,he,{enumerable:!0,configurable:!0,writable:!0,value:to}):Z[he]=to;var fi=(Z,he,to)=>f$(Z,typeof he!="symbol"?he+"":he,to);const to=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Qs=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function qh(e){return to.includes(e)}function Yh(e){return Qs.includes(e)}const Js=["timer"],ec={timer:"bpmn:TimerEventDefinition"};function Kh(e){return typeof e=="string"&&Js.includes(e)}function Uu(e){if(e.length===1)return Js.find(t=>ec[t]===e[0])}const tc=["ko","en","ja","zh"];function ZE(e){return typeof e=="string"&&tc.includes(e)}const Xh="http://g1project.net/spec/bpmn/bwl/1.0",qu="bwl",Yu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],nc="bwl:ReviewRequest",Zh={name:"bwl-hints",uri:Xh,prefix:qu,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"}]}]},Ku="bwl.undoEpisode",Qh=new WeakSet;function QE(e){Qh.has(e)||(e.register(Ku,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Qh.add(e))}function Jh(e,t){QE(e);const n={run:t};if(e.execute(Ku,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Xu(e){return Array.prototype.concat.apply([],e)}const Ia=Object.prototype.toString,JE=Object.prototype.hasOwnProperty;function no(e){return e===void 0}function cn(e){return e!==void 0}function Lo(e){return e==null}function Fe(e){return Ia.call(e)==="[object Array]"}function hn(e){return Ia.call(e)==="[object Object]"}function ze(e){return Ia.call(e)==="[object Number]"}function mn(e){const t=Ia.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function qn(e){return Ia.call(e)==="[object String]"}function e1(e){if(!Fe(e))throw new Error("must supply array")}function Yn(e,t){return!Lo(e)&&JE.call(e,t)}function Pt(e,t){const n=rc(t);let i;return z(e,function(r,o){if(n(r,o))return i=r,!1}),i}function em(e,t){const n=rc(t);let i=Fe(e)?-1:void 0;return z(e,function(r,o){if(n(r,o))return i=o,!1}),i}function nt(e,t){const n=rc(t);let i=[];return z(e,function(r,o){n(r,o)&&i.push(r)}),i}function z(e,t){let n,i;if(no(e))return;const r=Fe(e)?o1:r1;for(let o in e)if(Yn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function t1(e,t){if(no(e))return[];e1(e);const n=rc(t);return e.filter(function(i,r){return!n(i,r)})}function Kn(e,t,n){return z(e,function(i,r){n=t(n,i,r)}),n}function io(e,t){return!!Kn(e,function(n,i,r){return n&&t(i,r)},!0)}function br(e,t){return!!Pt(e,t)}function kn(e,t){let n=[];return z(e,function(i,r){n.push(t(i,r))}),n}function ic(e){return e&&Object.keys(e)||[]}function n1(e){return ic(e).length}function Io(e){return kn(e,t=>t)}function Bo(e,t,n={}){return t=Zu(t),z(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function tm(e,...t){e=Zu(e);let n={};return z(t,r=>Bo(r,e,n)),kn(n,function(r,o){return r[0]})}const i1=tm;function Bi(e,t){t=Zu(t);let n=[];return z(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),kn(n,i=>i.v)}function No(e){return function(t){return io(e,function(n,i){return t[i]===n})}}function Zu(e){return mn(e)?e:t=>t[e]}function rc(e){return mn(e)?e:t=>t===e}function r1(e){return e}function o1(e){return Number(e)}function Qu(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function l(){n&&a(!0),c()}function u(...p){o=Date.now(),i=p,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Gn(e,t){return e.bind(t)}function U(e,...t){return Object.assign(e,...t)}function a1(e,t,n){let i=e;return z(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];cn(a)&&Lo(s)&&(s=i[r]=isNaN(+a)?{}:[]),no(a)?no(n)?delete i[r]:i[r]=n:i=s}),e}function Pi(e,t){let n={},i=Object(e);return z(t,function(r){r in i&&(n[r]=e[r])}),n}function Ni(e,t){let n={},i=Object(e);return z(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function M(e,t){var n=ue(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function tt(e,t){return br(t,function(n){return M(e,n)})}function ue(e){return e&&e.businessObject||e}function ct(e){return e&&e.di}const s1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",nm="i18n",$o="i18n:Translation";function ro(e){if(e){if(M(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(M(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Fo(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,$o)})}function On(e){return e.get("xml:lang")}function xr(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,nc)})}function Ba(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,r,o)=>i!==t&&o.indexOf(i)===r)]}function Ju(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function ep(e,t,n){const i=ro(e);if(!i)return{};const r=i.target[i.key]??"",o=Fo(e).filter(u=>On(u)),a=u=>u.body??"",s=r?o.filter(u=>a(u)===r).map(On):[],c=r?s.length?s:[n??t.designLocale]:[],l={};for(const u of Ba(t)){if(c.includes(u)){l[u]=r;continue}const p=o.find(f=>On(f)===u&&a(f));p&&(l[u]=a(p))}return l}const oc="bwl.updateTranslation";class tp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:r,locales:o,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=ro(c),u=[];t.undo=u;const p=Fo(c).filter(N=>On(N)),f=s??(l?l.target[l.key]??"":""),d=a??r,h=(N=>{if(!N)return[];const P=p.filter(D=>D.body===N).map(On);return P.length?P:[d]})(f),y=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,C=N=>{var P;return((P=p.find(D=>On(D)===N&&D.body))==null?void 0:P.body)??(h.includes(N)?f:"")},x=N=>xr(c).some(P=>P.locale===N),m=C(y);if(m===i)return[];const v=!!m&&!x(y),_=v?o.filter(N=>N!==y&&C(N)&&!x(N)):[],E=()=>{let N=c.extensionElements;return N||(N=this.moddle.create("bpmn:ExtensionElements",{values:[]}),N.$parent=c,c.extensionElements=N,u.push(()=>delete c.extensionElements)),N.get("values")},T=(N,P)=>{const D=E();let F=D.find(J=>{var ge;return((ge=J.$instanceOf)==null?void 0:ge.call(J,$o))&&On(J)===N});if(F){const J=F.body;F.body=P,u.push(()=>F.body=J)}else F=this.moddle.create($o,{body:P}),F.set("xml:lang",N),F.$parent=c.extensionElements,D.push(F),u.push(()=>D.splice(D.indexOf(F),1))},O=N=>{const P=E(),D=P.indexOf(N);P.splice(D,1),u.push(()=>P.splice(D,0,N))};if(s===void 0){if(y===r&&l){if(f&&!p.some(P=>P.body===f)){const P=a&&a!==r?a:void 0;P&&T(P,f)}const N=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{N?l.target[l.key]=f:delete l.target[l.key]})}T(y,i)}else(p.some(N=>On(N)===y)||!f&&y!==d)&&T(y,i);if(!v)for(const N of xr(c).filter(P=>P.locale===y))O(N);for(const N of _){const P=E(),D=this.moddle.create(nc,{locale:N,sourceLocale:y,previous:m});D.$parent=c.extensionElements,P.push(D),u.push(()=>P.splice(P.indexOf(D),1))}for(const N of xr(c).filter(P=>P.sourceLocale===y&&(P.previous??"")===i))O(N);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):[]}}fi(tp,"$inject",["moddle"]);const np="bwl.setTranslations",c1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class ip{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:r=[],designLocale:o,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!ro(l))return[];const p=()=>{let C=l.extensionElements;return C||(C=this.moddle.create("bpmn:ExtensionElements",{values:[]}),C.$parent=l,l.extensionElements=C,u.push(()=>delete l.extensionElements)),C.get("values")},f=C=>{const x=p(),m=x.indexOf(C);m<0||(x.splice(m,1),u.push(()=>x.splice(m,0,C)))},d=C=>Fo(l).find(x=>On(x)===C);if(i===null)for(const C of a){const x=d(C);x&&f(x)}else if(i)for(const C of a){const x=i[C];if(x===void 0)continue;const m=d(C);if(m){if(m.body===x)continue;const E=m.body;m.body=x,u.push(()=>m.body=E);continue}if(C===o&&(s??o)===o)continue;const v=p(),_=this.moddle.create($o,{body:x});_.set("xml:lang",C),_.$parent=l.extensionElements,v.push(_),u.push(()=>v.splice(v.indexOf(_),1))}const h=[...i===null?[]:c.requests.filter(C=>!r.includes(C.locale)&&!(i&&i[C.locale]!==void 0&&i[C.locale]!==c.texts[C.locale])&&!(i&&C.sourceLocale&&i[C.sourceLocale]===C.previous))];for(const C of xr(l)){const x=h.findIndex(m=>c1(C,m));x>=0?h.splice(x,1):f(C)}for(const C of h){const x=p(),m=this.moddle.create(nc,{locale:C.locale,...C.sourceLocale?{sourceLocale:C.sourceLocale}:{},previous:C.previous});m.$parent=l.extensionElements,x.push(m),u.push(()=>x.splice(x.indexOf(m),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}fi(ip,"$inject",["moddle"]);function rp(e){return xr(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class op{constructor(t){t.registerHandler(oc,tp),t.registerHandler(np,ip)}}fi(op,"$inject",["commandStack"]);const ap={__init__:["translationCommands"],translationCommands:["type",op]},im=["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"],l1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},u1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(tc.map(e=>[e,{type:"string"}])),additionalProperties:!1},p1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},f1={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},d1={type:"string",enum:[...Js],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},h1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Qs]},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},m1={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},g1={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},y1={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},v1={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},b1={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},x1={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},_1={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},w1={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},E1={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Yu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function En(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const S1={"participant.add":En("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":En("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":En("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":En("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:[...Qs]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":En("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":En("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":En("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":En("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":En("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":En("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":En("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":En("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":En("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":En("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":En("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":En("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":En("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...tc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":En("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},rm={anyOf:im.map(e=>S1[e])},R1={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:p1,irParticipant:f1,irNode:h1,irFlowCondition:m1,irSequenceFlow:g1,irMessageFlow:y1,irDataStore:v1,irDataAssociation:b1,irTextAnnotation:x1,irAssociation:_1,irGroup:w1,bwlPlacement:E1,eventDefinition:d1,localeTexts:u1,nullableString:l1,symbolicOp:rm}};function sp(){}sp.prototype.get=function(e){return this.$model.properties.get(this,e)},sp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function om(e,t){this.model=e,this.properties=t}om.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(sp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),z(a,Gn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var C1=U(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),am=U(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 cp(e,t){var n=am[e];return n?n(t):t}function lp(e){return!!C1[e]}function sm(e){return!!am[e]}function Dn(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function oi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}oi.prototype.build=function(){return Pi(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},oi.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)},oi.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},oi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Dn(r[0],i),a=Dn(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},oi.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},oi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},oi.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},oi.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},oi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},oi.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")},oi.prototype.hasProperty=function(e){return this.propertiesByName[e]},oi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(z(e.properties,Gn(function(o){o=U({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function _r(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Gn(this.registerPackage,this))}_r.prototype.getPackage=function(e){return this.packageMap[e]},_r.prototype.getPackages=function(){return this.packages},_r.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;cm(t,e,"prefix"),cm(t,e,"uri"),z(e.types,Gn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},_r.prototype.registerType=function(e,t){e=U({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:U({},e.meta||{})});var n=Dn(e.name,t.prefix),i=n.name,r=Object.create(null);z(e.properties,Gn(function(o){var a=Dn(o.name,n.prefix),s=a.name;lp(o.type)||(o.type=Dn(o.type,a.prefix).name),U(o,{ns:a,name:s}),r[s]=o},this)),U(e,{ns:n,name:i,propertiesByName:r}),z(e.extends,Gn(function(o){var a=Dn(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},_r.prototype.mapTypes=function(e,t,n){var i=lp(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=Dn(c,lp(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},_r.prototype.getEffectiveDescriptor=function(e){var t=Dn(e),n=new oi(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},_r.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function cm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function oo(e){this.model=e}oo.prototype.set=function(e,t,n){if(!qn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;M1(n)?i?delete e[r]:delete e.$attrs[up(t)]:i?r in e?e[r]=n:lm(e,i,n):e.$attrs[up(t)]=n},oo.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[up(t)];var i=n.name;return!e[i]&&n.isMany&&lm(e,n,[]),e[i]},oo.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=U({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},oo.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},oo.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},oo.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function M1(e){return typeof e>"u"}function lm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function up(e){return e.replace(/^:/,"")}function di(e,t={}){this.properties=new oo(this),this.factory=new om(this,this.properties),this.registry=new _r(e,this.properties),this.typeCache=Object.create(null),this.config=t}di.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},di.prototype.getType=function(e){var t=this.typeCache,n=qn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},di.prototype.createAny=function(e,t,n){var i=Dn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){a1(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),z(n,function(a,s){hn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},di.prototype.getPackage=function(e){return this.registry.getPackage(e)},di.prototype.getPackages=function(){return this.registry.getPackages()},di.prototype.getElementDescriptor=function(e){return e.$descriptor},di.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},di.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},di.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var um=String.fromCharCode,A1=Object.prototype.hasOwnProperty,P1=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Na={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Na).forEach(function(e){Na[e.toUpperCase()]=Na[e]});function T1(e,t,n,i){return i?A1.call(Na,i)?Na[i]:"&"+i+";":um(t||parseInt(n,16))}function ao(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(P1,T1):e}var pm="non-whitespace outside of root node";function wr(e){return new Error(e)}function k1(e){return"missing namespace for prefix <"+e+">"}function ac(e){return{get:e,enumerable:!0}}function O1(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var fm=Symbol("nameCache");function pp(e){return e+"$uri"}function D1(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[pp(i)]=n;return t}function sc(){return{line:0,column:0}}function L1(e){throw e}function dm(e){if(!this)return new dm(e);var t=e&&e.proxy,n,i,r,o,a=L1,s,c,l,u,p=sc,f=!1,d=!1,g="",h=!1,y=!1,C=null,x=!1,m,v,_,E;function T(D){D instanceof Error||(D=wr(D)),C=D,a(D,p)}function O(D){s&&(D instanceof Error||(D=wr(D)),s(D,p))}this.on=function(D,F){if(typeof F!="function")throw wr("required args <name, cb>");switch(D){case"openTag":i=F;break;case"text":n=F;break;case"closeTag":r=F;break;case"error":a=F;break;case"warn":s=F;break;case"cdata":o=F;break;case"attention":u=F;break;case"question":l=F;break;case"comment":c=F;break;default:throw wr("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw wr("required args <nsMap={}>");var F=Object.create(null),J;for(J in D)F[J]=D[J];return y=!0,E=F,this};function N(){m=y?[]:null,v=y?D1(E):null,_=[],p=sc,x=!1,C=null,d=!1,g=""}this.parse=function(D){if(typeof D!="string")throw wr("required args <xml=string>");if(f)throw wr("parse during stream; call end() first");return N(),P(D),p=sc,x=!1,C},this.write=function(D){if(typeof D!="string")throw wr("required args <xml=string>");return f||(N(),f=!0),C||(g=P(g+D,!0)||""),this},this.end=function(){return f||N(),f=!1,C||P(g),g="",p=sc,x=!1,C},this.stop=function(){x=!0};function P(D,F=!1){var J=null,ge=null,Ae,De=0,qe=!1,rt=!1,Me=0,X=0,ne,q,K,oe,fe,Te,$,R,w,G="",V=0,te;function Re(xt,dn){var wn=xt.indexOf(":");if(wn===-1)return xt;var jn=v[xt.substring(0,wn)];return jn?dn===jn?xt.substr(wn+1):jn+xt.substr(wn):(O(k1(xt.substring(0,wn))),null)}function Qe(){if(te!==null)return te;var xt,dn,wn=y&&v.xmlns,jn=y&&h?[]:null,Ct=V,Yt=G,vn=Yt.length,ka,Hn,Di,ri,Zt,Mo={},Oa=new Set,Tn,pt,yt;e:for(;Ct<vn;Ct++)if(Tn=!1,pt=Yt.charCodeAt(Ct),!(pt===32||pt<14&&pt>8)){for((pt<65||pt>122||pt>90&&pt<97)&&pt!==95&&pt!==58&&(O("illegal first char attribute name"),Tn=!0),yt=Ct+1;yt<vn;yt++)if(pt=Yt.charCodeAt(yt),!(pt>96&&pt<123||pt>64&&pt<91||pt>47&&pt<59||pt===46||pt===45||pt===95)){if(pt===32||pt<14&&pt>8){O("missing attribute value"),Ct=yt;continue e}if(pt===61)break;O("illegal attribute name char"),Tn=!0}if(Zt=Yt.substring(Ct,yt),Zt==="xmlns:xmlns"&&(O("illegal declaration of xmlns"),Tn=!0),pt=Yt.charCodeAt(yt+1),pt===34)yt=Yt.indexOf('"',Ct=yt+2),yt===-1&&(yt=Yt.indexOf("'",Ct),yt!==-1&&(O("attribute value quote missmatch"),Tn=!0));else if(pt===39)yt=Yt.indexOf("'",Ct=yt+2),yt===-1&&(yt=Yt.indexOf('"',Ct),yt!==-1&&(O("attribute value quote missmatch"),Tn=!0));else for(O("missing attribute value quotes"),Tn=!0,yt=yt+1;yt<vn&&(pt=Yt.charCodeAt(yt+1),!(pt===32||pt<14&&pt>8));yt++);for(yt===-1&&(O("missing closing quotes"),yt=vn,Tn=!0),Tn||(Di=Yt.substring(Ct,yt)),Ct=yt;yt+1<vn&&(pt=Yt.charCodeAt(yt+1),!(pt===32||pt<14&&pt>8));yt++)Ct===yt&&(O("illegal character after attribute end"),Tn=!0);if(Ct=yt+1,Tn)continue e;if(Oa.has(Zt)){O("attribute <"+Zt+"> already defined");continue}if(Oa.add(Zt),!y){Mo[Zt]=Di;continue}if(h){if(Hn=Zt==="xmlns"?"xmlns":Zt.charCodeAt(0)===120&&Zt.substr(0,6)==="xmlns:"?Zt.substr(6):null,Hn!==null){if(xt=ao(Di),dn=pp(Hn),ri=E[xt],!ri){if(Hn==="xmlns"||dn in v&&v[dn]!==xt)do ri="ns"+De++;while(typeof v[ri]<"u");else ri=Hn;E[xt]=ri}v[Hn]!==ri&&(ka||(v=O1(v),ka=!0),v[Hn]=ri,Hn==="xmlns"&&(v[pp(ri)]=xt,wn=ri),v[dn]=xt),Mo[Zt]=Di;continue}jn.push(Zt,Di);continue}Zt=Re(Zt,wn),Zt!==null&&(Mo[Zt]=Di)}if(h)for(Ct=0,vn=jn.length;Ct<vn;Ct++)Zt=Re(jn[Ct++],wn),Di=jn[Ct],Zt!==null&&(Mo[Zt]=Di);return te=Mo}function ht(){for(var xt=/(\r\n|\r|\n)/g,dn=0,wn=0,jn=0,Ct=X,Yt,vn;Me>=jn&&(Yt=xt.exec(D),!(!Yt||(Ct=Yt[0].length+Yt.index,Ct>Me)));)dn+=1,jn=Ct;return Me==-1?(wn=Ct,vn=D.substring(X)):X===0?vn=D.substring(X,Me):(wn=Me-jn,vn=X==-1?D.substring(Me):D.substring(Me,X+1)),{data:vn,line:dn,column:wn}}for(p=ht,t&&(w=Object.create({},{name:ac(function(){return $}),originalName:ac(function(){return R}),attrs:ac(Qe),ns:ac(function(){return v})}));X!==-1;){if(D.charCodeAt(X)===60?Me=X:Me=D.indexOf("<",X),Me===-1){if(F)return D.substring(X);if(_.length)return T("unexpected end of file");if(!d)return T("missing start tag");X<D.length&&D.substring(X).trim()&&O(pm);return}if(d||(d=!0),X!==Me){if(_.length){if(n&&(n(D.substring(X,Me),ao,p),x))return}else if(D.substring(X,Me).trim()&&(O(pm),x))return}if(oe=D.charCodeAt(Me+1),oe===33){if(K=D.charCodeAt(Me+2),K===91&&D.substr(Me+3,6)==="CDATA["){if(X=D.indexOf("]]>",Me),X===-1)return F?D.substring(Me):T("unclosed cdata");if(o&&(o(D.substring(Me+9,X),p),x))return;X+=3;continue}if(K===45&&D.charCodeAt(Me+3)===45){if(X=D.indexOf("-->",Me),X===-1)return F?D.substring(Me):T("unclosed comment");if(c&&(c(D.substring(Me+4,X),ao,p),x))return;X+=3;continue}}if(oe===63){if(X=D.indexOf("?>",Me),X===-1)return F?D.substring(Me):T("unclosed question");if(l&&(l(D.substring(Me,X+2),p),x))return;X+=2;continue}for(ne=Me+1;;ne++){if(fe=D.charCodeAt(ne),isNaN(fe))return F?D.substring(Me):(X=-1,T("unclosed tag"));if(fe===34)K=D.indexOf('"',ne+1),ne=K!==-1?K:ne;else if(fe===39)K=D.indexOf("'",ne+1),ne=K!==-1?K:ne;else if(fe===62){X=ne;break}}if(oe===33){if(u&&(u(D.substring(Me,X+1),ao,p),x))return;X+=1;continue}if(te={},oe===47){if(qe=!1,rt=!0,!_.length)return T("missing open tag");if(ne=$=_.pop(),K=Me+2+ne.length,D.substring(Me+2,K)!==ne)return T("closing tag mismatch");for(;K<X;K++)if(oe=D.charCodeAt(K),!(oe===32||oe>8&&oe<14))return T("close tag")}else{if(D.charCodeAt(X-1)===47?(ne=$=D.substring(Me+1,X-1),qe=!0,rt=!0):(ne=$=D.substring(Me+1,X),qe=!0,rt=!1),!(oe>96&&oe<123||oe>64&&oe<91||oe===95||oe===58))return T("illegal first char nodeName");for(K=1,q=ne.length;K<q;K++)if(oe=ne.charCodeAt(K),!(oe>96&&oe<123||oe>64&&oe<91||oe>47&&oe<59||oe===45||oe===95||oe==46)){if(oe===32||oe<14&&oe>8){$=ne.substring(0,K),te=null;break}return T("invalid nodeName")}rt||_.push($)}if(y){Ae=v,qe&&(rt||m.push(Ae),te===null&&(h=ne.indexOf("xmlns",K)!==-1)&&(V=K,G=ne,Qe(),h=!1)),R=$,ge!==v&&(J=v[fm],J===void 0&&(J=v[fm]=Object.create(null)),ge=v);var Wt=J[$];if(Wt!==void 0)$=Wt;else{if(oe=$.indexOf(":"),oe!==-1){if(Te=v[$.substring(0,oe)],!Te)return T("missing namespace on <"+R+">");$=$.substr(oe+1)}else Te=v.xmlns;Te&&($=Te+":"+$),J[R]=$}}if(qe&&(V=K,G=ne,i&&(t?i(w,ao,rt,p):i($,Qe,ao,rt,p),x)))return;if(rt){if(r&&(r(t?w:$,ao,qe,p),x))return;y&&(qe?v=Ae:v=m.pop())}X+=1}}}function hm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var fp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},mm="property";function gm(e){return e.xml&&e.xml.serialize}function I1(e){const t=gm(e);return t!==mm&&(t||null)}function B1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ym(e,t){return hm(t)?e.prefix+":"+B1(e.localName):e.name}function N1(e,t){var n=e.name,i=e.localName,r=t&&t.xml&&t.xml.typePrefix;return r&&i.indexOf(r)===0?e.prefix+":"+i.slice(r.length):n}function $1(e,t,n){const i=Dn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Dn(r);var a=n.getPackage(o.prefix);return N1(o,a)}function Er(e){return new Error(e)}function er(e){return e.$descriptor}function F1(e){U(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Er("expected element");var n=this.elementsById,i=er(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Er("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function $a(){}$a.prototype.handleEnd=function(){},$a.prototype.handleText=function(){},$a.prototype.handleNode=function(){};function dp(){}dp.prototype=Object.create($a.prototype),dp.prototype.handleNode=function(){return this};function jo(){}jo.prototype=Object.create($a.prototype),jo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Fa(e,t){this.property=e,this.context=t}Fa.prototype=Object.create(jo.prototype),Fa.prototype.handleNode=function(e){if(this.element)throw Er("expected no sub nodes");return this.element=this.createReference(e),this},Fa.prototype.handleEnd=function(){this.element.id=this.body},Fa.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function hp(e,t){this.element=t,this.propertyDesc=e}hp.prototype=Object.create(jo.prototype),hp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=cp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function cc(){}cc.prototype=Object.create(jo.prototype),cc.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 Nn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Nn.prototype=Object.create(cc.prototype),Nn.prototype.addReference=function(e){this.context.addReference(e)},Nn.prototype.handleText=function(e){var t=this.element,n=er(t),i=n.bodyProperty;if(!i)throw Er("unexpected body text <"+e+">");jo.prototype.handleText.call(this,e)},Nn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=er(t),i=n.bodyProperty;i&&e!==void 0&&(e=cp(i.type,e),t.set(i.name,e))},Nn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=er(n),r=this.context,o=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){r.addReference({element:o,property:u.ns.name,id:f})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=cp(u.type,c):l==="xmlns"?l=":"+l:(s=Dn(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},Nn.prototype.getPropertyForNode=function(e){var t=e.name,n=Dn(t),i=this.type,r=this.model,o=er(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=I1(s);if(l){const u=e.attributes[l];if(u){const p=$1(u,e.ns,r),f=r.getType(p);return U({},s,{effectiveType:er(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=ym(n,c),u=r.getType(l);if(s=Pt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return U({},s,{effectiveType:er(u).name})}else if(s=Pt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Er("unrecognized element <"+n.name+">")},Nn.prototype.toString=function(){return"ElementDescriptor["+er(this.type).name+"]"},Nn.prototype.valueHandler=function(e,t){return new hp(e,t)},Nn.prototype.referenceHandler=function(e){return new Fa(e,this.context)},Nn.prototype.handler=function(e){return e==="Element"?new Ho(this.model,e,this.context):new Nn(this.model,e,this.context)},Nn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,sm(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(U(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function mp(e,t,n){Nn.call(this,e,t,n)}mp.prototype=Object.create(Nn.prototype),mp.prototype.createElement=function(e){var t=e.name,n=Dn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&ym(n,o)||t;if(!r.hasType(a))throw Er("unexpected element <"+e.originalName+">");return Nn.prototype.createElement.call(this,e)};function Ho(e,t,n){this.model=e,this.context=n}Ho.prototype=Object.create(cc.prototype),Ho.prototype.createElement=function(e){var t=e.name,n=Dn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Ho.prototype.handleChild=function(e){var t=new Ho(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},Ho.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function gp(e){e instanceof di&&(e={model:e}),U(this,{lax:!1},e)}gp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Nn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new F1(U({},t,{rootHandler:i})),s=new dm({proxy:!0}),c=j1();i.context=a,c.push(i);function l(_,E,T){var O=E(),N=O.line,P=O.column,D=O.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var F="unparsable content "+(D?D+" ":"")+`detected
|
|
1
|
+
(function(Z,he){typeof exports=="object"&&typeof module<"u"?he(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],he):(Z=typeof globalThis<"u"?globalThis:Z||self,he(Z.BpmnModeler={},Z.Vue))})(this,(function(Z,he){"use strict";var y$=Object.defineProperty;var v$=(Z,he,to)=>he in Z?y$(Z,he,{enumerable:!0,configurable:!0,writable:!0,value:to}):Z[he]=to;var fi=(Z,he,to)=>v$(Z,typeof he!="symbol"?he+"":he,to);const to=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],ic=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Qh(e){return to.includes(e)}function Jh(e){return ic.includes(e)}const rc=["timer"],oc={timer:"bpmn:TimerEventDefinition"};function em(e){return typeof e=="string"&&rc.includes(e)}function Qu(e){if(e.length===1)return rc.find(t=>oc[t]===e[0])}const ac=["ko","en","ja","zh"];function i1(e){return typeof e=="string"&&ac.includes(e)}const tm="http://g1project.net/spec/bpmn/bwl/1.0",Ju="bwl",ep=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],sc="bwl:ReviewRequest",nm={name:"bwl-hints",uri:tm,prefix:Ju,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"}]}]},tp="bwl.undoEpisode",im=new WeakSet;function r1(e){im.has(e)||(e.register(tp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),im.add(e))}function rm(e,t){r1(e);const n={run:t};if(e.execute(tp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function np(e){return Array.prototype.concat.apply([],e)}const Fa=Object.prototype.toString,o1=Object.prototype.hasOwnProperty;function no(e){return e===void 0}function an(e){return e!==void 0}function Bo(e){return e==null}function Fe(e){return Fa.call(e)==="[object Array]"}function fn(e){return Fa.call(e)==="[object Object]"}function ze(e){return Fa.call(e)==="[object Number]"}function dn(e){const t=Fa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Un(e){return Fa.call(e)==="[object String]"}function a1(e){if(!Fe(e))throw new Error("must supply array")}function qn(e,t){return!Bo(e)&&o1.call(e,t)}function Tt(e,t){const n=lc(t);let i;return z(e,function(r,o){if(n(r,o))return i=r,!1}),i}function om(e,t){const n=lc(t);let i=Fe(e)?-1:void 0;return z(e,function(r,o){if(n(r,o))return i=o,!1}),i}function it(e,t){const n=lc(t);let i=[];return z(e,function(r,o){n(r,o)&&i.push(r)}),i}function z(e,t){let n,i;if(no(e))return;const r=Fe(e)?p1:u1;for(let o in e)if(qn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function s1(e,t){if(no(e))return[];a1(e);const n=lc(t);return e.filter(function(i,r){return!n(i,r)})}function Yn(e,t,n){return z(e,function(i,r){n=t(n,i,r)}),n}function io(e,t){return!!Yn(e,function(n,i,r){return n&&t(i,r)},!0)}function br(e,t){return!!Tt(e,t)}function Tn(e,t){let n=[];return z(e,function(i,r){n.push(t(i,r))}),n}function cc(e){return e&&Object.keys(e)||[]}function c1(e){return cc(e).length}function No(e){return Tn(e,t=>t)}function $o(e,t,n={}){return t=ip(t),z(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function am(e,...t){e=ip(e);let n={};return z(t,r=>$o(r,e,n)),Tn(n,function(r,o){return r[0]})}const l1=am;function Li(e,t){t=ip(t);let n=[];return z(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),Tn(n,i=>i.v)}function Fo(e){return function(t){return io(e,function(n,i){return t[i]===n})}}function ip(e){return dn(e)?e:t=>t[e]}function lc(e){return dn(e)?e:t=>t===e}function u1(e){return e}function p1(e){return Number(e)}function rp(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function l(){n&&a(!0),c()}function u(...p){o=Date.now(),i=p,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function zn(e,t){return e.bind(t)}function U(e,...t){return Object.assign(e,...t)}function f1(e,t,n){let i=e;return z(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];an(a)&&Bo(s)&&(s=i[r]=isNaN(+a)?{}:[]),no(a)?no(n)?delete i[r]:i[r]=n:i=s}),e}function Ai(e,t){let n={},i=Object(e);return z(t,function(r){r in i&&(n[r]=e[r])}),n}function Ii(e,t){let n={},i=Object(e);return z(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function M(e,t){var n=ue(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function nt(e,t){return br(t,function(n){return M(e,n)})}function ue(e){return e&&e.businessObject||e}function lt(e){return e&&e.di}const d1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",sm="i18n",jo="i18n:Translation";function ro(e){if(e){if(M(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(M(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Ho(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,jo)})}function kn(e){return e.get("xml:lang")}function xr(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,sc)})}function ja(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,r,o)=>i!==t&&o.indexOf(i)===r)]}function op(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function ap(e,t,n){const i=ro(e);if(!i)return{};const r=i.target[i.key]??"",o=Ho(e).filter(u=>kn(u)),a=u=>u.body??"",s=r?o.filter(u=>a(u)===r).map(kn):[],c=r?s.length?s:[n??t.designLocale]:[],l={};for(const u of ja(t)){if(c.includes(u)){l[u]=r;continue}const p=o.find(f=>kn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const uc="bwl.updateTranslation";class sp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:r,locales:o,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=ro(c),u=[];t.undo=u;const p=Ho(c).filter(N=>kn(N)),f=s??(l?l.target[l.key]??"":""),d=a??r,h=(N=>{if(!N)return[];const P=p.filter(D=>D.body===N).map(kn);return P.length?P:[d]})(f),y=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,C=N=>{var P;return((P=p.find(D=>kn(D)===N&&D.body))==null?void 0:P.body)??(h.includes(N)?f:"")},x=N=>xr(c).some(P=>P.locale===N),m=C(y);if(m===i)return[];const v=!!m&&!x(y),_=v?o.filter(N=>N!==y&&C(N)&&!x(N)):[],S=()=>{let N=c.extensionElements;return N||(N=this.moddle.create("bpmn:ExtensionElements",{values:[]}),N.$parent=c,c.extensionElements=N,u.push(()=>delete c.extensionElements)),N.get("values")},k=(N,P)=>{const D=S();let j=D.find(ee=>{var ge;return((ge=ee.$instanceOf)==null?void 0:ge.call(ee,jo))&&kn(ee)===N});if(j){const ee=j.body;j.body=P,u.push(()=>j.body=ee)}else j=this.moddle.create(jo,{body:P}),j.set("xml:lang",N),j.$parent=c.extensionElements,D.push(j),u.push(()=>D.splice(D.indexOf(j),1))},O=N=>{const P=S(),D=P.indexOf(N);P.splice(D,1),u.push(()=>P.splice(D,0,N))};if(s===void 0){if(y===r&&l){if(f&&!p.some(P=>P.body===f)){const P=a&&a!==r?a:void 0;P&&k(P,f)}const N=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{N?l.target[l.key]=f:delete l.target[l.key]})}k(y,i)}else(p.some(N=>kn(N)===y)||!f&&y!==d)&&k(y,i);if(!v)for(const N of xr(c).filter(P=>P.locale===y))O(N);for(const N of _){const P=S(),D=this.moddle.create(sc,{locale:N,sourceLocale:y,previous:m});D.$parent=c.extensionElements,P.push(D),u.push(()=>P.splice(P.indexOf(D),1))}for(const N of xr(c).filter(P=>P.sourceLocale===y&&(P.previous??"")===i))O(N);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):[]}}fi(sp,"$inject",["moddle"]);const cp="bwl.setTranslations",h1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class lp{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:r=[],designLocale:o,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!ro(l))return[];const p=()=>{let C=l.extensionElements;return C||(C=this.moddle.create("bpmn:ExtensionElements",{values:[]}),C.$parent=l,l.extensionElements=C,u.push(()=>delete l.extensionElements)),C.get("values")},f=C=>{const x=p(),m=x.indexOf(C);m<0||(x.splice(m,1),u.push(()=>x.splice(m,0,C)))},d=C=>Ho(l).find(x=>kn(x)===C);if(i===null)for(const C of a){const x=d(C);x&&f(x)}else if(i)for(const C of a){const x=i[C];if(x===void 0)continue;const m=d(C);if(m){if(m.body===x)continue;const S=m.body;m.body=x,u.push(()=>m.body=S);continue}if(C===o&&(s??o)===o)continue;const v=p(),_=this.moddle.create(jo,{body:x});_.set("xml:lang",C),_.$parent=l.extensionElements,v.push(_),u.push(()=>v.splice(v.indexOf(_),1))}const h=[...i===null?[]:c.requests.filter(C=>!r.includes(C.locale)&&!(i&&i[C.locale]!==void 0&&i[C.locale]!==c.texts[C.locale])&&!(i&&C.sourceLocale&&i[C.sourceLocale]===C.previous))];for(const C of xr(l)){const x=h.findIndex(m=>h1(C,m));x>=0?h.splice(x,1):f(C)}for(const C of h){const x=p(),m=this.moddle.create(sc,{locale:C.locale,...C.sourceLocale?{sourceLocale:C.sourceLocale}:{},previous:C.previous});m.$parent=l.extensionElements,x.push(m),u.push(()=>x.splice(x.indexOf(m),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}fi(lp,"$inject",["moddle"]);function up(e){return xr(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class pp{constructor(t){t.registerHandler(uc,sp),t.registerHandler(cp,lp)}}fi(pp,"$inject",["commandStack"]);const fp={__init__:["translationCommands"],translationCommands:["type",pp]},cm=["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"],m1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},g1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(ac.map(e=>[e,{type:"string"}])),additionalProperties:!1},y1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},v1={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},b1={type:"string",enum:[...rc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},x1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...ic]},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},_1={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},w1={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},E1={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},S1={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},R1={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},C1={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},M1={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},A1={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},P1={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...ep]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function wn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const T1={"participant.add":wn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":wn("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":wn("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":wn("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:[...ic]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":wn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":wn("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":wn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":wn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":wn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":wn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":wn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":wn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":wn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":wn("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":wn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":wn("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":wn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...ac],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":wn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},lm={anyOf:cm.map(e=>T1[e])},k1={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:y1,irParticipant:v1,irNode:x1,irFlowCondition:_1,irSequenceFlow:w1,irMessageFlow:E1,irDataStore:S1,irDataAssociation:R1,irTextAnnotation:C1,irAssociation:M1,irGroup:A1,bwlPlacement:P1,eventDefinition:b1,localeTexts:g1,nullableString:m1,symbolicOp:lm}};function dp(){}dp.prototype.get=function(e){return this.$model.properties.get(this,e)},dp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function um(e,t){this.model=e,this.properties=t}um.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(dp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),z(a,zn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var O1=U(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),pm=U(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 hp(e,t){var n=pm[e];return n?n(t):t}function mp(e){return!!O1[e]}function fm(e){return!!pm[e]}function On(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function oi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}oi.prototype.build=function(){return Ai(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},oi.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)},oi.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},oi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=On(r[0],i),a=On(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},oi.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},oi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},oi.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},oi.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},oi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},oi.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")},oi.prototype.hasProperty=function(e){return this.propertiesByName[e]},oi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(z(e.properties,zn(function(o){o=U({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function _r(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,zn(this.registerPackage,this))}_r.prototype.getPackage=function(e){return this.packageMap[e]},_r.prototype.getPackages=function(){return this.packages},_r.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;dm(t,e,"prefix"),dm(t,e,"uri"),z(e.types,zn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},_r.prototype.registerType=function(e,t){e=U({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:U({},e.meta||{})});var n=On(e.name,t.prefix),i=n.name,r=Object.create(null);z(e.properties,zn(function(o){var a=On(o.name,n.prefix),s=a.name;mp(o.type)||(o.type=On(o.type,a.prefix).name),U(o,{ns:a,name:s}),r[s]=o},this)),U(e,{ns:n,name:i,propertiesByName:r}),z(e.extends,zn(function(o){var a=On(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},_r.prototype.mapTypes=function(e,t,n){var i=mp(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=On(c,mp(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},_r.prototype.getEffectiveDescriptor=function(e){var t=On(e),n=new oi(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},_r.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function dm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function oo(e){this.model=e}oo.prototype.set=function(e,t,n){if(!Un(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;D1(n)?i?delete e[r]:delete e.$attrs[gp(t)]:i?r in e?e[r]=n:hm(e,i,n):e.$attrs[gp(t)]=n},oo.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[gp(t)];var i=n.name;return!e[i]&&n.isMany&&hm(e,n,[]),e[i]},oo.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=U({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},oo.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},oo.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},oo.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function D1(e){return typeof e>"u"}function hm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function gp(e){return e.replace(/^:/,"")}function di(e,t={}){this.properties=new oo(this),this.factory=new um(this,this.properties),this.registry=new _r(e,this.properties),this.typeCache=Object.create(null),this.config=t}di.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},di.prototype.getType=function(e){var t=this.typeCache,n=Un(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},di.prototype.createAny=function(e,t,n){var i=On(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){f1(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),z(n,function(a,s){fn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},di.prototype.getPackage=function(e){return this.registry.getPackage(e)},di.prototype.getPackages=function(){return this.registry.getPackages()},di.prototype.getElementDescriptor=function(e){return e.$descriptor},di.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},di.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},di.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var mm=String.fromCharCode,L1=Object.prototype.hasOwnProperty,I1=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ha={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ha).forEach(function(e){Ha[e.toUpperCase()]=Ha[e]});function B1(e,t,n,i){return i?L1.call(Ha,i)?Ha[i]:"&"+i+";":mm(t||parseInt(n,16))}function ao(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(I1,B1):e}var gm="non-whitespace outside of root node";function wr(e){return new Error(e)}function N1(e){return"missing namespace for prefix <"+e+">"}function pc(e){return{get:e,enumerable:!0}}function $1(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var ym=Symbol("nameCache");function yp(e){return e+"$uri"}function F1(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[yp(i)]=n;return t}function fc(){return{line:0,column:0}}function j1(e){throw e}function vm(e){if(!this)return new vm(e);var t=e&&e.proxy,n,i,r,o,a=j1,s,c,l,u,p=fc,f=!1,d=!1,g="",h=!1,y=!1,C=null,x=!1,m,v,_,S;function k(D){D instanceof Error||(D=wr(D)),C=D,a(D,p)}function O(D){s&&(D instanceof Error||(D=wr(D)),s(D,p))}this.on=function(D,j){if(typeof j!="function")throw wr("required args <name, cb>");switch(D){case"openTag":i=j;break;case"text":n=j;break;case"closeTag":r=j;break;case"error":a=j;break;case"warn":s=j;break;case"cdata":o=j;break;case"attention":u=j;break;case"question":l=j;break;case"comment":c=j;break;default:throw wr("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw wr("required args <nsMap={}>");var j=Object.create(null),ee;for(ee in D)j[ee]=D[ee];return y=!0,S=j,this};function N(){m=y?[]:null,v=y?F1(S):null,_=[],p=fc,x=!1,C=null,d=!1,g=""}this.parse=function(D){if(typeof D!="string")throw wr("required args <xml=string>");if(f)throw wr("parse during stream; call end() first");return N(),P(D),p=fc,x=!1,C},this.write=function(D){if(typeof D!="string")throw wr("required args <xml=string>");return f||(N(),f=!0),C||(g=P(g+D,!0)||""),this},this.end=function(){return f||N(),f=!1,C||P(g),g="",p=fc,x=!1,C},this.stop=function(){x=!0};function P(D,j=!1){var ee=null,ge=null,Pe,De=0,Ye=!1,ot=!1,Me=0,X=0,ne,q,K,ae,fe,Te,$,R,w,G="",W=0,te;function Re(_t,pn){var _n=_t.indexOf(":");if(_n===-1)return _t;var jn=v[_t.substring(0,_n)];return jn?pn===jn?_t.substr(_n+1):jn+_t.substr(_n):(O(N1(_t.substring(0,_n))),null)}function Je(){if(te!==null)return te;var _t,pn,_n=y&&v.xmlns,jn=y&&h?[]:null,At=W,Yt=G,yn=Yt.length,Da,Hn,Oi,ii,Zt,Mo={},La=new Set,Pn,ft,xt;e:for(;At<yn;At++)if(Pn=!1,ft=Yt.charCodeAt(At),!(ft===32||ft<14&&ft>8)){for((ft<65||ft>122||ft>90&&ft<97)&&ft!==95&&ft!==58&&(O("illegal first char attribute name"),Pn=!0),xt=At+1;xt<yn;xt++)if(ft=Yt.charCodeAt(xt),!(ft>96&&ft<123||ft>64&&ft<91||ft>47&&ft<59||ft===46||ft===45||ft===95)){if(ft===32||ft<14&&ft>8){O("missing attribute value"),At=xt;continue e}if(ft===61)break;O("illegal attribute name char"),Pn=!0}if(Zt=Yt.substring(At,xt),Zt==="xmlns:xmlns"&&(O("illegal declaration of xmlns"),Pn=!0),ft=Yt.charCodeAt(xt+1),ft===34)xt=Yt.indexOf('"',At=xt+2),xt===-1&&(xt=Yt.indexOf("'",At),xt!==-1&&(O("attribute value quote missmatch"),Pn=!0));else if(ft===39)xt=Yt.indexOf("'",At=xt+2),xt===-1&&(xt=Yt.indexOf('"',At),xt!==-1&&(O("attribute value quote missmatch"),Pn=!0));else for(O("missing attribute value quotes"),Pn=!0,xt=xt+1;xt<yn&&(ft=Yt.charCodeAt(xt+1),!(ft===32||ft<14&&ft>8));xt++);for(xt===-1&&(O("missing closing quotes"),xt=yn,Pn=!0),Pn||(Oi=Yt.substring(At,xt)),At=xt;xt+1<yn&&(ft=Yt.charCodeAt(xt+1),!(ft===32||ft<14&&ft>8));xt++)At===xt&&(O("illegal character after attribute end"),Pn=!0);if(At=xt+1,Pn)continue e;if(La.has(Zt)){O("attribute <"+Zt+"> already defined");continue}if(La.add(Zt),!y){Mo[Zt]=Oi;continue}if(h){if(Hn=Zt==="xmlns"?"xmlns":Zt.charCodeAt(0)===120&&Zt.substr(0,6)==="xmlns:"?Zt.substr(6):null,Hn!==null){if(_t=ao(Oi),pn=yp(Hn),ii=S[_t],!ii){if(Hn==="xmlns"||pn in v&&v[pn]!==_t)do ii="ns"+De++;while(typeof v[ii]<"u");else ii=Hn;S[_t]=ii}v[Hn]!==ii&&(Da||(v=$1(v),Da=!0),v[Hn]=ii,Hn==="xmlns"&&(v[yp(ii)]=_t,_n=ii),v[pn]=_t),Mo[Zt]=Oi;continue}jn.push(Zt,Oi);continue}Zt=Re(Zt,_n),Zt!==null&&(Mo[Zt]=Oi)}if(h)for(At=0,yn=jn.length;At<yn;At++)Zt=Re(jn[At++],_n),Oi=jn[At],Zt!==null&&(Mo[Zt]=Oi);return te=Mo}function ht(){for(var _t=/(\r\n|\r|\n)/g,pn=0,_n=0,jn=0,At=X,Yt,yn;Me>=jn&&(Yt=_t.exec(D),!(!Yt||(At=Yt[0].length+Yt.index,At>Me)));)pn+=1,jn=At;return Me==-1?(_n=At,yn=D.substring(X)):X===0?yn=D.substring(X,Me):(_n=Me-jn,yn=X==-1?D.substring(Me):D.substring(Me,X+1)),{data:yn,line:pn,column:_n}}for(p=ht,t&&(w=Object.create({},{name:pc(function(){return $}),originalName:pc(function(){return R}),attrs:pc(Je),ns:pc(function(){return v})}));X!==-1;){if(D.charCodeAt(X)===60?Me=X:Me=D.indexOf("<",X),Me===-1){if(j)return D.substring(X);if(_.length)return k("unexpected end of file");if(!d)return k("missing start tag");X<D.length&&D.substring(X).trim()&&O(gm);return}if(d||(d=!0),X!==Me){if(_.length){if(n&&(n(D.substring(X,Me),ao,p),x))return}else if(D.substring(X,Me).trim()&&(O(gm),x))return}if(ae=D.charCodeAt(Me+1),ae===33){if(K=D.charCodeAt(Me+2),K===91&&D.substr(Me+3,6)==="CDATA["){if(X=D.indexOf("]]>",Me),X===-1)return j?D.substring(Me):k("unclosed cdata");if(o&&(o(D.substring(Me+9,X),p),x))return;X+=3;continue}if(K===45&&D.charCodeAt(Me+3)===45){if(X=D.indexOf("-->",Me),X===-1)return j?D.substring(Me):k("unclosed comment");if(c&&(c(D.substring(Me+4,X),ao,p),x))return;X+=3;continue}}if(ae===63){if(X=D.indexOf("?>",Me),X===-1)return j?D.substring(Me):k("unclosed question");if(l&&(l(D.substring(Me,X+2),p),x))return;X+=2;continue}for(ne=Me+1;;ne++){if(fe=D.charCodeAt(ne),isNaN(fe))return j?D.substring(Me):(X=-1,k("unclosed tag"));if(fe===34)K=D.indexOf('"',ne+1),ne=K!==-1?K:ne;else if(fe===39)K=D.indexOf("'",ne+1),ne=K!==-1?K:ne;else if(fe===62){X=ne;break}}if(ae===33){if(u&&(u(D.substring(Me,X+1),ao,p),x))return;X+=1;continue}if(te={},ae===47){if(Ye=!1,ot=!0,!_.length)return k("missing open tag");if(ne=$=_.pop(),K=Me+2+ne.length,D.substring(Me+2,K)!==ne)return k("closing tag mismatch");for(;K<X;K++)if(ae=D.charCodeAt(K),!(ae===32||ae>8&&ae<14))return k("close tag")}else{if(D.charCodeAt(X-1)===47?(ne=$=D.substring(Me+1,X-1),Ye=!0,ot=!0):(ne=$=D.substring(Me+1,X),Ye=!0,ot=!1),!(ae>96&&ae<123||ae>64&&ae<91||ae===95||ae===58))return k("illegal first char nodeName");for(K=1,q=ne.length;K<q;K++)if(ae=ne.charCodeAt(K),!(ae>96&&ae<123||ae>64&&ae<91||ae>47&&ae<59||ae===45||ae===95||ae==46)){if(ae===32||ae<14&&ae>8){$=ne.substring(0,K),te=null;break}return k("invalid nodeName")}ot||_.push($)}if(y){Pe=v,Ye&&(ot||m.push(Pe),te===null&&(h=ne.indexOf("xmlns",K)!==-1)&&(W=K,G=ne,Je(),h=!1)),R=$,ge!==v&&(ee=v[ym],ee===void 0&&(ee=v[ym]=Object.create(null)),ge=v);var Gt=ee[$];if(Gt!==void 0)$=Gt;else{if(ae=$.indexOf(":"),ae!==-1){if(Te=v[$.substring(0,ae)],!Te)return k("missing namespace on <"+R+">");$=$.substr(ae+1)}else Te=v.xmlns;Te&&($=Te+":"+$),ee[R]=$}}if(Ye&&(W=K,G=ne,i&&(t?i(w,ao,ot,p):i($,Je,ao,ot,p),x)))return;if(ot){if(r&&(r(t?w:$,ao,Ye,p),x))return;y&&(Ye?v=Pe:v=m.pop())}X+=1}}}function bm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var vp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},xm="property";function _m(e){return e.xml&&e.xml.serialize}function H1(e){const t=_m(e);return t!==xm&&(t||null)}function z1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function wm(e,t){return bm(t)?e.prefix+":"+z1(e.localName):e.name}function G1(e,t){var n=e.name,i=e.localName,r=t&&t.xml&&t.xml.typePrefix;return r&&i.indexOf(r)===0?e.prefix+":"+i.slice(r.length):n}function V1(e,t,n){const i=On(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=On(r);var a=n.getPackage(o.prefix);return G1(o,a)}function Er(e){return new Error(e)}function er(e){return e.$descriptor}function W1(e){U(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Er("expected element");var n=this.elementsById,i=er(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Er("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function za(){}za.prototype.handleEnd=function(){},za.prototype.handleText=function(){},za.prototype.handleNode=function(){};function bp(){}bp.prototype=Object.create(za.prototype),bp.prototype.handleNode=function(){return this};function zo(){}zo.prototype=Object.create(za.prototype),zo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ga(e,t){this.property=e,this.context=t}Ga.prototype=Object.create(zo.prototype),Ga.prototype.handleNode=function(e){if(this.element)throw Er("expected no sub nodes");return this.element=this.createReference(e),this},Ga.prototype.handleEnd=function(){this.element.id=this.body},Ga.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function xp(e,t){this.element=t,this.propertyDesc=e}xp.prototype=Object.create(zo.prototype),xp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=hp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function dc(){}dc.prototype=Object.create(zo.prototype),dc.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 Nn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Nn.prototype=Object.create(dc.prototype),Nn.prototype.addReference=function(e){this.context.addReference(e)},Nn.prototype.handleText=function(e){var t=this.element,n=er(t),i=n.bodyProperty;if(!i)throw Er("unexpected body text <"+e+">");zo.prototype.handleText.call(this,e)},Nn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=er(t),i=n.bodyProperty;i&&e!==void 0&&(e=hp(i.type,e),t.set(i.name,e))},Nn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=er(n),r=this.context,o=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){r.addReference({element:o,property:u.ns.name,id:f})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=hp(u.type,c):l==="xmlns"?l=":"+l:(s=On(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},Nn.prototype.getPropertyForNode=function(e){var t=e.name,n=On(t),i=this.type,r=this.model,o=er(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=H1(s);if(l){const u=e.attributes[l];if(u){const p=V1(u,e.ns,r),f=r.getType(p);return U({},s,{effectiveType:er(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=wm(n,c),u=r.getType(l);if(s=Tt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return U({},s,{effectiveType:er(u).name})}else if(s=Tt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Er("unrecognized element <"+n.name+">")},Nn.prototype.toString=function(){return"ElementDescriptor["+er(this.type).name+"]"},Nn.prototype.valueHandler=function(e,t){return new xp(e,t)},Nn.prototype.referenceHandler=function(e){return new Ga(e,this.context)},Nn.prototype.handler=function(e){return e==="Element"?new Go(this.model,e,this.context):new Nn(this.model,e,this.context)},Nn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,fm(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(U(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function _p(e,t,n){Nn.call(this,e,t,n)}_p.prototype=Object.create(Nn.prototype),_p.prototype.createElement=function(e){var t=e.name,n=On(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&wm(n,o)||t;if(!r.hasType(a))throw Er("unexpected element <"+e.originalName+">");return Nn.prototype.createElement.call(this,e)};function Go(e,t,n){this.model=e,this.context=n}Go.prototype=Object.create(dc.prototype),Go.prototype.createElement=function(e){var t=e.name,n=On(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Go.prototype.handleChild=function(e){var t=new Go(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},Go.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function wp(e){e instanceof di&&(e={model:e}),U(this,{lax:!1},e)}wp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Nn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new W1(U({},t,{rootHandler:i})),s=new vm({proxy:!0}),c=U1();i.context=a,c.push(i);function l(_,S,k){var O=S(),N=O.line,P=O.column,D=O.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var j="unparsable content "+(D?D+" ":"")+`detected
|
|
2
2
|
line: `+N+`
|
|
3
3
|
column: `+P+`
|
|
4
|
-
nested error: `+_.message;if(
|
|
5
|
-
`,
|
|
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 iS(e){e=U({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new tS,o=new nS(r,e.format);e.preamble&&o.append(H1);var a=new Nt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(rS(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function rS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in fp)n[i]=fp[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function uc(e,t){di.call(this,e,t)}uc.prototype=Object.create(di.prototype),uc.prototype.fromXML=function(e,t,n){qn(t)||(n=t,t="bpmn:Definitions");var i=new gp(U({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},uc.prototype.toXML=function(e,t){var n=new iS(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var oS="BPMN20",aS="http://www.omg.org/spec/BPMN/20100524/MODEL",sS="bpmn",cS=[],lS=[{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"}]}],uS=[{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"}]}],pS={tagAlias:"lowerCase",typePrefix:"t"},fS={name:oS,uri:aS,prefix:sS,associations:cS,types:lS,enumerations:uS,xml:pS},dS="BPMNDI",hS="http://www.omg.org/spec/BPMN/20100524/DI",mS="bpmndi",gS=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],yS=[{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"}]}],vS=[],bS={name:dS,uri:hS,prefix:mS,types:gS,enumerations:yS,associations:vS},xS="DC",_S="http://www.omg.org/spec/DD/20100524/DC",wS="dc",ES=[{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}]}],SS=[],RS={name:xS,uri:_S,prefix:wS,types:ES,associations:SS},CS="DI",MS="http://www.omg.org/spec/DD/20100524/DI",AS="di",PS=[{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"}]}],TS=[],kS={tagAlias:"lowerCase"},OS={name:CS,uri:MS,prefix:AS,types:PS,associations:TS,xml:kS},DS="bpmn.io colors for BPMN",LS="http://bpmn.io/schema/bpmn/biocolor/1.0",IS="bioc",BS=[{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"}]}],NS=[],$S=[],FS={name:DS,uri:LS,prefix:IS,types:BS,enumerations:NS,associations:$S},jS="BPMN in Color",HS="http://www.omg.org/spec/BPMN/non-normative/color/1.0",zS="color",GS=[{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"}]}],VS=[],WS=[],US={name:jS,uri:HS,prefix:zS,types:GS,enumerations:VS,associations:WS};const qS={bpmn:fS,bpmndi:bS,dc:RS,di:OS,bioc:FS,color:US};function wm(e,t){const n=U({},qS,e);return new uc(n,t)}const YS={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"}},pc={[nm]:YS,[qu]:Zh};function Em(){return wm(pc)}const Sm=Em();async function zo(e){const{rootElement:t,warnings:n}=await Sm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function KS(e){const{xml:t}=await Sm.toXML(e,{format:!0});return t}function bp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Go={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},XS=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function ZS(e){const t=Go;return XS.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 Vo(e,t){let n=0;for(const i of e)n+=t*ZS(i);return n}function Rm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&QS(e),JS(e),eR(e),tR(e)}function QS(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:Vo(r,o),fontBoundingBoxAscent:o*Go.ascentEm,fontBoundingBoxDescent:o*Go.descentEm,actualBoundingBoxAscent:o*Go.ascentEm,actualBoundingBoxDescent:o*Go.descentEm}}};t.getContext=()=>n}function JS(e){if(e.SVGMatrix)return;class t{constructor(){fi(this,"a",1);fi(this,"b",0);fi(this,"c",0);fi(this,"d",1);fi(this,"e",0);fi(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function eR(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function tR(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:Vo(n,12),height:14}})}const fc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),nR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),iR=1,dc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),rR=2;function lt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Cm=20,hc=5,Mm=3,oR=8,Wo=15,xp=50,Am=12,aR=Am*1.2;function _p(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>Vo(o,Am))),r=n.length*aR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Pm=1;function gn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function Uo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of gn(e))for(const s of gn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Pm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=Cm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function wp(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Tm(e,t){const n=Uo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function sR(e,t){let n=0;for(const i of t)i.id!==e.id&&Tm(e,i)&&n++;return n}function ai(e,t){let n=0;for(const i of t)i.id!==e.id&&Uo(e,i)&&n++;return n}const km=15,Om=20;function cR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Om||t.at>n[1]+Om)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Ep=20;function mc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Pm)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Cm||n.push([r-Ep,o+Ep])}return n}function gc(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of gn(e)){const o=cR(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of mc(r,gn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const lR=10,uR=1,pR=(e,t,n)=>t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.width<=e.x+e.width+n&&t.y+t.height<=e.y+e.height+n;function fR(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,l)&&f(e.y-s,-l)&&p>u}function Sp(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 dR=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,qo=1;function Fi(e,t){const n=e.x+qo,i=e.x+e.width-qo,r=e.y+qo,o=e.y+e.height-qo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Yo(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 Dm(e,t){const n=e.label;if(!n)return null;if(gn(e).some(i=>Fi(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(gn(i).some(r=>Fi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Yo(i).some(r=>Fi(n,r)))return i.id;return null}function xn(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(fR(e.waypoints[o],e.waypoints[o+1],r,rR)){i.push(r);break}}return i}const ja=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},hR=(e,t,n,i)=>Im(e,t,n,i)?0:Math.min(ja(e,n,i),ja(t,n,i),ja(n,e,t),ja(i,e,t)),Lm=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function yc(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,ja({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(Lm(e,s)||Lm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,hR(e,t,s[l],s[(l+1)%s.length]));return c}function Im(e,t,n,i){const r=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Bm=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Ha(e,t){let n=0;for(const i of t){if(i.id===e.id||Bm(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)Im(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function si(e,t){let n=0;for(const i of t)i.id===e.id||Bm(e,i)||Ha(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Nm(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)Ha(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function vc(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Ha(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function $m(e){const t=vc(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?r++:u==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:mR(e)}}function mR(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Fm(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!dc.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function jm(e){var n;const t=(n=Lt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Lt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Hm=e=>e?{members:e}:{},ci=e=>e.shapes.filter(t=>!t.container);function gR(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function yR(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function zm(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(gn(i).some(r=>Fi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Yo(i).some(r=>Fi(n,r)))return i.id;return null}function co(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 Gm=3;function Vm(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function za(e,t){const n=[];for(const i of t.shapes){if(i.container||dc.has(i.type))continue;const r=Vm(e,i);r>=Gm&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function dt(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of xn(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const r=e.shapes.filter(m=>m.container&&nR.has(m.type));if(r.length){const m=(v,_)=>{const E=e.shapes.find(T=>T.id===_);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 _ of xn(v,r))v.endpoints.includes(_.id)||v.endpoints.some(E=>m(_,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:_.id})}for(const m of e.edges){if(m.waypoints.length<2)continue;const v=[[m.source,m.waypoints[0]],[m.target,m.waypoints[m.waypoints.length-1]]];for(const[_,E]of v){if(!_)continue;const T=e.shapes.find(D=>D.id===_);if(!T||T.container)continue;const O=Math.max(T.x-E.x,E.x-(T.x+T.width),0),N=Math.max(T.y-E.y,E.y-(T.y+T.height),0),P=Math.hypot(O,N);P>lR&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:_,distance:Math.round(P)})}}const o=e.shapes.filter(m=>m.type==="bpmn:Participant");for(let m=0;m<o.length;m++)for(let v=m+1;v<o.length;v++){const _=o[m],E=o[v];if(_.x+_.width<=E.x||E.x+E.width<=_.x||_.y+_.height<=E.y||E.y+E.height<=_.y)continue;const T=(O,N)=>O.x<=N.x&&O.y<=N.y&&O.x+O.width>=N.x+N.width&&O.y+O.height>=N.y+N.height;n.push({kind:"pool-overlap",pools:[_.id,E.id],contained:T(_,E)||T(E,_)})}const a=i.filter(m=>!m.attached);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const _=a[m],E=a[v];if(!Sp(_,E,iR))continue;const T=_.id<E.id?[_.id,E.id]:[E.id,_.id];n.push({kind:"shape-overlap",shapes:T,identical:dR(_,E)})}const s=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<s.length;m++)for(let v=m+1;v<s.length;v++){const _=s[m],E=s[v],T=Math.min(_.x+_.width,E.x+E.width)-Math.max(_.x,E.x),O=Math.min(_.y+_.height,E.y+E.height)-Math.max(_.y,E.y);if(T<=hc||O<=hc)continue;const N=_.id<E.id?[_.id,E.id]:[E.id,_.id],P=new Set(E.members);if(_.members.some(F=>P.has(F))){const F=Fm(e,s,{x:Math.max(_.x,E.x),y:Math.max(_.y,E.y),right:Math.min(_.x+_.width,E.x+E.width),bottom:Math.min(_.y+_.height,E.y+E.height)});F.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:N,shapes:F});continue}const D=_.x<=E.x&&_.y<=E.y&&_.x+_.width>=E.x+E.width&&_.y+_.height>=E.y+E.height?_.id:E.x<=_.x&&E.y<=_.y&&E.x+E.width>=_.x+_.width&&E.y+E.height>=_.y+_.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:N,...D?{container:D}:{}})}const c=new Set(s.flatMap(m=>[...m.members])),l=m=>e.shapes.filter(v=>!v.container&&!dc.has(v.type)&&v.x>=m.x&&v.y>=m.y&&v.x+v.width<=m.x+m.width&&v.y+v.height<=m.y+m.height);for(const m of s){const v=l(m);if(!v.length)continue;const _=new Set(m.members),E=v.filter(T=>!_.has(T.id));E.some(T=>c.has(T.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:E.map(T=>T.id).sort()}))}for(const m of s){const v=new Set(l(m).map(P=>P.id)),_=new Set(m.members),E=new Set([...v].filter(P=>!_.has(P)&&c.has(P)));if(!E.size)continue;let T=!1,O=!1,N=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const D=E.has(P.source),F=E.has(P.target);!D&&F&&!v.has(P.source)?T=!0:D&&!F&&!v.has(P.target)?O=!0:D&&F&&(N=!0)}T&&O&&N&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...E].sort()})}const u=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<u.length;m++)for(let v=m+1;v<u.length;v++)for(let _=v+1;_<u.length;_++){const E=[u[m],u[v],u[_]],T={x:Math.max(...E.map(P=>P.x)),y:Math.max(...E.map(P=>P.y)),right:Math.min(...E.map(P=>P.x+P.width)),bottom:Math.min(...E.map(P=>P.y+P.height))};if(T.right-T.x<=hc||T.bottom-T.y<=hc)continue;const O=Fm(e,[],T);if(!O.length)continue;const N=E.map(P=>P.id).sort();n.push({kind:"group-stack-unreadable",groups:N,shapes:O})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||dc.has(v.type)||v.width<=0||v.height<=0)continue;const _=[["top",m.y,"h",m.x,m.x+m.width],["bottom",m.y+m.height,"h",m.x,m.x+m.width],["left",m.x,"v",m.y,m.y+m.height],["right",m.x+m.width,"v",m.y,m.y+m.height]];for(const[E,T,O,N,P]of _){const D=O==="h"?v.x:v.y,F=O==="h"?v.x+v.width:v.y+v.height;if(!(D<P&&N<F))continue;const J=O==="h"?v.y:v.x,ge=O==="h"?v.y+v.height:v.x+v.width;if(!(J<T&&T<ge))continue;const Ae=Math.min(T-J,ge-T);Ae<oR||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:E,depth:Ae})}}const p=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(p.length){const m=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const _=gn(v);if(_.length)for(const E of p){const T=E.x+E.width,O=E.y+E.height,N=v.endpoints.some(D=>{const F=m.get(D);return!!F&&E.x<F.x&&F.x<T&&E.y<F.y&&F.y<O});let P=null;for(const D of _){const[F,J,ge]=D.axis==="v"?[E.y,O,[["left",E.x],["right",T]]]:[E.x,T,[["top",E.y],["bottom",O]]],Ae=Math.min(D.hi,J)-Math.max(D.lo,F);if(Ae<xp)continue;const De=D.axis==="v"?E.x<D.at&&D.at<T:E.y<D.at&&D.at<O;if(!(De&&N))for(const[qe,rt]of ge){const Me=Math.abs(D.at-rt);Me<=Wo&&(!P||Me<P.distance)&&(P={side:qe,inside:De,distance:Me,length:Ae})}}P&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:P.side,inside:P.inside,distance:Math.round(P.distance),length:Math.round(P.length)})}}}const f=e.shapes.filter(m=>m.container&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Lane");for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const _=m.x<v.x+v.width&&v.x<m.x+m.width,E=m.y<v.y+v.height&&v.y<m.y+m.height,T=[["top",m.y,v.y,_],["bottom",m.y+m.height,v.y+v.height,_],["left",m.x,v.x,E],["right",m.x+m.width,v.x+v.width,E]];for(const[O,N,P,D]of T)D&&Math.abs(N-P)<=Mm&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:O})}const d=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<d.length;m++)for(let v=m+1;v<d.length;v++){const _=d[m],E=d[v],T=_.x<E.x+E.width&&E.x<_.x+_.width,O=_.y<E.y+E.height&&E.y<_.y+_.height,N=[["x",_.x+_.width,E.x,O],["x",E.x+E.width,_.x,O],["y",_.y+_.height,E.y,T],["y",E.y+E.height,_.y,T]];for(const[P,D,F,J]of N)if(J&&Math.abs(D-F)<=Mm){n.push({kind:"group-on-group-boundary",groups:_.id<E.id?[_.id,E.id]:[E.id,_.id],axis:P});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const _=e.edges[m],E=e.edges[v],T=Uo(_,E);if(!T)continue;const O=_.id<E.id?[_.id,E.id]:[E.id,_.id];n.push({kind:T.kind==="opposite"?"edge-overlap-opposite":T.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:O,axis:T.axis,length:Math.round(T.length)})}for(const m of e.edges){if(!m.label)continue;const v=gc(m,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:m.id,other:v.other,axis:v.axis})}for(const m of e.edges){if(!m.label)continue;const v=Dm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}if(t.includeObservationOnly){for(const m of e.edges)if(!(!m.label||m.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:_}of za(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(_)})}const g=new Set(i.map(m=>m.id)),h=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...h.filter(v=>!g.has(v.id))]){if(!m.label)continue;const v=zm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const y=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of h)for(const{owner:v,rect:_}of co(e))v===m.id||y.has(v)||Sp(m.label,_,qo)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const C=co(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:_}of C)v!==m.id&&Sp(m,_,qo)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const x=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??gR(m,e,x);if(!v)continue;const _=x.get(v);!_||!_.container||pR(_,m,uR)||m.type==="bpmn:TextAnnotation"&&!yR(m,_,e)||n.push({kind:"shape-outside-container",shape:m.id,container:_.id})}return n.sort((m,v)=>lt(m).localeCompare(lt(v)))}const Lt=e=>typeof e=="object"&&e!==null?e:void 0,Ut=e=>typeof e=="number"?e:0,tr=e=>{const t=Lt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function vR(e){const t=Lt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=tr(o);a&&n.push(a)}}return n}function bR(e){const t=Lt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:tr(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:tr(t.targetRef);return n&&i?{source:n,target:i}:{}}function xR(e,t){const n=Lt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=tr(n);return r?t.get(r):void 0}if(fc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return tr(n)}function Wm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Lt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=Lt(e))==null?void 0:s.rootElements)??[]){const f=Lt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Lt(d),h=tr(g),y=tr(g==null?void 0:g.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const p of i){const f=Lt((c=Lt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Lt(g);if(!h)continue;const y=Lt(h.bpmnElement),C=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!C)continue;const x=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",m=Lt(h.bounds);if(m){const _=h.isExpanded===!1&&x!=="bpmn:Participant",E=Lt((l=Lt(h.label))==null?void 0:l.bounds),T={id:C,type:x,x:Ut(m.x),y:Ut(m.y),width:Ut(m.width),height:Ut(m.height),container:fc.has(x)&&!_,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:xR(y,r)}:{},...E?{label:{x:Ut(E.x),y:Ut(E.y),width:Ut(E.width),height:Ut(E.height)}}:{},...x==="bpmn:Group"?Hm(jm(y)):{}},O=h.isHorizontal!==!1,N=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(C)&&O&&N&&(T.label=_p(T,N)),t.push(T);continue}const v=h.waypoint;if(Array.isArray(v)){const _=Lt((u=Lt(h.label))==null?void 0:u.bounds);n.push({id:C,type:x,waypoints:v.map(E=>{var T,O;return{x:Ut((T=Lt(E))==null?void 0:T.x),y:Ut((O=Lt(E))==null?void 0:O.y)}}),endpoints:vR(y),...bR(y),..._?{label:{x:Ut(_.x),y:Ut(_.y),width:Ut(_.width),height:Ut(_.height)}}:{}})}}}return{shapes:t,edges:n}}function Um(e){return dt(Wm(e),{includeObservationOnly:!0})}async function _R(e){const{definitions:t,warnings:n}=await zo(e);return{findings:Um(t),warnings:n}}function Ze(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=Lt(o.label),y=tr(o.source),C=tr(o.target);n.push({id:o.id,type:a,waypoints:s.map(x=>({x:Ut(x.x),y:Ut(x.y)})),endpoints:[y,C].filter(x=>!!x),...y&&C?{source:y,target:C}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Ut(h.y),width:Ut(h.width),height:Ut(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Lt(o.businessObject),l=Lt(o.label);let u=Lt(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Lt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&fc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Ut(o.width),height:Ut(o.height),container:fc.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Ut(l.y),width:Ut(l.width),height:Ut(l.height)}}:{},...a==="bpmn:Group"?Hm(jm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Lt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=_p(d,g)),t.push(d)}return{shapes:t,edges:n}}const wR={"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 ER(e,t){const n=wR[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function qm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ym(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 ER(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&qm(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?qm(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}},eventDefinitionOf:n=>{var o;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const r=(((o=i.businessObject)==null?void 0:o.eventDefinitions)??[]).map(a=>a.$type);return Uu(r)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:xr(i.businessObject).map(r=>r.locale)}}}const Rp=20,SR=4,Ot=(e,t)=>Math.abs(e-t)<.5;function bc(e,t,n,i=Rp){if(Ot(e.y,t.y)&&!Ot(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Ot(e.x,t.x)&&!Ot(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Km(e,t,n,i=Rp){if(n.length<2)return null;if(Ot(e.y,t.y)&&!Ot(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(Ot(e.x,t.x)&&!Ot(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function Xm(e,t,n=Rp){if(e.length!==4)return null;const[i,r,o,a]=e;if(Ot(i.y,r.y)&&Ot(r.x,o.x)&&Ot(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Ot(i.x,r.x)&&Ot(r.y,o.y)&&Ot(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function xc(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const Zm=30,RR=[0,-25,25,-40,40];function CR(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Zm:s-Zm,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return RR.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>xn({...e,endpoints:[],waypoints:f},[n]).length===0)}const Cp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Ko=(e,t,n)=>xn({...e,waypoints:t},n).length;function Mp(e,t,n,i){let r=[...e.waypoints],o=Ko(e,r,t);if(o===0)return null;let a=!1;for(const p of xc(e,t))if(Ko(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(gn),c=p=>gn({...e,waypoints:p}).some(f=>mc(f,s).length>0),l=CR(e,t).filter(p=>Ko(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&Ot(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(Ot(d[0].y,d[1].y)&&!Ot(d[0].x,d[1].x)){const g=t.filter(x=>!e.endpoints.includes(x.id)&&xn({...e,waypoints:d},[x]).length>0),h=g.length>=2?Km(d[0],d[1],g):null,C=(h?h.map(x=>[d[0],...x,d[1]]):g.length===1?(bc(d[0],d[1],g[0])??[]).map(x=>[d[0],...x,d[1]]):g.length===0?[d]:[]).filter(x=>Ko(e,x,t)===0&&x.length<=r.length).sort((x,m)=>Number(u(m))-Number(u(x)));if(C.length)return C.find(x=>!c(x))??C[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(C=>!e.endpoints.includes(C.id)&&xn({...e,waypoints:[f,d]},[C]).length>0);if(g.length<2)continue;const h=Km(f,d,g);if(!h)continue;const y=h.map(C=>Cp(r,p,C)).filter(C=>Ko(e,C,t)===0).sort((C,x)=>Number(u(x))-Number(u(C)));if(y.length)return y.find(C=>!c(C))??y[0]}for(let p=0;p<SR&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const g=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||xn({...e,waypoints:[g,h]},[y]).length===0)continue;const C=bc(g,h,y),x=C?C.map(v=>Cp(r,d,v)):Xm(r,y)??[];if(!x.length)continue;const m=[...x].sort((v,_)=>Number(u(_))-Number(u(v)));for(const v of m){const _=Ko(e,v,t);if(_<o){r=v,o=_,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Ap(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ze(i),a=ci(o),s=new Set,c=dt(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(lt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=o.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=Mp(p,a,g,o.edges);if(!h){xn(p,a).some(m=>m.type==="bpmn:TextAnnotation")&&s.add(u);continue}const y=o.edges.filter(m=>m.id!==u),C=ai(p,y);ai({...p,waypoints:h},y)>C||r.updateWaypoints(f,h)}return s}const MR=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},Pp=(e,t)=>Ha(e,[t])>0;function Qm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ze(i),a=ci(o);let s=o;const c=new Set(dt(o).map(lt));for(const[l,u]of vc(o))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(N=>N.id===p),g=s.edges.find(N=>N.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const y=h.parent,C=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,x=MR(g),m=[...xc(d,a)??[]],v=Mp(d,[...a,...x],C,o.edges);v&&m.push(v);for(let N=0;N+1<d.waypoints.length;N++)for(const P of x)for(const D of bc(d.waypoints[N],d.waypoints[N+1],P)??[])m.push(Cp(d.waypoints,N,D));const _=s.edges.filter(N=>N.id!==p),E=N=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:N}:P)}),T=N=>!C||N.every(P=>P.x>=C.x&&P.x<=C.x+C.width&&P.y>=C.y&&P.y<=C.y+C.height),O=m.find(N=>{const P={...d,waypoints:N};return Pp(P,g)||!T(N)||_.some(D=>D.id!==f&&!Pp(d,D)&&Pp(P,D))?!1:dt(E(N)).every(D=>c.has(lt(D)))});if(O){r.updateWaypoints(h,O),s=E(O);break}}}const AR=10;function Jm(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function eg(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(F=>F.type==="bpmn:Participant"&&F.container),i=t.shapes.find(F=>F.id===e.endpoints[0]),r=t.shapes.find(F=>F.id===e.endpoints[1]);if(!i||!r)return null;const o=Jm(i,n),a=Jm(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(F=>F.id!==o.id&&F.id!==a.id&&F.y>=c.y+c.height&&F.y+F.height<=l.y).sort((F,J)=>F.y-J.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,y=s?g:d,C=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],m=ci(t),v=t.edges.filter(F=>F.id!==e.id),_=si(e,v),E=xn(e,m).length;if(_===0&&E===0||E===0&&e.waypoints.length===2)return null;const T=Math.min(...u.map(F=>F.x)),O=Math.max(...u.map(F=>F.x+F.width)),N=(C.x+x.x)/2,P=F=>F.filter((J,ge)=>ge===0||!(Ot(J.x,F[ge-1].x)&&Ot(J.y,F[ge-1].y)));let D;for(let F=T;F<=O;F+=AR){const J=P([C,{x:C.x,y:h},{x:F,y:h},{x:F,y},{x:x.x,y},x]),ge={...e,waypoints:J};if(xn(ge,m).length>0)continue;const Ae=si(ge,v),De=Math.abs(F-N);(!D||Ae<D.cross||Ae===D.cross&&De<D.detour)&&(D={pts:J,cross:Ae,detour:De})}return D&&(E>0?D.cross<=_:D.cross<_)?D.pts:null}function tg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ze(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ze(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=eg(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const ji=[25,-25,40,-40],Xo=35;function PR(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-Xo:Math.max(e.y+e.height,t.y+t.height)+Xo;for(const l of[0,...ji])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...ji]){if(Math.abs(u)>=t.width/2-5)continue;const p=n+l,f=i+u;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function _c(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return PR(n,i);const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-Xo:n.y+n.height+Xo,p=[];for(const x of[0,...ji]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;p.push({pts:[{x:n.x,y:r},{x:m,y:r},{x:m,y:c}],cost:Math.abs(x)});for(const v of[0,...ji]){if(Math.abs(v)>=n.width/2-5)continue;const _=a+v;p.push({pts:[{x:_,y:l},{x:_,y:u},{x:m,y:u},{x:m,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const x of[0,...ji]){if(Math.abs(x)>=n.width/2-5)continue;const m=a+x;p.push({pts:[{x:m,y:g},{x:m,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,y=s?i.y+i.height:i.y,C=s?i.y+i.height+Xo:i.y-Xo;for(const x of[0,...ji]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;for(const v of[0,...ji]){if(Math.abs(v)>=n.width/2-5)continue;const _=a+v;p.push({pts:[{x:_,y:g},{x:_,y:C},{x:m,y:C},{x:m,y}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const wc=30;function ng(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Ot(i.y,r.y)&&!Ot(i.x,r.x),a=Ot(i.x,r.x)&&!Ot(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<wc||Math.abs(i.y-(s.y+s.height))<wc)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<wc||Math.abs(i.x-(s.x+s.width))<wc)return!0}}return!1}const Ec=40;function TR(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Ec,a=r.x+r.width+Ec,s=r.y-Ec,c=r.y+r.height+Ec;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function ig(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(E=>E.container),i=new Map(t.shapes.map(E=>[E.id,E])),r=ci(t),o=t.edges.filter(E=>E.id!==e.id),a=ai(e,o),s=si(e,o),c=E=>TR(E,t.shapes,e.endpoints)+(ng(E,n)?1:0),l=c(e.waypoints),u=E=>{if(!E)return;const T=E.x+E.width/2,O=E.y+E.height/2;return n.find(N=>N.type==="bpmn:Lane"&&T>=N.x&&T<=N.x+N.width&&O>=N.y&&O<=N.y+N.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=E=>{if(!d||!f)return!1;for(let T=1;T<E.length-2;T++){const O=E[T],N=E[T+1];if(Ot(O.y,N.y)&&!Ot(O.x,N.x)&&O.y>f.y&&O.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),C=(E=>{if(!E)return;const T=E.x+E.width/2,O=E.y+E.height/2;return n.filter(N=>N.type==="bpmn:Participant"&&T>=N.x&&T<=N.x+N.width&&O>=N.y&&O<=N.y+N.height).sort((N,P)=>N.width*N.height-P.width*P.height)[0]})(i.get(e.endpoints[0]??"")),x=E=>{if(!C)return 0;let T=0;for(let O=1;O<E.length-1;O++){const N=E[O];(N.x<C.x||N.x>C.x+C.width||N.y<C.y||N.y>C.y+C.height)&&T++}return T},m=x(e.waypoints);if(!ng(e.waypoints,n)&&!(d&&!h)&&m===0)return null;const v=E=>E.reduce((T,O,N)=>N?T+Math.abs(O.x-E[N-1].x)+Math.abs(O.y-E[N-1].y):0,0);let _;for(const{pts:E,cost:T}of _c(e,i)){const O={...e,waypoints:E};if(xn(O,r).length>0)continue;const N=ai(O,o);if(N>a)continue;const P=x(E);if(P>m)continue;const D=P<m&&N===0;if(!D&&si(O,o)>s)continue;const F=c(E),J=g(E);if(!D&&!(J&&!h)&&F>=l)continue;const Ae=J?0:1,De=v(E);(!_||P<_.out||P===_.out&&(Ae<_.lane||Ae===_.lane&&(N<_.opp||N===_.opp&&(F<_.sc||F===_.sc&&(T<_.cost||T===_.cost&&De<_.len)))))&&(_={pts:E,out:P,sc:F,lane:Ae,opp:N,cost:T,len:De})}return(_==null?void 0:_.pts)??null}function kR(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,r=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),o=r.filter(p=>p.endpoints[1]===i),a=r.filter(p=>p.endpoints[0]===i);if(o.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function OR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ze(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of o){const s=Ze(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=ci(s),u=s.edges.filter(y=>y.id!==a),p=xn(c,l).length,f=ai(c,u),d=si(c,u),g=n.has(a)?new Set(dt(s).map(lt)):null,h=xc(c,s.shapes);h.length===2&&kR(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const C={...c,waypoints:y};if(xn(C,l).length>p||ai(C,u)>f||si(C,u)>d)continue;if(g){const m=new Set(dt({...s,edges:s.edges.map(E=>E.id===a?C:E)}).map(lt)),v=[...m].filter(E=>!g.has(E)).length,_=[...g].filter(E=>!m.has(E)).length;if(v>_)continue}const x=i.get(a);x&&r.updateWaypoints(x,y);break}}}function rg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ze(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ze(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=ig(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function Tp(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Ot(n[0].x,n[1].x)&&!Ot(n[0].y,n[1].y),s=Ot(n[n.length-1].x,n[n.length-2].x)&&!Ot(n[n.length-1].y,n[n.length-2].y);for(const c of ji){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function DR(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const C of[0,...ji])Math.abs(C)<i.width/2-5&&y.push({pts:[{x:f,y:l},{x:u+C,y:l},{x:u+C,y:h}],cost:Math.abs(C)}),Math.abs(C)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:p+C},{x:g,y:p+C}],cost:Math.abs(C)});return y}function kp(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(r+o)/2,p=[];for(const f of[0,...ji]){const d=u+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function og(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ci(t),r=t.edges.filter(d=>d.id!==e.id),o=ai(e,r);if(o===0)return null;const a=si(e,r);let s;const c=d=>d.reduce((g,h,y)=>y?g+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],y=Math.hypot(h.x-g.x,h.y-g.y);return y>=1&&c(d)/y>=l?1:0},p=u(e.waypoints),f=[..._c(e,n),...kp(e,n),...Tp(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(xn(h,i).length>0)continue;const y=ai(h,r),C=si(h,r),x=o-y+(p-u(d));if(y>=o||C-a>x)continue;const m=c(d);(!s||y<s.opposite||y===s.opposite&&(C<s.cross||C===s.cross&&(g<s.cost||g===s.cost&&m<s.len)))&&(s={pts:d,opposite:y,cross:C,cost:g,len:m})}return(s==null?void 0:s.pts)??null}function ag(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Uo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function LR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ci(t),r=t.edges.filter(f=>f.id!==e.id),o=ag(e,r);if(o===0)return null;const a=ai(e,r),s=si(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[..._c(e,n),...kp(e,n),...DR(e,n),...Tp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(xn(g,i).length>0)continue;const h=ag(g,r);if(h>=o)continue;const y=ai(g,r);if(y-h>a-o)continue;const C=si(g,r);if(C-s>(o-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:y,cross:C,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function sg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=dt(Ze(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(lt(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=Ze(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=LR(l,c);if(!u)continue;const p=i.get(s);p&&r.updateWaypoints(p,u)}}function cg(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function lg(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Uo(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:cg(e,n)&&cg(t,n)}function ug(e,t,n){let i=0;for(const r of t)r.id!==e.id&&lg(e,r,n)&&i++;return i}function IR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ci(t),r=t.edges.filter(f=>f.id!==e.id),o=ug(e,r,n);if(o===0)return null;const a=ai(e,r),s=si(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[..._c(e,n),...kp(e,n),...Tp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(xn(g,i).length>0)continue;const h=ug(g,r,n);if(h>=o)continue;const y=ai(g,r);if(y-h>a-o)continue;const C=si(g,r);if(C-s>(o-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:y,cross:C,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function BR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ze(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=dt(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(lt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!u||!p||!lg(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ze(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=IR(p,u);if(!f)continue;const d=i.get(l);d&&r.updateWaypoints(d,f)}}function pg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ze(i),a=dt(o).filter(u=>wp(u)&&!t.has(lt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(wp(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=o.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ze(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=og(f,p);if(!d)continue;const g=i.get(u);g&&r.updateWaypoints(g,d)}}const NR=10,$R=(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 fg(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!gc(e,i))return null;const r=ci(t),o=i.flatMap(gn);for(const a of gn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of mc(a,o))s=s.flatMap(([h,y])=>{const C=[];return d>h&&C.push([h,Math.min(y,d)]),g<y&&C.push([Math.max(h,g),y]),C.filter(([x,m])=>m>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+NR*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-km}:{x:a.at+Sn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!gc({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&$R(f,d)))return f}return null}const Sn=8;function Op(e,t){const n=e.label;if(!n)return null;const i=gn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,g=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(gn),...t.shapes.filter(f=>f.container).flatMap(Yo)],l=f=>!c.some(d=>Fi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Sn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Sn,s.at-Sn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-Sn-n.height,s.at+Sn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const dg=30,FR=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n},hg=(e,t)=>FR({x:e.x+e.width/2,y:e.y+e.height/2},t);function jR(e,t){const n=e.label;if(!n)return null;const i=gn(e);if(!i.length)return null;const r=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(gn),...t.shapes.filter(c=>c.container).flatMap(Yo)],o=co(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!r.some(l=>Fi(c,l))&&!za(c,t).length&&!o.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+Sn,c.at-Sn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Sn,c.at-Sn-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 mg(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=Ze(n),o=new Set(dt(r).map(lt));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((E,T)=>E.x-u[T].x===d&&E.y-u[T].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const E=r.edges.find(D=>D.id===c);if(!(E!=null&&E.label)||!za(E.label,r).length)continue;let T={...E.label,x:l.label.x,y:l.label.y};if((za(T,r).length||hg(T,E.waypoints)>dg)&&(T=null),!T&&hg(E.label,E.waypoints)>dg&&(T=jR(E,r)),!T)continue;const O=T,N={...r,edges:r.edges.map(D=>D.id===c?{...D,label:O}:D)},P=dt(N);if(P.some(D=>!o.has(lt(D))))continue;i.moveElements([f],{x:O.x-f.x,y:O.y-f.y}),r=N,o=new Set(P.map(lt));continue}const y=l.label.x+d-f.x,C=l.label.y+g-f.y;if(y===0&&C===0)continue;const x=r.edges.find(E=>E.id===c);if(!(x!=null&&x.label))continue;const m={...x.label,x:x.label.x+y,y:x.label.y+C},v={...r,edges:r.edges.map(E=>E.id===c?{...E,label:m}:E)},_=dt(v);_.some(E=>!o.has(lt(E)))||(i.moveElements([f],{x:y,y:C}),r=v,o=new Set(_.map(lt)))}}function gg(e,t,n=new Set){const{elementRegistry:i}=e,r=e.modeling,o=Ze(i);for(const a of o.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Op(a,o);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&r.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function yg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ze(i),a=dt(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(lt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const l=fg(c,o);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function vg(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(gn),...t.shapes.filter(f=>f.container).flatMap(Yo)],r=i.filter(f=>Fi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=co(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Fi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of r)f.axis==="h"?l.push({...n,y:f.at-Sn-n.height},{...n,y:f.at+Sn}):l.push({...n,x:f.at-Sn-n.width},{...n,x:f.at+Sn});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+Sn},{...n,x:u-n.width/2,y:e.y-Sn-n.height},{...n,x:e.x+e.width+Sn,y:p-n.height/2},{...n,x:e.x-Sn-n.width,y:p-n.height/2}),l.find(c)??null}function bg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ze(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=vg(o,Ze(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function HR(e,t){const n=e.x,i=e.x+e.width,r=e.y,o=e.y+e.height;if(t.x<n||t.x>i||t.y<r||t.y>o)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,r),o))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-r,{x:t.x,y:r}],[o-t.y,{x:t.x,y:o}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function xg(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=Ze(n),o=new Set(dt(r).map(lt));const a=[...new Set(dt(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(lt(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,y]of u){const C=h?r.shapes.find(m=>m.id===h):void 0;if(!C)continue;const x=HR(C,l[y]);x.x===l[y].x&&x.y===l[y].y||(l[y]=x,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=dt(f);if(d.some(h=>!o.has(lt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),r=f,o=new Set(d.map(lt)))}}const Dp=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function _g(e,t){const n=(r,o,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>o?`${o}.${u}`:u;return{id:r,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((r,o)=>n(r.id,`participant.lanes[${o}]`,r))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((r,o)=>({...n(r.id,`lanes[${o}]`,r),omittedMeansRemove:(t==null?void 0:t.categoryOf(r.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function zR(e,t,n){const i=[],r=n?Ba(n):[];return e.forEach((o,a)=>{if(o.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:o.id,field:"locale"});return}if(!r.includes(o.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:o.id,field:"locale",locale:o.locale,locales:r});return}t.categoryOf(o.id)!==void 0&&!t.reviewRequestLocalesOf(o.id).includes(o.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:o.id,locale:o.locale});return}for(const s of _g(o,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:r});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:r});continue}if(!l)continue;if(!Dp(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):r.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:r}),p=!1);if(!p)continue;const f=r.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function hi(e,t,n){const i=t==="text"?"texts":"names",{[i]:r,...o}=e;return n===void 0?o:{...o,[t]:n}}function GR(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:r}=n,o=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(Dp(c.map)){const l=c.map;return o(c.id).texts={...l},l[r]}if(c.plain===null||c.condition===null&&c.plain===void 0){o(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(o(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=o(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=_g(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=hi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>hi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=hi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>hi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:hi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:hi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:hi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:hi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:hi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:hi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(hi(c,"text",a(l[0])));break;default:s.push(Dp(l[0].map)?hi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const VR=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,wg=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Eg={"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}]},Ga=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Sc=e=>typeof e=="string"&&e!=="";function WR(e){const t=[];function n(i,r,o,a){if(a===null){Sc(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!Ga(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Sc(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a,s;if(!Ga(i)||!Sc(i.kind)||!(i.kind in Eg)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const c of Eg[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!Ga(f))break;f=f[g]}if(!Ga(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(r,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:r,field:c.path});continue}d.forEach((g,h)=>n(r,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;Ga(c)&&!Sc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:r,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const l=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Yh(l)){t.push({kind:"node-type-unsupported",opIndex:r,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!Kh(p)){t.push({kind:"payload-invalid",opIndex:r,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:r,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function Sg(e,t,n={}){const i=WR(e);if(i.length>0)return i;const r=[],o=new Map,a=new Map;function s(h,y,C){if(!VR.test(y)){r.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||o.has(y)){r.push({kind:"id-duplicate",opIndex:h,id:y});return}o.set(y,{...C,opIndex:h})}e.forEach((h,y)=>{var C;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(y,x.id,{category:"lane"});break;case"node.add":s(y,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(y,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,h.dataStore.id,{category:"dataStore"});for(const x of h.associations??[])x.id&&s(y,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(y,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(y,h.association.id,{category:"association"});break;case"annotation.add":s(y,h.annotation.id,{category:"annotation"}),(C=h.association)!=null&&C.id&&s(y,h.association.id,{category:"association"});break;case"group.add":s(y,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(y,x.id,{category:"lane"})}break}});const c=h=>{var y;return((y=o.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=o.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,C,x){const m=c(y);if(m===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:C});return}if(x&&!x.includes(m)){r.push({kind:"ref-category",opIndex:h,ref:y,role:C,expected:x.join("|"),actual:m});return}return m}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var C;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:x,lane:m}=h.node;if(x===void 0){(p||m!==void 0)&&r.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,x,"participant",["participant"])===void 0)break;m!==void 0&&((((C=o.get(x))==null?void 0:C.lanes)??a.get(x)??t.lanesOf(x)).includes(m)||r.push({kind:"lane-unknown",opIndex:y,lane:m,participant:x}));break}case"sequenceFlow.add":{const{id:x,source:m,target:v,name:_,condition:E}=h.flow,T=u(y,m,"source",["flowNode"]),O=u(y,v,"target",["flowNode"]);T&&O&&l(m)!==l(v)&&r.push({kind:"flow-cross-pool",opIndex:y,id:x}),_!==void 0&&E!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:x});break}case"messageFlow.add":{const{id:x,source:m,target:v}=h.flow,_=u(y,m,"source",["flowNode","participant"]),E=u(y,v,"target",["flowNode","participant"]);if(_&&E){const T=l(m),O=l(v);T!==void 0&&T===O&&r.push({kind:"message-flow-same-pool",opIndex:y,id:x})}for(const T of[m,v])d(T)&&r.push({kind:"message-flow-timer-endpoint",opIndex:y,id:x,ref:T});break}case"dataStore.add":{for(const x of h.associations??[]){if([x.source,x.target].filter(_=>_===h.dataStore.id).length!==1){r.push({kind:"data-association-ends",opIndex:y,source:x.source,target:x.target});continue}const v=x.source===h.dataStore.id?x.target:x.source;u(y,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:x,target:m}=h.association,v=u(y,x,"source"),_=u(y,m,"target");if(v&&_){const E=new Set([v,_]);E.has("dataStore")&&E.has("flowNode")||r.push({kind:"data-association-ends",opIndex:y,source:x,target:m})}break}case"association.add":{const{id:x,source:m,target:v}=h.association,_=u(y,m,"source"),E=u(y,v,"target");_&&E&&_!=="annotation"&&E!=="annotation"&&r.push({kind:"association-detached",opIndex:y,annotation:x??`${m}->${v}`});break}case"annotation.add":{if(h.association){const{source:x,target:m}=h.association;if(x!==h.annotation.id&&m!==h.annotation.id)r.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const v=x===h.annotation.id?m:x;u(y,v,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const x of h.group.members??[]){const m=u(y,x,"member");m&&wg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const x=t.lanesOf(h.id),m=h.lanes.map(_=>_.id);for(const _ of x)m.includes(_)||r.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:_});for(const _ of m)t.categoryOf(_)!==void 0&&!x.includes(_)&&r.push({kind:"id-duplicate",opIndex:y,id:_});const v=m.filter(_=>x.includes(_));v.length===x.length&&v.some((_,E)=>_!==x[E])&&r.push({kind:"lane-reorder-unsupported",opIndex:y,participant:h.id})}break}case"node.update":{if(g(y,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const x=t.participantOf(h.id);(x?a.get(x)??t.lanesOf(x):[]).includes(h.lane)||r.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:x??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const x=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,m=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),_=h.source??(v==null?void 0:v.source),E=h.target??(v==null?void 0:v.target);x&&m&&_!==void 0&&E!==void 0&&new Set([l(_),l(E),l(h.id)]).size>1&&r.push({kind:"flow-cross-pool",opIndex:y,id:h.id})}break}case"messageFlow.update":g(y,h.id,"messageFlow");break;case"dataStore.update":g(y,h.id,"dataStore");break;case"annotation.update":{if(g(y,h.id,"annotation")===void 0)break;h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.update":{if(g(y,h.id,"group")===void 0)break;for(const x of h.members??[]){const m=u(y,x,"member");m&&wg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&r.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),r.push(...zR(e,t,n.i18n)),r;function g(h,y,C){if(o.has(y)){r.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const x=t.categoryOf(y);if(x===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(C&&x!==C){r.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:C,actual:x});return}return x}}function Rg(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 Rc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Cc={"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]},Rn=10,UR=300,qR=160,Cg=20,Lp=100,Mg=40,YR=10;function Ip(e,t,n,i,r){const o=n,a=(P,D)=>{const[F,J]=Cc[P];let ge={x:t.x+t.width/2+F*(t.width/2+o.width/2+D),y:t.y+t.height/2+J*(t.height/2+o.height/2+D)};const Ae=i.x+Rn+o.width/2,De=i.x+i.width-Rn-o.width/2,qe=i.y+Rn+o.height/2,rt=i.y+i.height-Rn-o.height/2,Me={x:Math.min(De,Math.max(Ae,ge.x)),y:Math.min(rt,Math.max(qe,ge.y))};return(Me.x!==ge.x||Me.y!==ge.y)&&(ge=Math.abs(Me.x-(t.x+t.width/2))<(t.width+o.width)/2+Rn&&Math.abs(Me.y-(t.y+t.height/2))<(t.height+o.height)/2+Rn?{x:t.x+t.width+Rn+o.width/2,y:Me.y}:Me),ge},s=(i.children??[]).filter(P=>!("waypoints"in P&&P.waypoints)&&P.type!=="bpmn:Lane"&&P.type!=="label"&&typeof P.x=="number"&&P.id!==r.selfId),c=Ze(e),l=P=>{var F,J;if(!r.selfId)return!1;const D=e.get(P);return!!D&&(((F=D.source)==null?void 0:F.id)===r.selfId||((J=D.target)==null?void 0:J.id)===r.selfId)},u=c.edges.filter(P=>!l(P.id)).flatMap(gn),p=co(c).filter(P=>P.owner!==r.selfId).map(P=>P.rect),f=P=>({x0:P.x-o.width/2-Rn,x1:P.x+o.width/2+Rn,y0:P.y-o.height/2-Rn,y1:P.y+o.height/2+Rn}),d=P=>{const D=f(P);return s.some(F=>D.x0<F.x+F.width&&D.x1>F.x&&D.y0<F.y+F.height&&D.y1>F.y)},g=P=>{const D=f(P);return u.some(F=>F.axis==="h"?F.at>D.y0&&F.at<D.y1&&F.lo<D.x1&&F.hi>D.x0:F.at>D.x0&&F.at<D.x1&&F.lo<D.y1&&F.hi>D.y0)},h=P=>{const D=f(P);return p.some(F=>D.x0<F.x+F.width&&D.x1>F.x&&D.y0<F.y+F.height&&D.y1>F.y)},y=c.shapes.filter(P=>P.type==="bpmn:Group").flatMap(P=>[{axis:"h",at:P.y,lo:P.x,hi:P.x+P.width},{axis:"h",at:P.y+P.height,lo:P.x,hi:P.x+P.width},{axis:"v",at:P.x,lo:P.y,hi:P.y+P.height},{axis:"v",at:P.x+P.width,lo:P.y,hi:P.y+P.height}]),C=P=>{const D=f(P);return y.some(F=>F.axis==="h"?F.at>D.y0&&F.at<D.y1&&F.lo<D.x1&&F.hi>D.x0:F.at>D.x0&&F.at<D.x1&&F.lo<D.y1&&F.hi>D.y0)},x=P=>d(P)||g(P)||h(P)||C(P),m=P=>P.x-o.width/2>=i.x&&P.x+o.width/2<=i.x+i.width&&P.y-o.height/2>=i.y&&P.y+o.height/2<=i.y+i.height;if(r.placement){const P=De=>De.startsWith("top")?De.replace(/^top/,"bottom"):De.replace(/^bottom/,"top"),D=De=>De.endsWith("left")?De.replace(/left$/,"right"):De.replace(/right$/,"left"),F=r.placement.side,J=[F,P(F),D(F),P(D(F)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ge=r.placement.offset??50;let Ae=a(F,ge);if(x(Ae)){const De=new Set;for(const qe of J){if(De.has(qe))continue;De.add(qe);const rt=a(qe,ge);if(m(rt)&&!x(rt)){Ae=rt;break}}}return Ae}const v=r.from,_=i.x+Rn+o.width/2,E=i.x+i.width-Rn-o.width/2,T=i.y+Rn+o.height/2,O=i.y+i.height-Rn-o.height/2;let N={x:Math.min(E,Math.max(_,v.x)),y:Math.min(O,Math.max(T,v.y))};if(x(N)){const P=(t.width+o.width)/2+Rn,F=[{x:N.x+P,y:N.y},{x:N.x-P,y:N.y},{x:N.x,y:N.y-o.height-Rn},{x:N.x,y:N.y+o.height+Rn}].filter(m).find(J=>!x(J));F&&(N=F)}return N}function Kt(e,t){return e.filter(n=>n.kind===t)}class Ag extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function Pg(e,t){var AE,PE,TE,kE,OE,DE,LE,IE,BE,NE,$E,FE,jE,HE,zE,GE,VE,WE,UE,qE,YE,KE,XE;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>o.get(b),f=b=>{const S=p(b);if(!S)throw new Error(`하강 참조 해소 실패: ${b}`);return S},d=b=>{let S=b.parent;for(;S;){if(S.type==="bpmn:Participant")return S;S=S.parent}},g=new Map;for(const b of o.filter(S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=Kt(e,"participant.add"),y=Kt(e,"node.add"),C=Kt(e,"sequenceFlow.add"),x=Kt(e,"messageFlow.add"),m=Kt(e,"dataStore.add"),v=Kt(e,"dataAssociation.add"),_=Kt(e,"annotation.add"),E=Kt(e,"group.add"),T=new Map(y.map(b=>[b.node.id,b])),O=(b,S,A)=>{var j;const k=b.businessObject,I=(((j=k.extensionElements)==null?void 0:j.values)??[]).filter(B=>B.$type!==S),L=A?[...I,i.create(S,A)]:I;if(!L.length){k.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const H=i.create("bpmn:ExtensionElements",{values:L});L.forEach(B=>{B.$parent=H}),n.updateProperties(b,{extensionElements:H})},N=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Kt(e,"element.remove")){const S=p(b.id);S&&n.removeElements([S])}const P=b=>o.filter(S=>{var A;return S.type==="bpmn:Lane"&&((A=d(S))==null?void 0:A.id)===b}).sort((S,A)=>S.y-A.y);for(const b of Kt(e,"participant.update")){const S=f(b.id);if(b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),!b.lanes)continue;const A=P(b.id);if(!A.length){n.splitLane(S,b.lanes.length),P(b.id).forEach((I,L)=>{const H=b.lanes[L];H&&n.updateProperties(I,{id:H.id,name:H.name})});continue}const k=new Set(A.map(I=>I.id));b.lanes.forEach((I,L)=>{if(k.has(I.id)){n.updateProperties(f(I.id),{name:I.name});return}const H=L===0?n.addLane(P(b.id)[0],"top"):n.addLane(f(b.lanes[L-1].id),"bottom");n.updateProperties(H,{id:I.id,name:I.name})})}const D=150,F=130,J=80,ge=90,Ae=180,De=30,qe=30,rt=(b,S,A,k,I)=>{const L=A-S.width/2,H=k-S.height/2;return(b.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!(I!=null&&I.has(j.id))&&typeof j.x=="number"&&L<j.x+j.width+qe&&L+S.width+qe>j.x&&H<j.y+j.height&&H+S.height>j.y)},Me=new Set;for(const b of h){Me.add(`pool:${b.participant.id}`);for(const S of b.participant.lanes??[])Me.add(S.id)}const X=new Map;for(const b of y){const S=b.node.lane??`pool:${b.node.participant??""}`;let A=X.get(S);A||X.set(S,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const ne=new Map;for(const[b,S]of X){if(!Me.has(b))continue;const A=[...S].sort((L,H)=>L-H),k=A.map((L,H)=>H===0?0:H%2===1?Math.ceil(H/2):-(H/2)),I=Math.min(...k);ne.set(b,new Map(A.map((L,H)=>[L,k[H]-I])))}{const b=new Map;for(const S of h)(S.participant.lanes??[]).forEach((A,k)=>b.set(A.id,k));for(const[S,A]of ne){if(!b.has(S)||A.size<2)continue;const k=b.get(S),I=A.get(0)??0,L=new Set;for(const ee of y){if(ee.node.lane!==S||(ee.band??0)!==0||!ee.node.type.endsWith("Gateway"))continue;const de={in:new Set,out:new Set,cross:new Set};for(const pe of C){const me=pe.flow.source===ee.node.id;if(!me&&pe.flow.target!==ee.node.id)continue;const Ye=T.get(me?pe.flow.target:pe.flow.source);if(!Ye||Ye.node.participant!==ee.node.participant||!Ye.node.lane)continue;let Ce,Q=!1;if(Ye.node.lane!==S){const ie=b.get(Ye.node.lane);if(ie===void 0)continue;Ce=ie>k?"down":"up",Q=!0}else{const ie=A.get(Ye.band??0)??I;Ce=ie>I?"down":ie<I?"up":void 0}Ce&&(de[me?"out":"in"].add(Ce),Q&&de.cross.add(Ce))}for(const pe of["up","down"])de.in.has(pe)&&de.out.has(pe)&&de.cross.has(pe)&&L.add(pe)}if(L.size!==1)continue;const[H]=L,j=Math.max(...A.values()),B=H==="down"?j:0;if(I===B)continue;const W=[...A.entries()].filter(([ee])=>ee!==0).sort((ee,de)=>ee[1]-de[1]),Y=[...Array(j+1).keys()].filter(ee=>ee!==B),ae=new Map([[0,B]]);W.forEach(([ee],de)=>ae.set(ee,Y[de])),ne.set(S,ae)}}const q=b=>{var S;return(((S=X.get(b))==null?void 0:S.size)??0)>1},K=b=>b.band??(b.node.lane||!q(`pool:${b.node.participant??""}`)?void 0:0),oe=new Map,fe=b=>oe.get(b.node.id)??K(b),Te=new Set,$=new Set;{const b=new Map;for(const k of C)b.set(k.flow.target,(b.get(k.flow.target)??0)+1);const S=k=>{const I=[],L=new Set([k]),H=[k];for(;H.length;){const j=H.shift();I.push(j);for(const B of C)B.flow.source!==j||L.has(B.flow.target)||(b.get(B.flow.target)??0)!==1||(L.add(B.flow.target),H.push(B.flow.target))}return I},A=(k,I)=>{var L;return((L=ne.get(k))==null?void 0:L.get(I))??I};for(const k of y){if(!k.node.type.endsWith("Gateway"))continue;const I=k.node.lane??`pool:${k.node.participant??""}`,L=ne.get(I);if(!L||L.size<2)continue;const H=fe(k);if(H===void 0||A(I,H)!==A(I,0))continue;const j=A(I,H),B=C.filter(pe=>pe.flow.source===k.node.id).map(pe=>T.get(pe.flow.target)).filter(pe=>!!pe&&(pe.node.lane??`pool:${pe.node.participant??""}`)===I),W=B.filter(pe=>{const me=fe(pe);return me!==void 0&&A(I,me)===j&&(b.get(pe.node.id)??0)===1}),Y=B.some(pe=>{const me=fe(pe);return me!==void 0&&A(I,me)>j});if(W.length!==1||!Y)continue;const ae=new Set(B.flatMap(pe=>S(pe.node.id)));if(!C.some(pe=>pe.flow.target===k.node.id&&ae.has(pe.flow.source)))continue;const de=new Map;for(const[pe,me]of L)de.set(pe,me+1);de.set(-1,0),ne.set(I,de);for(const pe of S(W[0].node.id))T.has(pe)&&(oe.set(pe,-1),$.add(pe));Te.add(k.node.id)}}const R=(b,S)=>{var A;return((A=ne.get(b))==null?void 0:A.get(S))??S},w=(b,S,A,k)=>{const I=b?p(b):S?p(S):void 0;if(!I)return!1;const L=b?I.y+Math.min(I.height/2,ge):I.y+J;return Math.abs(L+R(b??`pool:${S??""}`,A)*D-k)<=D/2},G=new Map;for(const[b,S]of X){let A=0;for(const k of S)A=Math.max(A,R(b,k));G.set(b,A)}const V=b=>Ae+D*b,te=(b,S,A)=>{const k=u().children.filter(I=>!("waypoints"in I&&I.waypoints)&&I.type!=="label"&&I.id!==S&&typeof I.y=="number"&&I.y>=b);k.length&&n.moveElements(k,{x:0,y:A})},Re=(b,S,A)=>{const k=b.type==="bpmn:Participant"?b:void 0;if(!k||k.children.some(j=>j.type==="bpmn:Lane"))return;const I=A+S.height/2+De-k.y;if(k.height>=I)return;const L=I-k.height,H=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:I}),te(H,k.id,L)},Qe=(b,S)=>{const A=S-b.height;if(A<=0)return;const k=d(b)??b,I=[],L=B=>{I.push(B);for(const W of B.children??[])L(W)};L(k);const H=b.y+b.height-10,j=l.calculateAdjustments(I,"y",A,H);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:A},"s",H)},ht=(b,S,A)=>{if(b){const H=f(b),j=V(S);if(H.height>=j)return;const B=j-H.height,W=d(H),Y=W?W.y+W.height:H.y+H.height;Qe(H,j),te(Y,W==null?void 0:W.id,B);return}if(!A)return;const k=D*(S+1);if(A.height>=k)return;const I=k-A.height,L=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:k}),te(L,A.id,I)},Wt=new Map;for(const b of C)Wt.set(b.flow.target,(Wt.get(b.flow.target)??0)+1);const xt=b=>(Wt.get(b)??0)<=1,dn=new Set(y.map(b=>b.node.id).filter(b=>Kt(e,"sequenceFlow.update").filter(S=>S.target===b).length===1&&!C.some(S=>S.flow.target===b||S.flow.source===b&&T.has(S.flow.target)))),wn=new Map,jn=(b,S)=>{if(!b)return;const A=p(b);if(!A||A.height>=V(S))return;const k=A.y+A.height-10,I=d(A);if(I)return new Set((I.children??[]).filter(L=>L.type!=="bpmn:Lane"&&typeof L.y=="number"&&L.y>k).map(L=>L.id))},Ct=(b,S,A)=>{if(!b)return!0;const k=p(b);return k?A-S.height/2>=k.y&&A+S.height/2<=k.y+k.height:!0},Yt=h.map((b,S)=>({op:b,declared:S}));Yt.sort((b,S)=>{const A=b.op.order??Number.POSITIVE_INFINITY,k=S.op.order??Number.POSITIVE_INFINITY;return A!==k?A-k:b.declared-S.declared});let vn=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(vn=Math.max(vn,b.y+b.height+60));for(const{op:b}of Yt){const S=b.participant,A=y.filter(ee=>ee.node.participant===S.id).length,k=((AE=S.lanes)==null?void 0:AE.length)??0,I=Math.max(1200,A*160+300),L=(S.lanes??[]).map(ee=>V(G.get(ee.id)??0)),H=L.reduce((ee,de)=>ee+de,0);k&&H<300&&(L[k-1]+=300-H);const j=Math.max(300,D*((G.get(`pool:${S.id}`)??0)+1)),B=S.blackBox||A+k===0?120:k?Math.max(300,H):j,W=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:S.id,name:S.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...S.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:I,height:B,isExpanded:!0}),Y=n.createShape(W,{x:100+I/2,y:vn+B/2},u()),ae=S.lanes??[];if(ae.length&&n.splitLane(Y,ae.length),ae.length){const ee=o.filter(de=>{var pe;return de.type==="bpmn:Lane"&&((pe=d(de))==null?void 0:pe.id)===S.id}).sort((de,pe)=>de.y-pe.y);if(ee.forEach((de,pe)=>{const me=ae[pe];me&&n.updateProperties(de,{id:me.id,name:me.name})}),L.some(de=>de!==Y.height/k)){let de=Y.y;ee.forEach((pe,me)=>{const Ye=L[me];n.resizeShape(pe,{x:pe.x,y:de,width:pe.width,height:Ye}),de+=Ye})}}vn=Y.y+Y.height+60}const ka=b=>{var k;const S=T.get(b);if(S)return S.node.participant??"";const A=p(b);return A?A.type==="bpmn:Participant"?A.id:((k=d(A))==null?void 0:k.id)??"":""},Hn=new Map,Di=b=>{let S=Hn.get(b);return S||Hn.set(b,S={nodes:[],flows:[]}),S};for(const b of y)Di(b.node.participant??"").nodes.push(b);for(const b of C)Di(ka(b.flow.source)).flows.push(b);const ri=b=>{var S;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((S=b.condition)==null?void 0:S.label)})},Zt=(b,S,A)=>r.createShape({type:Rc(b.type),...b.eventDefinition?{eventDefinitionType:ec[b.eventDefinition]}:{},businessObject:i.create(Rc(b.type),{id:b.id,name:b.name,...S!==void 0?{"bwl:band":S}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Mo=[...Yt.map(({op:b})=>b.participant.id).filter(b=>Hn.has(b)),...[...Hn.keys()].filter(b=>!h.some(S=>S.participant.id===b))],Oa=b=>b.endsWith("Gateway");for(const b of Mo){const S=Hn.get(b),A=b?f(b):void 0,k=A?A.x+150:250;let I=A?A.y+80:120;const L=(Q,ie,se)=>{if(Q){const ve=f(Q);return ve.y+Math.min(ve.height/2,ge)+R(Q,ie??0)*D}return ie!==void 0&&A?A.y+J+R(`pool:${b}`,ie)*D:se},H=(Q,ie,se)=>{if(Q){const ve=f(Q);return ve.y+Math.min(ve.height/2,ge)+ie*D}return A?A.y+J+ie*D:se},j=Q=>Q.participant?f(Q.participant):u(),B=(Q,ie,se,ve,et,Ve,gt,Tt)=>{const xe=se!==void 0||ve!==void 0,be=Be=>{const we=()=>ht(se,Be,A);Tt?Tt(we):we()},re=R(se??`pool:${b}`,ve??0);if((ve===void 0||w(se,b,ve,gt??Number.NaN))&>!==void 0&&Ct(se,ie,gt)&&!rt(Q,ie,et,gt))return{x:et,y:gt};if(xe)for(let Be=0;Be<4;Be++){const we=H(se,re+Be,Ve);if(!rt(Q,ie,et,we,jn(se,re+Be)))return be(re+Be),{x:et,y:we}}const ye=L(se,ve,Ve);xe?be(re):Tt?Tt(()=>Re(Q,ie,ie.y+ie.height/2)):Re(Q,ie,ye);let Ie=et;for(let Be=0;Be<64;Be++){const we=rt(Q,ie,Ie,ye);if(!we)break;Ie=we.x+we.width+F+ie.width/2}return{x:Ie,y:ye}},W=new Set(S.flows.map(Q=>Q.flow.target)),Y=new Map,ae=Q=>{if(Q===void 0)return;const ie=o.get(Q);if(!(!ie||typeof ie.x!="number"||typeof ie.width!="number"))return ie.x+ie.width+F};for(const Q of S.nodes){if(W.has(Q.node.id))continue;const ie=Zt(Q.node,Q.band,Q.afterColumn),se=K(Q),ve=Q.node.lane?`${Q.node.lane}|${se??""}`:se!==void 0?`band:${se}`:"",et=j(Q.node),Ve=Y.get(ve)??k,gt=ae(Q.afterColumn),Tt=gt===void 0?Ve:Math.max(Ve,gt);let xe;const be=B(et,ie,Q.node.lane,se,Tt,I,void 0,dn.has(Q.node.id)&&Q.node.participant!==void 0?re=>xe=re:void 0);if(xe?n.createShape(ie,be,et,{autoResize:!1}):n.createShape(ie,be,et),xe){const re=Q.node.lane?f(Q.node.lane):et;wn.set(Q.node.id,{container:re,relCy:be.y-re.y,grow:xe})}Y.set(ve,be.x+ie.width+F),!Q.node.lane&&se===void 0&&(I+=160)}const ee=new Set,de=new Map,pe=new Map,me=new Map;if(b&&Me.has(`pool:${b}`)){const Q=new Map;for(const xe of S.flows)Q.set(xe.flow.target,(Q.get(xe.flow.target)??0)+1);const ie=xe=>L(xe.node.lane,fe(xe),Number.NaN),se=new Set,ve=xe=>{var ye;const be=(ye=T.get(xe))==null?void 0:ye.node.participant;if(be)return p(be);const re=p(xe);if(re)return re.type==="bpmn:Participant"?re:d(re)},et=xe=>{const be=[],re=new Set([xe]),ye=[xe];for(;ye.length;){const Ie=ye.shift(),Be=T.get(Ie);Be&&be.push(Be);for(const we of S.flows)we.flow.source!==Ie||re.has(we.flow.target)||(Q.get(we.flow.target)??0)!==1||(re.add(we.flow.target),ye.push(we.flow.target))}return be},Ve=xe=>{if(!A)return;const be=new Set(xe.map(Ie=>Ie.node.id));let re=!1,ye=!1;for(const Ie of x){if(!be.has(Ie.flow.source))continue;const Be=ve(Ie.flow.target);!Be||Be.id===A.id||(Be.y<A.y?re=!0:ye=!0)}return re&&!ye?"up":ye&&!re?"down":void 0};for(const xe of S.nodes){if(!Oa(xe.node.type))continue;const be=L(xe.node.lane,K(xe),Number.NaN);if(Number.isNaN(be))continue;const re=[];for(const we of S.flows){if(we.flow.source!==xe.node.id)continue;const ot=T.get(we.flow.target);if(!ot||ot.node.lane!==xe.node.lane||(Q.get(ot.node.id)??0)!==1)continue;const Ke=K(ot);if(Ke===void 0)continue;const Mt=L(ot.node.lane,Ke,Number.NaN);if(Number.isNaN(Mt))continue;const Pe=et(ot.node.id),ke=Ve(Pe);ke&&re.push({subtree:Pe,band:Ke,row:Mt,dir:ke})}if(!re.some(we=>we.dir==="up")||!re.some(we=>we.dir==="down")||!re.some(we=>we.dir==="up"&&re.some(ot=>ot.dir==="down"&&ot.row<we.row)))continue;const Ie=[...re].sort((we,ot)=>we.row-ot.row);[...re.filter(we=>we.dir==="up"),...re.filter(we=>we.dir==="down")].sort((we,ot)=>we.dir===ot.dir?we.row-ot.row:we.dir==="up"?-1:1).forEach((we,ot)=>{const Ke=Ie[ot].band;if(Ke!==we.band){se.add(xe.node.id);for(const Mt of we.subtree)K(Mt)===we.band&&oe.set(Mt.node.id,Ke)}})}const gt=xe=>{if(!A)return;const be=new Set(xe.map(Ie=>Ie.node.id));let re=!1,ye=!1;for(const Ie of x){if(!be.has(Ie.flow.target))continue;const Be=ve(Ie.flow.source);!Be||Be.id===A.id||(Be.y<A.y?re=!0:ye=!0)}return re&&!ye?"up":ye&&!re?"down":void 0};for(const xe of S.nodes){if(!Oa(xe.node.type))continue;const be=xe.node.lane??`pool:${b}`,re=ne.get(be);if(!re||re.size<2)continue;const ye=re.get(0);if(ye===void 0)continue;const Ie=Math.max(...re.values()),Be=ye===Ie&&ye!==0?"down":void 0;if(!Be)continue;const we=[];for(const ke of S.flows){if(ke.flow.source!==xe.node.id)continue;const Xe=T.get(ke.flow.target);if(!Xe||Xe.node.lane!==xe.node.lane||(Q.get(Xe.node.id)??0)!==1)continue;const bn=fe(Xe);bn!==void 0&&we.push({t:Xe,subtree:et(Xe.node.id),band:bn})}const ot=we.find(ke=>(re.get(ke.band)??ke.band)===ye);if(!ot||gt(ot.subtree)===Be||Ve(ot.subtree)===Be)continue;const Ke=we.find(ke=>ke!==ot&>(ke.subtree)===Be);if(!Ke)continue;const Mt=ot.band,Pe=Ke.band;for(const ke of ot.subtree)fe(ke)===Mt&&oe.set(ke.node.id,Pe);for(const ke of Ke.subtree)fe(ke)===Pe&&oe.set(ke.node.id,Mt);se.add(xe.node.id)}for(const xe of S.nodes){if(!Oa(xe.node.type))continue;const be=ie(xe);if(Number.isNaN(be)||_.some(we=>{var ot,Ke;return(((ot=we.placement)==null?void 0:ot.anchor)??(we.association?we.association.source===we.annotation.id?we.association.target:we.association.source:void 0))===xe.node.id&&((Ke=we.placement)==null?void 0:Ke.side.startsWith("bottom"))}))continue;let ye,Ie=!1,Be;for(const we of S.flows){if(we.flow.source!==xe.node.id)continue;const ot=T.get(we.flow.target);if(!ot||!ot.node.lane&&K(ot)===void 0)continue;const Ke=ie(ot);Number.isNaN(Ke)||(Math.abs(Ke-be)<.5&&(Ie=!0),Ke>be?!ye||Ke>ye.row?ye={id:ot.node.id,row:Ke,count:1}:Ke===ye.row&&ye.count++:Ke<be&&ot.node.lane===xe.node.lane&&(!Be||Ke>Be.row?Be={op:ot,row:Ke,count:1}:Ke===Be.row&&Be.count++))}ye&&ye.count===1&&(Q.get(ye.id)??0)===1&&!se.has(xe.node.id)&&ee.add(ye.id),!Ie&&Be&&Be.count===1&&(Q.get(Be.op.node.id)??0)===1&&!Te.has(xe.node.id)&&de.set(Be.op.node.id,{lane:xe.node.lane,band:fe(xe)})}const Tt=new Map;for(const xe of x)Tt.set(xe.flow.target,[...Tt.get(xe.flow.target)??[],xe]);for(const xe of S.nodes){const be=Tt.get(xe.node.id);if(!be||be.length!==1||!Q.get(xe.node.id)||!xe.node.lane&&K(xe)===void 0||$.has(xe.node.id))continue;const re=(PE=T.get(be[0].flow.source))==null?void 0:PE.node.participant,ye=re?p(re):void 0;if(!ye||!A||ye.id===A.id)continue;const Ie=xe.node.lane??`pool:${b}`,Be=ne.get(Ie);if(!Be)continue;const we=Be.get(0)??0,ot=(Be.get(fe(xe)??0)??we)-we;if(ot===0)continue;const Ke=ye.y<A.y;if(Ke&&ot<0||!Ke&&ot>0)continue;let Mt;for(const[Pe,ke]of Be){const Xe=ke-we;(Ke&&Xe<0&&(!Mt||Xe<Mt.row)||!Ke&&Xe>0&&(!Mt||Xe>Mt.row))&&(Mt={band:Pe,row:Xe})}Mt&&pe.set(xe.node.id,{lane:xe.node.lane,band:Mt.band})}}const Ye=new Set;let Ce=0;for(;Ce++<S.nodes.length+2;){for(let se=0;se<S.nodes.length+S.flows.length+2;se++){let ve=!1;for(const et of S.flows){const Ve=et.flow;if(Ye.has(Ve.id))continue;const gt=p(Ve.source);if(!gt)continue;const Tt=p(Ve.target),xe=T.get(Ve.target);if(!Tt&&xe){const be=Zt(xe.node,xe.band),re=fe(xe);if(xe.node.lane||re!==void 0){const ye=j(xe.node),Ie=gt,Be=Ie.x+(me.get(Ve.source)??0)+Ie.width+F,we=de.get(Ve.target)??pe.get(Ve.target),ot=B(ye,be,we?we.lane:xe.node.lane,we?we.band:re,ee.has(Ve.target)?Ie.x+Ie.width/2:Be,Number.NaN,we||!xt(Ve.target)?void 0:Ie.y+Ie.height/2),Ke=n.createShape(be,ot,ye);ee.has(Ve.target)&&me.set(Ve.target,Be-(Ke.x+Ke.width/2)),n.connect(gt,Ke,{type:"bpmn:SequenceFlow",businessObject:ri(Ve)})}else s.append(gt,be,{connection:{type:"bpmn:SequenceFlow",businessObject:ri(Ve)}})}else if(Tt)n.connect(gt,Tt,{type:"bpmn:SequenceFlow",businessObject:ri(Ve)});else continue;Ye.add(Ve.id),ve=!0}if(!ve)break}const Q=S.nodes.filter(se=>!p(se.node.id));if(!Q.length)break;const ie=Q[0];{const se=Zt(ie.node,ie.band),ve=j(ie.node),et=K(ie);n.createShape(se,B(ve,se,ie.node.lane,et,k,I),ve),!ie.node.lane&&et===void 0&&(I+=160)}}}const Tn=40,pt=b=>{const S=Y=>Y.kind==="label-over-line"||Y.kind==="label-over-shape"||Y.kind==="label-on-shared-segment"?Y.edge===b.id:Y.kind==="annotation-over-label"||Y.kind==="pool-name-over-label"?Y.label===b.id:!1,A=()=>new Set(dt(Ze(o)).filter(Y=>!S(Y)).map(Y=>lt(Y))),k=A(),I=b.waypoints.map(Y=>({x:Y.x,y:Y.y})),L=b.label,H=L&&{x:L.x,y:L.y};n.layoutConnection(b,{waypoints:[]});const j=A(),B=[...j].filter(Y=>!k.has(Y)).length,W=[...k].filter(Y=>!j.has(Y)).length;B<=W||(n.updateWaypoints(b,I),L&&H&&(L.x!==H.x||L.y!==H.y)&&n.moveElements([L],{x:H.x-L.x,y:H.y-L.y}))},yt=5,Ao=10,nE=200,Nu=new Set([...C.map(b=>b.flow.id),...x.map(b=>b.flow.id),...Kt(e,"sequenceFlow.update").map(b=>b.id),...Kt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),BN=(b,S,A,k,I,L)=>{const H=new Set(b.map(Q=>Q.id)),j=Math.min(...b.map(Q=>Q.x))+S-Ao,B=Math.max(...b.map(Q=>Q.x+Q.width))+S+nE+Ao,W=Math.min(...b.map(Q=>Q.y+Math.min(0,...A)))-Ao,Y=Math.max(...b.map(Q=>Q.y+Q.height+Math.max(0,...A)))+Ao,ae=o.getAll().filter(Q=>{if(Q.type!=="bpmn:SequenceFlow"&&Q.type!=="bpmn:MessageFlow")return!1;const ie=Q;return Nu.has(ie.id)||!ie.waypoints||ie.waypoints.length<2||[ie.source,ie.target].some(ve=>!ve||H.has(ve.id)||ve.x>=k)?!1:ie.waypoints.some((ve,et)=>{const Ve=ie.waypoints[et+1];return!!Ve&&Math.max(ve.x,Ve.x)>=j&&Math.min(ve.x,Ve.x)<=B&&Math.max(ve.y,Ve.y)>=W&&Math.min(ve.y,Ve.y)<=Y})});if(!ae.length)return 0;const ee=Q=>{const ie=new Map;for(const se of b)for(const ve of A){const et={id:se.id,type:se.type,x:se.x+S+Q,y:se.y+ve,width:se.width,height:se.height};for(const Ve of ae){let gt=1/0;for(let xe=0;xe+1<Ve.waypoints.length;xe++)gt=Math.min(gt,yc(Ve.waypoints[xe],Ve.waypoints[xe+1],et));const Tt=`${Ve.id}|${se.id}`;ie.set(Tt,Math.min(ie.get(Tt)??1/0,gt))}}return ie},de=[...ee(0)].filter(([,Q])=>Q<=yt).map(([Q])=>Q);if(!de.length)return 0;let pe=0;for(let Q=1;Q<=nE;Q++){const ie=ee(Q);if([...ie.values()].every(se=>se>yt)&&de.every(se=>(ie.get(se)??1/0)>=Ao)){pe=Q;break}}if(!pe)return 0;const me=Math.min(...b.map(Q=>Q.x))+S+pe,Ye=new Set(de.map(Q=>Q.slice(0,Q.indexOf("|"))));return ae.some(Q=>Q.type==="bpmn:SequenceFlow"&&Ye.has(Q.id)&&Q.waypoints.some((ie,se)=>{const ve=Q.waypoints[se+1];if(!ve||Math.min(ie.y,ve.y)>L||Math.max(ie.y,ve.y)<L||ie.y===ve.y)return!1;const et=ie.x+(L-ie.y)*(ve.x-ie.x)/(ve.y-ie.y);return et>I&&et<me}))?0:pe},Po=(b,S=()=>!0)=>{const A=p(b);if(!A)return[];const k=[A],I=new Set([b]);for(let L=0;L<k.length;L++){const H=k[L].id;for(const j of C){const B=j.flow.target;if(j.flow.source!==H||I.has(B)||!T.has(B))continue;I.add(B);const W=p(B);W&&S(W)&&k.push(W)}}return k},NN=(b,S=()=>!0)=>{const A=p(b);if(!A)return[];const k=[A],I=new Set([b]);for(let L=0;L<k.length;L++){const H=k[L].id;for(const j of C){const B=j.flow.source;if(j.flow.target!==H||I.has(B)||!T.has(B))continue;I.add(B);const W=p(B);W&&S(W)&&k.push(W)}}return k},Mi=30,vr=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",$u=(b,S)=>Np(n,b,S),Us=(b,S,A=!1)=>{const k=new Set(b.flatMap(B=>B.subtree.map(W=>W.id)));for(const B of b){const W=(B.pool.children??[]).filter(vr).filter(ae=>!k.has(ae.id));if(B.subtree.some(ae=>W.some(ee=>ae.x+S<ee.x+ee.width+Mi&&ae.x+S+ae.width+Mi>ee.x&&ae.y<ee.y+ee.height&&ae.y+ae.height>ee.y)))return null}const I=b.map(B=>B.pool.width),L=A?o.filter(B=>Array.isArray(B.waypoints)).map(B=>({c:B,wps:B.waypoints.map(W=>({x:W.x,y:W.y}))})):[],H=o.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(b.flatMap(B=>B.subtree),{x:S,y:0});const j=b.map(B=>{const Y=Math.max(...B.subtree.map(ae=>ae.x+ae.width))+Tg-(B.pool.x+B.pool.width);return Y>0&&$u(B.pool,B.pool.width+Y),Y});return()=>{n.moveElements(b.flatMap(B=>B.subtree),{x:-S,y:0}),b.forEach((B,W)=>{j[W]>0&&$u(B.pool,I[W])});for(const{c:B,wps:W}of L){const Y=B.waypoints??[];Y.length===W.length&&Y.every((ee,de)=>Math.abs(ee.x-W[de].x)<=.5&&Math.abs(ee.y-W[de].y)<=.5)||n.updateWaypoints(B,W.map(ee=>({x:ee.x,y:ee.y})))}for(let B=0;B<3;B++){let W=0;for(const Y of H){const ae=Y.x-Y.label.x,ee=Y.y-Y.label.y;Math.abs(ae)<=.5&&Math.abs(ee)<=.5||(n.moveElements([Y.label],{x:ae,y:ee}),W++)}if(!W)break}}},Nh=b=>{var I,L;const S=new Map,A=new Map;for(const H of o.getAll()){if(H.type!=="bpmn:Participant")continue;const j=H;(j.children??[]).length||(S.set(j.id,j),A.set(j.id,[]))}for(const H of o.getAll()){if(H.type!=="bpmn:MessageFlow")continue;const j=H,B=(I=j.source)==null?void 0:I.id,W=(L=j.target)==null?void 0:L.id;B&&W&&A.has(B)&&A.get(B).push(W),B&&W&&A.has(W)&&A.get(W).push(B)}const k=[];for(const[H,j]of A)j.length&&j.every(B=>b.has(B))&&k.push(S.get(H));return k},iE=(b,S)=>{if(!b.length)return null;const A=new Set(b.map(Y=>Y.id)),k=o.getAll().filter(Y=>Y.type==="bpmn:Participant"&&!A.has(Y.id)),I=Math.min(...k.filter(Y=>(Y.children??[]).length>0).map(Y=>Y.x)),L=new Set(b.filter(Y=>Math.abs(Y.x-I)<=2).map(Y=>Y.id));if(b.some(Y=>{const ae=L.has(Y.id)?Y.x:Y.x+S,ee=L.has(Y.id)?Y.width+S:Y.width;return k.some(de=>ae<de.x+de.width+Mi&&ae+ee+Mi>de.x&&Y.y<de.y+de.height&&Y.y+Y.height>de.y)}))return null;const j=o.filter(Y=>Y.type==="label").map(Y=>({label:Y,x:Y.x,y:Y.y})),B=b.filter(Y=>!L.has(Y.id)),W=b.filter(Y=>L.has(Y.id)).map(Y=>({pool:Y,was:{x:Y.x,y:Y.y,width:Y.width,height:Y.height}}));B.length&&n.moveElements(B,{x:S,y:0});for(const{pool:Y,was:ae}of W)n.resizeShape(Y,{...ae,width:ae.width+S});return()=>{for(const{pool:Y,was:ae}of W)n.resizeShape(Y,ae);B.length&&n.moveElements(B,{x:-S,y:0});for(let Y=0;Y<3;Y++){let ae=0;for(const ee of j){const de=ee.x-ee.label.x,pe=ee.y-ee.label.y;Math.abs(de)<=.5&&Math.abs(pe)<=.5||(n.moveElements([ee.label],{x:de,y:pe}),ae++)}if(!ae)break}}},rE=(b,S,A)=>{const k=A.x+A.width/2,I=S.y>A.y,L=I?A.y+A.height:A.y,H=I?S.y:S.y+S.height,j=b.source===S?[{x:k,y:H},{x:k,y:L}]:[{x:k,y:L},{x:k,y:H}],B=Ze(o),W={...B.edges.find(Y=>Y.id===b.id),waypoints:j};return xn(W,ci(B)).length?!1:(n.updateWaypoints(b,j),!0)},$N=()=>{const b=o.filter(I=>I.type==="bpmn:Participant"),S=Math.min(...b.filter(I=>(I.children??[]).length>0).map(I=>I.x)),A=I=>!!I&&I.type==="bpmn:Participant"&&!(I.children??[]).length&&Math.abs(I.x-S)<=2&&!h.some(L=>L.participant.id===I.id),k=new Set;for(const I of o.getAll()){if(I.type!=="bpmn:MessageFlow")continue;const L=I;if((L.waypoints??[]).length!==2)continue;const H=[L.source,L.target].find(B=>A(B)),j=H===L.source?L.target:L.source;H&&j&&j.type!=="bpmn:Participant"&&k.add(L.id)}return k},FN=b=>{var A;const S=new Map;for(const k of b){const I=o.get(k);if(!I||(I.waypoints??[]).length===2)continue;const L=((A=I.source)==null?void 0:A.type)==="bpmn:Participant"?I.source:I.target,H=L===I.source?I.target:I.source;if(H.x+H.width/2<=L.x+L.width)continue;const j=S.get(L.id)??{pool:L,msgs:[]};j.msgs.push({conn:I,other:H}),S.set(L.id,j)}for(const{pool:k,msgs:I}of S.values()){const L=Math.max(...I.map(({other:pe})=>pe.x+pe.width/2))+Lp;if(o.getAll().some(pe=>{if(pe.type!=="bpmn:Participant"||pe.id===k.id)return!1;const me=pe;return k.x<me.x+me.width+Mi&&L+Mi>me.x&&k.y<me.y+me.height&&k.y+k.height>me.y}))continue;const j={x:k.x,y:k.y,width:k.width,height:k.height},B=[...k.incoming??[],...k.outgoing??[]],W=B.map(pe=>({c:pe,wps:(pe.waypoints??[]).map(me=>({x:me.x,y:me.y}))})),Y=B.flatMap(pe=>{const me=pe.label;return me?[{label:me,x:me.x,y:me.y}]:[]}),ae=Qr();n.resizeShape(k,{...j,width:L-k.x});const ee=I.filter(({conn:pe,other:me})=>rE(pe,k,me)).length,de=Qr();if(!(ee>0&&de.messages>ae.messages&&de.lines>=ae.lines)){n.resizeShape(k,j);for(const{c:pe,wps:me}of W){const Ye=pe.waypoints??[];Ye.length===me.length&&Ye.every((Q,ie)=>Math.abs(Q.x-me[ie].x)<=.5&&Math.abs(Q.y-me[ie].y)<=.5)||n.updateWaypoints(pe,me.map(Q=>({x:Q.x,y:Q.y})))}for(let pe=0;pe<3;pe++){let me=0;for(const Ye of Y){const Ce=Ye.x-Ye.label.x,Q=Ye.y-Ye.label.y;Math.abs(Ce)<=.5&&Math.abs(Q)<=.5||(n.moveElements([Ye.label],{x:Ce,y:Q}),me++)}if(!me)break}}}},oE=()=>{let b=0;for(const S of o.getAll()){if(S.type!=="bpmn:DataInputAssociation"&&S.type!=="bpmn:DataOutputAssociation")continue;const A=S.waypoints??[];for(let k=1;k<A.length;k++)b+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return b},aE=()=>{let b=0;for(const S of o.getAll()){if(S.type!=="bpmn:Association")continue;const A=S.waypoints??[];for(let k=1;k<A.length;k++)b+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return b},jN=b=>{const S=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const k=A;if(b.has(k.id))continue;const L=[...k.incoming??[],...k.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===k?B.target:B.source);if(!L.length||L.some(B=>B===void 0))continue;const H=B=>{if(!("waypoints"in B&&B.waypoints))return[B.id];const W=B,Y=[W.source,W.target];return Y.some(ae=>!ae)?[]:Y.map(ae=>ae.id)},j=L.flatMap(B=>H(B));j.length&&j.every(B=>b.has(B))&&S.push(k)}return S},sE=()=>dt(Ze(o)).filter(b=>b.kind==="edge-crosses-shape").length,cE=b=>{const S=(b.children??[]).filter(vr);let A=0;for(let k=0;k<S.length;k++)for(let I=k+1;I<S.length;I++){const L=S[k],H=S[I];L.x<H.x+H.width&&L.x+L.width>H.x&&L.y<H.y+H.height&&L.y+L.height>H.y&&A++}return A},Qr=()=>{const b=Ze(o),S=A=>A.length>=2&&(A.every(k=>Math.abs(k.x-A[0].x)<.01)||A.every(k=>Math.abs(k.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>S(A.waypoints)).length}},lE=b=>{const S=new Map;for(const k of o.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const I=k;if(!I.waypoints||I.waypoints.length!==2)continue;const L=I.source,H=I.target;if(!L||!H)continue;const j=b.has(L.id);if(j===b.has(H.id))continue;const B=j?H:L,W=d(B);if(!W||b.has(B.id))continue;const Y=S.get(W.id);Y?B.x<Y.minX&&(Y.minX=B.x):S.set(W.id,{pool:W,minX:B.x})}const A=[];for(const{pool:k,minX:I}of S.values()){const L=(k.children??[]).filter(H=>vr(H)&&!b.has(H.id)&&H.x>=I);L.length&&A.push({subtree:L,pool:k})}return A},HN=(b,S,A)=>{const k=new Map(S.map(H=>[H.pool.id,{subtree:[...H.subtree],pool:H.pool}])),I=new Set(b);for(const H of S)for(const j of H.subtree)I.add(j.id);let L=!1;for(;;){let H=0;for(const j of lE(I)){if(j.pool===A)continue;const B=k.get(j.pool.id);B?B.subtree.push(...j.subtree):k.set(j.pool.id,{subtree:[...j.subtree],pool:j.pool});for(const W of j.subtree)I.add(W.id);H+=j.subtree.length}if(!H)break;L=!0}return L?[...k.values()]:null},uE=new Map;for(const b of Kt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const S=T.get(b.target);if(!S)continue;const A=p(b.target),k=p(b.id);if(!A||!k)continue;const I=b.source!==void 0?p(b.source):k.source,L=k.target;if(!I||!L||L.id===A.id)continue;const H=k.waypoints&&k.waypoints.length>=3&&Math.abs(k.waypoints[0].x-k.waypoints[1].x)<1&&Math.abs(k.waypoints[0].y-k.waypoints[1].y)>1?{x:k.waypoints[0].x,y:k.waypoints[0].y}:void 0,j=H?k.waypoints[1].y:void 0,B=H&&k.label?{x:k.label.x,y:k.label.y}:void 0,W=B&&k.label&&Math.abs(B.y+k.label.height/2-j)<=D/5&&B.x+k.label.width>H.x?B.x+k.label.width+6:void 0,Y=(I.outgoing??[]).filter(Pe=>Pe.type==="bpmn:SequenceFlow"&&Pe.id!==k.id&&Pe.target&&!Nu.has(Pe.id)),ae=new Set(Y.map(Pe=>Pe.target.id)),ee=Pe=>{const ke={type:"bpmn:Task",x:Pe.x+2,y:Pe.y+2,width:Pe.width-4,height:Pe.height-4};return Y.find(Xe=>(Xe.waypoints??[]).some((bn,_t)=>!!Xe.waypoints[_t+1]&&yc(bn,Xe.waypoints[_t+1],ke)===0))},de=Po(b.target),pe=new Set(de.map(Pe=>Pe.id)),me=wn.has(b.target)?{autoResize:!1}:void 0,Ye=Math.min(...de.map(Pe=>Pe.x)),Ce=Math.max(...de.map(Pe=>Pe.x+Pe.width)),Q=I.x+I.width,ie=A.y+A.height/2,se=BN(de,Q+Tn-Ye,[0,I.y+I.height/2-ie,L.y+L.height/2-ie],L.x,Q,I.y+I.height/2),ve=Q+Tn+se,et=(()=>{if(W===void 0)return 0;const Pe=Q+Tn,ke=I.y+I.height/2-A.height/2,Xe={x:Pe,y:ke,width:Ce-Ye,height:A.height},bn=d(I);return((bn==null?void 0:bn.children)??[]).some(mt=>vr(mt)&&!pe.has(mt.id)&&mt.id!==I.id&&mt.id!==L.id&&mt.type!=="bpmn:Group"&&mt.type!=="bpmn:Participant"&&mt.x<Xe.x+Xe.width&&mt.x+mt.width>Xe.x&&mt.y<Xe.y+Xe.height&&mt.y+mt.height>Xe.y)||ee(Xe)?Math.max(0,W-Pe):0})(),Ve=Ce-Ye+Tn*2+se+et-(L.x-Q);let gt=[];if(Ve>0){const Pe=d(A),ke=(Pe==null?void 0:Pe.children)??[],Xe=Ne=>Ne.type==="bpmn:Lane";gt=(()=>{const Ne=new Set;for(const $e of ke)vr($e)&&!pe.has($e.id)&&$e.id!==I.id&&$e.x>=L.x&&Ne.add($e.id);const At=[];for(const $e of ke){if($e.type!=="bpmn:DataStoreReference"&&$e.type!=="bpmn:DataObjectReference")continue;const vt=$e,Un=[...vt.incoming??[],...vt.outgoing??[]].filter(Qt=>Qt.type==="bpmn:DataInputAssociation"||Qt.type==="bpmn:DataOutputAssociation").map(Qt=>Qt.source===vt?Qt.target:Qt.source);Un.length&&Un.every(Qt=>Qt!==void 0&&Ne.has(Qt.id))&&At.push(vt)}return At})();const _t=ke.filter(Ne=>!("waypoints"in Ne&&Ne.waypoints)&&!Xe(Ne)&&Ne.type!=="label"&&!pe.has(Ne.id)&&Ne.id!==I.id&&Ne.x>=L.x),mt=_t.flatMap(Ne=>Ne.labels??[]),It=Pe?[Pe,...ke.filter(Ne=>Xe(Ne))]:[];if(_t.length){const Ne=new Set(_t.map(bt=>bt.id)),At=lE(Ne),$e=At.length?HN(Ne,At,Pe):null,vt=bt=>{const kt=new Set(Ne);for(const jt of bt)for(const Ii of jt.subtree)kt.add(Ii.id);return jN(kt)},zn=vt(At),Un=$e?vt($e):zn,Qt=Nh(Ne),Gu=new Set(Ne);for(const bt of At)for(const kt of bt.subtree)Gu.add(kt.id);const Vu=At.length?Nh(Gu):Qt,Wu=(()=>{if(!$e)return[];const bt=new Set(Ne);for(const kt of $e)for(const jt of kt.subtree)bt.add(jt.id);return Nh(bt)})(),Ks=new Set([..._t,...It].map(bt=>bt.id)),Wh=ke.filter(bt=>{const kt=bt.labelTarget;return bt.type==="label"&&!!kt&&"waypoints"in kt&&!!kt.source&&!!kt.target&&Ks.has(kt.source.id)&&Ks.has(kt.target.id)}),Uh=$N();n.createSpace([..._t,...mt,...Wh],It,{x:Ve,y:0},"e",L.x-1);const Li=(bt,kt)=>{const jt=Qr(),Ii=Us(bt,Ve);if(!Ii)return!1;const Bt=kt.length?iE(kt,Ve):null,Ai=Qr();return Ai.messages>jt.messages&&Ai.lines>=jt.lines?!0:(Bt==null||Bt(),Ii(),!1)},ft=$e?Li($e,Wu):!1;let sn=ft;!sn&&At.length&&(sn=Li(At,Vu));const Ft=ft?Un:zn;if(!sn){for(const bt of At){const kt=Qr(),jt=Us([bt],Ve);if(!jt)continue;const Ii=Qr();(Ii.messages<=kt.messages||Ii.lines<kt.lines)&&jt()}if(Qt.length){const bt=Qr(),kt=iE(Qt,Ve);if(kt){const jt=Qr();(jt.messages<=bt.messages||jt.lines<bt.lines)&&kt()}}}if(FN(Uh),Ft.length){const bt=()=>new Set(dt(Ze(o)).map(jt=>lt(jt))),kt=jt=>{const Ii=aE(),Bt=bt(),Ai=jt.map(Jt=>({a:Jt,x:Jt.x,y:Jt.y})),Do=o.filter(Jt=>Jt.type==="label").map(Jt=>({label:Jt,x:Jt.x,y:Jt.y}));n.moveElements(jt,{x:Ve,y:0});const u$=[...bt()].filter(Jt=>!Bt.has(Jt));if(aE()<Ii&&u$.length===0)return!0;for(const{a:Jt,x:Xs,y:Zs}of Ai)(Jt.x!==Xs||Jt.y!==Zs)&&n.moveElements([Jt],{x:Xs-Jt.x,y:Zs-Jt.y});for(const Jt of Do){const Xs=Jt.x-Jt.label.x,Zs=Jt.y-Jt.label.y;(Xs!==0||Zs!==0)&&n.moveElements([Jt.label],{x:Xs,y:Zs})}return!1};if(!kt(Ft)&&Ft.length>1)for(const jt of Ft)kt([jt])}}}const Tt=S.node.lane!==void 0?p(S.node.lane):S.node.participant!==void 0?p(S.node.participant):void 0,xe=Pe=>{if(!Tt)return!0;const ke=Pe.y+Pe.height/2;return ke>=Tt.y&&ke<=Tt.y+Tt.height},be=!xe(I)&&xe(L)?L:I,re=be.y+be.height/2,ye=re-(A.y+A.height/2),Ie=S.band!==void 0,Be=Ie?[A]:de,we=(S.band===void 0||w(S.node.lane,S.node.participant,S.band,re))&&xt(b.target)&&Be.every(Pe=>{var ke;return Ct((ke=T.get(Pe.id))==null?void 0:ke.node.lane,Pe,Pe.y+Pe.height/2+ye)}),ot=Pe=>Math.abs(Pe.y+Pe.height/2-(A.y+A.height/2))<=D/2;if(we&&Ie){const Pe=Math.abs(ye)<=D/2?de.filter(ke=>ke.id!==A.id&&ot(ke)):[];if(n.moveElements(de,{x:ve-Ye,y:0},void 0,me),n.moveElements([A],{x:0,y:ye},void 0,me),Pe.length){const ke=()=>new Set(dt(Ze(o)).map(Ne=>lt(Ne))),Xe=ke(),bn=o.filter(Ne=>Ne.type==="label").map(Ne=>({label:Ne,x:Ne.x,y:Ne.y}));n.moveElements(Pe,{x:0,y:ye});const _t=ke(),mt=[..._t].filter(Ne=>!Xe.has(Ne)).length,It=[...Xe].filter(Ne=>!_t.has(Ne)).length;if(mt>It){n.moveElements(Pe,{x:0,y:-ye});for(const Ne of bn){const At=Ne.x-Ne.label.x,$e=Ne.y-Ne.label.y;(At!==0||$e!==0)&&n.moveElements([Ne.label],{x:At,y:$e})}}}}else n.moveElements(de,{x:ve-Ye,y:we?ye:0},void 0,me);const Ke=d(A);if(!we&&S.node.lane===void 0&&S.band!==void 0&&Ke){const Pe=Ke.y+J+R(`pool:${S.node.participant??""}`,S.band)*D,ke=Pe-(A.y+A.height/2);ke!==0&&!rt(Ke,A,A.x+A.width/2,Pe,pe)&&n.moveElements([A],{x:0,y:ke},void 0,me)}if(Ke){const Pe=(Ke.children??[]).filter(_t=>vr(_t)&&!pe.has(_t.id)&&_t.type!=="bpmn:Group"&&_t.type!=="bpmn:Participant"),ke=(_t,mt,It,Ne,At)=>_t.x+mt<At.x+At.width+Ne&&_t.x+mt+_t.width+Ne>At.x&&_t.y+It<At.y+At.height+Ne&&_t.y+It+_t.height+Ne>At.y,Xe=Pe.find(_t=>ke(A,0,0,0,_t)),bn=Xe?void 0:ee(A);if(Xe||bn){const _t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],mt=o.getAll().filter(ft=>{if(!_t.includes(ft.type))return!1;const sn=ft;return Nu.has(sn.id)||!sn.waypoints||sn.waypoints.length<2?!1:![sn.source,sn.target].some(Ft=>!Ft||pe.has(Ft.id))}),It=(ft,sn,Ft)=>{var bt;return Ct((bt=T.get(ft.id))==null?void 0:bt.node.lane,ft,ft.y+Ft+ft.height/2)&&ft.x+sn>=Ke.x&&ft.x+sn+ft.width<=Ke.x+Ke.width&&ft.y+Ft>=Ke.y&&ft.y+Ft+ft.height<=Ke.y+Ke.height},Ne=(ft,sn)=>de.every(Ft=>It(Ft,ft,sn)&&!Pe.some(bt=>ke(Ft,ft,sn,Ao,bt))&&mt.every(bt=>{const kt={id:Ft.id,type:Ft.type,x:Ft.x+ft,y:Ft.y+sn,width:Ft.width,height:Ft.height};for(let jt=0;jt+1<bt.waypoints.length;jt++)if(yc(bt.waypoints[jt],bt.waypoints[jt+1],kt)<Ao)return!1;return!0})),At=A.y+A.height/2,$e=[j,L.y+L.height/2].filter(ft=>ft!==void 0&&Math.abs(ft-At)>=1),vt=Xe&&ae.has(Xe.id)?Xe:bn==null?void 0:bn.target,zn=vt?vt.x-A.x:0,Un=Math.max(...de.map(ft=>ft.x+ft.width)),Qt=[...zn!==0?[zn]:[],...se!==0?[-se]:[],0],Gu=W===void 0?[]:Qt.map(ft=>Math.max(ft,W-A.x)),Vu=ft=>Un+ft+Tn<=L.x,Wu=[...new Set([...Gu,...Qt])].filter(Vu),Ks=Xe&&ae.has(Xe.id)?[Xe.x+Xe.width+Tn-A.x]:[],Wh=W===void 0?[]:Ks.map(ft=>Math.max(ft,W-A.x)),Uh=[...new Set([...Wh,...Ks])].filter(ft=>Vu(ft)&&!Wu.includes(ft));let Li;for(const ft of[Wu,Uh]){for(const sn of $e){for(const Ft of ft)if(Ne(Ft,sn-At)){Li={dx:Ft,dy:sn-At};break}if(Li)break}if(Li)break}if(Li){const ft=Bt=>{const Ai=Bt;return[Ai.edge,Ai.other,...Array.isArray(Ai.edges)?Ai.edges:[]].some(Do=>typeof Do=="string"&&Nu.has(Do))},sn=()=>new Set(dt(Ze(o)).filter(Bt=>!ft(Bt)).map(Bt=>lt(Bt))),Ft=sn(),bt=o.filter(Bt=>Bt.type==="label").map(Bt=>({label:Bt,x:Bt.x,y:Bt.y}));n.moveElements(de,{x:Li.dx,y:Li.dy},void 0,me);const kt=sn(),jt=[...kt].filter(Bt=>!Ft.has(Bt)).length,Ii=[...Ft].filter(Bt=>!kt.has(Bt)).length;if(jt>Ii){n.moveElements(de,{x:-Li.dx,y:-Li.dy},void 0,me);for(const Bt of bt){const Ai=Bt.x-Bt.label.x,Do=Bt.y-Bt.label.y;(Ai!==0||Do!==0)&&n.moveElements([Bt.label],{x:Ai,y:Do})}}else H&&uE.set(k.id,{exit:H,channelY:j,label:B})}}}{const Pe=new Set(de.map(mt=>mt.id)),ke=new Set(C.map(mt=>mt.flow.id)),Xe=20,bn=mt=>{const It=mt.source,Ne=mt.target,At=Math.min(It.x,Ne.x)-Xe,$e=Math.max(It.x+It.width,Ne.x+Ne.width)+Xe,vt=Math.min(It.y,Ne.y)-Xe,zn=Math.max(It.y+It.height,Ne.y+Ne.height)+Xe;return mt.waypoints.some(Un=>Un.x<At||Un.x>$e||Un.y<vt||Un.y>zn)},_t=new Map;for(const mt of de)for(const It of[...mt.incoming??[],...mt.outgoing??[]])It.id!==b.id&&ke.has(It.id)&&!(Pe.has(It.source.id)&&Pe.has(It.target.id))&&_t.set(It.id,It);for(const mt of _t.values())bn(mt)&&pt(mt)}const Mt=gt.length?d(gt[0]):void 0;if(Mt){const Pe={assoc:oE(),overlaps:cE(Mt),crosses:sE()},ke=gt.map($e=>({st:$e,x:$e.x})),Xe=o.filter($e=>$e.type==="label").map($e=>({label:$e,x:$e.x,y:$e.y})),bn=Math.min(...gt.flatMap($e=>[...$e.incoming??[],...$e.outgoing??[]].filter(vt=>vt.type==="bpmn:DataInputAssociation"||vt.type==="bpmn:DataOutputAssociation").map(vt=>(vt.source===$e?vt.target:vt.source).x))),_t=new Set(gt.map($e=>$e.id)),mt=(Mt.children??[]).filter(vr).filter($e=>!_t.has($e.id));let It=bn;for(const $e of[...gt].sort((vt,zn)=>vt.x-zn.x)){let vt=It;for(let zn=0;zn<100;zn++){const Un=mt.find(Qt=>vt<Qt.x+Qt.width+Mi&&vt+$e.width+Mi>Qt.x&&$e.y<Qt.y+Qt.height&&$e.y+$e.height>Qt.y);if(!Un)break;vt=Un.x+Un.width+Mi}vt!==$e.x&&n.moveElements([$e],{x:vt-$e.x,y:0}),It=vt+$e.width+Mi}const Ne=It+150-(Mt.x+Mt.width);Ne>0&&$u(Mt,Mt.width+Ne);const At={assoc:oE(),overlaps:cE(Mt),crosses:sE()};if(At.assoc>=Pe.assoc||At.overlaps>Pe.overlaps||At.crosses>Pe.crosses){for(const{st:$e,x:vt}of ke)$e.x!==vt&&n.moveElements([$e],{x:vt-$e.x,y:0});Ne>0&&$u(Mt,Mt.width-Ne);for(const $e of Xe){const vt=$e.x-$e.label.x,zn=$e.y-$e.label.y;(vt!==0||zn!==0)&&n.moveElements([$e.label],{x:vt,y:zn})}}}}for(const[b,S]of wn){const A=p(b);if(!A)continue;const k=S.container,I=Math.abs(A.y+A.height/2-k.y-S.relCy)>=.5,L=A.label,H=Math.min(A.y,L&&!L.hidden?L.y:A.y),j=Math.max(A.y+A.height,L&&!L.hidden?L.y+L.height:0);if(I&&H>=k.y&&j<=k.y+k.height)continue;const B=A.y;S.grow(),A.y!==B&&n.moveElements([A],{x:0,y:B-A.y},void 0,{autoResize:!1})}const pE=(b,S)=>{const A=S.target===b,k=f(S.source),I=f(S.target),L=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,I,S.id?{type:L,businessObject:i.create(L,{id:S.id})}:{type:L})},fE=b=>{for(const S of h){if(!S.participant.blackBox)continue;const A=p(S.participant.id);if(!A)continue;const k=[];for(const L of x){const H=L.flow.source===S.participant.id?L.flow.target:L.flow.target===S.participant.id?L.flow.source:void 0,j=H?p(H):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&k.push(j)}if(!k.length)continue;if(!b&&S.order===void 0){const L=(()=>{var j;const H=new Map;for(const B of k){const W=d(B);if(!W)continue;const Y=H.get(W.id);Y?Y.n+=1:H.set(W.id,{shape:W,n:1})}return(j=[...H.values()].sort((B,W)=>W.n-B.n)[0])==null?void 0:j.shape})();if(L){const H=W=>W.reduce((Y,ae)=>Y+ae,0)/W.length,j=H(k.map(W=>W.y+W.height/2))<L.y+L.height/2,B=o.filter(W=>W.type==="bpmn:Participant"&&W.id!==S.participant.id&&W.id!==L.id).filter(W=>j?W.y+W.height<=L.y+5:W.y>=L.y+L.height-5);if(B.length){const W=[...B.reduce((se,ve)=>se.set(ve.y,(se.get(ve.y)??0)+1),new Map)].sort((se,ve)=>ve[1]-se[1]||(j?ve[0]-se[0]:se[0]-ve[0]))[0][0],Y=Math.min(A.width,UR),ae=qR,ee=k.map(se=>se.x+se.width/2),de=Math.round(H(ee)-Y/2),pe=Math.max(...ee)+Lp,me=se=>({x:se,width:Math.max(Y,pe-se)}),Ye=B.filter(se=>Math.min(se.y+se.height,W+ae)-Math.max(se.y,W)>0),Ce=se=>{const ve=me(se);return Ye.some(et=>et.x<ve.x+ve.width&&ve.x<et.x+et.width)},Q=se=>{const ve=me(se);return ee.filter(et=>et>=ve.x+10&&et<=ve.x+ve.width-10).length},ie=(()=>{if(!Ce(de))return de;const se=Q(de);return Ye.flatMap(ve=>[ve.x+ve.width+Cg,ve.x-Cg-Y]).map(ve=>Math.round(ve)).filter(ve=>!Ce(ve)&&Q(ve)>=se).sort((ve,et)=>Math.abs(ve-de)-Math.abs(et-de))[0]??de})();if(ie!==A.x||W!==A.y||Y!==A.width||ae!==A.height){const se=()=>new Set(dt(Ze(o)).map(xe=>lt(xe))),ve=se(),et={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:ie,y:W,width:Y,height:ae});const Ve=se(),gt=[...Ve].filter(xe=>!ve.has(xe)).length,Tt=[...ve].filter(xe=>!Ve.has(xe)).length;gt>Tt&&n.resizeShape(A,et)}}}}const I=Math.max(...k.map(L=>L.x+L.width/2))+Lp;if(I>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:I-A.x,height:A.height}),!!b)for(const L of x){const H=p(L.flow.id),j=L.flow.source===S.participant.id?L.flow.target:L.flow.target===S.participant.id?L.flow.source:void 0,B=j?p(j):void 0;if(!H||!B||B.type==="bpmn:Participant")continue;const W=B.x+B.width/2;W<A.x+10||W>A.x+A.width-10||rE(H,A,B)}}};fE(!1);for(const b of x){const S=b.flow;n.connect(f(S.source),f(S.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:S.id,name:S.name})})}{const A=new Set([...C.map(B=>B.flow.id),...x.map(B=>B.flow.id)].filter(B=>!!B)),k=o.filter(B=>!!B.waypoints),I=(B,W)=>Math.abs(W.x-B.x)<2?"L":Math.abs(W.x-(B.x+B.width))<2?"R":Math.abs(W.y-B.y)<2?"T":Math.abs(W.y-(B.y+B.height))<2?"B":void 0,L=new Map,H=(B,W,Y)=>{if(!B||!W||typeof B.x!="number")return;const ae=I(B,W);if(!ae)return;let ee=L.get(B.id);ee||L.set(B.id,ee=new Map),ee.set(ae,[...ee.get(ae)??[],Y])};for(const B of k){const W=B.waypoints;!W||W.length<2||(H(B.source,W[0],{id:B.id,dir:"out"}),H(B.target,W[W.length-1],{id:B.id,dir:"in"}))}const j=new Set;for(const[B,W]of L){const Y=p(B);if(!Y||typeof Y.x!="number"||![...W.values()].some(Ce=>{const Q=Ce.filter(ie=>ie.dir==="in");return Ce.length>=3&&Q.length>=1&&Ce.some(ie=>ie.dir==="out")&&Q.some(ie=>A.has(ie.id))}))continue;const ee=d(Y);if(!ee||j.has(ee.id)||(ee.children??[]).some(Ce=>Ce.type==="bpmn:Lane"))continue;const de=(TE=W.get("T"))!=null&&TE.length?(kE=W.get("B"))!=null&&kE.length?void 0:"B":"T";if(!de||(de==="T"?Y.y-ee.y:ee.y+ee.height-(Y.y+Y.height))>=D)continue;const me=(ee.children??[]).filter(Ce=>!("waypoints"in Ce&&Ce.waypoints)&&Ce.type!=="label"&&typeof Ce.x=="number"),Ye=ee.y+ee.height;n.resizeShape(ee,{x:ee.x,y:ee.y,width:ee.width,height:ee.height+D}),te(Ye,ee.id,D),de==="T"&&me.length&&n.moveElements(me,{x:0,y:D}),j.add(ee.id)}}const $h=20,dE=4,zN=3,GN=2,VN=[10,30,80],Jr=()=>{const b=Ze(o);return{bad:dt(b).filter(S=>S.kind==="edge-crosses-shape"||S.kind==="edge-overlap-opposite"||S.kind==="edge-overlap-mixed").length,crossings:Nm(b),straight:b.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length}},Da=b=>{const S=Ze(o),A=S.edges.find(k=>k.id===b);return A?xn(A,ci(S)).length:0},Fu=b=>Da(b)>0,ju=b=>Ze(o).edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.id!==b&&S.waypoints.length===2).length,WN=(b,S,A)=>Us([{subtree:b,pool:S}],A),hE=(b,S)=>S.bad>b.bad||S.crossings>b.crossings&&S.straight<=b.straight&&S.bad>=b.bad,La=(b,S)=>hE(b,S)||S.straight<b.straight,To=(b,S,A=()=>!0,k=hE,I=!1)=>{const L=Jr(),H=Us(b,S,I);if(!H)return!1;const j=Jr();return k(L,j)||!A()?(H(),!1):!0},UN=(b,S,A,k=()=>!0)=>To([{subtree:b,pool:S}],A,k),ko=b=>{var S;return!!((S=T.get(b))!=null&&S.node.participant)},qs=new Map;for(const b of x){if(!ko(b.flow.target))continue;const S=qs.get(b.flow.target)??[];S.push(b),qs.set(b.flow.target,S)}const Hu=[...qs.keys()],Fh=new Set(C.map(b=>b.flow.target)),mE=b=>Yt.findIndex(({op:S})=>S.participant.id===b);Hu.sort((b,S)=>{var I,L;const A=Fh.has(b)?1:0,k=Fh.has(S)?1:0;return A!==k?A-k:mE((I=T.get(b))==null?void 0:I.node.participant)-mE((L=T.get(S))==null?void 0:L.node.participant)});const eo=b=>b.x+b.width/2,qN=b=>{const S=new Map;for(const I of o.getAll()){const L=I;if(!L.waypoints||!L.source||!L.target)continue;(S.get(L.source.id)??S.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const A=new Set([b]),k=[b];for(let I=0;I<k.length;I++)for(const L of S.get(k[I])??[])A.has(L)||(A.add(L),k.push(L));return A},YN=(b,S)=>{const A=qN(S);let k;for(const I of o.getAll()){const L=I;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==b||A.has(L.source.id))continue;const H=L.source;if(typeof H.x!="number"||H.type==="bpmn:Participant")continue;const j=eo(H);(k===void 0||j>k)&&(k=j)}return k},jh=(b,S)=>{const A=p(b.flow.source);if(A)return A.type==="bpmn:Participant"?YN(A.id,S):eo(A)},gE=b=>{let S;for(const A of qs.get(b)??[]){const k=jh(A,b);k!==void 0&&(!S||k>S.cx)&&(S={op:A,cx:k})}return S==null?void 0:S.op},KN=b=>{const S=gE(b),A=p(b),k=S?jh(S,b):void 0;return A&&k!==void 0?k-eo(A):void 0},XN=b=>{const S=KN(b);return S!==void 0&&Math.abs(S)<$h},Hh=(b,S,A,k,I)=>{var L;for(let H=!0;H;){H=!1;for(const j of x){if(j.flow.id===A)continue;const B=S.has(j.flow.source),W=S.has(j.flow.target);if(B===W||k(B?j.flow.source:j.flow.target))continue;const Y=B?j.flow.target:j.flow.source;if(I(Y)||!ko(Y))continue;const ae=p(j.flow.id);if(!(ae!=null&&ae.waypoints)||ae.waypoints.length!==2)continue;const ee=p(Y),de=(L=T.get(Y))==null?void 0:L.node.participant;if(!ee||!de)continue;const pe=Po(Y,me=>me.x>=ee.x).filter(me=>!S.has(me.id));if(!(!pe.length||pe.some(me=>I(me.id)))){for(const me of pe)S.add(me.id);b.set(de,[...b.get(de)??[],...pe]),H=!0}}}return[...b].map(([H,j])=>({subtree:j,pool:f(H)}))},yE=(b,S,A,k,I)=>Hh(new Map([[S,[...b]]]),new Set(b.map(L=>L.id)),k,L=>L===A,L=>L===I),zh=b=>{const S=gE(b);if(!S)return null;const A=p(b),k=p(S.flow.source),I=jh(S,b);if(!A||!k||I===void 0)return null;const L=I-eo(A);if(L>=$h){const H=T.get(b).node.participant,j=Po(b,B=>B.x>=A.x);return{groups:yE(j,H,b,S.flow.id,S.flow.source),dx:L}}if(-L>=$h&&ko(S.flow.source)){const H=T.get(S.flow.source).node.participant,j=Po(S.flow.source,B=>B.x>=k.x&&!XN(B.id));return{groups:yE(j,H,S.flow.source,S.flow.id,b),dx:-L}}return null},vE=()=>Hu.map(b=>({id:b,plan:zh(b)})).filter(b=>!!b.plan).sort((b,S)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))-Math.min(...S.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))).map(b=>b.id);for(let b=0;b<3;b++){const S=Jr(),A=[];for(const I of vE()){const L=zh(I);if(!L)continue;const H=Us(L.groups,L.dx);H&&A.push(H)}if(!A.length)break;if(!La(S,Jr()))continue;for(const I of A.reverse())I();let k=!1;for(const I of vE()){const L=zh(I);L&&To(L.groups,L.dx,()=>!0,La)&&(k=!0)}if(!k)break}for(const b of Hu){if(Fh.has(b))continue;const S=T.get(b);if(!S||S.node.lane!==void 0)continue;const A=K(S);if(A===void 0)continue;const k=p(b),I=k?d(k):void 0;if(!k||!I)continue;const L=I.y+J+R(`pool:${S.node.participant??""}`,A)*D,H=L-(k.y+k.height/2);H!==0&&!rt(I,k,k.x+k.width/2,L)&&n.moveElements([k],{x:0,y:H})}const bE=new Set;for(let b=0,S=!0;S&&b<zN;b++){S=!1;for(const A of Hu.flatMap(k=>qs.get(k)??[])){if(bE.has(A.flow.id)||!Fu(A.flow.id))continue;const k=p(A.flow.target);if(!k)continue;const I=f(T.get(A.flow.target).node.participant),L=Po(A.flow.target,W=>W.x>=k.x),H=k.width+F,j=Da(A.flow.id),B=ju(A.flow.id);for(let W=1;W<=dE;W++){const Y=()=>Da(A.flow.id)<j&&ju(A.flow.id)>=B;if(UN(L,I,H*W,Y)){bE.add(A.flow.id),S=!0;break}}}}const Gh=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),xE=new Set(Gh.map(b=>b.id));for(const b of o.filter(S=>S.type==="bpmn:MessageFlow"))xE.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Gh.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Gh){if(!Fu(b.id))continue;const S=p(b.source),A=p(b.target);if(!S||!A)continue;let k,I,L;if(b.preexisting){const[j,B]=S.type==="bpmn:Participant"?[A,S]:[S,A];if(k=eo(j),k<B.x||k>B.x+B.width)continue;[I,L]=j.y<B.y?[j.y+j.height,B.y]:[B.y+B.height,j.y]}else{if(S.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(k=S.x+S.width/2,Math.abs(k-(A.x+A.width/2))>15))continue;[I,L]=S.y<A.y?[S.y+S.height,A.y]:[A.y+A.height,S.y]}const H=[...T.values()].map(j=>p(j.node.id)).filter(j=>!!j&&j.id!==S.id&&j.id!==A.id).filter(j=>j.x<=k&&k<=j.x+j.width&&j.y+j.height>I&&j.y<L).sort((j,B)=>j.x-B.x);for(const j of H){const B=(OE=T.get(j.id))==null?void 0:OE.node.participant,W=B?p(B):void 0;if(!B||!W)continue;const Y=[...T.values()].filter(ie=>ie.node.participant===B).map(ie=>ie.node.id),ae=ie=>ie.map(se=>p(se)).filter(se=>!!se),de=[NN(j.id,ie=>{var se;return((se=T.get(ie.id))==null?void 0:se.node.participant)===B}),ae(Y)].filter(ie=>ie.length).map(ie=>[{subtree:ie,pool:W}]);if(b.preexisting){const ie=ae(Y);ie.length&&de.push(Hh(new Map([[B,[...ie]]]),new Set(ie.map(se=>se.id)),b.id,()=>!1,se=>se===S.id||se===A.id))}const pe=j.width+F,me=Da(b.id),Ye=ju(b.id),Ce=()=>Da(b.id)<me&&ju(b.id)>=Ye;let Q=!1;for(const ie of de){for(let se=1;se<=dE;se++)if(To(ie,pe*se,Ce)){Q=!0;break}if(Q)break}if(!Fu(b.id))break}}const zu=()=>{var S;const b=new Set;for(const A of dt(Ze(o)))A.kind!=="edge-crosses-shape"||xE.has(A.edge)||((S=p(A.edge))==null?void 0:S.type)==="bpmn:MessageFlow"&&b.add(`${A.edge}>${A.shape}`);return b},ZN=(b,S)=>Jr().bad>=b&&[...zu()].some(A=>!S.has(A)),_E=b=>{var S,A;return Da(b)===0&&((A=(S=p(b))==null?void 0:S.waypoints)==null?void 0:A.length)===2},QN=(b,S,A)=>{const k=new Set(b.flatMap(L=>L.subtree.map(H=>H.id))),I=[...zu()].filter(L=>!A.has(L)).map(L=>L.split(">")[1]);return[...new Set(I)].filter(L=>k.has(L)&&L!==S.source&&L!==S.target)},JN=(b,S,A,k,I)=>{const L=b.map(W=>({...W,subtree:W.subtree.filter(Y=>!I.includes(Y.id))})).filter(W=>W.subtree.length),H=new Set(L.flatMap(W=>W.subtree.map(Y=>Y.id))),j=()=>I.every(W=>{const Y=p(W);return!!Y&&C.filter(ae=>ae.flow.target===W&&H.has(ae.flow.source)).every(ae=>{const ee=p(ae.flow.source);return!!ee&&ee.x+ee.width<=Y.x})});return To(L,S,()=>_E(A.id)&&[...zu()].every(W=>k.has(W))&&j(),La,!0)};for(const b of x){if(!Fu(b.flow.id))continue;const S=p(b.flow.id);if(((DE=S==null?void 0:S.waypoints)==null?void 0:DE.length)!==2)continue;const A=p(b.flow.source),k=p(b.flow.target);if(!A||!k||A.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!ko(b.flow.source)||!ko(b.flow.target)||Math.abs(eo(A)-eo(k))>GN)continue;const I=eo(A),L=S.waypoints.map(me=>me.y),[H,j]=[Math.min(...L),Math.max(...L)],B=ci(Ze(o)).filter(me=>me.id!==A.id&&me.id!==k.id&&me.x<I&&I<me.x+me.width&&H<me.y+me.height&&me.y<j);if(!B.length)continue;const W=(LE=T.get(b.flow.source))==null?void 0:LE.node.participant,Y=(IE=T.get(b.flow.target))==null?void 0:IE.node.participant;if(!W||!Y)continue;const ae=new Map;for(const[me,Ye,Ce]of[[b.flow.source,A,W],[b.flow.target,k,Y]]){const Q=ae.get(Ce)??[],ie=Po(me,se=>se.x>=Ye.x).filter(se=>!Q.some(ve=>ve.id===se.id));ae.set(Ce,[...Q,...ie])}const ee=new Set([...ae.values()].flat().map(me=>me.id)),de=Hh(ae,ee,b.flow.id,me=>me===b.flow.source||me===b.flow.target,()=>!1),pe=Math.max(...B.map(me=>me.x+me.width));for(const me of VN){const Ye=pe+me-I;if(Ye<=0)continue;const Ce=Jr().bad,Q=zu();let ie=[],se=!0;const ve=()=>!_E(b.flow.id)||se&&(ie=QN(de,b.flow,Q),ie.length)?!1:!ZN(Ce,Q);if(To(de,Ye,ve,La))break;if(ie.length&&(JN(de,Ye,b.flow,Q,ie)||(se=!1,To(de,Ye,ve,La))))break}}{const b=A=>A.y+A.height/2,S=[];for(const A of T.keys()){if(!ko(A))continue;const k=C.filter(H=>H.flow.target===A);if(k.length!==1)continue;const I=p(k[0].flow.source),L=p(A);!I||!L||!T.has(I.id)||Math.abs(b(I)-b(L))>1||L.x-(I.x+I.width)<=F+1||S.push({id:A,pred:I,node:L})}S.sort((A,k)=>A.node.x-k.node.x);for(const{id:A}of S){const k=T.get(A),I=p(A),L=p(C.find(ee=>ee.flow.target===A).flow.source);if(!I||!L)continue;const H=I.x-(L.x+L.width);if(H<=F+1)continue;const j=f(k.node.participant),B=Po(A,ee=>ee.x>=I.x),W=Jr(),Y=WN(B,j,-(H-F));if(!Y)continue;const ae=Jr();(ae.bad>W.bad||ae.crossings>=W.crossings||ae.straight<W.straight)&&Y()}}fE(!0);const e$=10,t$=400,n$=b=>[...b.incoming??[],...b.outgoing??[]].filter(S=>S.type==="bpmn:DataInputAssociation"||S.type==="bpmn:DataOutputAssociation").map(S=>S.source===b?S.target:S.source).filter(S=>!!S&&typeof S.y=="number"),i$=o.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),r$=(b,S)=>{const A=b.x+b.width/2,k=b.y+b.height/2;let I;for(const L of i$){if((d(L)??u())!==S||L.y<b.y+b.height)continue;const H=Math.abs(L.x+L.width/2-A);H>t$||H<L.width||!n$(L).some(B=>B.height===b.height&&Math.abs(B.y+B.height/2-k)<=e$&&L.y>=B.y+B.height)||(!I||H<I.dx||H===I.dx&&L.id<I.id)&&(I={dx:H,id:L.id,cy:L.y+L.height/2})}return I==null?void 0:I.cy};for(const b of m){const S=b.associations??[],A=S.map(L=>L.source===b.dataStore.id?L.target:L.source).map(p).find(Boolean),k=A?d(A)??u():u(),I=A?{x:A.x+A.width/2,y:r$(A,k)??A.y+A.height+110}:{x:200,y:vn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},I,k);for(const L of S)pE(b.dataStore.id,L)}for(const b of v){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;pE(A,b.association)}let wE=0;const Oo=10,EE=40,o$=(b,S)=>{const A=S.map(B=>d(B)).filter(B=>!!B);for(const B of A){const W=Oo,Y=B.y,ae=B.y+B.height,ee=B.x,de=B.x+B.width;if(Math.abs(b.y-Y)<W){const pe=Y+W-b.y;b.y+=pe,b.height-=pe}if(Math.abs(b.y+b.height-ae)<W&&(b.height=ae-W-b.y),Math.abs(b.x-ee)<W){const pe=ee+W-b.x;b.x+=pe,b.width-=pe}Math.abs(b.x+b.width-de)<W&&(b.width=de-W-b.x)}if(!A.length)return;const k=Math.min(...A.map(B=>B.y)),I=Math.max(...A.map(B=>B.y+B.height)),L=k-b.y,H=b.y+b.height-I,j=EE-Oo;if(L>0!=H>0)if(L>0&&L<j){const B=L+Oo;b.y+=B,b.height-=B}else H>0&&H<j&&(b.height-=H+Oo)},a$=(b,S)=>{const A=Oo,k=30,I=o.filter(L=>L.type==="bpmn:Group"&&L.id!==S);for(const L of I){const H=L.x,j=L.x+L.width,B=L.y,W=L.y+L.height,Y=b.y<W&&B<b.y+b.height,ae=b.x<j&&H<b.x+b.width;if(Y){if(Math.abs(b.x-j)<A){const ee=Math.min(j+A-b.x,k);ee>0&&b.width-ee>0&&(b.x+=ee,b.width-=ee)}if(Math.abs(b.x+b.width-H)<A){const ee=Math.min(b.x+b.width-(H-A),k);ee>0&&b.width-ee>0&&(b.width-=ee)}}if(ae){if(Math.abs(b.y-W)<A){const ee=Math.min(W+A-b.y,k);ee>0&&b.height-ee>0&&(b.y+=ee,b.height-=ee)}if(Math.abs(b.y+b.height-B)<A){const ee=Math.min(b.y+b.height-(B-A),k);ee>0&&b.height-ee>0&&(b.height-=ee)}}}},Vh=(b,S)=>{const A=EE,k=Math.min(...b.map(B=>B.x))-A,I=Math.min(...b.map(B=>B.y))-A,L=Math.max(...b.map(B=>B.x+B.width))+A,H=Math.max(...b.map(B=>B.y+B.height))+A,j={x:k,y:I,width:L-k,height:H-I};return o$(j,b),a$(j,S),j};for(const b of E){const S=(b.group.members??[]).map(p).filter(I=>!!I);let A;S.length?A=Vh(S,b.group.id):(A={x:300+wE*350,y:40,width:300,height:200},wE++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(k,b.group.name),(BE=b.group.members)!=null&&BE.length&&O(k,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(I=>!!I.waypoints),S=new Map,A=(I,L)=>{!I||!L||(S.has(I)||S.set(I,new Set),S.get(I).add(L))};for(const I of b){const L=(NE=I.source)==null?void 0:NE.id,H=($E=I.target)==null?void 0:$E.id;A(L,H),((FE=I.type)!=null&&FE.includes("DataOutputAssociation")||(jE=I.type)!=null&&jE.includes("DataInputAssociation")||I.type==="bpmn:Association")&&A(H,L)}const k=o.filter(I=>I.type==="bpmn:Group");for(const I of k){const H=(((HE=I.businessObject.extensionElements)==null?void 0:HE.values)??[]).find(Ce=>Ce.$type==="bwl:Members"),j=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const B=new Set(j),W=[...j];for(;W.length;){const Ce=W.shift();for(const Q of S.get(Ce)??[])B.has(Q)||(B.add(Q),W.push(Q))}const Y=I.x,ae=I.x+I.width,ee=I.y,de=I.y+I.height,pe=Ce=>C.filter(Q=>Q.flow.target===Ce).length,me=Ce=>{var ie;const Q=((ie=p(Ce))==null?void 0:ie.type)??"";if(Q==="bpmn:StartEvent"&&pe(Ce)===0)return!1;if(Q.endsWith("Gateway")){const se=C.filter(ve=>ve.flow.target===Ce).map(ve=>ve.flow.source);if(se.length&&se.every(ve=>{var et;return((et=p(ve))==null?void 0:et.type)==="bpmn:StartEvent"&&pe(ve)===0}))return!1}return!0},Ye=o.filter(Ce=>vr(Ce)).filter(Ce=>Ce.type!=="bpmn:Group"&&Ce.type!=="bpmn:Participant"&&Ce.type!=="bpmn:TextAnnotation"&&!B.has(Ce.id)&&ko(Ce.id)&&me(Ce.id)&&Ce.x<ae&&Ce.x+Ce.width>Y&&Ce.y<de&&Ce.y+Ce.height>ee);if(Ye.length)for(const Ce of[-1,1]){const Q=Ye.filter(be=>(be.x+be.width-Y<=ae-be.x?-1:1)===Ce);if(!Q.length)continue;const ie=[];for(const be of Q){const re=ie.find(ye=>ye.some(Ie=>be.y<Ie.y+Ie.height&&be.y+be.height>Ie.y));re?re.push(be):ie.push([be])}const se=new Map;for(const be of ie){let re=Ce<0?Y-Oo:ae+Oo;for(const ye of[...be].sort((Ie,Be)=>Ce<0?Be.x-Ie.x:Ie.x-Be.x)){const Ie=Ce<0?Math.min(ye.x,re-ye.width):Math.max(ye.x,re);re=Ce<0?Ie-Mi:Ie+ye.width+Mi,Ie!==ye.x&&Math.sign(Ie-ye.x)===Ce&&se.set(ye.id,Ie-ye.x)}}const ve=new Map,et=be=>ve.get(be)===be||!ve.get(be)?be:et(ve.get(be));for(const be of Q)ve.set(be.id,be.id);for(const be of x){const re=se.has(be.flow.source)?be.flow.source:void 0,ye=se.has(be.flow.target)?be.flow.target:void 0;if(!re||!ye)continue;const Ie=p(be.flow.id);((zE=Ie==null?void 0:Ie.waypoints)==null?void 0:zE.length)===2&&ve.set(et(re),et(ye))}const Ve=new Map;for(const be of Q){if(!se.has(be.id))continue;const re=et(be.id);Ve.set(re,[...Ve.get(re)??[],be])}const gt=[...Ve.values()].sort((be,re)=>Ce<0?Math.min(...be.map(ye=>ye.x))-Math.min(...re.map(ye=>ye.x)):Math.max(...re.map(ye=>ye.x))-Math.max(...be.map(ye=>ye.x))),Tt=[];let xe=!0;for(const be of gt){const re=be.map(Be=>se.get(Be.id)??0).reduce((Be,we)=>Math.abs(we)>Math.abs(Be)?we:Be,0),ye=new Map;let Ie=!0;for(const Be of be){const we=d(Be);if(!we){Ie=!1;break}ye.has(we.id)||ye.set(we.id,{subtree:[],pool:we}),ye.get(we.id).subtree.push(Be)}Ie&&To([...ye.values()],re,()=>!0,La)?Tt.push({shapes:be,dx:re}):xe=!1}if(!xe)for(const be of Tt.reverse())n.moveElements(be.shapes,{x:-be.dx,y:0})}}}{const b=new Set([...E.map(S=>S.group.id),...Kt(e,"group.update").map(S=>S.id)]);for(const S of o.filter(A=>A.type==="bpmn:Group")){if(b.has(S.id))continue;const k=(((GE=S.businessObject.extensionElements)==null?void 0:GE.values)??[]).find(j=>j.$type==="bwl:Members"),I=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(j=>!!j);!I.length||!I.some(j=>{const B=g.get(j.id);return!B||B.x!==j.x||B.y!==j.y})||!I.some(j=>j.x<S.x||j.y<S.y||j.x+j.width>S.x+S.width||j.y+j.height>S.y+S.height)||n.resizeShape(S,Vh(I,S.id))}}{const S=new Map(co(Ze(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),k=new Map,I=(j,B)=>{!j||!B||(k.has(j)||k.set(j,new Set),k.get(j).add(B))};for(const j of A){const B=(VE=j.source)==null?void 0:VE.id,W=(WE=j.target)==null?void 0:WE.id;I(B,W),((UE=j.type)!=null&&UE.includes("DataOutputAssociation")||(qE=j.type)!=null&&qE.includes("DataInputAssociation")||j.type==="bpmn:Association")&&I(W,B)}const L=j=>C.filter(B=>B.flow.target===j).length,H=j=>{var W;const B=((W=p(j))==null?void 0:W.type)??"";if(B==="bpmn:StartEvent"&&L(j)===0)return!1;if(B.endsWith("Gateway")){const Y=C.filter(ae=>ae.flow.target===j).map(ae=>ae.flow.source);if(Y.length&&Y.every(ae=>{var ee;return((ee=p(ae))==null?void 0:ee.type)==="bpmn:StartEvent"&&L(ae)===0}))return!1}return!0};for(const j of o.filter(B=>B.type==="bpmn:Group")){const W=(((YE=j.businessObject.extensionElements)==null?void 0:YE.values)??[]).find(re=>re.$type==="bwl:Members"),Y=((W==null?void 0:W.refs)??"").split(" ").filter(Boolean);if(!Y.length)continue;const ae=Y.map(p).filter(re=>!!re);if(!ae.length||!(E.some(re=>re.group.id===j.id)||Kt(e,"group.update").some(re=>re.id===j.id)||ae.some(re=>{const ye=g.get(re.id);return!ye||ye.x!==re.x||ye.y!==re.y})))continue;const de=new Set(Y),pe=[...Y];for(;pe.length;){const re=pe.shift();for(const ye of k.get(re)??[])de.has(ye)||(de.add(ye),pe.push(ye))}const me=j.x,Ye=j.x+j.width,Ce=j.y,Q=j.y+j.height,ie=re=>{const ye=S.get(re.id),Ie={x:re.x,y:re.y,width:re.width,height:re.height};return ye?[Ie,{x:ye.x,y:ye.y,width:ye.width,height:ye.height}]:[Ie]},se=ae.flatMap(ie),ve=Math.min(...se.map(re=>re.x)),et=Math.max(...se.map(re=>re.x+re.width)),Ve=Math.min(...se.map(re=>re.y)),gt=Math.max(...se.map(re=>re.y+re.height)),Tt={L:ve-me,R:Ye-et,T:Ve-Ce,B:Q-gt},xe=o.filter(re=>vr(re)).filter(re=>re.type!=="bpmn:Group"&&re.type!=="bpmn:Participant"&&re.type!=="bpmn:TextAnnotation"&&!de.has(re.id)&&H(re.id)&&re.x<Ye&&re.x+re.width>me&&re.y<Q&&re.y+re.height>Ce);if(!xe.length)continue;const be={L:0,R:0,T:0,B:0};for(const re of xe){const ye=ie(re),Ie=Math.min(...ye.map(ke=>ke.x)),Be=Math.max(...ye.map(ke=>ke.x+ke.width)),we=Math.min(...ye.map(ke=>ke.y)),ot=Math.max(...ye.map(ke=>ke.y+ke.height)),Ke={L:Be-me,R:Ye-Ie,T:ot-Ce,B:Q-we},Mt=["L","R","T","B"].filter(ke=>Ke[ke]<=Tt[ke]+.001);if(!Mt.length)continue;const Pe=Mt.reduce((ke,Xe)=>Ke[Xe]<Ke[ke]?Xe:ke,Mt[0]);be[Pe]=Math.max(be[Pe],Math.min(Ke[Pe]+10,Tt[Pe]))}!be.L&&!be.R&&!be.T&&!be.B||n.resizeShape(j,{x:j.x+be.L,y:j.y+be.T,width:j.width-be.L-be.R,height:j.height-be.T-be.B})}}const SE=b=>{const S=b.waypoints;if(S!=null&&S.length){const k=S[Math.floor((S.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ys=0;const RE=12,CE=14,s$=15,c$=300,l$=b=>{const S=b.split(`
|
|
7
|
-
`),A=Math.max(...S.map(L=>Vo(L,RE))),k=Math.max(100,Math.min(c$,Math.ceil(A)+CE)),I=S.reduce((L,H)=>L+Math.max(1,Math.ceil((Vo(H,RE)+CE)/k)),0);return{width:k,height:Math.max(30,I*s$+10)}};for(const b of _){const S=b.association,A=((KE=b.placement)==null?void 0:KE.anchor)??(S?S.source===b.annotation.id?S.target:S.source:void 0),k=A?p(A):void 0,I=k?SE(k):void 0,L=l$(b.annotation.text??"");let H;if(I&&b.placement){const[Y,ae]=Cc[b.placement.side],ee=b.placement.offset??50;H={x:I.x+I.width/2+Y*(I.width/2+L.width/2+ee),y:I.y+I.height/2+ae*(I.height/2+L.height/2+ee)}}else I?(H={x:I.x+I.width/2+180+Ys%3*260,y:I.y-110-Ys%2*95},Ys++):(H={x:300+Ys*260,y:60},Ys++);const j=k?d(k)??u():u(),B=j;I&&typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant"&&(H=Ip(o,I,L,B,b.placement?{placement:b.placement}:{from:H}));const W=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},H,j);if(S){const Y=ae=>ae===b.annotation.id?W:f(ae);n.connect(Y(S.source),Y(S.target),S.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:S.id})}:{type:"bpmn:Association"})}b.placement&&O(W,"bwl:Placement",N(b.placement))}for(const b of Kt(e,"association.add")){const S=b.association;n.connect(f(S.source),f(S.target),S.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:S.id})}:{type:"bpmn:Association"})}const ME=()=>new Set(o.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of Kt(e,"node.update")){let S=f(b.id);if(b.type&&Rc(b.type)!==S.type){const A=S.x+S.width/2,k=S.y+S.height/2,I=ME();S=c.replaceElement(S,{type:Rc(b.type),...b.eventDefinition?{eventDefinitionType:ec[b.eventDefinition]}:{}});const L=ME(),H=[...I].filter(W=>W!==b.id&&!L.has(W));if(H.length)throw new Ag({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:H});const j=Math.round(A-(S.x+S.width/2)),B=Math.round(k-(S.y+S.height/2));if(j!==0||B!==0){n.moveShape(S,{x:j,y:B});for(const W of[...S.incoming??[],...S.outgoing??[]])pt(W)}}if(b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(S,{"bwl:band":b.band});const A=S.y+S.height/2,k=d(S),I=b.lane?f(b.lane):((k==null?void 0:k.children)??[]).find(H=>H.type==="bpmn:Lane"&&A>=H.y&&A<=H.y+H.height);b.band!==void 0&&ht(I==null?void 0:I.id,b.band,k);const L=I?I.y+(b.band===void 0?I.height/2:Math.min(I.height/2,ge)+R(I.id,b.band)*D):b.band!==void 0&&k?k.y+J+R(`pool:${k.id}`,b.band)*D:void 0;if(L!==void 0){const H=L-A;H!==0&&n.moveElements([S],{x:0,y:H})}}}for(const b of Kt(e,"sequenceFlow.update")){const S=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=S,k=b.source!==void 0?f(b.source):A.source,I=b.target!==void 0?f(b.target):A.target,L=B=>({x:B.x+B.width/2,y:B.y+B.height/2});n.reconnect(A,k,I,[L(k),L(I)]);const H=uE.get(A.id),j=I.y+I.height/2;if(H&&I.x>H.exit.x&&Math.abs(j-H.exit.y)>1){n.updateWaypoints(A,[H.exit,{x:H.exit.x,y:j},{x:I.x,y:j}]);const B=A.label;if(B&&H.label){const Y=Math.abs(H.label.y+B.height/2-H.channelY)<=D/5&&H.label.x+B.width>H.exit.x,ae=H.exit.x+6,ee=I.x-6-B.width,de=Y?ee>=ae?{x:Math.max(ae,Math.min(H.label.x,ee)),y:H.label.y+(j-H.channelY)}:void 0:H.label;de&&(de.x!==B.x||de.y!==B.y)&&n.moveElements([B],{x:de.x-B.x,y:de.y-B.y})}}else Math.abs(j-(k.y+k.height/2))>1&&pt(A)}b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(S,{name:((XE=b.condition)==null?void 0:XE.label)??void 0})}for(const b of Kt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Kt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Kt(e,"annotation.update")){const S=f(b.id);if(b.text!==void 0&&n.updateProperties(S,{text:b.text}),b.placement===null)O(S,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),k=SE(A),I=d(A)??u(),L=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[H,j]=Cc[b.placement.side],B=b.placement.offset??50,W={x:k.x+k.width/2+H*(k.width/2+S.width/2+B),y:k.y+k.height/2+j*(k.height/2+S.height/2+B)},Y=L?Ip(o,k,{width:S.width,height:S.height},I,{placement:b.placement,selfId:b.id}):W;n.moveElements([S],{x:Y.x-(S.x+S.width/2),y:Y.y-(S.y+S.height/2)}),O(S,"bwl:Placement",N(b.placement))}}for(const b of Kt(e,"group.update")){const S=f(b.id);if(b.name!==void 0&&n.updateLabel(S,b.name??""),b.members){const A=b.members.map(p).filter(k=>!!k);A.length&&n.resizeShape(S,Vh(A,b.id)),O(S,"bwl:Members",{refs:b.members.join(" ")})}}}function Bp(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 KR(e,t,n){var u,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>dt(f).filter(d=>!t.has(lt(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ze(i),c=o(s),l=[...new Set(c.flatMap(Bp))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const ge=d.x+d.width/2,Ae=d.y+d.height/2;h=i.getAll().find(De=>{if(De.type!=="bpmn:Participant")return!1;const qe=De;return typeof qe.x=="number"&&typeof qe.width=="number"&&ge>=qe.x&&ge<=qe.x+qe.width&&Ae>=qe.y&&Ae<=qe.y+qe.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const C=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ge=>ge.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(ge=>ge.type==="bpmn:Association"),m=(C!=null&&C.anchor?i.get(C.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!m)continue;const v=m.waypoints,_=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:m.x,y:m.y,width:m.width,height:m.height},E={width:d.width,height:d.height},T={x:d.x+d.width/2,y:d.y+d.height/2},O=C==null?void 0:C.side,N=[];O&&O in Cc&&N.push(Ip(i,_,E,h,{placement:{side:O,offset:(C==null?void 0:C.offset)??null},selfId:f}));for(const[ge,Ae]of[[-1,0],[1,0],[0,-1],[0,1]])for(let De=1;De<=YR;De++)N.push({x:T.x+ge*Mg*De,y:T.y+Ae*Mg*De});const P={...s,edges:s.edges.filter(ge=>ge.id!==(x==null?void 0:x.id))},D=o(P),F=D.filter(ge=>Bp(ge).includes(f)).length;if(!F)continue;let J;for(const ge of N){const Ae=ge.x-T.x,De=ge.y-T.y;if(!Ae&&!De||ge.x-E.width/2<h.x||ge.x+E.width/2>h.x+h.width||ge.y-E.height/2<h.y||ge.y+E.height/2>h.y+h.height)continue;const qe={...P,shapes:P.shapes.map(ne=>ne.id===f?{...ne,x:ne.x+Ae,y:ne.y+De}:ne)},rt=o(qe),Me=rt.filter(ne=>Bp(ne).includes(f)).length;if(Me>=F||rt.length>D.length)continue;const X=Math.abs(Ae)+Math.abs(De);if((!J||Me<J.mine||Me===J.mine&&(rt.length<J.all||rt.length===J.all&&X<J.dist))&&(J={x:ge.x,y:ge.y,mine:Me,all:rt.length,dist:X}),J.mine===0&&J.all<D.length)break}J&&r.moveElements([d],{x:J.x-T.x,y:J.y-T.y})}}const XR=60;function Np(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function ZR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>dt(u).filter(p=>!t.has(lt(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const C of n.shapes)C.type!=="bpmn:Group"||f.has(C.id)||[...d].some(x=>{const m=s.get(x);return m&&c(C,m)})&&(f.add(C.id),y=!0);for(const C of n.shapes)C.type!=="bpmn:Participant"||d.has(C.id)||[...f].some(x=>{const m=s.get(x);return m&&c(m,C)})&&(d.add(C.id),y=!0);if(!y)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(y=>{const C=s.get(y);return C&&c(C,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Ze(i),f=o(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[_,E]=v.pools,T=g.get(_),O=g.get(E);if(!T||!O)continue;const[N,P]=T.x<=O.x?[T,O]:[O,T];if(v.contained)continue;const D=s.get(N.id),F=s.get(P.id),J=D&&F?Math.max(F.x-(D.x+D.width),0):XR,ge=N.x+N.width+J-P.x;if(ge<=0)continue;const Ae=l(P.id).filter(De=>i.get(De));Ae.length&&(!h||ge>h.dx)&&(h={movers:Ae,dx:ge})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const C=f.length,x=d.length;r.moveElements(y,{x:h.dx,y:0});const m=o(Ze(i));if(!(a(m).length<x&&m.length<=C)){r.moveElements(y,{x:-h.dx,y:0});return}}}const Mc=.5,Tg=150;function QR(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(m=>m.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(m=>m.x+m.width),a=Math.max(...o);if(a-Math.min(...o)>Mc)return;const s=r.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(s.length<2)return;const c=new Map(r.map(m=>[m.id,m.x]));if(s.some(m=>Math.abs(m.x-c.get(m.id))>Mc))return;const l=s.map(m=>m.x+m.width);if(Math.max(...l)-Math.min(...l)<=Mc)return;const u=m=>m.x+m.width,p=m=>!!m&&typeof m.width=="number",f=m=>{const v={shapes:[],edges:[],lanes:[]},_=E=>{for(const T of E.children??[]){if("waypoints"in T&&T.waypoints){v.edges.push(T);continue}T.type!=="label"&&(T.type==="bpmn:Lane"?v.lanes.push(T):v.shapes.push(T),_(T))}};return _(m),v},d=new Map(s.map(m=>[m.id,f(m)]));let g=a;for(const m of s){const{shapes:v}=d.get(m.id),_=v.flatMap(E=>[u(E),...p(E.label)?[u(E.label)]:[]]);_.length&&(g=Math.max(g,Math.max(..._)+Tg))}const h=s.filter(m=>Math.abs(u(m)-g)>Mc);if(!h.length)return;for(const m of h){const v=u(m),{shapes:_,edges:E,lanes:T}=d.get(m.id);if([..._.flatMap(P=>[u(P),...p(P.label)?[u(P.label)]:[]]),...E.flatMap(P=>[...P.waypoints.map(D=>D.x),...p(P.label)?[u(P.label)]:[]])].some(P=>P>g)||[...(m.incoming??[]).map(P=>P.waypoints[P.waypoints.length-1]),...(m.outgoing??[]).map(P=>P.waypoints[0])].some(P=>!P||P.x>g||Math.abs(P.x-v)<1))return;if(g>v){const P={x:v,y:m.y,width:g-v,height:m.height},D=new Set([m.id,..._.map(J=>J.id),...E.map(J=>J.id),...T.map(J=>J.id)]);if(n.getAll().some(J=>{var De;if("waypoints"in J&&J.waypoints||J.type==="bpmn:Group"||!p(J))return!1;const ge=J.type==="label"?(De=J.labelTarget)==null?void 0:De.id:J.id;if(!ge||D.has(ge)||D.has(J.id))return!1;const Ae=J;return Ae.x<P.x+P.width&&Ae.x+Ae.width>P.x&&Ae.y<P.y+P.height&&Ae.y+Ae.height>P.y}))return}}const y=()=>new Set(dt(Ze(n)).map(lt)),C=y(),x=h.map(m=>m.width);for(const m of h)Np(i,m,g-m.x,{layout:!1});[...y()].every(m=>C.has(m))||h.forEach((m,v)=>Np(i,m,x[v],{layout:!1}))}function JR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>dt(l).filter(u=>!t.has(lt(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(E=>E.id!==l.id&&E.type!=="bpmn:Group"&&a(l,E));if(!p.length)continue;const f=p.map(E=>i.get(E.id)).filter(E=>!!E&&typeof E.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),y=g.t+(l.y-d.t),C=g.r+(l.x+l.width-d.r),x=g.b+(l.y+l.height-d.b),m={x:h,y,width:C-h,height:x-y};if(m.width<=0||m.height<=0||Math.abs(m.x-u.x)<1&&Math.abs(m.y-u.y)<1&&Math.abs(m.width-u.width)<1&&Math.abs(m.height-u.height)<1)continue;const v=o(Ze(i)).length,_={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,m),o(Ze(i)).length>v&&r.resizeShape(u,_)}}const Ac=20,Pc=10;function eC(e,t,n,i){var p,f;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(dt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(lt)),s=Ze(r),c=dt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(lt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const x=h.members.map(Te=>r.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!x.length)continue;const m=Math.min(...x.map(Te=>Te.x)),v=Math.min(...x.map(Te=>Te.y)),_=Math.max(...x.map(Te=>Te.x+Te.width)),E=Math.max(...x.map(Te=>Te.y+Te.height)),T=h.x,O=h.y,N=h.x+h.width,P=h.y+h.height;let D=T,F=O,J=N,ge=P;for(const Te of g){const $=s.edges.find(w=>w.id===Te.edge);if(!$)continue;const R=$.endpoints.some(w=>{const G=s.shapes.find(Re=>Re.id===w);if(!G||G.container)return!1;const V=G.x+G.width/2,te=G.y+G.height/2;return T<V&&V<N&&O<te&&te<P});for(const w of gn($)){const G=w.axis==="v"?[O,P]:[T,N];Math.min(w.hi,G[1])-Math.max(w.lo,G[0])<xp||(w.axis==="v"?T<w.at&&w.at<N:O<w.at&&w.at<P)&&R||(w.axis==="v"?(Math.abs(w.at-T)<=Wo&&(D=Math.max(D,w.at+Ac)),Math.abs(w.at-N)<=Wo&&(J=Math.min(J,w.at-Ac))):(Math.abs(w.at-O)<=Wo&&(F=Math.max(F,w.at+Ac)),Math.abs(w.at-P)<=Wo&&(ge=Math.min(ge,w.at-Ac))))}}if(D>m-Pc&&(D=T),F>v-Pc&&(F=O),J<_+Pc&&(J=N),ge<E+Pc&&(ge=P),D===T&&F===O&&J===N&&ge===P)continue;const Ae=r.get(d),De={x:Ae.x,y:Ae.y,width:Ae.width,height:Ae.height},qe=Ze(r),rt=new Set(dt(qe).map(lt)),Me=a(qe);o.resizeShape(Ae,{x:D,y:F,width:J-D,height:ge-F});let X=Ze(r),ne=dt(X).filter(Te=>!rt.has(lt(Te)));const q=[];if(ne.length>0&&ne.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&X.edges.some($=>$.id===Te.edge))){for(const Te of ne){if(Te.kind!=="label-over-line")continue;const $=X.edges.find(te=>te.id===Te.edge),R=$&&Op($,X),w=(f=r.get(Te.edge))==null?void 0:f.label;if(!R||!w)continue;const G=R.x-w.x,V=R.y-w.y;o.moveElements([w],{x:G,y:V}),q.push({label:w,dx:G,dy:V})}X=Ze(r),ne=dt(X).filter(Te=>!rt.has(lt(Te)))}const oe=a(X),fe=[...oe].some(Te=>!Me.has(Te));if(ne.length||fe||oe.size>=Me.size){for(const Te of q.reverse())o.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});o.resizeShape(Ae,De)}}}function tC(e,t,n,i){var c;const r=n.getRootElement().businessObject,o=Ju((r==null?void 0:r.$parent)??r),a=Ba(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:ep(u,i,o),requests:rp(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...o?{rootLang:o}:{},before:s.get(l)}]:[]})}}function kg(e,t,n={}){var N,P;const{i18n:i,lower:r=Pg}=n,o=Rg(e),a=Ym(o.elementRegistry),s=Sg(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=GR(t,a,i),u=i&&l.writes.size?tC(l.writes,o.elementRegistry,o.canvas,i):void 0,p=Ze(o.elementRegistry),f=new Set(dt(p).map(lt)),d=new Set(dt(p,{includeObservationOnly:!0}).map(lt)),g=new Set(p.edges.map(D=>D.id)),h=new Set(t.flatMap(D=>D.kind==="sequenceFlow.update"&&(D.source!==void 0||D.target!==void 0)?[D.id]:[])),y=new Set(p.shapes.map(D=>D.id)),C=vc(p),x=C.length,m=new Set(C.map(([D,F])=>`${D}|${F}`)),v=new Map;for(const D of o.elementRegistry.filter(F=>"waypoints"in F&&!!F.waypoints))D.label&&v.set(D.id,{wps:D.waypoints.map(F=>({x:F.x,y:F.y})),label:{x:D.label.x,y:D.label.y},source:(N=D.source)==null?void 0:N.id,target:(P=D.target)==null?void 0:P.id});const _=e.get("commandStack");try{Jh(_,()=>{r(l.ops,o);for(const F of(u==null?void 0:u.contexts())??[])_.execute(np,F);ZR(o,f,p),QR(o,p),JR(o,f,p),tg(o,g);const D=Ap(o,f);Qm(o,m,g),pg(o,f,g),rg(o,g),OR(o,g,h),sg(o,f,g),BR(o,f,g),yg(o,f,g),gg(o,g,h),bg(o,y),KR(o,f,y),Ap(o,f,D),eC(o,d,p,g),xg(o,f),mg(o,v)})}catch(D){return{ok:!1,issues:[D instanceof Ag?D.issue:{kind:"lower-failed",message:D instanceof Error?D.message:String(D)}],findings:[],stats:c}}const E=Ze(o.elementRegistry),T=dt(E,{includeObservationOnly:!0}).filter(D=>!d.has(lt(D))),O=$m(E);return{ok:!0,issues:[],findings:T,stats:{edgeCrossings:{before:x,after:O.pairs.length,pairs:O.pairs,solidPairs:O.solidPairs,dashedPairs:O.dashedPairs,mixedPairs:O.mixedPairs,crossPoolMessages:O.crossPoolMessages}}}}function nC(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Og(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Dg(e,t){const n=Og(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Lg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function iC(e){return typeof e=="string"&&Yu.includes(e)}function Ti(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Ig(e,t={}){const n=e.rootElements??[],i=n.find(X=>X.$type==="bpmn:Collaboration"),r=new Map(n.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),o=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],y=[],C=[],x=[],m=new Map,v=new Set,_=new Set,E=X=>{X&&v.add(X)},T=X=>{v.add(X),_.add(X)},O=X=>{const ne=Lg(X,"bwl:Placement");if(!ne)return;const q=typeof ne.anchor=="string"?ne.anchor:void 0;if(!q||!iC(ne.side))return;const K=typeof ne.offset=="number"?ne.offset:void 0;y.push({owner:X.id,anchor:q,side:ne.side,...K!==void 0?{offset:K}:{}})},N=X=>{const ne=Lg(X,"bwl:Members"),q=typeof(ne==null?void 0:ne.refs)=="string"?ne.refs.split(/\s+/).filter(Boolean):[];q.length&&x.push({owner:X.id,refs:q})},P=X=>{var ne;for(const q of X)switch(E(q.id),q.$type){case"bpmn:TextAnnotation":T(q.id),m.set(q.id,q),c.push({id:q.id,text:typeof q.text=="string"?q.text:""}),O(q);break;case"bpmn:Association":g.push({id:q.id,type:q.$type,source:Ti(q.sourceRef),target:Ti(q.targetRef)});break;case"bpmn:Group":{T(q.id),m.set(q.id,q);const K=(ne=q.categoryValueRef)==null?void 0:ne.value;l.push({id:q.id,...typeof K=="string"&&K?{name:K}:{}}),N(q);break}default:u.push({id:q.id,type:q.$type,reason:"type-outside-mvp"})}},D=X=>{for(const ne of X.flowElements??[])E(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"}),(ne.flowElements??[]).length&&D(ne);for(const ne of X.artifacts??[])E(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"})},F=(X,ne)=>{const q=X.flowElements??[],K=(X.laneSets??[]).flatMap(fe=>fe.lanes??[]),oe=new Map;for(const fe of K){E(fe.id),m.set(fe.id,fe);for(const Te of fe.flowNodeRef??[]){const $=Ti(Te);$&&oe.set($,fe.id)}}for(const fe of q){if(E(fe.id),m.set(fe.id,fe),fe.$type==="bpmn:SequenceFlow"){f.push({id:fe.id,source:Ti(fe.sourceRef),target:Ti(fe.targetRef),...typeof fe.name=="string"&&fe.name?{name:fe.name}:{}});continue}if(fe.$type==="bpmn:DataStoreReference"){T(fe.id),s.push({id:fe.id,...fe.name?{name:fe.name}:{}});continue}const Te=nC(fe.$type),$=Te==="intermediateCatchEvent"?Uu((fe.eventDefinitions??[]).map(V=>V.$type)):void 0;if(!qh(Te)||Te==="intermediateCatchEvent"&&!$){u.push({id:fe.id,type:fe.$type,reason:"type-outside-mvp"});continue}T(fe.id);const R=Te==="boundaryEvent"?Ti(fe.attachedToRef):void 0;a.push({id:fe.id,type:Te,...fe.name?{name:fe.name}:{},...ne?{participant:ne}:{},...oe.has(fe.id)?{lane:oe.get(fe.id)}:{},...R?{attachedTo:R}:{},...$?{eventDefinition:$}:{}}),Te==="subProcess"&&D(fe);const w=Dg(fe,"bwl:band");w!==void 0&&(p.bands[fe.id]=w);const G=Og(fe,"bwl:afterColumn");typeof G=="string"&&G!==""&&C.push([fe.id,G]);for(const V of fe.dataOutputAssociations??[])E(V.id),h.push({id:V.id,type:V.$type,source:fe.id,target:Ti(V.targetRef)});for(const V of fe.dataInputAssociations??[])E(V.id),h.push({id:V.id,type:V.$type,source:Ti((V.sourceRef??[])[0]),target:fe.id})}P(X.artifacts??[])};if(i){const X=new Set;for(const ne of i.participants??[]){T(ne.id),m.set(ne.id,ne);const q=Ti(ne.processRef);q&&X.add(q);const K=q?r.get(q):void 0,oe=((K==null?void 0:K.laneSets)??[]).flatMap(R=>R.lanes??[]),fe=oe.map(R=>({id:R.id,...R.name?{name:R.name}:{}}));for(const R of fe)T(R.id);const Te=!K||(K.flowElements??[]).length===0&&oe.length===0&&(K.artifacts??[]).length===0;o.push({id:ne.id,...ne.name?{name:ne.name}:{},...Te?{blackBox:!0}:{},...fe.length?{lanes:fe}:{}});const $=Dg(ne,"bwl:poolOrder");$!==void 0&&(p.poolOrders[ne.id]=$),K&&F(K,ne.id)}for(const ne of i.messageFlows??[])E(ne.id),m.set(ne.id,ne),d.push({id:ne.id,source:Ti(ne.sourceRef),target:Ti(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});P(i.artifacts??[]);for(const[ne,q]of r)!X.has(ne)&&(q.flowElements??[]).length>0&&u.push({id:ne,type:q.$type,reason:"unreachable-process"})}else for(const X of r.values())F(X);const J=[],ge=[],Ae=[],De=[],qe=(X,ne)=>!!X&&!!ne&&_.has(X)&&_.has(ne);for(const X of f){if(!qe(X.source,X.target)){u.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}J.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),_.add(X.id)}for(const X of d){if(!qe(X.source,X.target)){u.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}ge.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),_.add(X.id)}for(const X of h){if(!qe(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}De.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&_.add(X.id)}for(const X of g){if(!qe(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}Ae.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const rt=new Map(l.map(X=>[X.id,X]));for(const{owner:X,refs:ne}of x){const q=ne.filter(oe=>v.has(oe)),K=rt.get(X);K&&q.length&&(K.members=q)}for(const X of y)v.has(X.anchor)&&(p.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});for(const[X,ne]of C)v.has(ne)&&(p.afterColumns[X]=ne);const Me={...o.length?{participants:o}:{},nodes:a,sequenceFlows:J,...ge.length?{messageFlows:ge}:{},...s.length?{dataStores:s}:{},...De.length?{dataAssociations:De}:{},...c.length?{annotations:c}:{},...Ae.length?{associations:Ae}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Me,hints:p,omitted:u,i18n:rC(Me,m,e,t.i18n)}:{definition:Me,hints:p,omitted:u}}function rC(e,t,n,i){const r=Ju(n),o=Ba(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=ep(u,i,r);Object.keys(p).length&&(c[l]=p);for(const f of rp(u))o.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:o.slice(1),reviewRequests:a}}async function oC(e,t={}){const{definitions:n,warnings:i}=await zo(e);return{...Ig(n,t),warnings:i}}const aC=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function $p(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function sC(e){return $p(e.processRef)!==void 0}function cC(e){const t=new Set,n=r=>{const o=$p(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function lC(e){const t=[],n=i=>{for(const r of i.flowElements??[])aC.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function uC(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 Fp(e){const t=[],n=e.rootElements??[],i=cC(e);for(const o of lC(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])sC(s)&&uC(o.get($p(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 pC(e){const{definitions:t,warnings:n}=await zo(e);return{issues:Fp(t),warnings:n}}const fC=.5,dC=8,hC=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Zo=e=>typeof e=="number"?e:Number(e??NaN),Tc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function mC(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${Tc(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${Tc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Tc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function gC(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[Zo(s.x),Zo(s.y),Zo(s.width),Zo(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Tc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[Zo(f.x),Zo(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function Bg(e){const t=gC(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!hC.has(s)&&n.set(c,{type:s,props:mC(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function Ng(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function $g(e,t,n={}){const i=n.moveTolerance??fC,r=Bg(e),o=Bg(t),a=[],s=[],c=[];for(const[l,u]of o){const p=r.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||Ng(p.geometry,u.geometry,i)||Ng(p.label,u.label,n.labelTolerance??dC))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function yC(e,t,n={}){const[i,r]=await Promise.all([zo(e),zo(t)]);return{...$g(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function vC(e){return new Set([...e.added,...e.modified])}function bC(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Fg(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=kg(e,t.ops,{i18n:i});if(!r.ok)return{status:"rejected",issues:r.issues};const{xml:o}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:o??"",findings:r.findings,stats:r.stats}}const xC=Symbol("bpmn-editor"),jp={geometry:[],semantic:[]};function _C(){const e=he.ref(!1),t=he.ref(!0),n=he.ref(!1),i=he.shallowRef(jp),r=he.shallowRef(void 0),o=he.shallowRef(void 0);let a,s,c,l;const u=()=>{if(f(),!c){i.value=jp;return}const x=dt(Ze(c.get("elementRegistry")),{includeObservationOnly:!0}),m=c.getDefinitions();i.value={geometry:x,semantic:m?Fp(m):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function f(){const x=p();if(!x||!a){o.value=void 0;return}const m=x.locales(),v={};for(const _ of m)v[_]={untranslated:x.untranslatedCount(_),reviewRequested:x.reviewRequestedCount(_)};o.value={designLocale:a.designLocale,locales:m,displayLocale:x.getDisplayLocale()??a.designLocale,counts:v}}function d(){const x=p();x&&(x.configure(a),a&&s&&(s=x.setDisplayLocale(s)))}const g=()=>{e.value=!0,u()};function h(x,m){x.get("canvas").getContainer().style.pointerEvents=m?"":"none";const v=x.get("keyboard");m?(l&&v.bind(l),l=void 0):l||(l=v.getBinding(),v.unbind())}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function C(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:r,i18n:o,configureI18n(x){a=x,d(),f()},setDisplayLocale(x){var v;s=x;const m=(v=p())==null?void 0:v.setDisplayLocale(x);m&&(s=m),f()},setChangeScope(x){r.value=x===void 0?void 0:new Set(x)},requestFocus(x){if(!c)return;const m=c.get("elementRegistry").get(x);m&&(c.get("canvas").scrollToElement(m,180),c.get("selection").select(m))},describeElement(x){const m=c==null?void 0:c.get("elementRegistry").get(x),v=m==null?void 0:m.businessObject;if(!v)return;const _=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof _=="string"&&_.trim()!==""?_.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(x){c&&this.detach(),c=x,c.get("eventBus").on("commandStack.changed",g),t.value||h(c,!1),d(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",g),c&&!t.value&&h(c,!0),l=void 0,c=void 0,i.value=jp,r.value=void 0,o.value=void 0},setEditable(x){t.value=x,c&&h(c,x)},async applyAgentBatch(x,m){const v=y();n.value=!0;try{const _=await Fg(v,x,{currentVersion:m,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return _.status==="applied"&&(e.value=!1),_}finally{n.value=!1}},async importXml(x){const{warnings:m}=await y().importXML(x);return e.value=!1,r.value=void 0,u(),{warnings:bp(m)}},async saveXml(){const{xml:x}=await y().saveXML({format:!0});return e.value=!1,x??""},undo:()=>{var x;return(x=C())==null?void 0:x.undo()},redo:()=>{var x;return(x=C())==null?void 0:x.redo()},canUndo:()=>{var x;return((x=C())==null?void 0:x.canUndo())??!1},canRedo:()=>{var x;return((x=C())==null?void 0:x.canRedo())??!1}}}const wC=new RegExp("\\p{Script=Hangul}","u"),EC=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,SC=new RegExp("\\p{Script=Han}","u");function Hp(e){const t=wC.test(e),n=EC.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:SC.test(e)?"han":"other"}}function jg(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 Hg(e){var i;const t=new Set,n=[];for(const r of(e==null?void 0:e.diagrams)??[])for(const o of((i=r==null?void 0:r.plane)==null?void 0:i.planeElement)??[]){const a=o==null?void 0:o.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=ro(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Fo(a).filter(l=>On(l))})}return n}const Va=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function RC(e){const t=jg(e),n=Hg(e);let i;const r={},o=[],a=[],s=[];for(const g of n){const h=g.trs.filter(y=>(y.body??"")===g.name).map(On);if(h.length){const y=[...h].sort().join("+");r[y]=(r[y]??0)+1,i=i?new Set([...i].filter(C=>h.includes(C))):new Set(h)}else g.trs.some(y=>y.body)?o.push(Va(g)):s.push({e:g,inference:Hp(g.name)});for(const y of g.trs){const C=On(y),x=y.body??"",m=Hp(x);m.locale&&m.locale!==C?a.push({...Va(g),locale:C,script:m.script}):C==="ko"&&m.script==="han"&&g.trs.some(v=>v!==y&&v.body===x)&&a.push({...Va(g),locale:C,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...Va(g),locale:h.locale}):d.push({...Va(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:o,matchedBy:r,scriptMismatch:a}}function CC(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!jg(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const r=new Map(Hg(e).map(o=>[o.bo.id,o]));for(const{id:o,name:a,locale:s}of t.additions){const c=r.get(o);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>On(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create($o,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function MC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zp={exports:{}},zg;function AC(){if(zg)return zp.exports;zg=1;var e=zp.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},zp.exports}var PC=AC(),TC=MC(PC);function Hi(e){if(!(this instanceof Hi))return new Hi(e);e=e||[128,36,1],this._seed=e.length?TC.rack(e[0],e[1],e[2]):e}Hi.prototype.next=function(e){return this._seed(e||!0)},Hi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Hi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Hi.prototype.assigned=function(e){return this._seed.get(e)||!1},Hi.prototype.unclaim=function(e){delete this._seed.hats[e]},Hi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const ln={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};ln.td=ln.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],ln.option=ln.optgroup=[1,'<select multiple="multiple">',"</select>"],ln.thead=ln.tbody=ln.colgroup=ln.caption=ln.tfoot=[1,"<table>","</table>"],ln.polyline=ln.ellipse=ln.polygon=ln.circle=ln.text=ln.line=ln.path=ln.rect=ln.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Dt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[r,o,a]=Object.hasOwn(ln,i)?ln[i]:ln._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function kC(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function $n(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(r,o){n[o]=r})}),e}function Ln(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const OC=Object.prototype.toString;function $t(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 OC.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 kc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function lo(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function DC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oc={},Gg;function LC(){if(Gg)return Oc;Gg=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Oc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Oc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Oc}var Vg=LC(),IC=DC(Vg),Ge=kC({__proto__:null,default:IC},[Vg]),Wg=["focus","blur"];function BC(e,t,n,i,r){return Wg.indexOf(n)!==-1&&(r=!0),Ge.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=lo(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function NC(e,t,n,i){return Wg.indexOf(t)!==-1&&(i=!0),Ge.unbind(e,t,n,i)}var Xn={bind:BC,unbind:NC};function Gp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function wt(e,t){return t=t||document,t.querySelector(e)}function Dc(e,t){return t=t||document,t.querySelectorAll(e)}function zi(e){e.parentNode&&e.parentNode.removeChild(e)}function $C(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function FC(e,t){return t.appendChild($C(e,t))}function We(e,t){return FC(t,e),e}var Vp=2,Ug={"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":Vp,"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":Vp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function jC(e,t){return Ug[t]?e.style[t]:e.getAttributeNS(null,t)}function qg(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Ug[i];r?(r===Vp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function HC(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)qg(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)qg(e,t,n);else return jC(e,t);else HC(e,t);return e}const zC=Object.prototype.toString;function st(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 zC.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 Lc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Yg(e){return e.cloneNode(!0)}var Wp={svg:"http://www.w3.org/2000/svg"},Kg='<svg xmlns="'+Wp.svg+'"';function GC(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Wp.svg)===-1&&(e=Kg+e.substring(4)):(e=Kg+">"+e+"</svg>",t=!0);var n=VC(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function VC(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=GC(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Wp.svg,e),t&&Se(n,t),n}var Up=null;function Xg(){return Up===null&&(Up=Oe("svg")),Up}function Zg(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function WC(e,t,n,i,r,o){var a=Xg().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Zg(a,e);case 6:return Zg(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Wa(e){return Xg().createSVGTransform()}var Qg=/([&<>]{1})/g,UC=/([&<>\n\r"]{1})/g,qC={"&":"&","<":"<",">":">",'"':"'"};function qp(e,t){function n(i,r){return qC[r]||r}return e.replace(t,n)}function Jg(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(qp(e.textContent,Qg));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',qp(o.value,UC),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Jg(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",qp(e.nodeValue,Qg),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function YC(e){for(var t=e.firstChild,n=[];t;)Jg(t,n),t=t.nextSibling;return n.join("")}function ey(e,t){return YC(e)}function un(e){var t=e.parentNode;return t&&t.removeChild(e),e}function KC(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function XC(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(KC(e,i))}function Ua(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),XC(n,t)),n.consolidate()}const ZC=/^class[ {]/;function QC(e){return ZC.test(e.toString())}function Yp(e){return Array.isArray(e)}function Kp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ic(...e){e.length===1&&Yp(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const JC=/constructor\s*[^(]*\(\s*([^)]*)\)/m,eM=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,tM=/\/\*([^*]*)\*\//m;function nM(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(QC(e)?JC:eM);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(tM);return(r&&r[1]||i).trim()})||[]}function ty(e,t){const n=t||{get:function(m,v){if(i.push(m),v===!1)return null;throw s(`No provider for "${m}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(m){const v=i.join(" -> ");return i.length=0,new Error(v?`${m} (Resolving: ${v})`:m)};function c(m,v){if(!r[m]&&m.includes(".")){const _=m.split(".");let E=c(_.shift());for(;_.length;)E=E[_.shift()];return E}if(Kp(o,m))return o[m];if(Kp(r,m)){if(i.indexOf(m)!==-1)throw i.push(m),s("Cannot resolve circular dependency!");return i.push(m),o[m]=r[m][0](r[m][1]),i.pop(),o[m]}return n.get(m,v)}function l(m,v){if(typeof v>"u"&&(v={}),typeof m!="function")if(Yp(m))m=Ic(m.slice());else throw s(`Cannot invoke "${m}". Expected a function!`);const E=(m.$inject||nM(m)).map(T=>Kp(v,T)?v[T]:c(T));return{fn:m,dependencies:E}}function u(m){const{fn:v,dependencies:_}=l(m),E=Function.prototype.bind.call(v,null,..._);return new E}function p(m,v,_){const{fn:E,dependencies:T}=l(m,_);return E.apply(v,T)}function f(m){return Ic(v=>m.get(v))}function d(m,v){if(v&&v.length){const _=Object.create(null),E=Object.create(null),T=[],O=[],N=[];let P,D,F,J;for(let ge in r)P=r[ge],v.indexOf(ge)!==-1&&(P[2]==="private"?(D=T.indexOf(P[3]),D===-1?(F=P[3].createChild([],v),J=f(F),T.push(P[3]),O.push(F),N.push(J),_[ge]=[J,ge,"private",F]):_[ge]=[N[D],ge,"private",O[D]]):_[ge]=[P[2],P[1]],E[ge]=!0),(P[2]==="factory"||P[2]==="type")&&P[1].$scope&&v.forEach(Ae=>{P[1].$scope.indexOf(Ae)!==-1&&(_[ge]=[P[2],P[1]],E[Ae]=!0)});v.forEach(ge=>{if(!E[ge])throw new Error('No provider for "'+ge+'". Cannot use provider from the parent!')}),m.unshift(_)}return new ty(m,a)}const g={factory:p,type:u,value:function(m){return m}};function h(m,v){const _=m.__init__||[];return function(){_.forEach(E=>{typeof E=="string"?v.get(E):v.invoke(E)})}}function y(m){const v=m.__exports__;if(v){const _=m.__modules__,E=Object.keys(m).reduce((D,F)=>(F!=="__exports__"&&F!=="__modules__"&&F!=="__init__"&&F!=="__depends__"&&(D[F]=m[F]),D),Object.create(null)),T=(_||[]).concat(E),O=d(T),N=Ic(function(D){return O.get(D)});v.forEach(function(D){r[D]=[N,D,"private",O]});const P=(m.__init__||[]).slice();return P.unshift(function(){O.init()}),m=Object.assign({},m,{__init__:P}),h(m,O)}return Object.keys(m).forEach(function(_){if(_==="__init__"||_==="__depends__")return;const E=m[_];if(E[2]==="private"){r[_]=E;return}const T=E[0],O=E[1];r[_]=[g[T],iM(T,O),T]}),h(m,a)}function C(m,v){return m.indexOf(v)!==-1||(m=(v.__depends__||[]).reduce(C,m),m.indexOf(v)!==-1)?m:m.concat(v)}function x(m){const v=m.reduce(C,[]).map(y);let _=!1;return function(){_||(_=!0,v.forEach(E=>E()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function iM(e,t){return e!=="value"&&Yp(t)&&(t=Ic(t.slice())),t}var rM=1e3;function nr(e,t){var n=this;t=t||rM,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}nr.prototype.canRender=function(e){},nr.prototype.drawShape=function(e,t){},nr.prototype.drawConnection=function(e,t){},nr.prototype.getShapePath=function(e){},nr.prototype.getConnectionPath=function(e){};function uo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function oM(e){return["M",e.x,e.y]}function Xp(e){return["L",e.x,e.y]}function aM(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function sM(e,t){const n=e.length,i=[oM(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(Xp(a));continue}const c=Math.min(t,Zp(a.x-o.x,a.y-o.y),Zp(s.x-a.x,s.y-a.y));if(!c){i.push(Xp(a));continue}const l=Bc(a,o,c),u=Bc(a,o,c*.5),p=Bc(a,s,c),f=Bc(a,s,c*.5);i.push(Xp(l)),i.push(aM(u,f,p))}return i}function Bc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Zp(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Zp(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function qa(e,t,n){ze(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return ze(n)&&(i.dataset.cornerRadius=String(n)),Qp(i,e)}function Qp(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:uo(sM(t,n))}),e}function Nc(e){var t=new Set(e);return nt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function po(e,t,n){n=n||0,Fe(e)||(e=[e]),z(e,function(i,r){var o=t(i,r,n);Fe(o)&&o.length&&po(o,t,n+1)})}function Jp(e,t,n){var i=new Set,r=new Set;return po(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Ya(e,t){return Jp(e)}function cM(e,t,n){no(t)&&(t=!0),hn(t)&&(n=t,t=!0),n=n||{};var i=Ka(n.allShapes),r=Ka(n.allConnections),o=Ka(n.enclosedElements),a=Ka(n.enclosedConnections),s=Ka(n.topLevel,t&&Bo(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,z(u.incoming,c),z(u.outgoing,c),u.children}return po(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function en(e,t){t=!!t,Fe(e)||(e=[e]);var n,i,r,o;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=en(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>r||r===void 0)&&(r=c+p),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function Qo(e,t){var n={};return z(e,function(i){var r=i;r.waypoints&&(r=en(r)),!ze(t.y)&&r.x>t.x&&(n[i.id]=i),!ze(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ze(t.width)&&ze(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ze(t.width)||!ze(t.height))&&(n[i.id]=i)}),n}function ny(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function iy(e){return!!(e&&e.isFrame)}function Ka(e,t){return U({},e||{},t||{})}var lM=1;function Cr(e,t){nr.call(this,e,lM),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})}Ee(Cr,nr),Cr.prototype.canRender=function(){return!0},Cr.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),iy(n)?Se(r,U({},this.FRAME_STYLE,i||{})):Se(r,U({},this.SHAPE_STYLE,i||{})),We(t,r),r},Cr.prototype.drawConnection=function(t,n,i){var r=qa(n.waypoints,U({},this.CONNECTION_STYLE,i||{}));return We(t,r),r},Cr.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return uo(a)},Cr.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return uo(o)},Cr.$inject=["eventBus","styles"];function uM(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return U(o,{class:n})},this.style=function(n,i){!Fe(n)&&!i&&(i=n,n=[]);var r=Kn(n,function(o,a){return U(o,e[a]||{})},{});return i?U(r,i):r},this.computeStyle=function(n,i,r){return Fe(i)||(r=i,i=[]),t.style(i||[],U({},r,n||{}))}}const pM={__init__:["defaultRenderer"],defaultRenderer:["type",Cr],styles:["type",uM]};function qt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Xt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function ef(e,t){return!e||!t?-1:e.indexOf(t)}function Xa(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function tf(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Xa(e,t);return Math.abs(r/o)<=i}var fM=2;function ir(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(dM(r,n))return o;return!1}function dM(e,t){const n=t[0];return io(t,function(i){return Math.abs(n[e]-i[e])<=fM})}function ry(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 nf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var hM=/,?([a-z]),?/gi,oy=parseFloat,tn=Math,Mr=tn.PI,Gi=tn.min,Vi=tn.max,ay=tn.pow,Ar=tn.abs,mM=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,gM=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,sy=Array.isArray||function(e){return e instanceof Array};function yM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vM(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 bM(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),r=t.cache=t.cache||{},o=t.count=t.count||[];return yM(r,i)?(vM(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function xM(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(mM,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(gM,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=of,n}function _M(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 wM(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 rf(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 of(){return this.join(",").replace(hM,"$1")}function EM(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=of,t}function cy(e,t,n,i,r,o,a,s,c){var l=1-c,u=ay(l,3),p=ay(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*r+d*a,h=u*t+p*3*c*i+l*3*c*c*o+d*s;return{x:$c(g),y:$c(h)}}function ly(e){var t=PM(...e);return rf(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 SM(e,t){return e=rf(e),t=rf(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 uy(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function py(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<u;g++){var h=l*p[g]+l,y=uy(h,e,n,r,a),C=uy(h,t,i,o,s),x=y*y+C*C;d+=f[g]*tn.sqrt(x)}return l*d}function RM(e,t,n,i,r,o,a,s){if(!(Vi(e,n)<Gi(r,a)||Gi(e,n)>Vi(r,a)||Vi(t,i)<Gi(o,s)||Gi(t,i)>Vi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var p=$c(c/u),f=$c(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Gi(e,n).toFixed(2)||d>+Vi(e,n).toFixed(2)||d<+Gi(r,a).toFixed(2)||d>+Vi(r,a).toFixed(2)||g<+Gi(t,i).toFixed(2)||g>+Vi(t,i).toFixed(2)||g<+Gi(o,s).toFixed(2)||g>+Vi(o,s).toFixed(2)))return{x:p,y:f}}}}function $c(e){return Math.round(e*1e11)/1e11}function CM(e,t,n){var i=ly(e),r=ly(t);if(!SM(i,r))return[];var o=py(...e),a=py(...t),s=dy(e)?1:~~(o/5)||1,c=dy(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=cy(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=cy(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var y=l[d],C=l[d+1],x=u[g],m=u[g+1],v=Ar(C.x-y.x)<.01?"y":"x",_=Ar(m.x-x.x)<.01?"y":"x",E=RM(y.x,y.y,C.x,C.y,x.x,x.y,m.x,m.y),T;if(E){if(T=E.x.toFixed(9)+"#"+E.y.toFixed(9),p[T])continue;p[T]=!0;var O=y.t+Ar((E[v]-y[v])/(C[v]-y[v]))*(C.t-y.t),N=x.t+Ar((E[_]-x[_])/(m[_]-x[_]))*(m.t-x.t);O>=0&&O<=1&&N>=0&&N<=1&&f.push({x:E.x,y:E.y,t1:O,t2:N})}}return f}function fy(e,t,n){e=gy(e),t=gy(t);for(var i,r,o,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(p=[i,r,...y.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var C=0,x=t.length;C<x;C++){var m=t[C];if(m[0]=="M")o=l=m[1],a=u=m[2];else{m[0]=="C"?(f=[o,a,...m.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,l,u,l,u],o=l,a=u);var v=CM(p,f);{for(var _=0,E=v.length;_<E;_++)v[_].segment1=g,v[_].segment2=C,v[_].bez1=p,v[_].bez2=f;d=d.concat(v)}}}}}return d}function MM(e){return sy(e)&&sy(e[0])}function AM(e){if(_M(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=of,t}function dy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Fc(e,t,n,i){return[e,t,n,i,n,i]}function hy(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function my(e,t,n,i,r,o,a,s,c,l){var u=Mr*120/180,p=Mr/180*(+r||0),f=[],d,g=bM(function($,R,w){var G=$*tn.cos(w)-R*tn.sin(w),V=$*tn.sin(w)+R*tn.cos(w);return{x:G,y:V}});if(l)T=l[0],O=l[1],_=l[2],E=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,C=h*h/(n*n)+y*y/(i*i);C>1&&(C=tn.sqrt(C),n=C*n,i=C*i);var x=n*n,m=i*i,v=(o==a?-1:1)*tn.sqrt(Ar((x*m-x*y*y-m*h*h)/(x*y*y+m*h*h))),_=v*n*y/i+(e+s)/2,E=v*-i*h/n+(t+c)/2,T=tn.asin(((t-E)/i).toFixed(9)),O=tn.asin(((c-E)/i).toFixed(9));T=e<_?Mr-T:T,O=s<_?Mr-O:O,T<0&&(T=Mr*2+T),O<0&&(O=Mr*2+O),a&&T>O&&(T=T-Mr*2),!a&&O>T&&(O=O-Mr*2)}var N=O-T;if(Ar(N)>u){var P=O,D=s,F=c;O=T+u*(a&&O>T?1:-1),s=_+n*tn.cos(O),c=E+i*tn.sin(O),f=my(s,c,n,i,r,0,a,D,F,[O,P,_,E])}N=O-T;var J=tn.cos(T),ge=tn.sin(T),Ae=tn.cos(O),De=tn.sin(O),qe=tn.tan(N/4),rt=4/3*n*qe,Me=4/3*i*qe,X=[e,t],ne=[e+rt*ge,t-Me*J],q=[s+rt*De,c-Me*Ae],K=[s,c];if(ne[0]=2*X[0]-ne[0],ne[1]=2*X[1]-ne[1],l)return[ne,q,K].concat(f);f=[ne,q,K].concat(f).join().split(",");for(var oe=[],fe=0,Te=f.length;fe<Te;fe++)oe[fe]=fe%2?g(f[fe-1],f[fe],p).y:g(f[fe],f[fe+1],p).x;return oe}function PM(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,y,C,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,f=3*i-3*t),Ar(u)<1e-12){if(Ar(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}y=p*p-4*f*u,C=tn.sqrt(y),!(y<0)&&(g=(-p+C)/(2*u),0<g&&g<1&&c.push(g),h=(-p-C)/(2*u),0<h&&h<1&&c.push(h))}for(var m=c.length,v=m,_;m--;)d=c[m],_=1-d,l[0][m]=_*_*_*e+3*_*_*d*n+3*_*d*d*r+d*d*d*a,l[1][m]=_*_*_*t+3*_*_*d*i+3*_*d*d*o+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Gi(...l[0]),y0:Gi(...l[1]),x1:Vi(...l[0]),y1:Vi(...l[1])}}function gy(e){if(MM(e)||(e=xM(e)),wM(e))return e;for(var t=EM(AM(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,y;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...my(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),f=["C",h,y,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...hy(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...hy(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Fc(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Fc(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Fc(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Fc(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)o[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=oy(u[p-4])||n.x,n.by=oy(u[p-3])||n.y}return t}function Et(e){return hn(e)&&Yn(e,"waypoints")}function Je(e){return hn(e)&&Yn(e,"labelTarget")}function TM(e){return hn(e)&&Lo(e.parent)}function yy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function rr(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Le(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function jc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function kM(e){return rr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function OM(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=IM(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function je(e){return Et(e)?OM(e):kM(e)}function Cn(e,t,n){n=n||0,hn(n)||(n={x:n,y:n});var i=Le(e),r=Le(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function Za(e,t,n){var i=DM(e,t);return i.length===1||i.length===2&&Xa(i[0],i[1])<1?rr(i[0]):i.length>1?(i=Bi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),rr(i[n?0:i.length-1])):null}function DM(e,t){return fy(e,t)}function LM(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Xa(n,r)===0||tf(i,r,n)?e.splice(t,1):t++;return e}function IM(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hc(e,t){return Math.round(e*t)/t}function vy(e){return ze(e)?e+"px":e}function BM(e){for(;e.parent;)e=e.parent;return e}function NM(e){e=U({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),$n(n,{position:"relative",overflow:"hidden",width:vy(e.width),height:vy(e.height)}),t.appendChild(n),n}function by(e,t,n){const i=Oe("g");st(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const $M="base",xy=0,FM=1,jM={shape:["x","y","width","height"],connection:["waypoints"]};function He(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}He.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],He.prototype._init=function(e){const t=this._eventBus,n=this._container=NM(e),i=this._svg=Oe("svg");Se(i,{width:"100%",height:"100%"}),Ln(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),We(n,i);const r=this._viewport=by(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Qu(this._viewboxChanged,300)),this._restoreFocus=Qu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},He.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},He.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},He.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=ny(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},He.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},He.prototype.restoreFocus=function(){this._restoreFocus()},He.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},He.prototype.isFocused=function(){return this._focused},He.prototype.getDefaultLayer=function(){return this.getLayer($M,xy)},He.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},He.prototype._getChildIndex=function(e){return Kn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},He.prototype._createLayer=function(e,t){typeof t>"u"&&(t=FM);const n=this._getChildIndex(t);return{group:by(this._viewport,"layer-"+e,n),index:t,visible:!0}},He.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},He.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(un(n),t.visible=!1),n},He.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],un(t.group))},He.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},He.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(BM(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},He.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},He.prototype._findPlaneForRoot=function(e){return Pt(this._planes,function(t){return t.rootElement===e})},He.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},He.prototype._resolveElements=function(e){return Fe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},He.prototype.getContainer=function(){return this._container},He.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),st(r).add(t)):(e.markers.delete(t),st(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},He.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},He.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},He.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},He.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},He.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},He.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,xy);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},He.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},He.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},He.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},He.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},He.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},He.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=jM[e];if(!io(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},He.prototype._setParent=function(e,t,n){Xt(t.children,e,n),e.parent=t},He.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},He.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},He.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},He.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),qt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},He.prototype.removeShape=function(e){return this._removeElement(e,"shape")},He.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},He.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},He.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},He.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},He.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Ua(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Ua(t),r=a?a.matrix:WC(),s=Hc(r.a,1e3),c=Hc(-r.e||0,1e3),l=Hc(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},He.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=U({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),_y(t,n)}),{x:n.e,y:n.f}},He.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=en(o),s=Le(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Le(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),y=Math.max(0,s.bottom-f.bottom),C=Math.min(0,s.top-f.top);u=g||h,p=y||C}this.scroll({dx:-u*l,dy:-p*l})},He.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Hc(i.a,1e3)};function _y(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}He.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},He.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=U(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),_y(this._viewport,u),u},He.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},He.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},He.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Jo="data-element-id";function li(e){this._elements={},this._eventBus=e}li.$inject=["eventBus"],li.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,Jo,i),n&&Se(n,Jo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},li.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,Jo,""),i.secondaryGfx&&Se(i.secondaryGfx,Jo,""),delete t[n])},li.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)},li.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,Jo,i),t},li.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,Jo);var n=this._elements[t];return n&&n.element},li.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},li.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},li.prototype.getAll=function(){return this.filter(function(e){return e})},li.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},li.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},li.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 HM(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function zM(e){return e.__refs_collection===!0}function GM(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function wy(e,t,n){var i=HM(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function VM(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function mi(e,t){if(!(this instanceof mi))return new mi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}mi.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?wy(this,t,e):VM(this,t,e)},mi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return zM(n)||wy(this,t,e),n},mi.prototype.ensureBound=function(e,t){GM(e,t)||this.bind(e,t)},mi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},mi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var af=new mi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ey=new mi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Sy=new mi({name:"attachers",collection:!0},{name:"host"}),Ry=new mi({name:"outgoing",collection:!0},{name:"source"}),Cy=new mi({name:"incoming",collection:!0},{name:"target"});function ea(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),af.bind(this,"parent"),Ey.bind(this,"labels"),Ry.bind(this,"outgoing"),Cy.bind(this,"incoming")}function Qa(){ea.call(this),af.bind(this,"children"),Sy.bind(this,"host"),Sy.bind(this,"attachers")}Ee(Qa,ea);function My(){ea.call(this),af.bind(this,"children")}Ee(My,Qa);function Ay(){Qa.call(this),Ey.bind(this,"labelTarget")}Ee(Ay,Qa);function Py(){ea.call(this),Ry.bind(this,"source"),Cy.bind(this,"target")}Ee(Py,ea);var WM={connection:Py,shape:Qa,label:Ay,root:My};function UM(e,t){var n=WM[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}function qM(e){return e instanceof ea}function or(){this._uid=12}or.prototype.createRoot=function(e){return this.create("root",e)},or.prototype.createLabel=function(e){return this.create("label",e)},or.prototype.createShape=function(e){return this.create("shape",e)},or.prototype.createConnection=function(e){return this.create("connection",e)},or.prototype.create=function(e,t){return t=U({},t||{}),t.id||(t.id=e+"_"+this._uid++),UM(e,t)};var zc="__fn",Ty=1e3,YM=Array.prototype.slice;function Zn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Zn.prototype.on=function(e,t,n,i){if(e=Fe(e)?e:[e],mn(t)&&(i=n,n=t,t=Ty),!ze(t))throw new Error("priority must be a number");var r=n;i&&(r=Gn(n,i),r[zc]=n[zc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Zn.prototype.once=function(e,t,n,i){var r=this;if(mn(t)&&(i=n,n=t,t=Ty),!ze(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[zc]=n,this.on(e,t,o)},Zn.prototype.off=function(e,t){e=Fe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Zn.prototype.createEvent=function(e){var t=new Ja;return t.init(e),t},Zn.prototype.fire=function(e,t){var n,i,r,o;if(o=YM.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 Ja?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Zn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Zn.prototype._destroy=function(){this._listeners={}},Zn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Zn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=KM(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Zn.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},Zn.prototype._getListeners=function(e){return this._listeners[e]},Zn.prototype._setListeners=function(e,t){this._listeners[e]=t},Zn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[zc]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Ja(){}Ja.prototype.stopPropagation=function(){this.cancelBubble=!0},Ja.prototype.preventDefault=function(){this.defaultPrevented=!0},Ja.prototype.init=function(e){U(this,e||{})};function KM(e,t){return e.apply(null,t)}function fo(e){return e.childNodes[0]}function XM(e){return e.parentNode.childNodes[1]}function Gc(e,t,n,i,r){var o=Wa();o.setTranslate(t,n);var a=Wa();a.setRotate(i||0,0,0);var s=Wa();s.setScale(1,1),Ua(e,[o,a,s])}function Mn(e,t,n){var i=Wa();i.setTranslate(t,n),Ua(e,i)}function ky(e,t){var n=Wa();n.setRotate(t,0,0),Ua(e,n)}function ui(e,t){this._eventBus=e,this._elementRegistry=t}ui.$inject=["eventBus","elementRegistry"],ui.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=XM(t),n||(n=Oe("g"),st(n).add("djs-children"),We(t.parentNode,n))):n=t,n},ui.prototype._clear=function(e){var t=fo(e);return kc(t),t},ui.prototype._createContainer=function(e,t,n,i){var r=Oe("g");st(r).add("djs-group"),typeof n<"u"?ZM(r,t,t.childNodes[n]):We(t,r);var o=Oe("g");st(o).add("djs-element"),st(o).add("djs-"+e),i&&st(o).add("djs-frame"),We(r,o);var a=Oe("g");return st(a).add("djs-visual"),We(o,a),o},ui.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,iy(t))},ui.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Kn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),z(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;z(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},ui.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},ui.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},ui.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},ui.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},ui.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Mn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},ui.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);un(t.parentNode)};function ZM(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const QM={__depends__:[pM],__init__:["canvas"],canvas:["type",He],elementRegistry:["type",li],elementFactory:["type",or],eventBus:["type",Zn],graphicsFactory:["type",ui]};function JM(e){var t=new ty(e);return t.init(),t}function eA(e){e=e||{};var t={config:["value",e]},n=[t,QM].concat(e.modules||[]);return JM(n)}function Tr(e,t){this._injector=t||eA(e),this.get("eventBus").fire("diagram.init")}Tr.prototype.get=function(e,t){return this._injector.get(e,t)},Tr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Tr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Tr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function In(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Vn(e,t){return e.$instanceOf(t)}function tA(e){return Pt(e.rootElements,function(t){return Vn(t,"bpmn:Process")||Vn(t,"bpmn:Collaboration")})}function nA(e){var t={},n=[],i={};function r(q,K){return function(oe){q(oe,K)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,K){var oe=q.gfx;if(oe)throw new Error(`already rendered ${In(q)}`);return e.element(q,i[q.id],K)}function c(q,K){return e.root(q,i[q.id],K)}function l(q,K){try{var oe=i[q.id]&&s(q,K);return o(q),oe}catch(fe){u(fe.message,{element:q,error:fe}),console.error(`failed to import ${In(q)}`,fe)}}function u(q,K){e.error(q,K)}var p=this.registerDi=function(K){var oe=K.bpmnElement;oe?i[oe.id]?u(`multiple DI elements defined for ${In(oe)}`,{element:oe}):i[oe.id]=K:u(`no bpmnElement referenced in ${In(K)}`,{element:K})};function f(q){d(q.plane)}function d(q){p(q),z(q.planeElement,g)}function g(q){p(q)}this.handleDefinitions=function(K,oe){var fe=K.diagrams;if(oe&&fe.indexOf(oe)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!oe&&fe&&fe.length&&(oe=fe[0]),!oe)throw new Error("no diagram to display");i={},f(oe);var Te=oe.plane;if(!Te)throw new Error(`no plane for ${In(oe)}`);var $=Te.bpmnElement;if(!$)if($=tA(K),$)u(`correcting missing bpmnElement on ${In(Te)} to ${In($)}`),Te.bpmnElement=$,p(Te);else throw new Error("no process or collaboration to display");var R=c($,Te);if(Vn($,"bpmn:Process")||Vn($,"bpmn:SubProcess"))y($,R);else if(Vn($,"bpmn:Collaboration"))X($,R),C(K.rootElements,R);else throw new Error(`unsupported bpmnElement for ${In(Te)}: ${In($)}`);h(n)};var h=this.handleDeferred=function(){for(var K;n.length;)K=n.shift(),K()};function y(q,K){qe(q,K),N(q.ioSpecification,K),O(q.artifacts,K),o(q)}function C(q,K){var oe=nt(q,function(fe){return!a(fe)&&Vn(fe,"bpmn:Process")&&fe.laneSets});oe.forEach(r(y,K))}function x(q,K){l(q,K)}function m(q,K){z(q,r(x,K))}function v(q,K){l(q,K)}function _(q,K){l(q,K)}function E(q,K){l(q,K)}function T(q,K){l(q,K)}function O(q,K){z(q,function(oe){Vn(oe,"bpmn:Association")?n.push(function(){T(oe,K)}):T(oe,K)})}function N(q,K){q&&(z(q.dataInputs,r(_,K)),z(q.dataOutputs,r(E,K)))}var P=this.handleSubProcess=function(K,oe){qe(K,oe),O(K.artifacts,oe)};function D(q,K){var oe=l(q,K);Vn(q,"bpmn:SubProcess")&&P(q,oe||K),Vn(q,"bpmn:Activity")&&N(q.ioSpecification,K),n.push(function(){z(q.dataInputAssociations,r(v,K)),z(q.dataOutputAssociations,r(v,K))})}function F(q,K){l(q,K)}function J(q,K){l(q,K)}function ge(q,K){n.push(function(){var oe=l(q,K);q.childLaneSet&&Ae(q.childLaneSet,oe||K),ne(q)})}function Ae(q,K){z(q.lanes,r(ge,K))}function De(q,K){z(q,r(Ae,K))}function qe(q,K){rt(q.flowElements,K),q.laneSets&&De(q.laneSets,K)}function rt(q,K){z(q,function(oe){Vn(oe,"bpmn:SequenceFlow")?n.push(function(){F(oe,K)}):Vn(oe,"bpmn:BoundaryEvent")?n.unshift(function(){D(oe,K)}):Vn(oe,"bpmn:FlowNode")?D(oe,K):Vn(oe,"bpmn:DataObject")||(Vn(oe,"bpmn:DataStoreReference")||Vn(oe,"bpmn:DataObjectReference")?J(oe,K):u(`unrecognized flowElement ${In(oe)} in context ${In(K&&K.businessObject)}`,{element:oe,context:K}))})}function Me(q,K){var oe=l(q,K),fe=q.processRef;fe&&y(fe,oe||K)}function X(q,K){z(q.participants,r(Me,K)),n.push(function(){m(q.messageFlows,K)}),O(q.artifacts,K)}function ne(q){z(q.flowNodeRef,function(K){var oe=K.get("lanes");oe&&oe.push(q)})}}function iA(e,t,n){var i,r,o,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,C){return i.add(h,y,C)},error:function(h,y){s.push({message:h,context:y})}},f=new nA(p);u=u||l.diagrams&&l.diagrams[0];var d=rA(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function rA(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=oA(n));var r;M(i,"bpmn:Collaboration")?r=i:r=Pt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Pt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=kn(r.participants,function(l){return l.processRef}),o.push(r));var a=Oy(o),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function Oy(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(Oy(n.flowElements)))}),t}function oA(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var aA='<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>',Dy=aA,Ly={verticalAlign:"middle"},Iy={color:"#404040"},sA={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},cA={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},lA={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"},uA='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Dy+'</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>',Wi;function pA(){Wi=Dt(uA),$n(Wi,sA),$n(wt("svg",Wi),Ly),$n(wt(".backdrop",Wi),cA),$n(wt(".notice",Wi),lA),$n(wt(".link",Wi),Iy,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function fA(){Wi||(pA(),Xn.bind(Wi,".backdrop","click",function(e){document.body.removeChild(Wi)})),document.body.appendChild(Wi)}const Vc=5,By="djs-outline-hidden";function Ht(e){e=U({},hA,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),gA(this._container)}Ee(Ht,Tr),Ht.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Wc(s,o),s=dA(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Ht.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Ht.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Wc(o,[]),o}if(typeof t=="string"&&(i=mA(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Wc(o,[]),o}try{this.clear()}catch(o){throw Wc(o,[]),o}const{warnings:r}=await iA(this,n,i);return{warnings:r}},Ht.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},Ht.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=wt(":scope > defs",i._svg),a=ey(r),s=o?"<defs>"+ey(o)+"</defs>":"",c=i.getContainer();$t(c).add(By);let l;try{l=r.getBBox()}finally{$t(c).remove(By)}const u=l.x-Vc,p=l.y-Vc,f=l.width+Vc*2,d=l.height+Vc*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+_.message;if(k)return a.addWarning({message:j,error:_}),!0;throw Er(j)}function u(_,S){return l(_,S,!0)}function p(){var _=a.elementsById,S=a.references,k,O;for(k=0;O=S[k];k++){var N=O.element,P=_[O.id],D=er(N).propertiesByName[O.property];if(P||a.addWarning({message:"unresolved reference <"+O.id+">",element:O.element,property:O.property,value:O.id}),D.isMany){var j=N.get(D.name),ee=j.indexOf(O);ee===-1&&(ee=j.length),P?j[ee]=P:j.splice(ee,1)}else N.set(D.name,P)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(_){if(d.test(_)){var S=g.exec(_),k=S&&S[1];!k||h.test(k)||a.addWarning({message:"unsupported document encoding <"+k+">, falling back to UTF-8"})}}function C(_,S){var k=c.peek();try{c.push(k.handleNode(_))}catch(O){l(O,S,o)&&c.push(new bp)}}function x(_,S){try{c.peek().handleText(_)}catch(k){u(k,S)}}function m(_,S){_.trim()&&x(_,S)}var v=r.getPackages().reduce(function(_,S){return _[S.uri]=S.prefix,_},Object.entries(vp).reduce(function(_,[S,k]){return _[k]=S,_},r.config&&r.config.nsMap||{}));return s.ns(v).on("openTag",function(_,S,k,O){var N=_.attrs||{},P=Object.keys(N).reduce(function(j,ee){var ge=S(N[ee]);return j[ee]=ge,j},{}),D={name:_.name,originalName:_.originalName,attributes:P,ns:_.ns};C(D,O)}).on("question",y).on("closeTag",f).on("cdata",x).on("text",function(_,S,k){m(S(_),k)}).on("error",l).on("warn",u),new Promise(function(_,S){var k;try{s.parse(e),p()}catch(j){k=j}var O=i.element;!k&&!O&&(k=Er("failed to parse document as <"+i.type.$descriptor.name+">"));var N=a.warnings,P=a.references,D=a.elementsById;return k?(k.warnings=N,S(k)):_({rootElement:O,elementsById:D,references:P,warnings:N})})},wp.prototype.handler=function(e){return new _p(this.model,e)};function U1(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var q1=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,Y1=/<|>|'|"|&|\n\r|\n/g,Em=/<|>|&/g;function Bi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Bi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Bi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Bi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Bi.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)},Bi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Bi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Bi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Bi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Bi.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 K1(e){return e.charAt(0).toLowerCase()+e.slice(1)}function X1(e,t){return bm(t)?K1(e):e}function Sm(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Rm(e){return Un(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Z1(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 Q1(e,t){return t.isGeneric?U({localName:t.ns.localName},e):U({localName:X1(t.ns.localName,t.$pkg)},e)}function J1(e,t){return U({localName:t.ns.localName},e)}function eS(e){var t=e.$descriptor;return it(t.properties,function(n){var i=n.name;if(n.isVirtual||!qn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var tS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},nS={"<":"lt",">":"gt","&":"amp"};function Cm(e,t,n){return e=Un(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function iS(e){return Cm(e,Y1,tS)}function rS(e){return Cm(e,Em,nS)}function oS(e){return it(e,function(t){return t.isAttr})}function aS(e){return it(e,function(t){return!t.isAttr})}function Ep(e){this.tagName=e}Ep.prototype.build=function(e){return this.element=e,this},Ep.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function so(){}so.prototype.serializeValue=so.prototype.serializeTo=function(e){e.append(this.escape?rS(this.value):this.value)},so.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Em)!==-1&&(this.escape=!0),this};function Sp(e){this.tagName=e}Sm(Sp,so),Sp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Nt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Nt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=eS(e),this.parseAttributes(oS(r)),this.parseContainments(aS(r))),this.parseGenericAttributes(e,i),this},Nt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Q1(t,e)},Nt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return J1(t,e)},Nt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Nt.prototype.nsAttributeName=function(e){var t;if(Un(e)?t=On(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}:U({localName:t.localName},n)},Nt.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}))},Nt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new so().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Nt(this).build(i))})},Nt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=On(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},Nt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Nt.prototype.parseGenericAttributes=function(e,t){var n=this;z(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},Nt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new so().build(r,o[0]));else if(fm(r.type))z(o,function(l){n.push(new Sp(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)z(o,function(l){n.push(new Ep(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=_m(r);z(o,function(l){var u;c?c===xm?u=new Nt(t,r):u=new hc(t,r,c):u=new Nt(t),n.push(u.build(l))})}})},Nt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Bi(i):t=i),t},Nt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},Nt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},Nt.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];z(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Nt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Rm(e)},Nt.prototype.addAttribute=function(e,t){var n=this.attrs;Un(t)&&(t=iS(t));var i=om(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},Nt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=Z1(n).concat(t)),z(t,function(i){e.append(" ").append(Rm(i.name)).append('="').append(i.value).append('"')})},Nt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==so;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),z(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function hc(e,t,n){Nt.call(this,e,t),this.serialization=n}Sm(hc,Nt),hc.prototype.parseNsAttributes=function(e){var t=Nt.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},hc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function sS(){this.value="",this.write=function(e){this.value+=e}}function cS(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 lS(e){e=U({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new sS,o=new cS(r,e.format);e.preamble&&o.append(q1);var a=new Nt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(uS(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function uS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in vp)n[i]=vp[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function mc(e,t){di.call(this,e,t)}mc.prototype=Object.create(di.prototype),mc.prototype.fromXML=function(e,t,n){Un(t)||(n=t,t="bpmn:Definitions");var i=new wp(U({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},mc.prototype.toXML=function(e,t){var n=new lS(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var pS="BPMN20",fS="http://www.omg.org/spec/BPMN/20100524/MODEL",dS="bpmn",hS=[],mS=[{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"}]}],gS=[{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"}]}],yS={tagAlias:"lowerCase",typePrefix:"t"},vS={name:pS,uri:fS,prefix:dS,associations:hS,types:mS,enumerations:gS,xml:yS},bS="BPMNDI",xS="http://www.omg.org/spec/BPMN/20100524/DI",_S="bpmndi",wS=[{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"]}],ES=[{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"}]}],SS=[],RS={name:bS,uri:xS,prefix:_S,types:wS,enumerations:ES,associations:SS},CS="DC",MS="http://www.omg.org/spec/DD/20100524/DC",AS="dc",PS=[{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}]}],TS=[],kS={name:CS,uri:MS,prefix:AS,types:PS,associations:TS},OS="DI",DS="http://www.omg.org/spec/DD/20100524/DI",LS="di",IS=[{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"}]}],BS=[],NS={tagAlias:"lowerCase"},$S={name:OS,uri:DS,prefix:LS,types:IS,associations:BS,xml:NS},FS="bpmn.io colors for BPMN",jS="http://bpmn.io/schema/bpmn/biocolor/1.0",HS="bioc",zS=[{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"}]}],GS=[],VS=[],WS={name:FS,uri:jS,prefix:HS,types:zS,enumerations:GS,associations:VS},US="BPMN in Color",qS="http://www.omg.org/spec/BPMN/non-normative/color/1.0",YS="color",KS=[{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"}]}],XS=[],ZS=[],QS={name:US,uri:qS,prefix:YS,types:KS,enumerations:XS,associations:ZS};const JS={bpmn:vS,bpmndi:RS,dc:kS,di:$S,bioc:WS,color:QS};function Mm(e,t){const n=U({},JS,e);return new mc(n,t)}const eR={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"}},gc={[sm]:eR,[Ju]:nm};function Am(){return Mm(gc)}const Pm=Am();async function Vo(e){const{rootElement:t,warnings:n}=await Pm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function tR(e){const{xml:t}=await Pm.toXML(e,{format:!0});return t}function Rp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Wo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},nR=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function iR(e){const t=Wo;return nR.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 Uo(e,t){let n=0;for(const i of e)n+=t*iR(i);return n}function Tm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&rR(e),oR(e),aR(e),sR(e)}function rR(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:Uo(r,o),fontBoundingBoxAscent:o*Wo.ascentEm,fontBoundingBoxDescent:o*Wo.descentEm,actualBoundingBoxAscent:o*Wo.ascentEm,actualBoundingBoxDescent:o*Wo.descentEm}}};t.getContext=()=>n}function oR(e){if(e.SVGMatrix)return;class t{constructor(){fi(this,"a",1);fi(this,"b",0);fi(this,"c",0);fi(this,"d",1);fi(this,"e",0);fi(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function aR(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function sR(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:Uo(n,12),height:14}})}const yc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),cR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),lR=1,vc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),uR=2;function ut(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const km=20,bc=5,Om=3,pR=8,qo=15,Cp=50,Dm=12,fR=Dm*1.2;function Mp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>Uo(o,Dm))),r=n.length*fR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Lm=1;function hn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function Yo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of hn(e))for(const s of hn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Lm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=km&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Ap(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Im(e,t){const n=Yo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function dR(e,t){let n=0;for(const i of t)i.id!==e.id&&Im(e,i)&&n++;return n}function ai(e,t){let n=0;for(const i of t)i.id!==e.id&&Yo(e,i)&&n++;return n}const Bm=15,Nm=20;function hR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Nm||t.at>n[1]+Nm)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Pp=20;function xc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Lm)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<km||n.push([r-Pp,o+Pp])}return n}function _c(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hn(e)){const o=hR(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of xc(r,hn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const mR=10,gR=1,yR=(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 vR(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,l)&&f(e.y-s,-l)&&p>u}function Tp(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 bR=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Ko=1;function Ni(e,t){const n=e.x+Ko,i=e.x+e.width-Ko,r=e.y+Ko,o=e.y+e.height-Ko;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Xo(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 $m(e,t){const n=e.label;if(!n)return null;if(hn(e).some(i=>Ni(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(hn(i).some(r=>Ni(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Xo(i).some(r=>Ni(n,r)))return i.id;return null}function mn(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(vR(e.waypoints[o],e.waypoints[o+1],r,uR)){i.push(r);break}}return i}const Va=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},xR=(e,t,n,i)=>jm(e,t,n,i)?0:Math.min(Va(e,n,i),Va(t,n,i),Va(n,e,t),Va(i,e,t)),Fm=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function wc(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,Va({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(Fm(e,s)||Fm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,xR(e,t,s[l],s[(l+1)%s.length]));return c}function jm(e,t,n,i){const r=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Hm=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Wa(e,t){let n=0;for(const i of t){if(i.id===e.id||Hm(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)jm(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function si(e,t){let n=0;for(const i of t)i.id===e.id||Hm(e,i)||Wa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function zm(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)Wa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Ec(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Wa(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function Gm(e){const t=Ec(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?r++:u==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:_R(e)}}function _R(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Vm(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!vc.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function Wm(e){var n;const t=(n=It(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=It(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Um=e=>e?{members:e}:{},ci=e=>e.shapes.filter(t=>!t.container);function wR(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function ER(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function qm(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(hn(i).some(r=>Ni(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Xo(i).some(r=>Ni(n,r)))return i.id;return null}function co(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 Ym=3;function Km(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function Ua(e,t){const n=[];for(const i of t.shapes){if(i.container||vc.has(i.type))continue;const r=Km(e,i);r>=Ym&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function dt(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of mn(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const r=e.shapes.filter(m=>m.container&&cR.has(m.type));if(r.length){const m=(v,_)=>{const S=e.shapes.find(k=>k.id===_);return!!S&&S.x>=v.x&&S.y>=v.y&&S.x+S.width<=v.x+v.width&&S.y+S.height<=v.y+v.height};for(const v of e.edges)for(const _ of mn(v,r))v.endpoints.includes(_.id)||v.endpoints.some(S=>m(_,S))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:_.id})}for(const m of e.edges){if(m.waypoints.length<2)continue;const v=[[m.source,m.waypoints[0]],[m.target,m.waypoints[m.waypoints.length-1]]];for(const[_,S]of v){if(!_)continue;const k=e.shapes.find(D=>D.id===_);if(!k||k.container)continue;const O=Math.max(k.x-S.x,S.x-(k.x+k.width),0),N=Math.max(k.y-S.y,S.y-(k.y+k.height),0),P=Math.hypot(O,N);P>mR&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:_,distance:Math.round(P)})}}const o=e.shapes.filter(m=>m.type==="bpmn:Participant");for(let m=0;m<o.length;m++)for(let v=m+1;v<o.length;v++){const _=o[m],S=o[v];if(_.x+_.width<=S.x||S.x+S.width<=_.x||_.y+_.height<=S.y||S.y+S.height<=_.y)continue;const k=(O,N)=>O.x<=N.x&&O.y<=N.y&&O.x+O.width>=N.x+N.width&&O.y+O.height>=N.y+N.height;n.push({kind:"pool-overlap",pools:[_.id,S.id],contained:k(_,S)||k(S,_)})}const a=i.filter(m=>!m.attached);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const _=a[m],S=a[v];if(!Tp(_,S,lR))continue;const k=_.id<S.id?[_.id,S.id]:[S.id,_.id];n.push({kind:"shape-overlap",shapes:k,identical:bR(_,S)})}const s=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<s.length;m++)for(let v=m+1;v<s.length;v++){const _=s[m],S=s[v],k=Math.min(_.x+_.width,S.x+S.width)-Math.max(_.x,S.x),O=Math.min(_.y+_.height,S.y+S.height)-Math.max(_.y,S.y);if(k<=bc||O<=bc)continue;const N=_.id<S.id?[_.id,S.id]:[S.id,_.id],P=new Set(S.members);if(_.members.some(j=>P.has(j))){const j=Vm(e,s,{x:Math.max(_.x,S.x),y:Math.max(_.y,S.y),right:Math.min(_.x+_.width,S.x+S.width),bottom:Math.min(_.y+_.height,S.y+S.height)});j.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:N,shapes:j});continue}const D=_.x<=S.x&&_.y<=S.y&&_.x+_.width>=S.x+S.width&&_.y+_.height>=S.y+S.height?_.id:S.x<=_.x&&S.y<=_.y&&S.x+S.width>=_.x+_.width&&S.y+S.height>=_.y+_.height?S.id:void 0;n.push({kind:"group-overlap-unintended",groups:N,...D?{container:D}:{}})}const c=new Set(s.flatMap(m=>[...m.members])),l=m=>e.shapes.filter(v=>!v.container&&!vc.has(v.type)&&v.x>=m.x&&v.y>=m.y&&v.x+v.width<=m.x+m.width&&v.y+v.height<=m.y+m.height);for(const m of s){const v=l(m);if(!v.length)continue;const _=new Set(m.members),S=v.filter(k=>!_.has(k.id));S.some(k=>c.has(k.id))&&(S.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:S.map(k=>k.id).sort()}))}for(const m of s){const v=new Set(l(m).map(P=>P.id)),_=new Set(m.members),S=new Set([...v].filter(P=>!_.has(P)&&c.has(P)));if(!S.size)continue;let k=!1,O=!1,N=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const D=S.has(P.source),j=S.has(P.target);!D&&j&&!v.has(P.source)?k=!0:D&&!j&&!v.has(P.target)?O=!0:D&&j&&(N=!0)}k&&O&&N&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...S].sort()})}const u=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<u.length;m++)for(let v=m+1;v<u.length;v++)for(let _=v+1;_<u.length;_++){const S=[u[m],u[v],u[_]],k={x:Math.max(...S.map(P=>P.x)),y:Math.max(...S.map(P=>P.y)),right:Math.min(...S.map(P=>P.x+P.width)),bottom:Math.min(...S.map(P=>P.y+P.height))};if(k.right-k.x<=bc||k.bottom-k.y<=bc)continue;const O=Vm(e,[],k);if(!O.length)continue;const N=S.map(P=>P.id).sort();n.push({kind:"group-stack-unreadable",groups:N,shapes:O})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||vc.has(v.type)||v.width<=0||v.height<=0)continue;const _=[["top",m.y,"h",m.x,m.x+m.width],["bottom",m.y+m.height,"h",m.x,m.x+m.width],["left",m.x,"v",m.y,m.y+m.height],["right",m.x+m.width,"v",m.y,m.y+m.height]];for(const[S,k,O,N,P]of _){const D=O==="h"?v.x:v.y,j=O==="h"?v.x+v.width:v.y+v.height;if(!(D<P&&N<j))continue;const ee=O==="h"?v.y:v.x,ge=O==="h"?v.y+v.height:v.x+v.width;if(!(ee<k&&k<ge))continue;const Pe=Math.min(k-ee,ge-k);Pe<pR||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:S,depth:Pe})}}const p=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(p.length){const m=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const _=hn(v);if(_.length)for(const S of p){const k=S.x+S.width,O=S.y+S.height,N=v.endpoints.some(D=>{const j=m.get(D);return!!j&&S.x<j.x&&j.x<k&&S.y<j.y&&j.y<O});let P=null;for(const D of _){const[j,ee,ge]=D.axis==="v"?[S.y,O,[["left",S.x],["right",k]]]:[S.x,k,[["top",S.y],["bottom",O]]],Pe=Math.min(D.hi,ee)-Math.max(D.lo,j);if(Pe<Cp)continue;const De=D.axis==="v"?S.x<D.at&&D.at<k:S.y<D.at&&D.at<O;if(!(De&&N))for(const[Ye,ot]of ge){const Me=Math.abs(D.at-ot);Me<=qo&&(!P||Me<P.distance)&&(P={side:Ye,inside:De,distance:Me,length:Pe})}}P&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:S.id,side:P.side,inside:P.inside,distance:Math.round(P.distance),length:Math.round(P.length)})}}}const f=e.shapes.filter(m=>m.container&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Lane");for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const _=m.x<v.x+v.width&&v.x<m.x+m.width,S=m.y<v.y+v.height&&v.y<m.y+m.height,k=[["top",m.y,v.y,_],["bottom",m.y+m.height,v.y+v.height,_],["left",m.x,v.x,S],["right",m.x+m.width,v.x+v.width,S]];for(const[O,N,P,D]of k)D&&Math.abs(N-P)<=Om&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:O})}const d=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<d.length;m++)for(let v=m+1;v<d.length;v++){const _=d[m],S=d[v],k=_.x<S.x+S.width&&S.x<_.x+_.width,O=_.y<S.y+S.height&&S.y<_.y+_.height,N=[["x",_.x+_.width,S.x,O],["x",S.x+S.width,_.x,O],["y",_.y+_.height,S.y,k],["y",S.y+S.height,_.y,k]];for(const[P,D,j,ee]of N)if(ee&&Math.abs(D-j)<=Om){n.push({kind:"group-on-group-boundary",groups:_.id<S.id?[_.id,S.id]:[S.id,_.id],axis:P});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const _=e.edges[m],S=e.edges[v],k=Yo(_,S);if(!k)continue;const O=_.id<S.id?[_.id,S.id]:[S.id,_.id];n.push({kind:k.kind==="opposite"?"edge-overlap-opposite":k.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:O,axis:k.axis,length:Math.round(k.length)})}for(const m of e.edges){if(!m.label)continue;const v=_c(m,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:m.id,other:v.other,axis:v.axis})}for(const m of e.edges){if(!m.label)continue;const v=$m(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}if(t.includeObservationOnly){for(const m of e.edges)if(!(!m.label||m.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:_}of Ua(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(_)})}const g=new Set(i.map(m=>m.id)),h=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...h.filter(v=>!g.has(v.id))]){if(!m.label)continue;const v=qm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const y=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of h)for(const{owner:v,rect:_}of co(e))v===m.id||y.has(v)||Tp(m.label,_,Ko)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const C=co(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:_}of C)v!==m.id&&Tp(m,_,Ko)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const x=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??wR(m,e,x);if(!v)continue;const _=x.get(v);!_||!_.container||yR(_,m,gR)||m.type==="bpmn:TextAnnotation"&&!ER(m,_,e)||n.push({kind:"shape-outside-container",shape:m.id,container:_.id})}return n.sort((m,v)=>ut(m).localeCompare(ut(v)))}const It=e=>typeof e=="object"&&e!==null?e:void 0,Ut=e=>typeof e=="number"?e:0,tr=e=>{const t=It(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function SR(e){const t=It(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=tr(o);a&&n.push(a)}}return n}function RR(e){const t=It(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:tr(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:tr(t.targetRef);return n&&i?{source:n,target:i}:{}}function CR(e,t){const n=It(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=tr(n);return r?t.get(r):void 0}if(yc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return tr(n)}function Xm(e){var a,s,c,l,u;const t=[],n=[],i=((a=It(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=It(e))==null?void 0:s.rootElements)??[]){const f=It(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=It(d),h=tr(g),y=tr(g==null?void 0:g.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const p of i){const f=It((c=It(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=It(g);if(!h)continue;const y=It(h.bpmnElement),C=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!C)continue;const x=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",m=It(h.bounds);if(m){const _=h.isExpanded===!1&&x!=="bpmn:Participant",S=It((l=It(h.label))==null?void 0:l.bounds),k={id:C,type:x,x:Ut(m.x),y:Ut(m.y),width:Ut(m.width),height:Ut(m.height),container:yc.has(x)&&!_,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:CR(y,r)}:{},...S?{label:{x:Ut(S.x),y:Ut(S.y),width:Ut(S.width),height:Ut(S.height)}}:{},...x==="bpmn:Group"?Um(Wm(y)):{}},O=h.isHorizontal!==!1,N=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(C)&&O&&N&&(k.label=Mp(k,N)),t.push(k);continue}const v=h.waypoint;if(Array.isArray(v)){const _=It((u=It(h.label))==null?void 0:u.bounds);n.push({id:C,type:x,waypoints:v.map(S=>{var k,O;return{x:Ut((k=It(S))==null?void 0:k.x),y:Ut((O=It(S))==null?void 0:O.y)}}),endpoints:SR(y),...RR(y),..._?{label:{x:Ut(_.x),y:Ut(_.y),width:Ut(_.width),height:Ut(_.height)}}:{}})}}}return{shapes:t,edges:n}}function Zm(e){return dt(Xm(e),{includeObservationOnly:!0})}async function MR(e){const{definitions:t,warnings:n}=await Vo(e);return{findings:Zm(t),warnings:n}}function qe(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=It(o.label),y=tr(o.source),C=tr(o.target);n.push({id:o.id,type:a,waypoints:s.map(x=>({x:Ut(x.x),y:Ut(x.y)})),endpoints:[y,C].filter(x=>!!x),...y&&C?{source:y,target:C}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Ut(h.y),width:Ut(h.width),height:Ut(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=It(o.businessObject),l=It(o.label);let u=It(o.parent);for(;u&&u.type==="bpmn:Lane";)u=It(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&yc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Ut(o.width),height:Ut(o.height),container:yc.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Ut(l.y),width:Ut(l.width),height:Ut(l.height)}}:{},...a==="bpmn:Group"?Um(Wm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=It(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Mp(d,g)),t.push(d)}return{shapes:t,edges:n}}const AR={"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 PR(e,t){const n=AR[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Qm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Jm(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 PR(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Qm(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Qm(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}},eventDefinitionOf:n=>{var o;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const r=(((o=i.businessObject)==null?void 0:o.eventDefinitions)??[]).map(a=>a.$type);return Qu(r)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:xr(i.businessObject).map(r=>r.locale)}}}const kp=20,TR=4,Dt=(e,t)=>Math.abs(e-t)<.5;function Sc(e,t,n,i=kp){if(Dt(e.y,t.y)&&!Dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Dt(e.x,t.x)&&!Dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function eg(e,t,n,i=kp){if(n.length<2)return null;if(Dt(e.y,t.y)&&!Dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(Dt(e.x,t.x)&&!Dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function tg(e,t,n=kp){if(e.length!==4)return null;const[i,r,o,a]=e;if(Dt(i.y,r.y)&&Dt(r.x,o.x)&&Dt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Dt(i.x,r.x)&&Dt(r.y,o.y)&&Dt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Rc(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const ng=30,kR=[0,-25,25,-40,40];function OR(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+ng:s-ng,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return kR.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>mn({...e,endpoints:[],waypoints:f},[n]).length===0)}const Op=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Zo=(e,t,n)=>mn({...e,waypoints:t},n).length;function Dp(e,t,n,i){let r=[...e.waypoints],o=Zo(e,r,t);if(o===0)return null;let a=!1;for(const p of Rc(e,t))if(Zo(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(hn),c=p=>hn({...e,waypoints:p}).some(f=>xc(f,s).length>0),l=OR(e,t).filter(p=>Zo(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&Dt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(Dt(d[0].y,d[1].y)&&!Dt(d[0].x,d[1].x)){const g=t.filter(x=>!e.endpoints.includes(x.id)&&mn({...e,waypoints:d},[x]).length>0),h=g.length>=2?eg(d[0],d[1],g):null,C=(h?h.map(x=>[d[0],...x,d[1]]):g.length===1?(Sc(d[0],d[1],g[0])??[]).map(x=>[d[0],...x,d[1]]):g.length===0?[d]:[]).filter(x=>Zo(e,x,t)===0&&x.length<=r.length).sort((x,m)=>Number(u(m))-Number(u(x)));if(C.length)return C.find(x=>!c(x))??C[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(C=>!e.endpoints.includes(C.id)&&mn({...e,waypoints:[f,d]},[C]).length>0);if(g.length<2)continue;const h=eg(f,d,g);if(!h)continue;const y=h.map(C=>Op(r,p,C)).filter(C=>Zo(e,C,t)===0).sort((C,x)=>Number(u(x))-Number(u(C)));if(y.length)return y.find(C=>!c(C))??y[0]}for(let p=0;p<TR&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const g=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||mn({...e,waypoints:[g,h]},[y]).length===0)continue;const C=Sc(g,h,y),x=C?C.map(v=>Op(r,d,v)):tg(r,y)??[];if(!x.length)continue;const m=[...x].sort((v,_)=>Number(u(_))-Number(u(v)));for(const v of m){const _=Zo(e,v,t);if(_<o){r=v,o=_,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Lp(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=qe(i),a=ci(o),s=new Set,c=dt(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ut(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=o.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=mn(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const y=Dp(p,a,g,o.edges);if(!y){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const C=o.edges.filter(v=>v.id!==u),x=ai(p,C);ai({...p,waypoints:y},C)>x||r.updateWaypoints(f,y)}return s}const DR=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},Ip=(e,t)=>Wa(e,[t])>0;function ig(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=qe(i),a=ci(o);let s=o;const c=new Set(dt(o).map(ut));for(const[l,u]of Ec(o))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(N=>N.id===p),g=s.edges.find(N=>N.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const y=h.parent,C=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,x=DR(g),m=[...Rc(d,a)??[]],v=Dp(d,[...a,...x],C,o.edges);v&&m.push(v);for(let N=0;N+1<d.waypoints.length;N++)for(const P of x)for(const D of Sc(d.waypoints[N],d.waypoints[N+1],P)??[])m.push(Op(d.waypoints,N,D));const _=s.edges.filter(N=>N.id!==p),S=N=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:N}:P)}),k=N=>!C||N.every(P=>P.x>=C.x&&P.x<=C.x+C.width&&P.y>=C.y&&P.y<=C.y+C.height),O=m.find(N=>{const P={...d,waypoints:N};return Ip(P,g)||!k(N)||_.some(D=>D.id!==f&&!Ip(d,D)&&Ip(P,D))?!1:dt(S(N)).every(D=>c.has(ut(D)))});if(O){r.updateWaypoints(h,O),s=S(O);break}}}const LR=10;function rg(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function og(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(j=>j.type==="bpmn:Participant"&&j.container),i=t.shapes.find(j=>j.id===e.endpoints[0]),r=t.shapes.find(j=>j.id===e.endpoints[1]);if(!i||!r)return null;const o=rg(i,n),a=rg(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(j=>j.id!==o.id&&j.id!==a.id&&j.y>=c.y+c.height&&j.y+j.height<=l.y).sort((j,ee)=>j.y-ee.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,y=s?g:d,C=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],m=ci(t),v=t.edges.filter(j=>j.id!==e.id),_=si(e,v),S=mn(e,m).length;if(_===0&&S===0||S===0&&e.waypoints.length===2)return null;const k=Math.min(...u.map(j=>j.x)),O=Math.max(...u.map(j=>j.x+j.width)),N=(C.x+x.x)/2,P=j=>j.filter((ee,ge)=>ge===0||!(Dt(ee.x,j[ge-1].x)&&Dt(ee.y,j[ge-1].y)));let D;for(let j=k;j<=O;j+=LR){const ee=P([C,{x:C.x,y:h},{x:j,y:h},{x:j,y},{x:x.x,y},x]),ge={...e,waypoints:ee};if(mn(ge,m).length>0)continue;const Pe=si(ge,v),De=Math.abs(j-N);(!D||Pe<D.cross||Pe===D.cross&&De<D.detour)&&(D={pts:ee,cross:Pe,detour:De})}return D&&(S>0?D.cross<=_:D.cross<_)?D.pts:null}function ag(e,t){const{elementRegistry:n}=e,i=e.modeling,r=qe(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=qe(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=og(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const $i=[25,-25,40,-40],Qo=35;function IR(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-Qo:Math.max(e.y+e.height,t.y+t.height)+Qo;for(const l of[0,...$i])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...$i]){if(Math.abs(u)>=t.width/2-5)continue;const p=n+l,f=i+u;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function Cc(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return IR(n,i);const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-Qo:n.y+n.height+Qo,p=[];for(const x of[0,...$i]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;p.push({pts:[{x:n.x,y:r},{x:m,y:r},{x:m,y:c}],cost:Math.abs(x)});for(const v of[0,...$i]){if(Math.abs(v)>=n.width/2-5)continue;const _=a+v;p.push({pts:[{x:_,y:l},{x:_,y:u},{x:m,y:u},{x:m,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const x of[0,...$i]){if(Math.abs(x)>=n.width/2-5)continue;const m=a+x;p.push({pts:[{x:m,y:g},{x:m,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,y=s?i.y+i.height:i.y,C=s?i.y+i.height+Qo:i.y-Qo;for(const x of[0,...$i]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;for(const v of[0,...$i]){if(Math.abs(v)>=n.width/2-5)continue;const _=a+v;p.push({pts:[{x:_,y:g},{x:_,y:C},{x:m,y:C},{x:m,y}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const Mc=30;function sg(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Dt(i.y,r.y)&&!Dt(i.x,r.x),a=Dt(i.x,r.x)&&!Dt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Mc||Math.abs(i.y-(s.y+s.height))<Mc)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Mc||Math.abs(i.x-(s.x+s.width))<Mc)return!0}}return!1}const Ac=40;function BR(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Ac,a=r.x+r.width+Ac,s=r.y-Ac,c=r.y+r.height+Ac;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function cg(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(S=>S.container),i=new Map(t.shapes.map(S=>[S.id,S])),r=ci(t),o=t.edges.filter(S=>S.id!==e.id),a=ai(e,o),s=si(e,o),c=S=>BR(S,t.shapes,e.endpoints)+(sg(S,n)?1:0),l=c(e.waypoints),u=S=>{if(!S)return;const k=S.x+S.width/2,O=S.y+S.height/2;return n.find(N=>N.type==="bpmn:Lane"&&k>=N.x&&k<=N.x+N.width&&O>=N.y&&O<=N.y+N.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=S=>{if(!d||!f)return!1;for(let k=1;k<S.length-2;k++){const O=S[k],N=S[k+1];if(Dt(O.y,N.y)&&!Dt(O.x,N.x)&&O.y>f.y&&O.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),C=(S=>{if(!S)return;const k=S.x+S.width/2,O=S.y+S.height/2;return n.filter(N=>N.type==="bpmn:Participant"&&k>=N.x&&k<=N.x+N.width&&O>=N.y&&O<=N.y+N.height).sort((N,P)=>N.width*N.height-P.width*P.height)[0]})(i.get(e.endpoints[0]??"")),x=S=>{if(!C)return 0;let k=0;for(let O=1;O<S.length-1;O++){const N=S[O];(N.x<C.x||N.x>C.x+C.width||N.y<C.y||N.y>C.y+C.height)&&k++}return k},m=x(e.waypoints);if(!sg(e.waypoints,n)&&!(d&&!h)&&m===0)return null;const v=S=>S.reduce((k,O,N)=>N?k+Math.abs(O.x-S[N-1].x)+Math.abs(O.y-S[N-1].y):0,0);let _;for(const{pts:S,cost:k}of Cc(e,i)){const O={...e,waypoints:S};if(mn(O,r).length>0)continue;const N=ai(O,o);if(N>a)continue;const P=x(S);if(P>m)continue;const D=P<m&&N===0;if(!D&&si(O,o)>s)continue;const j=c(S),ee=g(S);if(!D&&!(ee&&!h)&&j>=l)continue;const Pe=ee?0:1,De=v(S);(!_||P<_.out||P===_.out&&(Pe<_.lane||Pe===_.lane&&(N<_.opp||N===_.opp&&(j<_.sc||j===_.sc&&(k<_.cost||k===_.cost&&De<_.len)))))&&(_={pts:S,out:P,sc:j,lane:Pe,opp:N,cost:k,len:De})}return(_==null?void 0:_.pts)??null}function NR(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,r=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),o=r.filter(p=>p.endpoints[1]===i),a=r.filter(p=>p.endpoints[0]===i);if(o.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function $R(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=qe(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of o){const s=qe(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=ci(s),u=s.edges.filter(y=>y.id!==a),p=mn(c,l).length,f=ai(c,u),d=si(c,u),g=n.has(a)?new Set(dt(s).map(ut)):null,h=Rc(c,s.shapes);h.length===2&&NR(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const C={...c,waypoints:y};if(mn(C,l).length>p||ai(C,u)>f||si(C,u)>d)continue;if(g){const m=new Set(dt({...s,edges:s.edges.map(S=>S.id===a?C:S)}).map(ut)),v=[...m].filter(S=>!g.has(S)).length,_=[...g].filter(S=>!m.has(S)).length;if(v>_)continue}const x=i.get(a);x&&r.updateWaypoints(x,y);break}}}function lg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=qe(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=qe(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=cg(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function Bp(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Dt(n[0].x,n[1].x)&&!Dt(n[0].y,n[1].y),s=Dt(n[n.length-1].x,n[n.length-2].x)&&!Dt(n[n.length-1].y,n[n.length-2].y);for(const c of $i){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function FR(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const C of[0,...$i])Math.abs(C)<i.width/2-5&&y.push({pts:[{x:f,y:l},{x:u+C,y:l},{x:u+C,y:h}],cost:Math.abs(C)}),Math.abs(C)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:p+C},{x:g,y:p+C}],cost:Math.abs(C)});return y}function Np(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(r+o)/2,p=[];for(const f of[0,...$i]){const d=u+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function ug(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ci(t),r=t.edges.filter(d=>d.id!==e.id),o=ai(e,r);if(o===0)return null;const a=si(e,r);let s;const c=d=>d.reduce((g,h,y)=>y?g+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],y=Math.hypot(h.x-g.x,h.y-g.y);return y>=1&&c(d)/y>=l?1:0},p=u(e.waypoints),f=[...Cc(e,n),...Np(e,n),...Bp(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(mn(h,i).length>0)continue;const y=ai(h,r),C=si(h,r),x=o-y+(p-u(d));if(y>=o||C-a>x)continue;const m=c(d);(!s||y<s.opposite||y===s.opposite&&(C<s.cross||C===s.cross&&(g<s.cost||g===s.cost&&m<s.len)))&&(s={pts:d,opposite:y,cross:C,cost:g,len:m})}return(s==null?void 0:s.pts)??null}function pg(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Yo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function jR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ci(t),r=t.edges.filter(f=>f.id!==e.id),o=pg(e,r);if(o===0)return null;const a=ai(e,r),s=si(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Cc(e,n),...Np(e,n),...FR(e,n),...Bp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(mn(g,i).length>0)continue;const h=pg(g,r);if(h>=o)continue;const y=ai(g,r);if(y-h>a-o)continue;const C=si(g,r);if(C-s>(o-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:y,cross:C,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function fg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=dt(qe(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ut(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=qe(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=jR(l,c);if(!u)continue;const p=i.get(s);p&&r.updateWaypoints(p,u)}}function dg(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 hg(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Yo(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:dg(e,n)&&dg(t,n)}function mg(e,t,n){let i=0;for(const r of t)r.id!==e.id&&hg(e,r,n)&&i++;return i}function HR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ci(t),r=t.edges.filter(f=>f.id!==e.id),o=mg(e,r,n);if(o===0)return null;const a=ai(e,r),s=si(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Cc(e,n),...Np(e,n),...Bp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(mn(g,i).length>0)continue;const h=mg(g,r,n);if(h>=o)continue;const y=ai(g,r);if(y-h>a-o)continue;const C=si(g,r);if(C-s>(o-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:y,cross:C,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function zR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=qe(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=dt(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ut(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!u||!p||!hg(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=qe(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=HR(p,u);if(!f)continue;const d=i.get(l);d&&r.updateWaypoints(d,f)}}function gg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=qe(i),a=dt(o).filter(u=>Ap(u)&&!t.has(ut(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Ap(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=o.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=qe(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=ug(f,p);if(!d)continue;const g=i.get(u);g&&r.updateWaypoints(g,d)}}const GR=10,VR=(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 yg(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!_c(e,i))return null;const r=ci(t),o=i.flatMap(hn);for(const a of hn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of xc(a,o))s=s.flatMap(([h,y])=>{const C=[];return d>h&&C.push([h,Math.min(y,d)]),g<y&&C.push([Math.max(h,g),y]),C.filter(([x,m])=>m>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+GR*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Bm}:{x:a.at+En+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!_c({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&VR(f,d)))return f}return null}const En=8;function $p(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,g=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Xo)],l=f=>!c.some(d=>Ni(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+En,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+En,s.at-En-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-En-n.height,s.at+En])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const vg=30,WR=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n},bg=(e,t)=>WR({x:e.x+e.width/2,y:e.y+e.height/2},t);function UR(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(hn),...t.shapes.filter(c=>c.container).flatMap(Xo)],o=co(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!r.some(l=>Ni(c,l))&&!Ua(c,t).length&&!o.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+En,c.at-En-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+En,c.at-En-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 xg(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=qe(n),o=new Set(dt(r).map(ut));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((S,k)=>S.x-u[k].x===d&&S.y-u[k].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const S=r.edges.find(D=>D.id===c);if(!(S!=null&&S.label)||!Ua(S.label,r).length)continue;let k={...S.label,x:l.label.x,y:l.label.y};if((Ua(k,r).length||bg(k,S.waypoints)>vg)&&(k=null),!k&&bg(S.label,S.waypoints)>vg&&(k=UR(S,r)),!k)continue;const O=k,N={...r,edges:r.edges.map(D=>D.id===c?{...D,label:O}:D)},P=dt(N);if(P.some(D=>!o.has(ut(D))))continue;i.moveElements([f],{x:O.x-f.x,y:O.y-f.y}),r=N,o=new Set(P.map(ut));continue}const y=l.label.x+d-f.x,C=l.label.y+g-f.y;if(y===0&&C===0)continue;const x=r.edges.find(S=>S.id===c);if(!(x!=null&&x.label))continue;const m={...x.label,x:x.label.x+y,y:x.label.y+C},v={...r,edges:r.edges.map(S=>S.id===c?{...S,label:m}:S)},_=dt(v);_.some(S=>!o.has(ut(S)))||(i.moveElements([f],{x:y,y:C}),r=v,o=new Set(_.map(ut)))}}function _g(e,t,n=new Set){const{elementRegistry:i}=e,r=e.modeling,o=qe(i);for(const a of o.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=$p(a,o);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&r.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function wg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=qe(i),a=dt(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ut(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const l=yg(c,o);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function Eg(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Xo)],r=i.filter(f=>Ni(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=co(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Ni(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of r)f.axis==="h"?l.push({...n,y:f.at-En-n.height},{...n,y:f.at+En}):l.push({...n,x:f.at-En-n.width},{...n,x:f.at+En});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+En},{...n,x:u-n.width/2,y:e.y-En-n.height},{...n,x:e.x+e.width+En,y:p-n.height/2},{...n,x:e.x-En-n.width,y:p-n.height/2}),l.find(c)??null}function Sg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=qe(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Eg(o,qe(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function qR(e,t){const n=e.x,i=e.x+e.width,r=e.y,o=e.y+e.height;if(t.x<n||t.x>i||t.y<r||t.y>o)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,r),o))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-r,{x:t.x,y:r}],[o-t.y,{x:t.x,y:o}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function Rg(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=qe(n),o=new Set(dt(r).map(ut));const a=[...new Set(dt(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ut(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,y]of u){const C=h?r.shapes.find(m=>m.id===h):void 0;if(!C)continue;const x=qR(C,l[y]);x.x===l[y].x&&x.y===l[y].y||(l[y]=x,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=dt(f);if(d.some(h=>!o.has(ut(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),r=f,o=new Set(d.map(ut)))}}const Fp=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Cg(e,t){const n=(r,o,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>o?`${o}.${u}`:u;return{id:r,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((r,o)=>n(r.id,`participant.lanes[${o}]`,r))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((r,o)=>({...n(r.id,`lanes[${o}]`,r),omittedMeansRemove:(t==null?void 0:t.categoryOf(r.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function YR(e,t,n){const i=[],r=n?ja(n):[];return e.forEach((o,a)=>{if(o.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:o.id,field:"locale"});return}if(!r.includes(o.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:o.id,field:"locale",locale:o.locale,locales:r});return}t.categoryOf(o.id)!==void 0&&!t.reviewRequestLocalesOf(o.id).includes(o.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:o.id,locale:o.locale});return}for(const s of Cg(o,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:r});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:r});continue}if(!l)continue;if(!Fp(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):r.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:r}),p=!1);if(!p)continue;const f=r.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function hi(e,t,n){const i=t==="text"?"texts":"names",{[i]:r,...o}=e;return n===void 0?o:{...o,[t]:n}}function KR(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:r}=n,o=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(Fp(c.map)){const l=c.map;return o(c.id).texts={...l},l[r]}if(c.plain===null||c.condition===null&&c.plain===void 0){o(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(o(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=o(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=Cg(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=hi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>hi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=hi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>hi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:hi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:hi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:hi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:hi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:hi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:hi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(hi(c,"text",a(l[0])));break;default:s.push(Fp(l[0].map)?hi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const XR=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Mg=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Ag={"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}]},qa=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Pc=e=>typeof e=="string"&&e!=="";function ZR(e){const t=[];function n(i,r,o,a){if(a===null){Pc(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!qa(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Pc(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a,s;if(!qa(i)||!Pc(i.kind)||!(i.kind in Ag)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const c of Ag[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!qa(f))break;f=f[g]}if(!qa(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(r,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:r,field:c.path});continue}d.forEach((g,h)=>n(r,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;qa(c)&&!Pc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:r,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const l=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Jh(l)){t.push({kind:"node-type-unsupported",opIndex:r,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!em(p)){t.push({kind:"payload-invalid",opIndex:r,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:r,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function Pg(e,t,n={}){const i=ZR(e);if(i.length>0)return i;const r=[],o=new Map,a=new Map;function s(h,y,C){if(!XR.test(y)){r.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||o.has(y)){r.push({kind:"id-duplicate",opIndex:h,id:y});return}o.set(y,{...C,opIndex:h})}e.forEach((h,y)=>{var C;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(y,x.id,{category:"lane"});break;case"node.add":s(y,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(y,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,h.dataStore.id,{category:"dataStore"});for(const x of h.associations??[])x.id&&s(y,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(y,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(y,h.association.id,{category:"association"});break;case"annotation.add":s(y,h.annotation.id,{category:"annotation"}),(C=h.association)!=null&&C.id&&s(y,h.association.id,{category:"association"});break;case"group.add":s(y,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(y,x.id,{category:"lane"})}break}});const c=h=>{var y;return((y=o.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=o.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,C,x){const m=c(y);if(m===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:C});return}if(x&&!x.includes(m)){r.push({kind:"ref-category",opIndex:h,ref:y,role:C,expected:x.join("|"),actual:m});return}return m}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var C;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:x,lane:m}=h.node;if(x===void 0){(p||m!==void 0)&&r.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,x,"participant",["participant"])===void 0)break;m!==void 0&&((((C=o.get(x))==null?void 0:C.lanes)??a.get(x)??t.lanesOf(x)).includes(m)||r.push({kind:"lane-unknown",opIndex:y,lane:m,participant:x}));break}case"sequenceFlow.add":{const{id:x,source:m,target:v,name:_,condition:S}=h.flow,k=u(y,m,"source",["flowNode"]),O=u(y,v,"target",["flowNode"]);k&&O&&l(m)!==l(v)&&r.push({kind:"flow-cross-pool",opIndex:y,id:x}),_!==void 0&&S!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:x});break}case"messageFlow.add":{const{id:x,source:m,target:v}=h.flow,_=u(y,m,"source",["flowNode","participant"]),S=u(y,v,"target",["flowNode","participant"]);if(_&&S){const k=l(m),O=l(v);k!==void 0&&k===O&&r.push({kind:"message-flow-same-pool",opIndex:y,id:x})}for(const k of[m,v])d(k)&&r.push({kind:"message-flow-timer-endpoint",opIndex:y,id:x,ref:k});break}case"dataStore.add":{for(const x of h.associations??[]){if([x.source,x.target].filter(_=>_===h.dataStore.id).length!==1){r.push({kind:"data-association-ends",opIndex:y,source:x.source,target:x.target});continue}const v=x.source===h.dataStore.id?x.target:x.source;u(y,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:x,target:m}=h.association,v=u(y,x,"source"),_=u(y,m,"target");if(v&&_){const S=new Set([v,_]);S.has("dataStore")&&S.has("flowNode")||r.push({kind:"data-association-ends",opIndex:y,source:x,target:m})}break}case"association.add":{const{id:x,source:m,target:v}=h.association,_=u(y,m,"source"),S=u(y,v,"target");_&&S&&_!=="annotation"&&S!=="annotation"&&r.push({kind:"association-detached",opIndex:y,annotation:x??`${m}->${v}`});break}case"annotation.add":{if(h.association){const{source:x,target:m}=h.association;if(x!==h.annotation.id&&m!==h.annotation.id)r.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const v=x===h.annotation.id?m:x;u(y,v,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const x of h.group.members??[]){const m=u(y,x,"member");m&&Mg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const x=t.lanesOf(h.id),m=h.lanes.map(_=>_.id);for(const _ of x)m.includes(_)||r.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:_});for(const _ of m)t.categoryOf(_)!==void 0&&!x.includes(_)&&r.push({kind:"id-duplicate",opIndex:y,id:_});const v=m.filter(_=>x.includes(_));v.length===x.length&&v.some((_,S)=>_!==x[S])&&r.push({kind:"lane-reorder-unsupported",opIndex:y,participant:h.id})}break}case"node.update":{if(g(y,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const x=t.participantOf(h.id);(x?a.get(x)??t.lanesOf(x):[]).includes(h.lane)||r.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:x??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const x=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,m=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),_=h.source??(v==null?void 0:v.source),S=h.target??(v==null?void 0:v.target);x&&m&&_!==void 0&&S!==void 0&&new Set([l(_),l(S),l(h.id)]).size>1&&r.push({kind:"flow-cross-pool",opIndex:y,id:h.id})}break}case"messageFlow.update":g(y,h.id,"messageFlow");break;case"dataStore.update":g(y,h.id,"dataStore");break;case"annotation.update":{if(g(y,h.id,"annotation")===void 0)break;h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.update":{if(g(y,h.id,"group")===void 0)break;for(const x of h.members??[]){const m=u(y,x,"member");m&&Mg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&r.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),r.push(...YR(e,t,n.i18n)),r;function g(h,y,C){if(o.has(y)){r.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const x=t.categoryOf(y);if(x===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(C&&x!==C){r.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:C,actual:x});return}return x}}function Tg(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 Tc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const kc={"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]},Sn=10,QR=300,JR=160,kg=20,jp=100,Og=40,eC=10;function Hp(e,t,n,i,r){const o=n,a=(P,D)=>{const[j,ee]=kc[P];let ge={x:t.x+t.width/2+j*(t.width/2+o.width/2+D),y:t.y+t.height/2+ee*(t.height/2+o.height/2+D)};const Pe=i.x+Sn+o.width/2,De=i.x+i.width-Sn-o.width/2,Ye=i.y+Sn+o.height/2,ot=i.y+i.height-Sn-o.height/2,Me={x:Math.min(De,Math.max(Pe,ge.x)),y:Math.min(ot,Math.max(Ye,ge.y))};return(Me.x!==ge.x||Me.y!==ge.y)&&(ge=Math.abs(Me.x-(t.x+t.width/2))<(t.width+o.width)/2+Sn&&Math.abs(Me.y-(t.y+t.height/2))<(t.height+o.height)/2+Sn?{x:t.x+t.width+Sn+o.width/2,y:Me.y}:Me),ge},s=(i.children??[]).filter(P=>!("waypoints"in P&&P.waypoints)&&P.type!=="bpmn:Lane"&&P.type!=="label"&&typeof P.x=="number"&&P.id!==r.selfId),c=qe(e),l=P=>{var j,ee;if(!r.selfId)return!1;const D=e.get(P);return!!D&&(((j=D.source)==null?void 0:j.id)===r.selfId||((ee=D.target)==null?void 0:ee.id)===r.selfId)},u=c.edges.filter(P=>!l(P.id)).flatMap(hn),p=co(c).filter(P=>P.owner!==r.selfId).map(P=>P.rect),f=P=>({x0:P.x-o.width/2-Sn,x1:P.x+o.width/2+Sn,y0:P.y-o.height/2-Sn,y1:P.y+o.height/2+Sn}),d=P=>{const D=f(P);return s.some(j=>D.x0<j.x+j.width&&D.x1>j.x&&D.y0<j.y+j.height&&D.y1>j.y)},g=P=>{const D=f(P);return u.some(j=>j.axis==="h"?j.at>D.y0&&j.at<D.y1&&j.lo<D.x1&&j.hi>D.x0:j.at>D.x0&&j.at<D.x1&&j.lo<D.y1&&j.hi>D.y0)},h=P=>{const D=f(P);return p.some(j=>D.x0<j.x+j.width&&D.x1>j.x&&D.y0<j.y+j.height&&D.y1>j.y)},y=c.shapes.filter(P=>P.type==="bpmn:Group").flatMap(P=>[{axis:"h",at:P.y,lo:P.x,hi:P.x+P.width},{axis:"h",at:P.y+P.height,lo:P.x,hi:P.x+P.width},{axis:"v",at:P.x,lo:P.y,hi:P.y+P.height},{axis:"v",at:P.x+P.width,lo:P.y,hi:P.y+P.height}]),C=P=>{const D=f(P);return y.some(j=>j.axis==="h"?j.at>D.y0&&j.at<D.y1&&j.lo<D.x1&&j.hi>D.x0:j.at>D.x0&&j.at<D.x1&&j.lo<D.y1&&j.hi>D.y0)},x=P=>d(P)||g(P)||h(P)||C(P),m=P=>P.x-o.width/2>=i.x&&P.x+o.width/2<=i.x+i.width&&P.y-o.height/2>=i.y&&P.y+o.height/2<=i.y+i.height;if(r.placement){const P=De=>De.startsWith("top")?De.replace(/^top/,"bottom"):De.replace(/^bottom/,"top"),D=De=>De.endsWith("left")?De.replace(/left$/,"right"):De.replace(/right$/,"left"),j=r.placement.side,ee=[j,P(j),D(j),P(D(j)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ge=r.placement.offset??50;let Pe=a(j,ge);if(x(Pe)){const De=new Set;for(const Ye of ee){if(De.has(Ye))continue;De.add(Ye);const ot=a(Ye,ge);if(m(ot)&&!x(ot)){Pe=ot;break}}}return Pe}const v=r.from,_=i.x+Sn+o.width/2,S=i.x+i.width-Sn-o.width/2,k=i.y+Sn+o.height/2,O=i.y+i.height-Sn-o.height/2;let N={x:Math.min(S,Math.max(_,v.x)),y:Math.min(O,Math.max(k,v.y))};if(x(N)){const P=(t.width+o.width)/2+Sn,j=[{x:N.x+P,y:N.y},{x:N.x-P,y:N.y},{x:N.x,y:N.y-o.height-Sn},{x:N.x,y:N.y+o.height+Sn}].filter(m).find(ee=>!x(ee));j&&(N=j)}return N}function Kt(e,t){return e.filter(n=>n.kind===t)}class Dg extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function Lg(e,t){var LE,IE,BE,NE,$E,FE,jE,HE,zE,GE,VE,WE,UE,qE,YE,KE,XE,ZE,QE,JE,e1,t1,n1;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>o.get(b),f=b=>{const E=p(b);if(!E)throw new Error(`하강 참조 해소 실패: ${b}`);return E},d=b=>{let E=b.parent;for(;E;){if(E.type==="bpmn:Participant")return E;E=E.parent}},g=new Map;for(const b of o.filter(E=>!("waypoints"in E&&E.waypoints)&&E.type!=="bpmn:Lane"&&E.type!=="label"&&typeof E.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=Kt(e,"participant.add"),y=Kt(e,"node.add"),C=Kt(e,"sequenceFlow.add"),x=Kt(e,"messageFlow.add"),m=Kt(e,"dataStore.add"),v=Kt(e,"dataAssociation.add"),_=Kt(e,"annotation.add"),S=Kt(e,"group.add"),k=new Map(y.map(b=>[b.node.id,b])),O=(b,E,A)=>{var F;const T=b.businessObject,I=(((F=T.extensionElements)==null?void 0:F.values)??[]).filter(B=>B.$type!==E),L=A?[...I,i.create(E,A)]:I;if(!L.length){T.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const H=i.create("bpmn:ExtensionElements",{values:L});L.forEach(B=>{B.$parent=H}),n.updateProperties(b,{extensionElements:H})},N=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Kt(e,"element.remove")){const E=p(b.id);E&&n.removeElements([E])}const P=b=>o.filter(E=>{var A;return E.type==="bpmn:Lane"&&((A=d(E))==null?void 0:A.id)===b}).sort((E,A)=>E.y-A.y);for(const b of Kt(e,"participant.update")){const E=f(b.id);if(b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),!b.lanes)continue;const A=P(b.id);if(!A.length){n.splitLane(E,b.lanes.length),P(b.id).forEach((I,L)=>{const H=b.lanes[L];H&&n.updateProperties(I,{id:H.id,name:H.name})});continue}const T=new Set(A.map(I=>I.id));b.lanes.forEach((I,L)=>{if(T.has(I.id)){n.updateProperties(f(I.id),{name:I.name});return}const H=L===0?n.addLane(P(b.id)[0],"top"):n.addLane(f(b.lanes[L-1].id),"bottom");n.updateProperties(H,{id:I.id,name:I.name})})}const D=150,j=130,ee=80,ge=90,Pe=180,De=30,Ye=30,ot=(b,E,A,T,I)=>{const L=A-E.width/2,H=T-E.height/2;return(b.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(I!=null&&I.has(F.id))&&typeof F.x=="number"&&L<F.x+F.width+Ye&&L+E.width+Ye>F.x&&H<F.y+F.height&&H+E.height>F.y)},Me=new Set;for(const b of h){Me.add(`pool:${b.participant.id}`);for(const E of b.participant.lanes??[])Me.add(E.id)}const X=new Map;for(const b of y){const E=b.node.lane??`pool:${b.node.participant??""}`;let A=X.get(E);A||X.set(E,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const ne=new Map;for(const[b,E]of X){if(!Me.has(b))continue;const A=[...E].sort((L,H)=>L-H),T=A.map((L,H)=>H===0?0:H%2===1?Math.ceil(H/2):-(H/2)),I=Math.min(...T);ne.set(b,new Map(A.map((L,H)=>[L,T[H]-I])))}{const b=new Map;for(const E of h)(E.participant.lanes??[]).forEach((A,T)=>b.set(A.id,T));for(const[E,A]of ne){if(!b.has(E)||A.size<2)continue;const T=b.get(E),I=A.get(0)??0,L=new Set;for(const J of y){if(J.node.lane!==E||(J.band??0)!==0||!J.node.type.endsWith("Gateway"))continue;const de={in:new Set,out:new Set,cross:new Set};for(const pe of C){const me=pe.flow.source===J.node.id;if(!me&&pe.flow.target!==J.node.id)continue;const Ke=k.get(me?pe.flow.target:pe.flow.source);if(!Ke||Ke.node.participant!==J.node.participant||!Ke.node.lane)continue;let Ce,Q=!1;if(Ke.node.lane!==E){const re=b.get(Ke.node.lane);if(re===void 0)continue;Ce=re>T?"down":"up",Q=!0}else{const re=A.get(Ke.band??0)??I;Ce=re>I?"down":re<I?"up":void 0}Ce&&(de[me?"out":"in"].add(Ce),Q&&de.cross.add(Ce))}for(const pe of["up","down"])de.in.has(pe)&&de.out.has(pe)&&de.cross.has(pe)&&L.add(pe)}if(L.size!==1)continue;const[H]=L,F=Math.max(...A.values()),B=H==="down"?F:0;if(I===B)continue;const V=[...A.entries()].filter(([J])=>J!==0).sort((J,de)=>J[1]-de[1]),Y=[...Array(F+1).keys()].filter(J=>J!==B),ie=new Map([[0,B]]);V.forEach(([J],de)=>ie.set(J,Y[de])),ne.set(E,ie)}}const q=b=>{var E;return(((E=X.get(b))==null?void 0:E.size)??0)>1},K=b=>b.band??(b.node.lane||!q(`pool:${b.node.participant??""}`)?void 0:0),ae=new Map,fe=b=>ae.get(b.node.id)??K(b),Te=new Set,$=new Set;{const b=new Map;for(const T of C)b.set(T.flow.target,(b.get(T.flow.target)??0)+1);const E=T=>{const I=[],L=new Set([T]),H=[T];for(;H.length;){const F=H.shift();I.push(F);for(const B of C)B.flow.source!==F||L.has(B.flow.target)||(b.get(B.flow.target)??0)!==1||(L.add(B.flow.target),H.push(B.flow.target))}return I},A=(T,I)=>{var L;return((L=ne.get(T))==null?void 0:L.get(I))??I};for(const T of y){if(!T.node.type.endsWith("Gateway"))continue;const I=T.node.lane??`pool:${T.node.participant??""}`,L=ne.get(I);if(!L||L.size<2)continue;const H=fe(T);if(H===void 0||A(I,H)!==A(I,0))continue;const F=A(I,H),B=C.filter(pe=>pe.flow.source===T.node.id).map(pe=>k.get(pe.flow.target)).filter(pe=>!!pe&&(pe.node.lane??`pool:${pe.node.participant??""}`)===I),V=B.filter(pe=>{const me=fe(pe);return me!==void 0&&A(I,me)===F&&(b.get(pe.node.id)??0)===1}),Y=B.some(pe=>{const me=fe(pe);return me!==void 0&&A(I,me)>F});if(V.length!==1||!Y)continue;const ie=new Set(B.flatMap(pe=>E(pe.node.id)));if(!C.some(pe=>pe.flow.target===T.node.id&&ie.has(pe.flow.source)))continue;const de=new Map;for(const[pe,me]of L)de.set(pe,me+1);de.set(-1,0),ne.set(I,de);for(const pe of E(V[0].node.id))k.has(pe)&&(ae.set(pe,-1),$.add(pe));Te.add(T.node.id)}}const R=(b,E)=>{var A;return((A=ne.get(b))==null?void 0:A.get(E))??E},w=(b,E,A,T)=>{const I=b?p(b):E?p(E):void 0;if(!I)return!1;const L=b?I.y+Math.min(I.height/2,ge):I.y+ee;return Math.abs(L+R(b??`pool:${E??""}`,A)*D-T)<=D/2},G=new Map;for(const[b,E]of X){let A=0;for(const T of E)A=Math.max(A,R(b,T));G.set(b,A)}const W=b=>Pe+D*b,te=(b,E,A)=>{const T=u().children.filter(I=>!("waypoints"in I&&I.waypoints)&&I.type!=="label"&&I.id!==E&&typeof I.y=="number"&&I.y>=b);T.length&&n.moveElements(T,{x:0,y:A})},Re=(b,E,A)=>{const T=b.type==="bpmn:Participant"?b:void 0;if(!T||T.children.some(F=>F.type==="bpmn:Lane"))return;const I=A+E.height/2+De-T.y;if(T.height>=I)return;const L=I-T.height,H=T.y+T.height;n.resizeShape(T,{x:T.x,y:T.y,width:T.width,height:I}),te(H,T.id,L)},Je=(b,E)=>{const A=E-b.height;if(A<=0)return;const T=d(b)??b,I=[],L=B=>{I.push(B);for(const V of B.children??[])L(V)};L(T);const H=b.y+b.height-10,F=l.calculateAdjustments(I,"y",A,H);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",H)},ht=(b,E,A)=>{if(b){const H=f(b),F=W(E);if(H.height>=F)return;const B=F-H.height,V=d(H),Y=V?V.y+V.height:H.y+H.height;Je(H,F),te(Y,V==null?void 0:V.id,B);return}if(!A)return;const T=D*(E+1);if(A.height>=T)return;const I=T-A.height,L=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:T}),te(L,A.id,I)},Gt=new Map;for(const b of C)Gt.set(b.flow.target,(Gt.get(b.flow.target)??0)+1);const _t=b=>(Gt.get(b)??0)<=1,pn=new Set(y.map(b=>b.node.id).filter(b=>Kt(e,"sequenceFlow.update").filter(E=>E.target===b).length===1&&!C.some(E=>E.flow.target===b||E.flow.source===b&&k.has(E.flow.target)))),_n=new Map,jn=(b,E)=>{if(!b)return;const A=p(b);if(!A||A.height>=W(E))return;const T=A.y+A.height-10,I=d(A);if(I)return new Set((I.children??[]).filter(L=>L.type!=="bpmn:Lane"&&typeof L.y=="number"&&L.y>T).map(L=>L.id))},At=(b,E,A)=>{if(!b)return!0;const T=p(b);return T?A-E.height/2>=T.y&&A+E.height/2<=T.y+T.height:!0},Yt=h.map((b,E)=>({op:b,declared:E}));Yt.sort((b,E)=>{const A=b.op.order??Number.POSITIVE_INFINITY,T=E.op.order??Number.POSITIVE_INFINITY;return A!==T?A-T:b.declared-E.declared});let yn=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(yn=Math.max(yn,b.y+b.height+60));for(const{op:b}of Yt){const E=b.participant,A=y.filter(J=>J.node.participant===E.id).length,T=((LE=E.lanes)==null?void 0:LE.length)??0,I=Math.max(1200,A*160+300),L=(E.lanes??[]).map(J=>W(G.get(J.id)??0)),H=L.reduce((J,de)=>J+de,0);T&&H<300&&(L[T-1]+=300-H);const F=Math.max(300,D*((G.get(`pool:${E.id}`)??0)+1)),B=E.blackBox||A+T===0?120:T?Math.max(300,H):F,V=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:E.id,name:E.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...E.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:I,height:B,isExpanded:!0}),Y=n.createShape(V,{x:100+I/2,y:yn+B/2},u()),ie=E.lanes??[];if(ie.length&&n.splitLane(Y,ie.length),ie.length){const J=o.filter(de=>{var pe;return de.type==="bpmn:Lane"&&((pe=d(de))==null?void 0:pe.id)===E.id}).sort((de,pe)=>de.y-pe.y);if(J.forEach((de,pe)=>{const me=ie[pe];me&&n.updateProperties(de,{id:me.id,name:me.name})}),L.some(de=>de!==Y.height/T)){let de=Y.y;J.forEach((pe,me)=>{const Ke=L[me];n.resizeShape(pe,{x:pe.x,y:de,width:pe.width,height:Ke}),de+=Ke})}}yn=Y.y+Y.height+60}const Da=b=>{var T;const E=k.get(b);if(E)return E.node.participant??"";const A=p(b);return A?A.type==="bpmn:Participant"?A.id:((T=d(A))==null?void 0:T.id)??"":""},Hn=new Map,Oi=b=>{let E=Hn.get(b);return E||Hn.set(b,E={nodes:[],flows:[]}),E};for(const b of y)Oi(b.node.participant??"").nodes.push(b);for(const b of C)Oi(Da(b.flow.source)).flows.push(b);const ii=b=>{var E;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((E=b.condition)==null?void 0:E.label)})},Zt=(b,E,A)=>r.createShape({type:Tc(b.type),...b.eventDefinition?{eventDefinitionType:oc[b.eventDefinition]}:{},businessObject:i.create(Tc(b.type),{id:b.id,name:b.name,...E!==void 0?{"bwl:band":E}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Mo=[...Yt.map(({op:b})=>b.participant.id).filter(b=>Hn.has(b)),...[...Hn.keys()].filter(b=>!h.some(E=>E.participant.id===b))],La=b=>b.endsWith("Gateway");for(const b of Mo){const E=Hn.get(b),A=b?f(b):void 0,T=A?A.x+150:250;let I=A?A.y+80:120;const L=(Q,re,se)=>{if(Q){const ve=f(Q);return ve.y+Math.min(ve.height/2,ge)+R(Q,re??0)*D}return re!==void 0&&A?A.y+ee+R(`pool:${b}`,re)*D:se},H=(Q,re,se)=>{if(Q){const ve=f(Q);return ve.y+Math.min(ve.height/2,ge)+re*D}return A?A.y+ee+re*D:se},F=Q=>Q.participant?f(Q.participant):u(),B=(Q,re,se,ve,tt,Ve,vt,kt)=>{const xe=se!==void 0||ve!==void 0,be=$e=>{const we=()=>ht(se,$e,A);kt?kt(we):we()},oe=R(se??`pool:${b}`,ve??0);if((ve===void 0||w(se,b,ve,vt??Number.NaN))&&vt!==void 0&&At(se,re,vt)&&!ot(Q,re,tt,vt))return{x:tt,y:vt};if(xe)for(let $e=0;$e<4;$e++){const we=H(se,oe+$e,Ve);if(!ot(Q,re,tt,we,jn(se,oe+$e)))return be(oe+$e),{x:tt,y:we}}const ye=L(se,ve,Ve);xe?be(oe):kt?kt(()=>Re(Q,re,re.y+re.height/2)):Re(Q,re,ye);let Ne=tt;for(let $e=0;$e<64;$e++){const we=ot(Q,re,Ne,ye);if(!we)break;Ne=we.x+we.width+j+re.width/2}return{x:Ne,y:ye}},V=new Set(E.flows.map(Q=>Q.flow.target)),Y=new Map,ie=Q=>{if(Q===void 0)return;const re=o.get(Q);if(!(!re||typeof re.x!="number"||typeof re.width!="number"))return re.x+re.width+j};for(const Q of E.nodes){if(V.has(Q.node.id))continue;const re=Zt(Q.node,Q.band,Q.afterColumn),se=K(Q),ve=Q.node.lane?`${Q.node.lane}|${se??""}`:se!==void 0?`band:${se}`:"",tt=F(Q.node),Ve=Y.get(ve)??T,vt=ie(Q.afterColumn),kt=vt===void 0?Ve:Math.max(Ve,vt);let xe;const be=B(tt,re,Q.node.lane,se,kt,I,void 0,pn.has(Q.node.id)&&Q.node.participant!==void 0?oe=>xe=oe:void 0);if(xe?n.createShape(re,be,tt,{autoResize:!1}):n.createShape(re,be,tt),xe){const oe=Q.node.lane?f(Q.node.lane):tt;_n.set(Q.node.id,{container:oe,relCy:be.y-oe.y,grow:xe})}Y.set(ve,be.x+re.width+j),!Q.node.lane&&se===void 0&&(I+=160)}const J=new Set,de=new Map,pe=new Map,me=new Map;if(b&&Me.has(`pool:${b}`)){const Q=new Map;for(const xe of E.flows)Q.set(xe.flow.target,(Q.get(xe.flow.target)??0)+1);const re=xe=>L(xe.node.lane,fe(xe),Number.NaN),se=new Set,ve=xe=>{var ye;const be=(ye=k.get(xe))==null?void 0:ye.node.participant;if(be)return p(be);const oe=p(xe);if(oe)return oe.type==="bpmn:Participant"?oe:d(oe)},tt=xe=>{const be=[],oe=new Set([xe]),ye=[xe];for(;ye.length;){const Ne=ye.shift(),$e=k.get(Ne);$e&&be.push($e);for(const we of E.flows)we.flow.source!==Ne||oe.has(we.flow.target)||(Q.get(we.flow.target)??0)!==1||(oe.add(we.flow.target),ye.push(we.flow.target))}return be},Ve=xe=>{if(!A)return;const be=new Set(xe.map(Ne=>Ne.node.id));let oe=!1,ye=!1;for(const Ne of x){if(!be.has(Ne.flow.source))continue;const $e=ve(Ne.flow.target);!$e||$e.id===A.id||($e.y<A.y?oe=!0:ye=!0)}return oe&&!ye?"up":ye&&!oe?"down":void 0};for(const xe of E.nodes){if(!La(xe.node.type))continue;const be=L(xe.node.lane,K(xe),Number.NaN);if(Number.isNaN(be))continue;const oe=[];for(const we of E.flows){if(we.flow.source!==xe.node.id)continue;const at=k.get(we.flow.target);if(!at||at.node.lane!==xe.node.lane||(Q.get(at.node.id)??0)!==1)continue;const Xe=K(at);if(Xe===void 0)continue;const Pt=L(at.node.lane,Xe,Number.NaN);if(Number.isNaN(Pt))continue;const Ae=tt(at.node.id),ke=Ve(Ae);ke&&oe.push({subtree:Ae,band:Xe,row:Pt,dir:ke})}if(!oe.some(we=>we.dir==="up")||!oe.some(we=>we.dir==="down")||!oe.some(we=>we.dir==="up"&&oe.some(at=>at.dir==="down"&&at.row<we.row)))continue;const Ne=[...oe].sort((we,at)=>we.row-at.row);[...oe.filter(we=>we.dir==="up"),...oe.filter(we=>we.dir==="down")].sort((we,at)=>we.dir===at.dir?we.row-at.row:we.dir==="up"?-1:1).forEach((we,at)=>{const Xe=Ne[at].band;if(Xe!==we.band){se.add(xe.node.id);for(const Pt of we.subtree)K(Pt)===we.band&&ae.set(Pt.node.id,Xe)}})}const vt=xe=>{if(!A)return;const be=new Set(xe.map(Ne=>Ne.node.id));let oe=!1,ye=!1;for(const Ne of x){if(!be.has(Ne.flow.target))continue;const $e=ve(Ne.flow.source);!$e||$e.id===A.id||($e.y<A.y?oe=!0:ye=!0)}return oe&&!ye?"up":ye&&!oe?"down":void 0};for(const xe of E.nodes){if(!La(xe.node.type))continue;const be=xe.node.lane??`pool:${b}`,oe=ne.get(be);if(!oe||oe.size<2)continue;const ye=oe.get(0);if(ye===void 0)continue;const Ne=Math.max(...oe.values()),$e=ye===Ne&&ye!==0?"down":void 0;if(!$e)continue;const we=[];for(const ke of E.flows){if(ke.flow.source!==xe.node.id)continue;const Ze=k.get(ke.flow.target);if(!Ze||Ze.node.lane!==xe.node.lane||(Q.get(Ze.node.id)??0)!==1)continue;const vn=fe(Ze);vn!==void 0&&we.push({t:Ze,subtree:tt(Ze.node.id),band:vn})}const at=we.find(ke=>(oe.get(ke.band)??ke.band)===ye);if(!at||vt(at.subtree)===$e||Ve(at.subtree)===$e)continue;const Xe=we.find(ke=>ke!==at&&vt(ke.subtree)===$e);if(!Xe)continue;const Pt=at.band,Ae=Xe.band;for(const ke of at.subtree)fe(ke)===Pt&&ae.set(ke.node.id,Ae);for(const ke of Xe.subtree)fe(ke)===Ae&&ae.set(ke.node.id,Pt);se.add(xe.node.id)}for(const xe of E.nodes){if(!La(xe.node.type))continue;const be=re(xe);if(Number.isNaN(be)||_.some(we=>{var at,Xe;return(((at=we.placement)==null?void 0:at.anchor)??(we.association?we.association.source===we.annotation.id?we.association.target:we.association.source:void 0))===xe.node.id&&((Xe=we.placement)==null?void 0:Xe.side.startsWith("bottom"))}))continue;let ye,Ne=!1,$e;for(const we of E.flows){if(we.flow.source!==xe.node.id)continue;const at=k.get(we.flow.target);if(!at||!at.node.lane&&K(at)===void 0)continue;const Xe=re(at);Number.isNaN(Xe)||(Math.abs(Xe-be)<.5&&(Ne=!0),Xe>be?!ye||Xe>ye.row?ye={id:at.node.id,row:Xe,count:1}:Xe===ye.row&&ye.count++:Xe<be&&at.node.lane===xe.node.lane&&(!$e||Xe>$e.row?$e={op:at,row:Xe,count:1}:Xe===$e.row&&$e.count++))}ye&&ye.count===1&&(Q.get(ye.id)??0)===1&&!se.has(xe.node.id)&&J.add(ye.id),!Ne&&$e&&$e.count===1&&(Q.get($e.op.node.id)??0)===1&&!Te.has(xe.node.id)&&de.set($e.op.node.id,{lane:xe.node.lane,band:fe(xe)})}const kt=new Map;for(const xe of x)kt.set(xe.flow.target,[...kt.get(xe.flow.target)??[],xe]);for(const xe of E.nodes){const be=kt.get(xe.node.id);if(!be||be.length!==1||!Q.get(xe.node.id)||!xe.node.lane&&K(xe)===void 0||$.has(xe.node.id))continue;const oe=(IE=k.get(be[0].flow.source))==null?void 0:IE.node.participant,ye=oe?p(oe):void 0;if(!ye||!A||ye.id===A.id)continue;const Ne=xe.node.lane??`pool:${b}`,$e=ne.get(Ne);if(!$e)continue;const we=$e.get(0)??0,at=($e.get(fe(xe)??0)??we)-we;if(at===0)continue;const Xe=ye.y<A.y;if(Xe&&at<0||!Xe&&at>0)continue;let Pt;for(const[Ae,ke]of $e){const Ze=ke-we;(Xe&&Ze<0&&(!Pt||Ze<Pt.row)||!Xe&&Ze>0&&(!Pt||Ze>Pt.row))&&(Pt={band:Ae,row:Ze})}Pt&&pe.set(xe.node.id,{lane:xe.node.lane,band:Pt.band})}}const Ke=new Set;let Ce=0;for(;Ce++<E.nodes.length+2;){for(let se=0;se<E.nodes.length+E.flows.length+2;se++){let ve=!1;for(const tt of E.flows){const Ve=tt.flow;if(Ke.has(Ve.id))continue;const vt=p(Ve.source);if(!vt)continue;const kt=p(Ve.target),xe=k.get(Ve.target);if(!kt&&xe){const be=Zt(xe.node,xe.band),oe=fe(xe);if(xe.node.lane||oe!==void 0){const ye=F(xe.node),Ne=vt,$e=Ne.x+(me.get(Ve.source)??0)+Ne.width+j,we=de.get(Ve.target)??pe.get(Ve.target),at=B(ye,be,we?we.lane:xe.node.lane,we?we.band:oe,J.has(Ve.target)?Ne.x+Ne.width/2:$e,Number.NaN,we||!_t(Ve.target)?void 0:Ne.y+Ne.height/2),Xe=n.createShape(be,at,ye);J.has(Ve.target)&&me.set(Ve.target,$e-(Xe.x+Xe.width/2)),n.connect(vt,Xe,{type:"bpmn:SequenceFlow",businessObject:ii(Ve)})}else s.append(vt,be,{connection:{type:"bpmn:SequenceFlow",businessObject:ii(Ve)}})}else if(kt)n.connect(vt,kt,{type:"bpmn:SequenceFlow",businessObject:ii(Ve)});else continue;Ke.add(Ve.id),ve=!0}if(!ve)break}const Q=E.nodes.filter(se=>!p(se.node.id));if(!Q.length)break;const re=Q[0];{const se=Zt(re.node,re.band),ve=F(re.node),tt=K(re);n.createShape(se,B(ve,se,re.node.lane,tt,T,I),ve),!re.node.lane&&tt===void 0&&(I+=160)}}}const Pn=40,ft=b=>{const E=Y=>Y.kind==="label-over-line"||Y.kind==="label-over-shape"||Y.kind==="label-on-shared-segment"?Y.edge===b.id:Y.kind==="annotation-over-label"||Y.kind==="pool-name-over-label"?Y.label===b.id:!1,A=()=>new Set(dt(qe(o)).filter(Y=>!E(Y)).map(Y=>ut(Y))),T=A(),I=b.waypoints.map(Y=>({x:Y.x,y:Y.y})),L=b.label,H=L&&{x:L.x,y:L.y};n.layoutConnection(b,{waypoints:[]});const F=A(),B=[...F].filter(Y=>!T.has(Y)).length,V=[...T].filter(Y=>!F.has(Y)).length;B<=V||(n.updateWaypoints(b,I),L&&H&&(L.x!==H.x||L.y!==H.y)&&n.moveElements([L],{x:H.x-L.x,y:H.y-L.y}))},xt=5,Ao=10,sE=200,zu=new Set([...C.map(b=>b.flow.id),...x.map(b=>b.flow.id),...Kt(e,"sequenceFlow.update").map(b=>b.id),...Kt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),zN=(b,E,A,T,I,L)=>{const H=new Set(b.map(Q=>Q.id)),F=Math.min(...b.map(Q=>Q.x))+E-Ao,B=Math.max(...b.map(Q=>Q.x+Q.width))+E+sE+Ao,V=Math.min(...b.map(Q=>Q.y+Math.min(0,...A)))-Ao,Y=Math.max(...b.map(Q=>Q.y+Q.height+Math.max(0,...A)))+Ao,ie=o.getAll().filter(Q=>{if(Q.type!=="bpmn:SequenceFlow"&&Q.type!=="bpmn:MessageFlow")return!1;const re=Q;return zu.has(re.id)||!re.waypoints||re.waypoints.length<2||[re.source,re.target].some(ve=>!ve||H.has(ve.id)||ve.x>=T)?!1:re.waypoints.some((ve,tt)=>{const Ve=re.waypoints[tt+1];return!!Ve&&Math.max(ve.x,Ve.x)>=F&&Math.min(ve.x,Ve.x)<=B&&Math.max(ve.y,Ve.y)>=V&&Math.min(ve.y,Ve.y)<=Y})});if(!ie.length)return 0;const J=Q=>{const re=new Map;for(const se of b)for(const ve of A){const tt={id:se.id,type:se.type,x:se.x+E+Q,y:se.y+ve,width:se.width,height:se.height};for(const Ve of ie){let vt=1/0;for(let xe=0;xe+1<Ve.waypoints.length;xe++)vt=Math.min(vt,wc(Ve.waypoints[xe],Ve.waypoints[xe+1],tt));const kt=`${Ve.id}|${se.id}`;re.set(kt,Math.min(re.get(kt)??1/0,vt))}}return re},de=[...J(0)].filter(([,Q])=>Q<=xt).map(([Q])=>Q);if(!de.length)return 0;let pe=0;for(let Q=1;Q<=sE;Q++){const re=J(Q);if([...re.values()].every(se=>se>xt)&&de.every(se=>(re.get(se)??1/0)>=Ao)){pe=Q;break}}if(!pe)return 0;const me=Math.min(...b.map(Q=>Q.x))+E+pe,Ke=new Set(de.map(Q=>Q.slice(0,Q.indexOf("|"))));return ie.some(Q=>Q.type==="bpmn:SequenceFlow"&&Ke.has(Q.id)&&Q.waypoints.some((re,se)=>{const ve=Q.waypoints[se+1];if(!ve||Math.min(re.y,ve.y)>L||Math.max(re.y,ve.y)<L||re.y===ve.y)return!1;const tt=re.x+(L-re.y)*(ve.x-re.x)/(ve.y-re.y);return tt>I&&tt<me}))?0:pe},Po=(b,E=()=>!0)=>{const A=p(b);if(!A)return[];const T=[A],I=new Set([b]);for(let L=0;L<T.length;L++){const H=T[L].id;for(const F of C){const B=F.flow.target;if(F.flow.source!==H||I.has(B)||!k.has(B))continue;I.add(B);const V=p(B);V&&E(V)&&T.push(V)}}return T},GN=(b,E=()=>!0)=>{const A=p(b);if(!A)return[];const T=[A],I=new Set([b]);for(let L=0;L<T.length;L++){const H=T[L].id;for(const F of C){const B=F.flow.source;if(F.flow.target!==H||I.has(B)||!k.has(B))continue;I.add(B);const V=p(B);V&&E(V)&&T.push(V)}}return T},Mi=30,Qi=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Gu=(b,E)=>Gp(n,b,E),Xs=(b,E,A=!1)=>{const T=new Set(b.flatMap(B=>B.subtree.map(V=>V.id)));for(const B of b){const V=(B.pool.children??[]).filter(Qi).filter(ie=>!T.has(ie.id));if(B.subtree.some(ie=>V.some(J=>ie.x+E<J.x+J.width+Mi&&ie.x+E+ie.width+Mi>J.x&&ie.y<J.y+J.height&&ie.y+ie.height>J.y)))return null}const I=b.map(B=>B.pool.width),L=A?o.filter(B=>Array.isArray(B.waypoints)).map(B=>({c:B,wps:B.waypoints.map(V=>({x:V.x,y:V.y}))})):[],H=o.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(b.flatMap(B=>B.subtree),{x:E,y:0});const F=b.map(B=>{const Y=Math.max(...B.subtree.map(ie=>ie.x+ie.width))+Ig-(B.pool.x+B.pool.width);return Y>0&&Gu(B.pool,B.pool.width+Y),Y});return()=>{n.moveElements(b.flatMap(B=>B.subtree),{x:-E,y:0}),b.forEach((B,V)=>{F[V]>0&&Gu(B.pool,I[V])});for(const{c:B,wps:V}of L){const Y=B.waypoints??[];Y.length===V.length&&Y.every((J,de)=>Math.abs(J.x-V[de].x)<=.5&&Math.abs(J.y-V[de].y)<=.5)||n.updateWaypoints(B,V.map(J=>({x:J.x,y:J.y})))}for(let B=0;B<3;B++){let V=0;for(const Y of H){const ie=Y.x-Y.label.x,J=Y.y-Y.label.y;Math.abs(ie)<=.5&&Math.abs(J)<=.5||(n.moveElements([Y.label],{x:ie,y:J}),V++)}if(!V)break}}},Gh=b=>{var I,L;const E=new Map,A=new Map;for(const H of o.getAll()){if(H.type!=="bpmn:Participant")continue;const F=H;(F.children??[]).length||(E.set(F.id,F),A.set(F.id,[]))}for(const H of o.getAll()){if(H.type!=="bpmn:MessageFlow")continue;const F=H,B=(I=F.source)==null?void 0:I.id,V=(L=F.target)==null?void 0:L.id;B&&V&&A.has(B)&&A.get(B).push(V),B&&V&&A.has(V)&&A.get(V).push(B)}const T=[];for(const[H,F]of A)F.length&&F.every(B=>b.has(B))&&T.push(E.get(H));return T},cE=(b,E)=>{if(!b.length)return null;const A=new Set(b.map(Y=>Y.id)),T=o.getAll().filter(Y=>Y.type==="bpmn:Participant"&&!A.has(Y.id)),I=Math.min(...T.filter(Y=>(Y.children??[]).length>0).map(Y=>Y.x)),L=new Set(b.filter(Y=>Math.abs(Y.x-I)<=2).map(Y=>Y.id));if(b.some(Y=>{const ie=L.has(Y.id)?Y.x:Y.x+E,J=L.has(Y.id)?Y.width+E:Y.width;return T.some(de=>ie<de.x+de.width+Mi&&ie+J+Mi>de.x&&Y.y<de.y+de.height&&Y.y+Y.height>de.y)}))return null;const F=o.filter(Y=>Y.type==="label").map(Y=>({label:Y,x:Y.x,y:Y.y})),B=b.filter(Y=>!L.has(Y.id)),V=b.filter(Y=>L.has(Y.id)).map(Y=>({pool:Y,was:{x:Y.x,y:Y.y,width:Y.width,height:Y.height}}));B.length&&n.moveElements(B,{x:E,y:0});for(const{pool:Y,was:ie}of V)n.resizeShape(Y,{...ie,width:ie.width+E});return()=>{for(const{pool:Y,was:ie}of V)n.resizeShape(Y,ie);B.length&&n.moveElements(B,{x:-E,y:0});for(let Y=0;Y<3;Y++){let ie=0;for(const J of F){const de=J.x-J.label.x,pe=J.y-J.label.y;Math.abs(de)<=.5&&Math.abs(pe)<=.5||(n.moveElements([J.label],{x:de,y:pe}),ie++)}if(!ie)break}}},lE=(b,E,A)=>{const T=A.x+A.width/2,I=E.y>A.y,L=I?A.y+A.height:A.y,H=I?E.y:E.y+E.height,F=b.source===E?[{x:T,y:H},{x:T,y:L}]:[{x:T,y:L},{x:T,y:H}],B=qe(o),V={...B.edges.find(Y=>Y.id===b.id),waypoints:F};return mn(V,ci(B)).length?!1:(n.updateWaypoints(b,F),!0)},VN=()=>{const b=o.filter(I=>I.type==="bpmn:Participant"),E=Math.min(...b.filter(I=>(I.children??[]).length>0).map(I=>I.x)),A=I=>!!I&&I.type==="bpmn:Participant"&&!(I.children??[]).length&&Math.abs(I.x-E)<=2&&!h.some(L=>L.participant.id===I.id),T=new Set;for(const I of o.getAll()){if(I.type!=="bpmn:MessageFlow")continue;const L=I;if((L.waypoints??[]).length!==2)continue;const H=[L.source,L.target].find(B=>A(B)),F=H===L.source?L.target:L.source;H&&F&&F.type!=="bpmn:Participant"&&T.add(L.id)}return T},WN=b=>{var A;const E=new Map;for(const T of b){const I=o.get(T);if(!I||(I.waypoints??[]).length===2)continue;const L=((A=I.source)==null?void 0:A.type)==="bpmn:Participant"?I.source:I.target,H=L===I.source?I.target:I.source;if(H.x+H.width/2<=L.x+L.width)continue;const F=E.get(L.id)??{pool:L,msgs:[]};F.msgs.push({conn:I,other:H}),E.set(L.id,F)}for(const{pool:T,msgs:I}of E.values()){const L=Math.max(...I.map(({other:pe})=>pe.x+pe.width/2))+jp;if(o.getAll().some(pe=>{if(pe.type!=="bpmn:Participant"||pe.id===T.id)return!1;const me=pe;return T.x<me.x+me.width+Mi&&L+Mi>me.x&&T.y<me.y+me.height&&T.y+T.height>me.y}))continue;const F={x:T.x,y:T.y,width:T.width,height:T.height},B=[...T.incoming??[],...T.outgoing??[]],V=B.map(pe=>({c:pe,wps:(pe.waypoints??[]).map(me=>({x:me.x,y:me.y}))})),Y=B.flatMap(pe=>{const me=pe.label;return me?[{label:me,x:me.x,y:me.y}]:[]}),ie=Qr();n.resizeShape(T,{...F,width:L-T.x});const J=I.filter(({conn:pe,other:me})=>lE(pe,T,me)).length,de=Qr();if(!(J>0&&de.messages>ie.messages&&de.lines>=ie.lines)){n.resizeShape(T,F);for(const{c:pe,wps:me}of V){const Ke=pe.waypoints??[];Ke.length===me.length&&Ke.every((Q,re)=>Math.abs(Q.x-me[re].x)<=.5&&Math.abs(Q.y-me[re].y)<=.5)||n.updateWaypoints(pe,me.map(Q=>({x:Q.x,y:Q.y})))}for(let pe=0;pe<3;pe++){let me=0;for(const Ke of Y){const Ce=Ke.x-Ke.label.x,Q=Ke.y-Ke.label.y;Math.abs(Ce)<=.5&&Math.abs(Q)<=.5||(n.moveElements([Ke.label],{x:Ce,y:Q}),me++)}if(!me)break}}}},uE=()=>{let b=0;for(const E of o.getAll()){if(E.type!=="bpmn:DataInputAssociation"&&E.type!=="bpmn:DataOutputAssociation")continue;const A=E.waypoints??[];for(let T=1;T<A.length;T++)b+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return b},pE=()=>{let b=0;for(const E of o.getAll()){if(E.type!=="bpmn:Association")continue;const A=E.waypoints??[];for(let T=1;T<A.length;T++)b+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return b},UN=b=>{const E=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const T=A;if(b.has(T.id))continue;const L=[...T.incoming??[],...T.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===T?B.target:B.source);if(!L.length||L.some(B=>B===void 0))continue;const H=B=>{if(!("waypoints"in B&&B.waypoints))return[B.id];const V=B,Y=[V.source,V.target];return Y.some(ie=>!ie)?[]:Y.map(ie=>ie.id)},F=L.flatMap(B=>H(B));F.length&&F.every(B=>b.has(B))&&E.push(T)}return E},fE=()=>dt(qe(o)).filter(b=>b.kind==="edge-crosses-shape").length,dE=b=>{const E=(b.children??[]).filter(Qi);let A=0;for(let T=0;T<E.length;T++)for(let I=T+1;I<E.length;I++){const L=E[T],H=E[I];L.x<H.x+H.width&&L.x+L.width>H.x&&L.y<H.y+H.height&&L.y+L.height>H.y&&A++}return A},Qr=()=>{const b=qe(o),E=A=>A.length>=2&&(A.every(T=>Math.abs(T.x-A[0].x)<.01)||A.every(T=>Math.abs(T.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>E(A.waypoints)).length}},hE=b=>{const E=new Map;for(const T of o.getAll()){if(T.type!=="bpmn:MessageFlow")continue;const I=T;if(!I.waypoints||I.waypoints.length!==2)continue;const L=I.source,H=I.target;if(!L||!H)continue;const F=b.has(L.id);if(F===b.has(H.id))continue;const B=F?H:L,V=d(B);if(!V||b.has(B.id))continue;const Y=E.get(V.id);Y?B.x<Y.minX&&(Y.minX=B.x):E.set(V.id,{pool:V,minX:B.x})}const A=[];for(const{pool:T,minX:I}of E.values()){const L=(T.children??[]).filter(H=>Qi(H)&&!b.has(H.id)&&H.x>=I);L.length&&A.push({subtree:L,pool:T})}return A},qN=(b,E,A)=>{const T=new Map(E.map(H=>[H.pool.id,{subtree:[...H.subtree],pool:H.pool}])),I=new Set(b);for(const H of E)for(const F of H.subtree)I.add(F.id);let L=!1;for(;;){let H=0;for(const F of hE(I)){if(F.pool===A)continue;const B=T.get(F.pool.id);B?B.subtree.push(...F.subtree):T.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const V of F.subtree)I.add(V.id);H+=F.subtree.length}if(!H)break;L=!0}return L?[...T.values()]:null},YN=(b,E)=>{const A=new Map;for(const I of o.getAll()){if(I.type!=="bpmn:DataInputAssociation"&&I.type!=="bpmn:DataOutputAssociation")continue;const L=I,H=L.waypoints;if(!H||H.length<2||!H.every(de=>Math.abs(de.x-H[0].x)<1))continue;const F=L.source,B=L.target;if(!F||!B)continue;const V=b.has(F.id);if(V===b.has(B.id))continue;const Y=V?B:F,ie=d(Y);if(!ie||ie===E||ie===d(V?F:B))continue;const J=A.get(ie.id);J?Y.x<J.minX&&(J.minX=Y.x):A.set(ie.id,{pool:ie,minX:Y.x})}const T=[];for(const{pool:I,minX:L}of A.values()){const H=(I.children??[]).filter(F=>Qi(F)&&!b.has(F.id)&&F.x>=L);H.length&&T.push({subtree:H,pool:I})}return T},mE=b=>{const E=qe(o),A=E.shapes.filter(I=>b.has(I.id)),T=new Set;for(const I of E.edges)if(!(I.type!=="bpmn:SequenceFlow"&&I.type!=="bpmn:MessageFlow"))for(const L of mn(I,A))T.add(`${I.id}|${L.id}`);return T},gE=new Map;for(const b of Kt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const E=k.get(b.target);if(!E)continue;const A=p(b.target),T=p(b.id);if(!A||!T)continue;const I=b.source!==void 0?p(b.source):T.source,L=T.target;if(!I||!L||L.id===A.id)continue;const H=T.waypoints&&T.waypoints.length>=3&&Math.abs(T.waypoints[0].x-T.waypoints[1].x)<1&&Math.abs(T.waypoints[0].y-T.waypoints[1].y)>1?{x:T.waypoints[0].x,y:T.waypoints[0].y}:void 0,F=H?T.waypoints[1].y:void 0,B=H&&T.label?{x:T.label.x,y:T.label.y}:void 0,V=B&&T.label&&Math.abs(B.y+T.label.height/2-F)<=D/5&&B.x+T.label.width>H.x?B.x+T.label.width+6:void 0,Y=(I.outgoing??[]).filter(Ae=>Ae.type==="bpmn:SequenceFlow"&&Ae.id!==T.id&&Ae.target&&!zu.has(Ae.id)),ie=new Set(Y.map(Ae=>Ae.target.id)),J=Ae=>{const ke={type:"bpmn:Task",x:Ae.x+2,y:Ae.y+2,width:Ae.width-4,height:Ae.height-4};return Y.find(Ze=>(Ze.waypoints??[]).some((vn,wt)=>!!Ze.waypoints[wt+1]&&wc(vn,Ze.waypoints[wt+1],ke)===0))},de=Po(b.target),pe=new Set(de.map(Ae=>Ae.id)),me=_n.has(b.target)?{autoResize:!1}:void 0,Ke=Math.min(...de.map(Ae=>Ae.x)),Ce=Math.max(...de.map(Ae=>Ae.x+Ae.width)),Q=I.x+I.width,re=A.y+A.height/2,se=zN(de,Q+Pn-Ke,[0,I.y+I.height/2-re,L.y+L.height/2-re],L.x,Q,I.y+I.height/2),ve=Q+Pn+se,tt=(()=>{if(V===void 0)return 0;const Ae=Q+Pn,ke=I.y+I.height/2-A.height/2,Ze={x:Ae,y:ke,width:Ce-Ke,height:A.height},vn=d(I);return((vn==null?void 0:vn.children)??[]).some(gt=>Qi(gt)&&!pe.has(gt.id)&>.id!==I.id&>.id!==L.id&>.type!=="bpmn:Group"&>.type!=="bpmn:Participant"&>.x<Ze.x+Ze.width&>.x+gt.width>Ze.x&>.y<Ze.y+Ze.height&>.y+gt.height>Ze.y)||J(Ze)?Math.max(0,V-Ae):0})(),Ve=Ce-Ke+Pn*2+se+tt-(L.x-Q);let vt=[];if(Ve>0){const Ae=d(A),ke=(Ae==null?void 0:Ae.children)??[],Ze=Le=>Le.type==="bpmn:Lane";vt=(()=>{const Le=new Set;for(const Ie of ke)Qi(Ie)&&!pe.has(Ie.id)&&Ie.id!==I.id&&Ie.x>=L.x&&Le.add(Ie.id);const St=[];for(const Ie of ke){if(Ie.type!=="bpmn:DataStoreReference"&&Ie.type!=="bpmn:DataObjectReference")continue;const bt=Ie,Wn=[...bt.incoming??[],...bt.outgoing??[]].filter(Qt=>Qt.type==="bpmn:DataInputAssociation"||Qt.type==="bpmn:DataOutputAssociation").map(Qt=>Qt.source===bt?Qt.target:Qt.source);Wn.length&&Wn.every(Qt=>Qt!==void 0&&Le.has(Qt.id))&&St.push(bt)}return St})();const wt=ke.filter(Le=>!("waypoints"in Le&&Le.waypoints)&&!Ze(Le)&&Le.type!=="label"&&!pe.has(Le.id)&&Le.id!==I.id&&Le.x>=L.x),gt=wt.flatMap(Le=>Le.labels??[]),Bt=Ae?[Ae,...ke.filter(Le=>Ze(Le))]:[];if(wt.length){const Le=new Set(wt.map(Qe=>Qe.id)),St=hE(Le),Ie=St.length?qN(Le,St,Ae):null,bt=Qe=>{const yt=new Set(Le);for(const Ot of Qe)for(const vr of Ot.subtree)yt.add(vr.id);return UN(yt)},Bn=bt(St),Wn=Ie?bt(Ie):Bn,Qt=Gh(Le),Yu=new Set(Le);for(const Qe of St)for(const yt of Qe.subtree)Yu.add(yt.id);const Js=St.length?Gh(Yu):Qt,ec=(()=>{if(!Ie)return[];const Qe=new Set(Le);for(const yt of Ie)for(const Ot of yt.subtree)Qe.add(Ot.id);return Gh(Qe)})(),Na=Ie??St,Do=(()=>{const Qe=new Set(Le);for(const yt of Na)for(const Ot of yt.subtree)Qe.add(Ot.id);return YN(Qe,Ae)})(),Zh=Do.length?bt([...Na,...Do]):Bn,Di=new Set([...wt,...Bt].map(Qe=>Qe.id)),mt=ke.filter(Qe=>{const yt=Qe.labelTarget;return Qe.type==="label"&&!!yt&&"waypoints"in yt&&!!yt.source&&!!yt.target&&Di.has(yt.source.id)&&Di.has(yt.target.id)}),bn=VN();n.createSpace([...wt,...gt,...mt],Bt,{x:Ve,y:0},"e",L.x-1);const Vt=(Qe,yt,Ot)=>{const vr=Qr(),Ku=Ot?mE(Ot):null,Xu=Xs(Qe,Ve,!!Ot);if(!Xu)return!1;const tc=yt.length?cE(yt,Ve):null,Zu=Qr(),Wt=!!Ot&&!!Ku&&[...mE(Ot)].some(Io=>!Ku.has(Io));return Zu.messages>vr.messages&&Zu.lines>=vr.lines&&!Wt?!0:(tc==null||tc(),Xu(),!1)},ri=Do.length>0&&Vt([...Na,...Do],Ie?ec:Js,new Set(Do.flatMap(Qe=>Qe.subtree.map(yt=>yt.id)))),Lo=!ri&&Ie?Vt(Ie,ec):!1;let Ji=ri||Lo;!Ji&&St.length&&(Ji=Vt(St,Js));const $a=ri?Zh:Lo?Wn:Bn;if(!Ji){for(const Qe of St){const yt=Qr(),Ot=Xs([Qe],Ve);if(!Ot)continue;const vr=Qr();(vr.messages<=yt.messages||vr.lines<yt.lines)&&Ot()}if(Qt.length){const Qe=Qr(),yt=cE(Qt,Ve);if(yt){const Ot=Qr();(Ot.messages<=Qe.messages||Ot.lines<Qe.lines)&&yt()}}}if(WN(bn),$a.length){const Qe=()=>new Set(dt(qe(o)).map(Ot=>ut(Ot))),yt=Ot=>{const vr=pE(),Ku=Qe(),Xu=Ot.map(Wt=>({a:Wt,x:Wt.x,y:Wt.y})),tc=o.filter(Wt=>Wt.type==="label").map(Wt=>({label:Wt,x:Wt.x,y:Wt.y}));n.moveElements(Ot,{x:Ve,y:0});const Zu=[...Qe()].filter(Wt=>!Ku.has(Wt));if(pE()<vr&&Zu.length===0)return!0;for(const{a:Wt,x:Io,y:nc}of Xu)(Wt.x!==Io||Wt.y!==nc)&&n.moveElements([Wt],{x:Io-Wt.x,y:nc-Wt.y});for(const Wt of tc){const Io=Wt.x-Wt.label.x,nc=Wt.y-Wt.label.y;(Io!==0||nc!==0)&&n.moveElements([Wt.label],{x:Io,y:nc})}return!1};if(!yt($a)&&$a.length>1)for(const Ot of $a)yt([Ot])}}}const kt=E.node.lane!==void 0?p(E.node.lane):E.node.participant!==void 0?p(E.node.participant):void 0,xe=Ae=>{if(!kt)return!0;const ke=Ae.y+Ae.height/2;return ke>=kt.y&&ke<=kt.y+kt.height},be=!xe(I)&&xe(L)?L:I,oe=be.y+be.height/2,ye=oe-(A.y+A.height/2),Ne=E.band!==void 0,$e=Ne?[A]:de,we=(E.band===void 0||w(E.node.lane,E.node.participant,E.band,oe))&&_t(b.target)&&$e.every(Ae=>{var ke;return At((ke=k.get(Ae.id))==null?void 0:ke.node.lane,Ae,Ae.y+Ae.height/2+ye)}),at=Ae=>Math.abs(Ae.y+Ae.height/2-(A.y+A.height/2))<=D/2;if(we&&Ne){const Ae=Math.abs(ye)<=D/2?de.filter(ke=>ke.id!==A.id&&at(ke)):[];if(n.moveElements(de,{x:ve-Ke,y:0},void 0,me),n.moveElements([A],{x:0,y:ye},void 0,me),Ae.length){const ke=()=>new Set(dt(qe(o)).map(Le=>ut(Le))),Ze=ke(),vn=o.filter(Le=>Le.type==="label").map(Le=>({label:Le,x:Le.x,y:Le.y}));n.moveElements(Ae,{x:0,y:ye});const wt=ke(),gt=[...wt].filter(Le=>!Ze.has(Le)).length,Bt=[...Ze].filter(Le=>!wt.has(Le)).length;if(gt>Bt){n.moveElements(Ae,{x:0,y:-ye});for(const Le of vn){const St=Le.x-Le.label.x,Ie=Le.y-Le.label.y;(St!==0||Ie!==0)&&n.moveElements([Le.label],{x:St,y:Ie})}}}}else n.moveElements(de,{x:ve-Ke,y:we?ye:0},void 0,me);const Xe=d(A);if(!we&&E.node.lane===void 0&&E.band!==void 0&&Xe){const Ae=Xe.y+ee+R(`pool:${E.node.participant??""}`,E.band)*D,ke=Ae-(A.y+A.height/2);ke!==0&&!ot(Xe,A,A.x+A.width/2,Ae,pe)&&n.moveElements([A],{x:0,y:ke},void 0,me)}if(Xe){const Ae=(Xe.children??[]).filter(wt=>Qi(wt)&&!pe.has(wt.id)&&wt.type!=="bpmn:Group"&&wt.type!=="bpmn:Participant"),ke=(wt,gt,Bt,Le,St)=>wt.x+gt<St.x+St.width+Le&&wt.x+gt+wt.width+Le>St.x&&wt.y+Bt<St.y+St.height+Le&&wt.y+Bt+wt.height+Le>St.y,Ze=Ae.find(wt=>ke(A,0,0,0,wt)),vn=Ze?void 0:J(A);if(Ze||vn){const wt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],gt=o.getAll().filter(mt=>{if(!wt.includes(mt.type))return!1;const bn=mt;return zu.has(bn.id)||!bn.waypoints||bn.waypoints.length<2?!1:![bn.source,bn.target].some(Vt=>!Vt||pe.has(Vt.id))}),Bt=(mt,bn,Vt)=>{var ri;return At((ri=k.get(mt.id))==null?void 0:ri.node.lane,mt,mt.y+Vt+mt.height/2)&&mt.x+bn>=Xe.x&&mt.x+bn+mt.width<=Xe.x+Xe.width&&mt.y+Vt>=Xe.y&&mt.y+Vt+mt.height<=Xe.y+Xe.height},Le=(mt,bn)=>de.every(Vt=>Bt(Vt,mt,bn)&&!Ae.some(ri=>ke(Vt,mt,bn,Ao,ri))&>.every(ri=>{const Lo={id:Vt.id,type:Vt.type,x:Vt.x+mt,y:Vt.y+bn,width:Vt.width,height:Vt.height};for(let Ji=0;Ji+1<ri.waypoints.length;Ji++)if(wc(ri.waypoints[Ji],ri.waypoints[Ji+1],Lo)<Ao)return!1;return!0})),St=A.y+A.height/2,Ie=[F,L.y+L.height/2].filter(mt=>mt!==void 0&&Math.abs(mt-St)>=1),bt=Ze&&ie.has(Ze.id)?Ze:vn==null?void 0:vn.target,Bn=bt?bt.x-A.x:0,Wn=Math.max(...de.map(mt=>mt.x+mt.width)),Qt=[...Bn!==0?[Bn]:[],...se!==0?[-se]:[],0],Yu=V===void 0?[]:Qt.map(mt=>Math.max(mt,V-A.x)),Js=mt=>Wn+mt+Pn<=L.x,ec=[...new Set([...Yu,...Qt])].filter(Js),Na=Ze&&ie.has(Ze.id)?[Ze.x+Ze.width+Pn-A.x]:[],Do=V===void 0?[]:Na.map(mt=>Math.max(mt,V-A.x)),Zh=[...new Set([...Do,...Na])].filter(mt=>Js(mt)&&!ec.includes(mt));let Di;for(const mt of[ec,Zh]){for(const bn of Ie){for(const Vt of mt)if(Le(Vt,bn-St)){Di={dx:Vt,dy:bn-St};break}if(Di)break}if(Di)break}if(Di){const mt=Qe=>{const yt=Qe;return[yt.edge,yt.other,...Array.isArray(yt.edges)?yt.edges:[]].some(Ot=>typeof Ot=="string"&&zu.has(Ot))},bn=()=>new Set(dt(qe(o)).filter(Qe=>!mt(Qe)).map(Qe=>ut(Qe))),Vt=bn(),ri=o.filter(Qe=>Qe.type==="label").map(Qe=>({label:Qe,x:Qe.x,y:Qe.y}));n.moveElements(de,{x:Di.dx,y:Di.dy},void 0,me);const Lo=bn(),Ji=[...Lo].filter(Qe=>!Vt.has(Qe)).length,$a=[...Vt].filter(Qe=>!Lo.has(Qe)).length;if(Ji>$a){n.moveElements(de,{x:-Di.dx,y:-Di.dy},void 0,me);for(const Qe of ri){const yt=Qe.x-Qe.label.x,Ot=Qe.y-Qe.label.y;(yt!==0||Ot!==0)&&n.moveElements([Qe.label],{x:yt,y:Ot})}}else H&&gE.set(T.id,{exit:H,channelY:F,label:B})}}}{const Ae=new Set(de.map(gt=>gt.id)),ke=new Set(C.map(gt=>gt.flow.id)),Ze=20,vn=gt=>{const Bt=gt.source,Le=gt.target,St=Math.min(Bt.x,Le.x)-Ze,Ie=Math.max(Bt.x+Bt.width,Le.x+Le.width)+Ze,bt=Math.min(Bt.y,Le.y)-Ze,Bn=Math.max(Bt.y+Bt.height,Le.y+Le.height)+Ze;return gt.waypoints.some(Wn=>Wn.x<St||Wn.x>Ie||Wn.y<bt||Wn.y>Bn)},wt=new Map;for(const gt of de)for(const Bt of[...gt.incoming??[],...gt.outgoing??[]])Bt.id!==b.id&&ke.has(Bt.id)&&!(Ae.has(Bt.source.id)&&Ae.has(Bt.target.id))&&wt.set(Bt.id,Bt);for(const gt of wt.values())vn(gt)&&ft(gt)}const Pt=vt.length?d(vt[0]):void 0;if(Pt){const Ae={assoc:uE(),overlaps:dE(Pt),crosses:fE()},ke=vt.map(Ie=>({st:Ie,x:Ie.x})),Ze=o.filter(Ie=>Ie.type==="label").map(Ie=>({label:Ie,x:Ie.x,y:Ie.y})),vn=Math.min(...vt.flatMap(Ie=>[...Ie.incoming??[],...Ie.outgoing??[]].filter(bt=>bt.type==="bpmn:DataInputAssociation"||bt.type==="bpmn:DataOutputAssociation").map(bt=>(bt.source===Ie?bt.target:bt.source).x))),wt=new Set(vt.map(Ie=>Ie.id)),gt=(Pt.children??[]).filter(Qi).filter(Ie=>!wt.has(Ie.id));let Bt=vn;for(const Ie of[...vt].sort((bt,Bn)=>bt.x-Bn.x)){let bt=Bt;for(let Bn=0;Bn<100;Bn++){const Wn=gt.find(Qt=>bt<Qt.x+Qt.width+Mi&&bt+Ie.width+Mi>Qt.x&&Ie.y<Qt.y+Qt.height&&Ie.y+Ie.height>Qt.y);if(!Wn)break;bt=Wn.x+Wn.width+Mi}bt!==Ie.x&&n.moveElements([Ie],{x:bt-Ie.x,y:0}),Bt=bt+Ie.width+Mi}const Le=Bt+150-(Pt.x+Pt.width);Le>0&&Gu(Pt,Pt.width+Le);const St={assoc:uE(),overlaps:dE(Pt),crosses:fE()};if(St.assoc>=Ae.assoc||St.overlaps>Ae.overlaps||St.crosses>Ae.crosses){for(const{st:Ie,x:bt}of ke)Ie.x!==bt&&n.moveElements([Ie],{x:bt-Ie.x,y:0});Le>0&&Gu(Pt,Pt.width-Le);for(const Ie of Ze){const bt=Ie.x-Ie.label.x,Bn=Ie.y-Ie.label.y;(bt!==0||Bn!==0)&&n.moveElements([Ie.label],{x:bt,y:Bn})}}}}for(const[b,E]of _n){const A=p(b);if(!A)continue;const T=E.container,I=Math.abs(A.y+A.height/2-T.y-E.relCy)>=.5,L=A.label,H=Math.min(A.y,L&&!L.hidden?L.y:A.y),F=Math.max(A.y+A.height,L&&!L.hidden?L.y+L.height:0);if(I&&H>=T.y&&F<=T.y+T.height)continue;const B=A.y;E.grow(),A.y!==B&&n.moveElements([A],{x:0,y:B-A.y},void 0,{autoResize:!1})}const yE=(b,E)=>{const A=E.target===b,T=f(E.source),I=f(E.target),L=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(T,I,E.id?{type:L,businessObject:i.create(L,{id:E.id})}:{type:L})},vE=b=>{for(const E of h){if(!E.participant.blackBox)continue;const A=p(E.participant.id);if(!A)continue;const T=[];for(const L of x){const H=L.flow.source===E.participant.id?L.flow.target:L.flow.target===E.participant.id?L.flow.source:void 0,F=H?p(H):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&T.push(F)}if(!T.length)continue;if(!b&&E.order===void 0){const L=(()=>{var F;const H=new Map;for(const B of T){const V=d(B);if(!V)continue;const Y=H.get(V.id);Y?Y.n+=1:H.set(V.id,{shape:V,n:1})}return(F=[...H.values()].sort((B,V)=>V.n-B.n)[0])==null?void 0:F.shape})();if(L){const H=V=>V.reduce((Y,ie)=>Y+ie,0)/V.length,F=H(T.map(V=>V.y+V.height/2))<L.y+L.height/2,B=o.filter(V=>V.type==="bpmn:Participant"&&V.id!==E.participant.id&&V.id!==L.id).filter(V=>F?V.y+V.height<=L.y+5:V.y>=L.y+L.height-5);if(B.length){const V=[...B.reduce((se,ve)=>se.set(ve.y,(se.get(ve.y)??0)+1),new Map)].sort((se,ve)=>ve[1]-se[1]||(F?ve[0]-se[0]:se[0]-ve[0]))[0][0],Y=Math.min(A.width,QR),ie=JR,J=T.map(se=>se.x+se.width/2),de=Math.round(H(J)-Y/2),pe=Math.max(...J)+jp,me=se=>({x:se,width:Math.max(Y,pe-se)}),Ke=B.filter(se=>Math.min(se.y+se.height,V+ie)-Math.max(se.y,V)>0),Ce=se=>{const ve=me(se);return Ke.some(tt=>tt.x<ve.x+ve.width&&ve.x<tt.x+tt.width)},Q=se=>{const ve=me(se);return J.filter(tt=>tt>=ve.x+10&&tt<=ve.x+ve.width-10).length},re=(()=>{if(!Ce(de))return de;const se=Q(de);return Ke.flatMap(ve=>[ve.x+ve.width+kg,ve.x-kg-Y]).map(ve=>Math.round(ve)).filter(ve=>!Ce(ve)&&Q(ve)>=se).sort((ve,tt)=>Math.abs(ve-de)-Math.abs(tt-de))[0]??de})();if(re!==A.x||V!==A.y||Y!==A.width||ie!==A.height){const se=()=>new Set(dt(qe(o)).map(xe=>ut(xe))),ve=se(),tt={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:re,y:V,width:Y,height:ie});const Ve=se(),vt=[...Ve].filter(xe=>!ve.has(xe)).length,kt=[...ve].filter(xe=>!Ve.has(xe)).length;vt>kt&&n.resizeShape(A,tt)}}}}const I=Math.max(...T.map(L=>L.x+L.width/2))+jp;if(I>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:I-A.x,height:A.height}),!!b)for(const L of x){const H=p(L.flow.id),F=L.flow.source===E.participant.id?L.flow.target:L.flow.target===E.participant.id?L.flow.source:void 0,B=F?p(F):void 0;if(!H||!B||B.type==="bpmn:Participant")continue;const V=B.x+B.width/2;V<A.x+10||V>A.x+A.width-10||lE(H,A,B)}}};vE(!1);for(const b of x){const E=b.flow;n.connect(f(E.source),f(E.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:E.id,name:E.name})})}{const A=new Set([...C.map(B=>B.flow.id),...x.map(B=>B.flow.id)].filter(B=>!!B)),T=o.filter(B=>!!B.waypoints),I=(B,V)=>Math.abs(V.x-B.x)<2?"L":Math.abs(V.x-(B.x+B.width))<2?"R":Math.abs(V.y-B.y)<2?"T":Math.abs(V.y-(B.y+B.height))<2?"B":void 0,L=new Map,H=(B,V,Y)=>{if(!B||!V||typeof B.x!="number")return;const ie=I(B,V);if(!ie)return;let J=L.get(B.id);J||L.set(B.id,J=new Map),J.set(ie,[...J.get(ie)??[],Y])};for(const B of T){const V=B.waypoints;!V||V.length<2||(H(B.source,V[0],{id:B.id,dir:"out"}),H(B.target,V[V.length-1],{id:B.id,dir:"in"}))}const F=new Set;for(const[B,V]of L){const Y=p(B);if(!Y||typeof Y.x!="number"||![...V.values()].some(Ce=>{const Q=Ce.filter(re=>re.dir==="in");return Ce.length>=3&&Q.length>=1&&Ce.some(re=>re.dir==="out")&&Q.some(re=>A.has(re.id))}))continue;const J=d(Y);if(!J||F.has(J.id)||(J.children??[]).some(Ce=>Ce.type==="bpmn:Lane"))continue;const de=(BE=V.get("T"))!=null&&BE.length?(NE=V.get("B"))!=null&&NE.length?void 0:"B":"T";if(!de||(de==="T"?Y.y-J.y:J.y+J.height-(Y.y+Y.height))>=D)continue;const me=(J.children??[]).filter(Ce=>!("waypoints"in Ce&&Ce.waypoints)&&Ce.type!=="label"&&typeof Ce.x=="number"),Ke=J.y+J.height;n.resizeShape(J,{x:J.x,y:J.y,width:J.width,height:J.height+D}),te(Ke,J.id,D),de==="T"&&me.length&&n.moveElements(me,{x:0,y:D}),F.add(J.id)}}const Vh=20,bE=4,KN=3,XN=2,ZN=[10,30,80],Jr=()=>{const b=qe(o);return{bad:dt(b).filter(E=>E.kind==="edge-crosses-shape"||E.kind==="edge-overlap-opposite"||E.kind==="edge-overlap-mixed").length,crossings:zm(b),straight:b.edges.filter(E=>E.type==="bpmn:MessageFlow"&&E.waypoints.length===2).length}},Ia=b=>{const E=qe(o),A=E.edges.find(T=>T.id===b);return A?mn(A,ci(E)).length:0},Vu=b=>Ia(b)>0,Wu=b=>qe(o).edges.filter(E=>E.type==="bpmn:MessageFlow"&&E.id!==b&&E.waypoints.length===2).length,QN=(b,E,A)=>Xs([{subtree:b,pool:E}],A),xE=(b,E)=>E.bad>b.bad||E.crossings>b.crossings&&E.straight<=b.straight&&E.bad>=b.bad,Ba=(b,E)=>xE(b,E)||E.straight<b.straight,To=(b,E,A=()=>!0,T=xE,I=!1)=>{const L=Jr(),H=Xs(b,E,I);if(!H)return!1;const F=Jr();return T(L,F)||!A()?(H(),!1):!0},JN=(b,E,A,T=()=>!0)=>To([{subtree:b,pool:E}],A,T),ko=b=>{var E;return!!((E=k.get(b))!=null&&E.node.participant)},Zs=new Map;for(const b of x){if(!ko(b.flow.target))continue;const E=Zs.get(b.flow.target)??[];E.push(b),Zs.set(b.flow.target,E)}const Uu=[...Zs.keys()],Wh=new Set(C.map(b=>b.flow.target)),_E=b=>Yt.findIndex(({op:E})=>E.participant.id===b);Uu.sort((b,E)=>{var I,L;const A=Wh.has(b)?1:0,T=Wh.has(E)?1:0;return A!==T?A-T:_E((I=k.get(b))==null?void 0:I.node.participant)-_E((L=k.get(E))==null?void 0:L.node.participant)});const eo=b=>b.x+b.width/2,e$=b=>{const E=new Map;for(const I of o.getAll()){const L=I;if(!L.waypoints||!L.source||!L.target)continue;(E.get(L.source.id)??E.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const A=new Set([b]),T=[b];for(let I=0;I<T.length;I++)for(const L of E.get(T[I])??[])A.has(L)||(A.add(L),T.push(L));return A},t$=(b,E)=>{const A=e$(E);let T;for(const I of o.getAll()){const L=I;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==b||A.has(L.source.id))continue;const H=L.source;if(typeof H.x!="number"||H.type==="bpmn:Participant")continue;const F=eo(H);(T===void 0||F>T)&&(T=F)}return T},Uh=(b,E)=>{const A=p(b.flow.source);if(A)return A.type==="bpmn:Participant"?t$(A.id,E):eo(A)},wE=b=>{let E;for(const A of Zs.get(b)??[]){const T=Uh(A,b);T!==void 0&&(!E||T>E.cx)&&(E={op:A,cx:T})}return E==null?void 0:E.op},n$=b=>{const E=wE(b),A=p(b),T=E?Uh(E,b):void 0;return A&&T!==void 0?T-eo(A):void 0},i$=b=>{const E=n$(b);return E!==void 0&&Math.abs(E)<Vh},qh=(b,E,A,T,I)=>{var L;for(let H=!0;H;){H=!1;for(const F of x){if(F.flow.id===A)continue;const B=E.has(F.flow.source),V=E.has(F.flow.target);if(B===V||T(B?F.flow.source:F.flow.target))continue;const Y=B?F.flow.target:F.flow.source;if(I(Y)||!ko(Y))continue;const ie=p(F.flow.id);if(!(ie!=null&&ie.waypoints)||ie.waypoints.length!==2)continue;const J=p(Y),de=(L=k.get(Y))==null?void 0:L.node.participant;if(!J||!de)continue;const pe=Po(Y,me=>me.x>=J.x).filter(me=>!E.has(me.id));if(!(!pe.length||pe.some(me=>I(me.id)))){for(const me of pe)E.add(me.id);b.set(de,[...b.get(de)??[],...pe]),H=!0}}}return[...b].map(([H,F])=>({subtree:F,pool:f(H)}))},EE=(b,E,A,T,I)=>qh(new Map([[E,[...b]]]),new Set(b.map(L=>L.id)),T,L=>L===A,L=>L===I),Yh=b=>{const E=wE(b);if(!E)return null;const A=p(b),T=p(E.flow.source),I=Uh(E,b);if(!A||!T||I===void 0)return null;const L=I-eo(A);if(L>=Vh){const H=k.get(b).node.participant,F=Po(b,B=>B.x>=A.x);return{groups:EE(F,H,b,E.flow.id,E.flow.source),dx:L}}if(-L>=Vh&&ko(E.flow.source)){const H=k.get(E.flow.source).node.participant,F=Po(E.flow.source,B=>B.x>=T.x&&!i$(B.id));return{groups:EE(F,H,E.flow.source,E.flow.id,b),dx:-L}}return null},SE=()=>Uu.map(b=>({id:b,plan:Yh(b)})).filter(b=>!!b.plan).sort((b,E)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))-Math.min(...E.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))).map(b=>b.id);for(let b=0;b<3;b++){const E=Jr(),A=[];for(const I of SE()){const L=Yh(I);if(!L)continue;const H=Xs(L.groups,L.dx);H&&A.push(H)}if(!A.length)break;if(!Ba(E,Jr()))continue;for(const I of A.reverse())I();let T=!1;for(const I of SE()){const L=Yh(I);L&&To(L.groups,L.dx,()=>!0,Ba)&&(T=!0)}if(!T)break}for(const b of Uu){if(Wh.has(b))continue;const E=k.get(b);if(!E||E.node.lane!==void 0)continue;const A=K(E);if(A===void 0)continue;const T=p(b),I=T?d(T):void 0;if(!T||!I)continue;const L=I.y+ee+R(`pool:${E.node.participant??""}`,A)*D,H=L-(T.y+T.height/2);H!==0&&!ot(I,T,T.x+T.width/2,L)&&n.moveElements([T],{x:0,y:H})}const RE=new Set;for(let b=0,E=!0;E&&b<KN;b++){E=!1;for(const A of Uu.flatMap(T=>Zs.get(T)??[])){if(RE.has(A.flow.id)||!Vu(A.flow.id))continue;const T=p(A.flow.target);if(!T)continue;const I=f(k.get(A.flow.target).node.participant),L=Po(A.flow.target,V=>V.x>=T.x),H=T.width+j,F=Ia(A.flow.id),B=Wu(A.flow.id);for(let V=1;V<=bE;V++){const Y=()=>Ia(A.flow.id)<F&&Wu(A.flow.id)>=B;if(JN(L,I,H*V,Y)){RE.add(A.flow.id),E=!0;break}}}}const Kh=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),CE=new Set(Kh.map(b=>b.id));for(const b of o.filter(E=>E.type==="bpmn:MessageFlow"))CE.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Kh.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Kh){if(!Vu(b.id))continue;const E=p(b.source),A=p(b.target);if(!E||!A)continue;let T,I,L;if(b.preexisting){const[F,B]=E.type==="bpmn:Participant"?[A,E]:[E,A];if(T=eo(F),T<B.x||T>B.x+B.width)continue;[I,L]=F.y<B.y?[F.y+F.height,B.y]:[B.y+B.height,F.y]}else{if(E.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(T=E.x+E.width/2,Math.abs(T-(A.x+A.width/2))>15))continue;[I,L]=E.y<A.y?[E.y+E.height,A.y]:[A.y+A.height,E.y]}const H=[...k.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==E.id&&F.id!==A.id).filter(F=>F.x<=T&&T<=F.x+F.width&&F.y+F.height>I&&F.y<L).sort((F,B)=>F.x-B.x);for(const F of H){const B=($E=k.get(F.id))==null?void 0:$E.node.participant,V=B?p(B):void 0;if(!B||!V)continue;const Y=[...k.values()].filter(re=>re.node.participant===B).map(re=>re.node.id),ie=re=>re.map(se=>p(se)).filter(se=>!!se),de=[GN(F.id,re=>{var se;return((se=k.get(re.id))==null?void 0:se.node.participant)===B}),ie(Y)].filter(re=>re.length).map(re=>[{subtree:re,pool:V}]);if(b.preexisting){const re=ie(Y);re.length&&de.push(qh(new Map([[B,[...re]]]),new Set(re.map(se=>se.id)),b.id,()=>!1,se=>se===E.id||se===A.id))}const pe=F.width+j,me=Ia(b.id),Ke=Wu(b.id),Ce=()=>Ia(b.id)<me&&Wu(b.id)>=Ke;let Q=!1;for(const re of de){for(let se=1;se<=bE;se++)if(To(re,pe*se,Ce)){Q=!0;break}if(Q)break}if(!Vu(b.id))break}}const qu=()=>{var E;const b=new Set;for(const A of dt(qe(o)))A.kind!=="edge-crosses-shape"||CE.has(A.edge)||((E=p(A.edge))==null?void 0:E.type)==="bpmn:MessageFlow"&&b.add(`${A.edge}>${A.shape}`);return b},r$=(b,E)=>Jr().bad>=b&&[...qu()].some(A=>!E.has(A)),ME=b=>{var E,A;return Ia(b)===0&&((A=(E=p(b))==null?void 0:E.waypoints)==null?void 0:A.length)===2},o$=(b,E,A)=>{const T=new Set(b.flatMap(L=>L.subtree.map(H=>H.id))),I=[...qu()].filter(L=>!A.has(L)).map(L=>L.split(">")[1]);return[...new Set(I)].filter(L=>T.has(L)&&L!==E.source&&L!==E.target)},a$=(b,E,A,T,I)=>{const L=b.map(V=>({...V,subtree:V.subtree.filter(Y=>!I.includes(Y.id))})).filter(V=>V.subtree.length),H=new Set(L.flatMap(V=>V.subtree.map(Y=>Y.id))),F=()=>I.every(V=>{const Y=p(V);return!!Y&&C.filter(ie=>ie.flow.target===V&&H.has(ie.flow.source)).every(ie=>{const J=p(ie.flow.source);return!!J&&J.x+J.width<=Y.x})});return To(L,E,()=>ME(A.id)&&[...qu()].every(V=>T.has(V))&&F(),Ba,!0)};for(const b of x){if(!Vu(b.flow.id))continue;const E=p(b.flow.id);if(((FE=E==null?void 0:E.waypoints)==null?void 0:FE.length)!==2)continue;const A=p(b.flow.source),T=p(b.flow.target);if(!A||!T||A.type==="bpmn:Participant"||T.type==="bpmn:Participant"||!ko(b.flow.source)||!ko(b.flow.target)||Math.abs(eo(A)-eo(T))>XN)continue;const I=eo(A),L=E.waypoints.map(me=>me.y),[H,F]=[Math.min(...L),Math.max(...L)],B=ci(qe(o)).filter(me=>me.id!==A.id&&me.id!==T.id&&me.x<I&&I<me.x+me.width&&H<me.y+me.height&&me.y<F);if(!B.length)continue;const V=(jE=k.get(b.flow.source))==null?void 0:jE.node.participant,Y=(HE=k.get(b.flow.target))==null?void 0:HE.node.participant;if(!V||!Y)continue;const ie=new Map;for(const[me,Ke,Ce]of[[b.flow.source,A,V],[b.flow.target,T,Y]]){const Q=ie.get(Ce)??[],re=Po(me,se=>se.x>=Ke.x).filter(se=>!Q.some(ve=>ve.id===se.id));ie.set(Ce,[...Q,...re])}const J=new Set([...ie.values()].flat().map(me=>me.id)),de=qh(ie,J,b.flow.id,me=>me===b.flow.source||me===b.flow.target,()=>!1),pe=Math.max(...B.map(me=>me.x+me.width));for(const me of ZN){const Ke=pe+me-I;if(Ke<=0)continue;const Ce=Jr().bad,Q=qu();let re=[],se=!0;const ve=()=>!ME(b.flow.id)||se&&(re=o$(de,b.flow,Q),re.length)?!1:!r$(Ce,Q);if(To(de,Ke,ve,Ba))break;if(re.length&&(a$(de,Ke,b.flow,Q,re)||(se=!1,To(de,Ke,ve,Ba))))break}}{const b=A=>A.y+A.height/2,E=[];for(const A of k.keys()){if(!ko(A))continue;const T=C.filter(H=>H.flow.target===A);if(T.length!==1)continue;const I=p(T[0].flow.source),L=p(A);!I||!L||!k.has(I.id)||Math.abs(b(I)-b(L))>1||L.x-(I.x+I.width)<=j+1||E.push({id:A,pred:I,node:L})}E.sort((A,T)=>A.node.x-T.node.x);for(const{id:A}of E){const T=k.get(A),I=p(A),L=p(C.find(J=>J.flow.target===A).flow.source);if(!I||!L)continue;const H=I.x-(L.x+L.width);if(H<=j+1)continue;const F=f(T.node.participant),B=Po(A,J=>J.x>=I.x),V=Jr(),Y=QN(B,F,-(H-j));if(!Y)continue;const ie=Jr();(ie.bad>V.bad||ie.crossings>=V.crossings||ie.straight<V.straight)&&Y()}}vE(!0);const s$=10,c$=400,l$=b=>[...b.incoming??[],...b.outgoing??[]].filter(E=>E.type==="bpmn:DataInputAssociation"||E.type==="bpmn:DataOutputAssociation").map(E=>E.source===b?E.target:E.source).filter(E=>!!E&&typeof E.y=="number"),u$=o.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),p$=(b,E)=>{const A=b.x+b.width/2,T=b.y+b.height/2;let I;for(const L of u$){if((d(L)??u())!==E||L.y<b.y+b.height)continue;const H=Math.abs(L.x+L.width/2-A);H>c$||H<L.width||!l$(L).some(B=>B.height===b.height&&Math.abs(B.y+B.height/2-T)<=s$&&L.y>=B.y+B.height)||(!I||H<I.dx||H===I.dx&&L.id<I.id)&&(I={dx:H,id:L.id,cy:L.y+L.height/2})}return I==null?void 0:I.cy};for(const b of m){const E=b.associations??[],A=E.map(L=>L.source===b.dataStore.id?L.target:L.source).map(p).find(Boolean),T=A?d(A)??u():u(),I=A?{x:A.x+A.width/2,y:p$(A,T)??A.y+A.height+110}:{x:200,y:yn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},I,T);for(const L of E)yE(b.dataStore.id,L)}for(const b of v){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;yE(A,b.association)}let AE=0;const Oo=10,PE=40,f$=(b,E)=>{const A=E.map(B=>d(B)).filter(B=>!!B);for(const B of A){const V=Oo,Y=B.y,ie=B.y+B.height,J=B.x,de=B.x+B.width;if(Math.abs(b.y-Y)<V){const pe=Y+V-b.y;b.y+=pe,b.height-=pe}if(Math.abs(b.y+b.height-ie)<V&&(b.height=ie-V-b.y),Math.abs(b.x-J)<V){const pe=J+V-b.x;b.x+=pe,b.width-=pe}Math.abs(b.x+b.width-de)<V&&(b.width=de-V-b.x)}if(!A.length)return;const T=Math.min(...A.map(B=>B.y)),I=Math.max(...A.map(B=>B.y+B.height)),L=T-b.y,H=b.y+b.height-I,F=PE-Oo;if(L>0!=H>0)if(L>0&&L<F){const B=L+Oo;b.y+=B,b.height-=B}else H>0&&H<F&&(b.height-=H+Oo)},d$=(b,E)=>{const A=Oo,T=30,I=o.filter(L=>L.type==="bpmn:Group"&&L.id!==E);for(const L of I){const H=L.x,F=L.x+L.width,B=L.y,V=L.y+L.height,Y=b.y<V&&B<b.y+b.height,ie=b.x<F&&H<b.x+b.width;if(Y){if(Math.abs(b.x-F)<A){const J=Math.min(F+A-b.x,T);J>0&&b.width-J>0&&(b.x+=J,b.width-=J)}if(Math.abs(b.x+b.width-H)<A){const J=Math.min(b.x+b.width-(H-A),T);J>0&&b.width-J>0&&(b.width-=J)}}if(ie){if(Math.abs(b.y-V)<A){const J=Math.min(V+A-b.y,T);J>0&&b.height-J>0&&(b.y+=J,b.height-=J)}if(Math.abs(b.y+b.height-B)<A){const J=Math.min(b.y+b.height-(B-A),T);J>0&&b.height-J>0&&(b.height-=J)}}}},Xh=(b,E)=>{const A=PE,T=Math.min(...b.map(B=>B.x))-A,I=Math.min(...b.map(B=>B.y))-A,L=Math.max(...b.map(B=>B.x+B.width))+A,H=Math.max(...b.map(B=>B.y+B.height))+A,F={x:T,y:I,width:L-T,height:H-I};return f$(F,b),d$(F,E),F};for(const b of S){const E=(b.group.members??[]).map(p).filter(I=>!!I);let A;E.length?A=Xh(E,b.group.id):(A={x:300+AE*350,y:40,width:300,height:200},AE++);const T=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(T,b.group.name),(zE=b.group.members)!=null&&zE.length&&O(T,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(I=>!!I.waypoints),E=new Map,A=(I,L)=>{!I||!L||(E.has(I)||E.set(I,new Set),E.get(I).add(L))};for(const I of b){const L=(GE=I.source)==null?void 0:GE.id,H=(VE=I.target)==null?void 0:VE.id;A(L,H),((WE=I.type)!=null&&WE.includes("DataOutputAssociation")||(UE=I.type)!=null&&UE.includes("DataInputAssociation")||I.type==="bpmn:Association")&&A(H,L)}const T=o.filter(I=>I.type==="bpmn:Group");for(const I of T){const H=(((qE=I.businessObject.extensionElements)==null?void 0:qE.values)??[]).find(Ce=>Ce.$type==="bwl:Members"),F=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const B=new Set(F),V=[...F];for(;V.length;){const Ce=V.shift();for(const Q of E.get(Ce)??[])B.has(Q)||(B.add(Q),V.push(Q))}const Y=I.x,ie=I.x+I.width,J=I.y,de=I.y+I.height,pe=Ce=>C.filter(Q=>Q.flow.target===Ce).length,me=Ce=>{var re;const Q=((re=p(Ce))==null?void 0:re.type)??"";if(Q==="bpmn:StartEvent"&&pe(Ce)===0)return!1;if(Q.endsWith("Gateway")){const se=C.filter(ve=>ve.flow.target===Ce).map(ve=>ve.flow.source);if(se.length&&se.every(ve=>{var tt;return((tt=p(ve))==null?void 0:tt.type)==="bpmn:StartEvent"&&pe(ve)===0}))return!1}return!0},Ke=o.filter(Ce=>Qi(Ce)).filter(Ce=>Ce.type!=="bpmn:Group"&&Ce.type!=="bpmn:Participant"&&Ce.type!=="bpmn:TextAnnotation"&&!B.has(Ce.id)&&ko(Ce.id)&&me(Ce.id)&&Ce.x<ie&&Ce.x+Ce.width>Y&&Ce.y<de&&Ce.y+Ce.height>J);if(Ke.length)for(const Ce of[-1,1]){const Q=Ke.filter(be=>(be.x+be.width-Y<=ie-be.x?-1:1)===Ce);if(!Q.length)continue;const re=[];for(const be of Q){const oe=re.find(ye=>ye.some(Ne=>be.y<Ne.y+Ne.height&&be.y+be.height>Ne.y));oe?oe.push(be):re.push([be])}const se=new Map;for(const be of re){let oe=Ce<0?Y-Oo:ie+Oo;for(const ye of[...be].sort((Ne,$e)=>Ce<0?$e.x-Ne.x:Ne.x-$e.x)){const Ne=Ce<0?Math.min(ye.x,oe-ye.width):Math.max(ye.x,oe);oe=Ce<0?Ne-Mi:Ne+ye.width+Mi,Ne!==ye.x&&Math.sign(Ne-ye.x)===Ce&&se.set(ye.id,Ne-ye.x)}}const ve=new Map,tt=be=>ve.get(be)===be||!ve.get(be)?be:tt(ve.get(be));for(const be of Q)ve.set(be.id,be.id);for(const be of x){const oe=se.has(be.flow.source)?be.flow.source:void 0,ye=se.has(be.flow.target)?be.flow.target:void 0;if(!oe||!ye)continue;const Ne=p(be.flow.id);((YE=Ne==null?void 0:Ne.waypoints)==null?void 0:YE.length)===2&&ve.set(tt(oe),tt(ye))}const Ve=new Map;for(const be of Q){if(!se.has(be.id))continue;const oe=tt(be.id);Ve.set(oe,[...Ve.get(oe)??[],be])}const vt=[...Ve.values()].sort((be,oe)=>Ce<0?Math.min(...be.map(ye=>ye.x))-Math.min(...oe.map(ye=>ye.x)):Math.max(...oe.map(ye=>ye.x))-Math.max(...be.map(ye=>ye.x))),kt=[];let xe=!0;for(const be of vt){const oe=be.map($e=>se.get($e.id)??0).reduce(($e,we)=>Math.abs(we)>Math.abs($e)?we:$e,0),ye=new Map;let Ne=!0;for(const $e of be){const we=d($e);if(!we){Ne=!1;break}ye.has(we.id)||ye.set(we.id,{subtree:[],pool:we}),ye.get(we.id).subtree.push($e)}Ne&&To([...ye.values()],oe,()=>!0,Ba)?kt.push({shapes:be,dx:oe}):xe=!1}if(!xe)for(const be of kt.reverse())n.moveElements(be.shapes,{x:-be.dx,y:0})}}}{const b=new Set([...S.map(E=>E.group.id),...Kt(e,"group.update").map(E=>E.id)]);for(const E of o.filter(A=>A.type==="bpmn:Group")){if(b.has(E.id))continue;const T=(((KE=E.businessObject.extensionElements)==null?void 0:KE.values)??[]).find(F=>F.$type==="bwl:Members"),I=((T==null?void 0:T.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!I.length||!I.some(F=>{const B=g.get(F.id);return!B||B.x!==F.x||B.y!==F.y})||!I.some(F=>F.x<E.x||F.y<E.y||F.x+F.width>E.x+E.width||F.y+F.height>E.y+E.height)||n.resizeShape(E,Xh(I,E.id))}}{const E=new Map(co(qe(o)).map(F=>[F.owner,F.rect])),A=o.filter(F=>!!F.waypoints),T=new Map,I=(F,B)=>{!F||!B||(T.has(F)||T.set(F,new Set),T.get(F).add(B))};for(const F of A){const B=(XE=F.source)==null?void 0:XE.id,V=(ZE=F.target)==null?void 0:ZE.id;I(B,V),((QE=F.type)!=null&&QE.includes("DataOutputAssociation")||(JE=F.type)!=null&&JE.includes("DataInputAssociation")||F.type==="bpmn:Association")&&I(V,B)}const L=F=>C.filter(B=>B.flow.target===F).length,H=F=>{var V;const B=((V=p(F))==null?void 0:V.type)??"";if(B==="bpmn:StartEvent"&&L(F)===0)return!1;if(B.endsWith("Gateway")){const Y=C.filter(ie=>ie.flow.target===F).map(ie=>ie.flow.source);if(Y.length&&Y.every(ie=>{var J;return((J=p(ie))==null?void 0:J.type)==="bpmn:StartEvent"&&L(ie)===0}))return!1}return!0};for(const F of o.filter(B=>B.type==="bpmn:Group")){const V=(((e1=F.businessObject.extensionElements)==null?void 0:e1.values)??[]).find(oe=>oe.$type==="bwl:Members"),Y=((V==null?void 0:V.refs)??"").split(" ").filter(Boolean);if(!Y.length)continue;const ie=Y.map(p).filter(oe=>!!oe);if(!ie.length||!(S.some(oe=>oe.group.id===F.id)||Kt(e,"group.update").some(oe=>oe.id===F.id)||ie.some(oe=>{const ye=g.get(oe.id);return!ye||ye.x!==oe.x||ye.y!==oe.y})))continue;const de=new Set(Y),pe=[...Y];for(;pe.length;){const oe=pe.shift();for(const ye of T.get(oe)??[])de.has(ye)||(de.add(ye),pe.push(ye))}const me=F.x,Ke=F.x+F.width,Ce=F.y,Q=F.y+F.height,re=oe=>{const ye=E.get(oe.id),Ne={x:oe.x,y:oe.y,width:oe.width,height:oe.height};return ye?[Ne,{x:ye.x,y:ye.y,width:ye.width,height:ye.height}]:[Ne]},se=ie.flatMap(re),ve=Math.min(...se.map(oe=>oe.x)),tt=Math.max(...se.map(oe=>oe.x+oe.width)),Ve=Math.min(...se.map(oe=>oe.y)),vt=Math.max(...se.map(oe=>oe.y+oe.height)),kt={L:ve-me,R:Ke-tt,T:Ve-Ce,B:Q-vt},xe=o.filter(oe=>Qi(oe)).filter(oe=>oe.type!=="bpmn:Group"&&oe.type!=="bpmn:Participant"&&oe.type!=="bpmn:TextAnnotation"&&!de.has(oe.id)&&H(oe.id)&&oe.x<Ke&&oe.x+oe.width>me&&oe.y<Q&&oe.y+oe.height>Ce);if(!xe.length)continue;const be={L:0,R:0,T:0,B:0};for(const oe of xe){const ye=re(oe),Ne=Math.min(...ye.map(ke=>ke.x)),$e=Math.max(...ye.map(ke=>ke.x+ke.width)),we=Math.min(...ye.map(ke=>ke.y)),at=Math.max(...ye.map(ke=>ke.y+ke.height)),Xe={L:$e-me,R:Ke-Ne,T:at-Ce,B:Q-we},Pt=["L","R","T","B"].filter(ke=>Xe[ke]<=kt[ke]+.001);if(!Pt.length)continue;const Ae=Pt.reduce((ke,Ze)=>Xe[Ze]<Xe[ke]?Ze:ke,Pt[0]);be[Ae]=Math.max(be[Ae],Math.min(Xe[Ae]+10,kt[Ae]))}!be.L&&!be.R&&!be.T&&!be.B||n.resizeShape(F,{x:F.x+be.L,y:F.y+be.T,width:F.width-be.L-be.R,height:F.height-be.T-be.B})}}const TE=b=>{const E=b.waypoints;if(E!=null&&E.length){const T=E[Math.floor((E.length-1)/2)];return{x:T.x,y:T.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Qs=0;const kE=12,OE=14,h$=15,m$=300,g$=b=>{const E=b.split(`
|
|
7
|
+
`),A=Math.max(...E.map(L=>Uo(L,kE))),T=Math.max(100,Math.min(m$,Math.ceil(A)+OE)),I=E.reduce((L,H)=>L+Math.max(1,Math.ceil((Uo(H,kE)+OE)/T)),0);return{width:T,height:Math.max(30,I*h$+10)}};for(const b of _){const E=b.association,A=((t1=b.placement)==null?void 0:t1.anchor)??(E?E.source===b.annotation.id?E.target:E.source:void 0),T=A?p(A):void 0,I=T?TE(T):void 0,L=g$(b.annotation.text??"");let H;if(I&&b.placement){const[Y,ie]=kc[b.placement.side],J=b.placement.offset??50;H={x:I.x+I.width/2+Y*(I.width/2+L.width/2+J),y:I.y+I.height/2+ie*(I.height/2+L.height/2+J)}}else I?(H={x:I.x+I.width/2+180+Qs%3*260,y:I.y-110-Qs%2*95},Qs++):(H={x:300+Qs*260,y:60},Qs++);const F=T?d(T)??u():u(),B=F;I&&typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant"&&(H=Hp(o,I,L,B,b.placement?{placement:b.placement}:{from:H}));const V=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},H,F);if(E){const Y=ie=>ie===b.annotation.id?V:f(ie);n.connect(Y(E.source),Y(E.target),E.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:E.id})}:{type:"bpmn:Association"})}b.placement&&O(V,"bwl:Placement",N(b.placement))}for(const b of Kt(e,"association.add")){const E=b.association;n.connect(f(E.source),f(E.target),E.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:E.id})}:{type:"bpmn:Association"})}const DE=()=>new Set(o.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of Kt(e,"node.update")){let E=f(b.id);if(b.type&&Tc(b.type)!==E.type){const A=E.x+E.width/2,T=E.y+E.height/2,I=DE();E=c.replaceElement(E,{type:Tc(b.type),...b.eventDefinition?{eventDefinitionType:oc[b.eventDefinition]}:{}});const L=DE(),H=[...I].filter(V=>V!==b.id&&!L.has(V));if(H.length)throw new Dg({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:H});const F=Math.round(A-(E.x+E.width/2)),B=Math.round(T-(E.y+E.height/2));if(F!==0||B!==0){n.moveShape(E,{x:F,y:B});for(const V of[...E.incoming??[],...E.outgoing??[]])ft(V)}}if(b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(E,{"bwl:band":b.band});const A=E.y+E.height/2,T=d(E),I=b.lane?f(b.lane):((T==null?void 0:T.children)??[]).find(H=>H.type==="bpmn:Lane"&&A>=H.y&&A<=H.y+H.height);b.band!==void 0&&ht(I==null?void 0:I.id,b.band,T);const L=I?I.y+(b.band===void 0?I.height/2:Math.min(I.height/2,ge)+R(I.id,b.band)*D):b.band!==void 0&&T?T.y+ee+R(`pool:${T.id}`,b.band)*D:void 0;if(L!==void 0){const H=L-A;H!==0&&n.moveElements([E],{x:0,y:H})}}}for(const b of Kt(e,"sequenceFlow.update")){const E=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=E,T=b.source!==void 0?f(b.source):A.source,I=b.target!==void 0?f(b.target):A.target,L=B=>({x:B.x+B.width/2,y:B.y+B.height/2});n.reconnect(A,T,I,[L(T),L(I)]);const H=gE.get(A.id),F=I.y+I.height/2;if(H&&I.x>H.exit.x&&Math.abs(F-H.exit.y)>1){n.updateWaypoints(A,[H.exit,{x:H.exit.x,y:F},{x:I.x,y:F}]);const B=A.label;if(B&&H.label){const Y=Math.abs(H.label.y+B.height/2-H.channelY)<=D/5&&H.label.x+B.width>H.exit.x,ie=H.exit.x+6,J=I.x-6-B.width,de=Y?J>=ie?{x:Math.max(ie,Math.min(H.label.x,J)),y:H.label.y+(F-H.channelY)}:void 0:H.label;de&&(de.x!==B.x||de.y!==B.y)&&n.moveElements([B],{x:de.x-B.x,y:de.y-B.y})}}else Math.abs(F-(T.y+T.height/2))>1&&ft(A)}b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(E,{name:((n1=b.condition)==null?void 0:n1.label)??void 0})}for(const b of Kt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Kt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Kt(e,"annotation.update")){const E=f(b.id);if(b.text!==void 0&&n.updateProperties(E,{text:b.text}),b.placement===null)O(E,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),T=TE(A),I=d(A)??u(),L=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[H,F]=kc[b.placement.side],B=b.placement.offset??50,V={x:T.x+T.width/2+H*(T.width/2+E.width/2+B),y:T.y+T.height/2+F*(T.height/2+E.height/2+B)},Y=L?Hp(o,T,{width:E.width,height:E.height},I,{placement:b.placement,selfId:b.id}):V;n.moveElements([E],{x:Y.x-(E.x+E.width/2),y:Y.y-(E.y+E.height/2)}),O(E,"bwl:Placement",N(b.placement))}}for(const b of Kt(e,"group.update")){const E=f(b.id);if(b.name!==void 0&&n.updateLabel(E,b.name??""),b.members){const A=b.members.map(p).filter(T=>!!T);A.length&&n.resizeShape(E,Xh(A,b.id)),O(E,"bwl:Members",{refs:b.members.join(" ")})}}}function zp(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function tC(e,t,n){var u,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>dt(f).filter(d=>!t.has(ut(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=qe(i),c=o(s),l=[...new Set(c.flatMap(zp))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const ge=d.x+d.width/2,Pe=d.y+d.height/2;h=i.getAll().find(De=>{if(De.type!=="bpmn:Participant")return!1;const Ye=De;return typeof Ye.x=="number"&&typeof Ye.width=="number"&&ge>=Ye.x&&ge<=Ye.x+Ye.width&&Pe>=Ye.y&&Pe<=Ye.y+Ye.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const C=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ge=>ge.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(ge=>ge.type==="bpmn:Association"),m=(C!=null&&C.anchor?i.get(C.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!m)continue;const v=m.waypoints,_=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:m.x,y:m.y,width:m.width,height:m.height},S={width:d.width,height:d.height},k={x:d.x+d.width/2,y:d.y+d.height/2},O=C==null?void 0:C.side,N=[];O&&O in kc&&N.push(Hp(i,_,S,h,{placement:{side:O,offset:(C==null?void 0:C.offset)??null},selfId:f}));for(const[ge,Pe]of[[-1,0],[1,0],[0,-1],[0,1]])for(let De=1;De<=eC;De++)N.push({x:k.x+ge*Og*De,y:k.y+Pe*Og*De});const P={...s,edges:s.edges.filter(ge=>ge.id!==(x==null?void 0:x.id))},D=o(P),j=D.filter(ge=>zp(ge).includes(f)).length;if(!j)continue;let ee;for(const ge of N){const Pe=ge.x-k.x,De=ge.y-k.y;if(!Pe&&!De||ge.x-S.width/2<h.x||ge.x+S.width/2>h.x+h.width||ge.y-S.height/2<h.y||ge.y+S.height/2>h.y+h.height)continue;const Ye={...P,shapes:P.shapes.map(ne=>ne.id===f?{...ne,x:ne.x+Pe,y:ne.y+De}:ne)},ot=o(Ye),Me=ot.filter(ne=>zp(ne).includes(f)).length;if(Me>=j||ot.length>D.length)continue;const X=Math.abs(Pe)+Math.abs(De);if((!ee||Me<ee.mine||Me===ee.mine&&(ot.length<ee.all||ot.length===ee.all&&X<ee.dist))&&(ee={x:ge.x,y:ge.y,mine:Me,all:ot.length,dist:X}),ee.mine===0&&ee.all<D.length)break}ee&&r.moveElements([d],{x:ee.x-k.x,y:ee.y-k.y})}}const nC=60;function Gp(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function iC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>dt(u).filter(p=>!t.has(ut(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const C of n.shapes)C.type!=="bpmn:Group"||f.has(C.id)||[...d].some(x=>{const m=s.get(x);return m&&c(C,m)})&&(f.add(C.id),y=!0);for(const C of n.shapes)C.type!=="bpmn:Participant"||d.has(C.id)||[...f].some(x=>{const m=s.get(x);return m&&c(m,C)})&&(d.add(C.id),y=!0);if(!y)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(y=>{const C=s.get(y);return C&&c(C,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=qe(i),f=o(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[_,S]=v.pools,k=g.get(_),O=g.get(S);if(!k||!O)continue;const[N,P]=k.x<=O.x?[k,O]:[O,k];if(v.contained)continue;const D=s.get(N.id),j=s.get(P.id),ee=D&&j?Math.max(j.x-(D.x+D.width),0):nC,ge=N.x+N.width+ee-P.x;if(ge<=0)continue;const Pe=l(P.id).filter(De=>i.get(De));Pe.length&&(!h||ge>h.dx)&&(h={movers:Pe,dx:ge})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const C=f.length,x=d.length;r.moveElements(y,{x:h.dx,y:0});const m=o(qe(i));if(!(a(m).length<x&&m.length<=C)){r.moveElements(y,{x:-h.dx,y:0});return}}}const Oc=.5,Ig=150;function rC(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(m=>m.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(m=>m.x+m.width),a=Math.max(...o);if(a-Math.min(...o)>Oc)return;const s=r.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(s.length<2)return;const c=new Map(r.map(m=>[m.id,m.x]));if(s.some(m=>Math.abs(m.x-c.get(m.id))>Oc))return;const l=s.map(m=>m.x+m.width);if(Math.max(...l)-Math.min(...l)<=Oc)return;const u=m=>m.x+m.width,p=m=>!!m&&typeof m.width=="number",f=m=>{const v={shapes:[],edges:[],lanes:[]},_=S=>{for(const k of S.children??[]){if("waypoints"in k&&k.waypoints){v.edges.push(k);continue}k.type!=="label"&&(k.type==="bpmn:Lane"?v.lanes.push(k):v.shapes.push(k),_(k))}};return _(m),v},d=new Map(s.map(m=>[m.id,f(m)]));let g=a;for(const m of s){const{shapes:v}=d.get(m.id),_=v.flatMap(S=>[u(S),...p(S.label)?[u(S.label)]:[]]);_.length&&(g=Math.max(g,Math.max(..._)+Ig))}const h=s.filter(m=>Math.abs(u(m)-g)>Oc);if(!h.length)return;for(const m of h){const v=u(m),{shapes:_,edges:S,lanes:k}=d.get(m.id);if([..._.flatMap(P=>[u(P),...p(P.label)?[u(P.label)]:[]]),...S.flatMap(P=>[...P.waypoints.map(D=>D.x),...p(P.label)?[u(P.label)]:[]])].some(P=>P>g)||[...(m.incoming??[]).map(P=>P.waypoints[P.waypoints.length-1]),...(m.outgoing??[]).map(P=>P.waypoints[0])].some(P=>!P||P.x>g||Math.abs(P.x-v)<1))return;if(g>v){const P={x:v,y:m.y,width:g-v,height:m.height},D=new Set([m.id,..._.map(ee=>ee.id),...S.map(ee=>ee.id),...k.map(ee=>ee.id)]);if(n.getAll().some(ee=>{var De;if("waypoints"in ee&&ee.waypoints||ee.type==="bpmn:Group"||!p(ee))return!1;const ge=ee.type==="label"?(De=ee.labelTarget)==null?void 0:De.id:ee.id;if(!ge||D.has(ge)||D.has(ee.id))return!1;const Pe=ee;return Pe.x<P.x+P.width&&Pe.x+Pe.width>P.x&&Pe.y<P.y+P.height&&Pe.y+Pe.height>P.y}))return}}const y=()=>new Set(dt(qe(n)).map(ut)),C=y(),x=h.map(m=>m.width);for(const m of h)Gp(i,m,g-m.x,{layout:!1});[...y()].every(m=>C.has(m))||h.forEach((m,v)=>Gp(i,m,x[v],{layout:!1}))}function oC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>dt(l).filter(u=>!t.has(ut(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(S=>S.id!==l.id&&S.type!=="bpmn:Group"&&a(l,S));if(!p.length)continue;const f=p.map(S=>i.get(S.id)).filter(S=>!!S&&typeof S.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),y=g.t+(l.y-d.t),C=g.r+(l.x+l.width-d.r),x=g.b+(l.y+l.height-d.b),m={x:h,y,width:C-h,height:x-y};if(m.width<=0||m.height<=0||Math.abs(m.x-u.x)<1&&Math.abs(m.y-u.y)<1&&Math.abs(m.width-u.width)<1&&Math.abs(m.height-u.height)<1)continue;const v=o(qe(i)).length,_={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,m),o(qe(i)).length>v&&r.resizeShape(u,_)}}const Dc=20,Lc=10;function aC(e,t,n,i){var p,f;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(dt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ut)),s=qe(r),c=dt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(ut(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const x=h.members.map(Te=>r.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!x.length)continue;const m=Math.min(...x.map(Te=>Te.x)),v=Math.min(...x.map(Te=>Te.y)),_=Math.max(...x.map(Te=>Te.x+Te.width)),S=Math.max(...x.map(Te=>Te.y+Te.height)),k=h.x,O=h.y,N=h.x+h.width,P=h.y+h.height;let D=k,j=O,ee=N,ge=P;for(const Te of g){const $=s.edges.find(w=>w.id===Te.edge);if(!$)continue;const R=$.endpoints.some(w=>{const G=s.shapes.find(Re=>Re.id===w);if(!G||G.container)return!1;const W=G.x+G.width/2,te=G.y+G.height/2;return k<W&&W<N&&O<te&&te<P});for(const w of hn($)){const G=w.axis==="v"?[O,P]:[k,N];Math.min(w.hi,G[1])-Math.max(w.lo,G[0])<Cp||(w.axis==="v"?k<w.at&&w.at<N:O<w.at&&w.at<P)&&R||(w.axis==="v"?(Math.abs(w.at-k)<=qo&&(D=Math.max(D,w.at+Dc)),Math.abs(w.at-N)<=qo&&(ee=Math.min(ee,w.at-Dc))):(Math.abs(w.at-O)<=qo&&(j=Math.max(j,w.at+Dc)),Math.abs(w.at-P)<=qo&&(ge=Math.min(ge,w.at-Dc))))}}if(D>m-Lc&&(D=k),j>v-Lc&&(j=O),ee<_+Lc&&(ee=N),ge<S+Lc&&(ge=P),D===k&&j===O&&ee===N&&ge===P)continue;const Pe=r.get(d),De={x:Pe.x,y:Pe.y,width:Pe.width,height:Pe.height},Ye=qe(r),ot=new Set(dt(Ye).map(ut)),Me=a(Ye);o.resizeShape(Pe,{x:D,y:j,width:ee-D,height:ge-j});let X=qe(r),ne=dt(X).filter(Te=>!ot.has(ut(Te)));const q=[];if(ne.length>0&&ne.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&X.edges.some($=>$.id===Te.edge))){for(const Te of ne){if(Te.kind!=="label-over-line")continue;const $=X.edges.find(te=>te.id===Te.edge),R=$&&$p($,X),w=(f=r.get(Te.edge))==null?void 0:f.label;if(!R||!w)continue;const G=R.x-w.x,W=R.y-w.y;o.moveElements([w],{x:G,y:W}),q.push({label:w,dx:G,dy:W})}X=qe(r),ne=dt(X).filter(Te=>!ot.has(ut(Te)))}const ae=a(X),fe=[...ae].some(Te=>!Me.has(Te));if(ne.length||fe||ae.size>=Me.size){for(const Te of q.reverse())o.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});o.resizeShape(Pe,De)}}}function sC(e,t,n,i){var c;const r=n.getRootElement().businessObject,o=op((r==null?void 0:r.$parent)??r),a=ja(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:ap(u,i,o),requests:up(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...o?{rootLang:o}:{},before:s.get(l)}]:[]})}}function Bg(e,t,n={}){var N,P;const{i18n:i,lower:r=Lg}=n,o=Tg(e),a=Jm(o.elementRegistry),s=Pg(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=KR(t,a,i),u=i&&l.writes.size?sC(l.writes,o.elementRegistry,o.canvas,i):void 0,p=qe(o.elementRegistry),f=new Set(dt(p).map(ut)),d=new Set(dt(p,{includeObservationOnly:!0}).map(ut)),g=new Set(p.edges.map(D=>D.id)),h=new Set(t.flatMap(D=>D.kind==="sequenceFlow.update"&&(D.source!==void 0||D.target!==void 0)?[D.id]:[])),y=new Set(p.shapes.map(D=>D.id)),C=Ec(p),x=C.length,m=new Set(C.map(([D,j])=>`${D}|${j}`)),v=new Map;for(const D of o.elementRegistry.filter(j=>"waypoints"in j&&!!j.waypoints))D.label&&v.set(D.id,{wps:D.waypoints.map(j=>({x:j.x,y:j.y})),label:{x:D.label.x,y:D.label.y},source:(N=D.source)==null?void 0:N.id,target:(P=D.target)==null?void 0:P.id});const _=e.get("commandStack");try{rm(_,()=>{r(l.ops,o);for(const j of(u==null?void 0:u.contexts())??[])_.execute(cp,j);iC(o,f,p),rC(o,p),oC(o,f,p),ag(o,g);const D=Lp(o,f);ig(o,m,g),gg(o,f,g),lg(o,g),$R(o,g,h),fg(o,f,g),zR(o,f,g),wg(o,f,g),_g(o,g,h),Sg(o,y),tC(o,f,y),Lp(o,f,D),aC(o,d,p,g),Rg(o,f),xg(o,v)})}catch(D){return{ok:!1,issues:[D instanceof Dg?D.issue:{kind:"lower-failed",message:D instanceof Error?D.message:String(D)}],findings:[],stats:c}}const S=qe(o.elementRegistry),k=dt(S,{includeObservationOnly:!0}).filter(D=>!d.has(ut(D))),O=Gm(S);return{ok:!0,issues:[],findings:k,stats:{edgeCrossings:{before:x,after:O.pairs.length,pairs:O.pairs,solidPairs:O.solidPairs,dashedPairs:O.dashedPairs,mixedPairs:O.mixedPairs,crossPoolMessages:O.crossPoolMessages}}}}function cC(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Ng(e,t){return typeof e.get=="function"?e.get(t):e[t]}function $g(e,t){const n=Ng(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Fg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function lC(e){return typeof e=="string"&&ep.includes(e)}function Pi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function jg(e,t={}){const n=e.rootElements??[],i=n.find(X=>X.$type==="bpmn:Collaboration"),r=new Map(n.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),o=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],y=[],C=[],x=[],m=new Map,v=new Set,_=new Set,S=X=>{X&&v.add(X)},k=X=>{v.add(X),_.add(X)},O=X=>{const ne=Fg(X,"bwl:Placement");if(!ne)return;const q=typeof ne.anchor=="string"?ne.anchor:void 0;if(!q||!lC(ne.side))return;const K=typeof ne.offset=="number"?ne.offset:void 0;y.push({owner:X.id,anchor:q,side:ne.side,...K!==void 0?{offset:K}:{}})},N=X=>{const ne=Fg(X,"bwl:Members"),q=typeof(ne==null?void 0:ne.refs)=="string"?ne.refs.split(/\s+/).filter(Boolean):[];q.length&&x.push({owner:X.id,refs:q})},P=X=>{var ne;for(const q of X)switch(S(q.id),q.$type){case"bpmn:TextAnnotation":k(q.id),m.set(q.id,q),c.push({id:q.id,text:typeof q.text=="string"?q.text:""}),O(q);break;case"bpmn:Association":g.push({id:q.id,type:q.$type,source:Pi(q.sourceRef),target:Pi(q.targetRef)});break;case"bpmn:Group":{k(q.id),m.set(q.id,q);const K=(ne=q.categoryValueRef)==null?void 0:ne.value;l.push({id:q.id,...typeof K=="string"&&K?{name:K}:{}}),N(q);break}default:u.push({id:q.id,type:q.$type,reason:"type-outside-mvp"})}},D=X=>{for(const ne of X.flowElements??[])S(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"}),(ne.flowElements??[]).length&&D(ne);for(const ne of X.artifacts??[])S(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"})},j=(X,ne)=>{const q=X.flowElements??[],K=(X.laneSets??[]).flatMap(fe=>fe.lanes??[]),ae=new Map;for(const fe of K){S(fe.id),m.set(fe.id,fe);for(const Te of fe.flowNodeRef??[]){const $=Pi(Te);$&&ae.set($,fe.id)}}for(const fe of q){if(S(fe.id),m.set(fe.id,fe),fe.$type==="bpmn:SequenceFlow"){f.push({id:fe.id,source:Pi(fe.sourceRef),target:Pi(fe.targetRef),...typeof fe.name=="string"&&fe.name?{name:fe.name}:{}});continue}if(fe.$type==="bpmn:DataStoreReference"){k(fe.id),s.push({id:fe.id,...fe.name?{name:fe.name}:{}});continue}const Te=cC(fe.$type),$=Te==="intermediateCatchEvent"?Qu((fe.eventDefinitions??[]).map(W=>W.$type)):void 0;if(!Qh(Te)||Te==="intermediateCatchEvent"&&!$){u.push({id:fe.id,type:fe.$type,reason:"type-outside-mvp"});continue}k(fe.id);const R=Te==="boundaryEvent"?Pi(fe.attachedToRef):void 0;a.push({id:fe.id,type:Te,...fe.name?{name:fe.name}:{},...ne?{participant:ne}:{},...ae.has(fe.id)?{lane:ae.get(fe.id)}:{},...R?{attachedTo:R}:{},...$?{eventDefinition:$}:{}}),Te==="subProcess"&&D(fe);const w=$g(fe,"bwl:band");w!==void 0&&(p.bands[fe.id]=w);const G=Ng(fe,"bwl:afterColumn");typeof G=="string"&&G!==""&&C.push([fe.id,G]);for(const W of fe.dataOutputAssociations??[])S(W.id),h.push({id:W.id,type:W.$type,source:fe.id,target:Pi(W.targetRef)});for(const W of fe.dataInputAssociations??[])S(W.id),h.push({id:W.id,type:W.$type,source:Pi((W.sourceRef??[])[0]),target:fe.id})}P(X.artifacts??[])};if(i){const X=new Set;for(const ne of i.participants??[]){k(ne.id),m.set(ne.id,ne);const q=Pi(ne.processRef);q&&X.add(q);const K=q?r.get(q):void 0,ae=((K==null?void 0:K.laneSets)??[]).flatMap(R=>R.lanes??[]),fe=ae.map(R=>({id:R.id,...R.name?{name:R.name}:{}}));for(const R of fe)k(R.id);const Te=!K||(K.flowElements??[]).length===0&&ae.length===0&&(K.artifacts??[]).length===0;o.push({id:ne.id,...ne.name?{name:ne.name}:{},...Te?{blackBox:!0}:{},...fe.length?{lanes:fe}:{}});const $=$g(ne,"bwl:poolOrder");$!==void 0&&(p.poolOrders[ne.id]=$),K&&j(K,ne.id)}for(const ne of i.messageFlows??[])S(ne.id),m.set(ne.id,ne),d.push({id:ne.id,source:Pi(ne.sourceRef),target:Pi(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});P(i.artifacts??[]);for(const[ne,q]of r)!X.has(ne)&&(q.flowElements??[]).length>0&&u.push({id:ne,type:q.$type,reason:"unreachable-process"})}else for(const X of r.values())j(X);const ee=[],ge=[],Pe=[],De=[],Ye=(X,ne)=>!!X&&!!ne&&_.has(X)&&_.has(ne);for(const X of f){if(!Ye(X.source,X.target)){u.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}ee.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),_.add(X.id)}for(const X of d){if(!Ye(X.source,X.target)){u.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}ge.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),_.add(X.id)}for(const X of h){if(!Ye(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}De.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&_.add(X.id)}for(const X of g){if(!Ye(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}Pe.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const ot=new Map(l.map(X=>[X.id,X]));for(const{owner:X,refs:ne}of x){const q=ne.filter(ae=>v.has(ae)),K=ot.get(X);K&&q.length&&(K.members=q)}for(const X of y)v.has(X.anchor)&&(p.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});for(const[X,ne]of C)v.has(ne)&&(p.afterColumns[X]=ne);const Me={...o.length?{participants:o}:{},nodes:a,sequenceFlows:ee,...ge.length?{messageFlows:ge}:{},...s.length?{dataStores:s}:{},...De.length?{dataAssociations:De}:{},...c.length?{annotations:c}:{},...Pe.length?{associations:Pe}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Me,hints:p,omitted:u,i18n:uC(Me,m,e,t.i18n)}:{definition:Me,hints:p,omitted:u}}function uC(e,t,n,i){const r=op(n),o=ja(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=ap(u,i,r);Object.keys(p).length&&(c[l]=p);for(const f of up(u))o.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:o.slice(1),reviewRequests:a}}async function pC(e,t={}){const{definitions:n,warnings:i}=await Vo(e);return{...jg(n,t),warnings:i}}const fC=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Vp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function dC(e){return Vp(e.processRef)!==void 0}function hC(e){const t=new Set,n=r=>{const o=Vp(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function mC(e){const t=[],n=i=>{for(const r of i.flowElements??[])fC.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function gC(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 Wp(e){const t=[],n=e.rootElements??[],i=hC(e);for(const o of mC(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])dC(s)&&gC(o.get(Vp(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 yC(e){const{definitions:t,warnings:n}=await Vo(e);return{issues:Wp(t),warnings:n}}const vC=.5,bC=8,xC=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Jo=e=>typeof e=="number"?e:Number(e??NaN),Ic=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function _C(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${Ic(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${Ic(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Ic).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function wC(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[Jo(s.x),Jo(s.y),Jo(s.width),Jo(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Ic(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[Jo(f.x),Jo(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function Hg(e){const t=wC(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!xC.has(s)&&n.set(c,{type:s,props:_C(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function zg(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function Gg(e,t,n={}){const i=n.moveTolerance??vC,r=Hg(e),o=Hg(t),a=[],s=[],c=[];for(const[l,u]of o){const p=r.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||zg(p.geometry,u.geometry,i)||zg(p.label,u.label,n.labelTolerance??bC))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function EC(e,t,n={}){const[i,r]=await Promise.all([Vo(e),Vo(t)]);return{...Gg(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function SC(e){return new Set([...e.added,...e.modified])}function RC(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Vg(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=Bg(e,t.ops,{i18n:i});if(!r.ok)return{status:"rejected",issues:r.issues};const{xml:o}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:o??"",findings:r.findings,stats:r.stats}}const CC=Symbol("bpmn-editor"),Up={geometry:[],semantic:[]};function MC(){const e=he.ref(!1),t=he.ref(!0),n=he.ref(!1),i=he.shallowRef(Up),r=he.shallowRef(void 0),o=he.shallowRef(void 0);let a,s,c,l;const u=()=>{if(f(),!c){i.value=Up;return}const x=dt(qe(c.get("elementRegistry")),{includeObservationOnly:!0}),m=c.getDefinitions();i.value={geometry:x,semantic:m?Wp(m):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function f(){const x=p();if(!x||!a){o.value=void 0;return}const m=x.locales(),v={};for(const _ of m)v[_]={untranslated:x.untranslatedCount(_),reviewRequested:x.reviewRequestedCount(_)};o.value={designLocale:a.designLocale,locales:m,displayLocale:x.getDisplayLocale()??a.designLocale,counts:v}}function d(){const x=p();x&&(x.configure(a),a&&s&&(s=x.setDisplayLocale(s)))}const g=()=>{e.value=!0,u()};function h(x,m){x.get("canvas").getContainer().style.pointerEvents=m?"":"none";const v=x.get("keyboard");m?(l&&v.bind(l),l=void 0):l||(l=v.getBinding(),v.unbind())}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function C(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:r,i18n:o,configureI18n(x){a=x,d(),f()},setDisplayLocale(x){var v;s=x;const m=(v=p())==null?void 0:v.setDisplayLocale(x);m&&(s=m),f()},setChangeScope(x){r.value=x===void 0?void 0:new Set(x)},requestFocus(x){if(!c)return;const m=c.get("elementRegistry").get(x);m&&(c.get("canvas").scrollToElement(m,180),c.get("selection").select(m))},describeElement(x){const m=c==null?void 0:c.get("elementRegistry").get(x),v=m==null?void 0:m.businessObject;if(!v)return;const _=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof _=="string"&&_.trim()!==""?_.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(x){c&&this.detach(),c=x,c.get("eventBus").on("commandStack.changed",g),t.value||h(c,!1),d(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",g),c&&!t.value&&h(c,!0),l=void 0,c=void 0,i.value=Up,r.value=void 0,o.value=void 0},setEditable(x){t.value=x,c&&h(c,x)},async applyAgentBatch(x,m){const v=y();n.value=!0;try{const _=await Vg(v,x,{currentVersion:m,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return _.status==="applied"&&(e.value=!1),_}finally{n.value=!1}},async importXml(x){const{warnings:m}=await y().importXML(x);return e.value=!1,r.value=void 0,u(),{warnings:Rp(m)}},async saveXml(){const{xml:x}=await y().saveXML({format:!0});return e.value=!1,x??""},undo:()=>{var x;return(x=C())==null?void 0:x.undo()},redo:()=>{var x;return(x=C())==null?void 0:x.redo()},canUndo:()=>{var x;return((x=C())==null?void 0:x.canUndo())??!1},canRedo:()=>{var x;return((x=C())==null?void 0:x.canRedo())??!1}}}const AC=new RegExp("\\p{Script=Hangul}","u"),PC=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,TC=new RegExp("\\p{Script=Han}","u");function qp(e){const t=AC.test(e),n=PC.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:TC.test(e)?"han":"other"}}function Wg(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 Ug(e){var i;const t=new Set,n=[];for(const r of(e==null?void 0:e.diagrams)??[])for(const o of((i=r==null?void 0:r.plane)==null?void 0:i.planeElement)??[]){const a=o==null?void 0:o.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=ro(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Ho(a).filter(l=>kn(l))})}return n}const Ya=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function kC(e){const t=Wg(e),n=Ug(e);let i;const r={},o=[],a=[],s=[];for(const g of n){const h=g.trs.filter(y=>(y.body??"")===g.name).map(kn);if(h.length){const y=[...h].sort().join("+");r[y]=(r[y]??0)+1,i=i?new Set([...i].filter(C=>h.includes(C))):new Set(h)}else g.trs.some(y=>y.body)?o.push(Ya(g)):s.push({e:g,inference:qp(g.name)});for(const y of g.trs){const C=kn(y),x=y.body??"",m=qp(x);m.locale&&m.locale!==C?a.push({...Ya(g),locale:C,script:m.script}):C==="ko"&&m.script==="han"&&g.trs.some(v=>v!==y&&v.body===x)&&a.push({...Ya(g),locale:C,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...Ya(g),locale:h.locale}):d.push({...Ya(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:o,matchedBy:r,scriptMismatch:a}}function OC(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Wg(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const r=new Map(Ug(e).map(o=>[o.bo.id,o]));for(const{id:o,name:a,locale:s}of t.additions){const c=r.get(o);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>kn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(jo,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function DC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yp={exports:{}},qg;function LC(){if(qg)return Yp.exports;qg=1;var e=Yp.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},Yp.exports}var IC=LC(),BC=DC(IC);function Fi(e){if(!(this instanceof Fi))return new Fi(e);e=e||[128,36,1],this._seed=e.length?BC.rack(e[0],e[1],e[2]):e}Fi.prototype.next=function(e){return this._seed(e||!0)},Fi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Fi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Fi.prototype.assigned=function(e){return this._seed.get(e)||!1},Fi.prototype.unclaim=function(e){delete this._seed.hats[e]},Fi.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 Lt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[r,o,a]=Object.hasOwn(sn,i)?sn[i]:sn._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function NC(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function $n(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(r,o){n[o]=r})}),e}function Dn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const $C=Object.prototype.toString;function $t(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 $C.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 Bc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function lo(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function FC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nc={},Yg;function jC(){if(Yg)return Nc;Yg=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Nc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Nc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Nc}var Kg=jC(),HC=FC(Kg),Ge=NC({__proto__:null,default:HC},[Kg]),Xg=["focus","blur"];function zC(e,t,n,i,r){return Xg.indexOf(n)!==-1&&(r=!0),Ge.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=lo(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function GC(e,t,n,i){return Xg.indexOf(t)!==-1&&(i=!0),Ge.unbind(e,t,n,i)}var Kn={bind:zC,unbind:GC};function Kp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Et(e,t){return t=t||document,t.querySelector(e)}function $c(e,t){return t=t||document,t.querySelectorAll(e)}function ji(e){e.parentNode&&e.parentNode.removeChild(e)}function VC(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function WC(e,t){return t.appendChild(VC(e,t))}function We(e,t){return WC(t,e),e}var Xp=2,Zg={"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":Xp,"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":Xp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function UC(e,t){return Zg[t]?e.style[t]:e.getAttributeNS(null,t)}function Qg(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Zg[i];r?(r===Xp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function qC(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Qg(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)Qg(e,t,n);else return UC(e,t);else qC(e,t);return e}const YC=Object.prototype.toString;function ct(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 YC.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 Fc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Jg(e){return e.cloneNode(!0)}var Zp={svg:"http://www.w3.org/2000/svg"},ey='<svg xmlns="'+Zp.svg+'"';function KC(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Zp.svg)===-1&&(e=ey+e.substring(4)):(e=ey+">"+e+"</svg>",t=!0);var n=XC(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function XC(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=KC(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Zp.svg,e),t&&Se(n,t),n}var Qp=null;function ty(){return Qp===null&&(Qp=Oe("svg")),Qp}function ny(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function ZC(e,t,n,i,r,o){var a=ty().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return ny(a,e);case 6:return ny(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Ka(e){return ty().createSVGTransform()}var iy=/([&<>]{1})/g,QC=/([&<>\n\r"]{1})/g,JC={"&":"&","<":"<",">":">",'"':"'"};function Jp(e,t){function n(i,r){return JC[r]||r}return e.replace(t,n)}function ry(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Jp(e.textContent,iy));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Jp(o.value,QC),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ry(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Jp(e.nodeValue,iy),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function eM(e){for(var t=e.firstChild,n=[];t;)ry(t,n),t=t.nextSibling;return n.join("")}function oy(e,t){return eM(e)}function cn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function tM(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function nM(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(tM(e,i))}function Xa(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),nM(n,t)),n.consolidate()}const iM=/^class[ {]/;function rM(e){return iM.test(e.toString())}function ef(e){return Array.isArray(e)}function tf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function jc(...e){e.length===1&&ef(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const oM=/constructor\s*[^(]*\(\s*([^)]*)\)/m,aM=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,sM=/\/\*([^*]*)\*\//m;function cM(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(rM(e)?oM:aM);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(sM);return(r&&r[1]||i).trim()})||[]}function ay(e,t){const n=t||{get:function(m,v){if(i.push(m),v===!1)return null;throw s(`No provider for "${m}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(m){const v=i.join(" -> ");return i.length=0,new Error(v?`${m} (Resolving: ${v})`:m)};function c(m,v){if(!r[m]&&m.includes(".")){const _=m.split(".");let S=c(_.shift());for(;_.length;)S=S[_.shift()];return S}if(tf(o,m))return o[m];if(tf(r,m)){if(i.indexOf(m)!==-1)throw i.push(m),s("Cannot resolve circular dependency!");return i.push(m),o[m]=r[m][0](r[m][1]),i.pop(),o[m]}return n.get(m,v)}function l(m,v){if(typeof v>"u"&&(v={}),typeof m!="function")if(ef(m))m=jc(m.slice());else throw s(`Cannot invoke "${m}". Expected a function!`);const S=(m.$inject||cM(m)).map(k=>tf(v,k)?v[k]:c(k));return{fn:m,dependencies:S}}function u(m){const{fn:v,dependencies:_}=l(m),S=Function.prototype.bind.call(v,null,..._);return new S}function p(m,v,_){const{fn:S,dependencies:k}=l(m,_);return S.apply(v,k)}function f(m){return jc(v=>m.get(v))}function d(m,v){if(v&&v.length){const _=Object.create(null),S=Object.create(null),k=[],O=[],N=[];let P,D,j,ee;for(let ge in r)P=r[ge],v.indexOf(ge)!==-1&&(P[2]==="private"?(D=k.indexOf(P[3]),D===-1?(j=P[3].createChild([],v),ee=f(j),k.push(P[3]),O.push(j),N.push(ee),_[ge]=[ee,ge,"private",j]):_[ge]=[N[D],ge,"private",O[D]]):_[ge]=[P[2],P[1]],S[ge]=!0),(P[2]==="factory"||P[2]==="type")&&P[1].$scope&&v.forEach(Pe=>{P[1].$scope.indexOf(Pe)!==-1&&(_[ge]=[P[2],P[1]],S[Pe]=!0)});v.forEach(ge=>{if(!S[ge])throw new Error('No provider for "'+ge+'". Cannot use provider from the parent!')}),m.unshift(_)}return new ay(m,a)}const g={factory:p,type:u,value:function(m){return m}};function h(m,v){const _=m.__init__||[];return function(){_.forEach(S=>{typeof S=="string"?v.get(S):v.invoke(S)})}}function y(m){const v=m.__exports__;if(v){const _=m.__modules__,S=Object.keys(m).reduce((D,j)=>(j!=="__exports__"&&j!=="__modules__"&&j!=="__init__"&&j!=="__depends__"&&(D[j]=m[j]),D),Object.create(null)),k=(_||[]).concat(S),O=d(k),N=jc(function(D){return O.get(D)});v.forEach(function(D){r[D]=[N,D,"private",O]});const P=(m.__init__||[]).slice();return P.unshift(function(){O.init()}),m=Object.assign({},m,{__init__:P}),h(m,O)}return Object.keys(m).forEach(function(_){if(_==="__init__"||_==="__depends__")return;const S=m[_];if(S[2]==="private"){r[_]=S;return}const k=S[0],O=S[1];r[_]=[g[k],lM(k,O),k]}),h(m,a)}function C(m,v){return m.indexOf(v)!==-1||(m=(v.__depends__||[]).reduce(C,m),m.indexOf(v)!==-1)?m:m.concat(v)}function x(m){const v=m.reduce(C,[]).map(y);let _=!1;return function(){_||(_=!0,v.forEach(S=>S()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function lM(e,t){return e!=="value"&&ef(t)&&(t=jc(t.slice())),t}var uM=1e3;function nr(e,t){var n=this;t=t||uM,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}nr.prototype.canRender=function(e){},nr.prototype.drawShape=function(e,t){},nr.prototype.drawConnection=function(e,t){},nr.prototype.getShapePath=function(e){},nr.prototype.getConnectionPath=function(e){};function uo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function pM(e){return["M",e.x,e.y]}function nf(e){return["L",e.x,e.y]}function fM(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function dM(e,t){const n=e.length,i=[pM(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(nf(a));continue}const c=Math.min(t,rf(a.x-o.x,a.y-o.y),rf(s.x-a.x,s.y-a.y));if(!c){i.push(nf(a));continue}const l=Hc(a,o,c),u=Hc(a,o,c*.5),p=Hc(a,s,c),f=Hc(a,s,c*.5);i.push(nf(l)),i.push(fM(u,f,p))}return i}function Hc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=rf(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function rf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Za(e,t,n){ze(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return ze(n)&&(i.dataset.cornerRadius=String(n)),of(i,e)}function of(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:uo(dM(t,n))}),e}function zc(e){var t=new Set(e);return it(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function po(e,t,n){n=n||0,Fe(e)||(e=[e]),z(e,function(i,r){var o=t(i,r,n);Fe(o)&&o.length&&po(o,t,n+1)})}function af(e,t,n){var i=new Set,r=new Set;return po(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Qa(e,t){return af(e)}function hM(e,t,n){no(t)&&(t=!0),fn(t)&&(n=t,t=!0),n=n||{};var i=Ja(n.allShapes),r=Ja(n.allConnections),o=Ja(n.enclosedElements),a=Ja(n.enclosedConnections),s=Ja(n.topLevel,t&&$o(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,z(u.incoming,c),z(u.outgoing,c),u.children}return po(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Jt(e,t){t=!!t,Fe(e)||(e=[e]);var n,i,r,o;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=Jt(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>r||r===void 0)&&(r=c+p),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function ea(e,t){var n={};return z(e,function(i){var r=i;r.waypoints&&(r=Jt(r)),!ze(t.y)&&r.x>t.x&&(n[i.id]=i),!ze(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ze(t.width)&&ze(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ze(t.width)||!ze(t.height))&&(n[i.id]=i)}),n}function sy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function cy(e){return!!(e&&e.isFrame)}function Ja(e,t){return U({},e||{},t||{})}var mM=1;function Cr(e,t){nr.call(this,e,mM),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})}Ee(Cr,nr),Cr.prototype.canRender=function(){return!0},Cr.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),cy(n)?Se(r,U({},this.FRAME_STYLE,i||{})):Se(r,U({},this.SHAPE_STYLE,i||{})),We(t,r),r},Cr.prototype.drawConnection=function(t,n,i){var r=Za(n.waypoints,U({},this.CONNECTION_STYLE,i||{}));return We(t,r),r},Cr.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return uo(a)},Cr.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return uo(o)},Cr.$inject=["eventBus","styles"];function gM(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return U(o,{class:n})},this.style=function(n,i){!Fe(n)&&!i&&(i=n,n=[]);var r=Yn(n,function(o,a){return U(o,e[a]||{})},{});return i?U(r,i):r},this.computeStyle=function(n,i,r){return Fe(i)||(r=i,i=[]),t.style(i||[],U({},r,n||{}))}}const yM={__init__:["defaultRenderer"],defaultRenderer:["type",Cr],styles:["type",gM]};function qt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Xt(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 sf(e,t){return!e||!t?-1:e.indexOf(t)}function es(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cf(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=es(e,t);return Math.abs(r/o)<=i}var vM=2;function ir(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(bM(r,n))return o;return!1}function bM(e,t){const n=t[0];return io(t,function(i){return Math.abs(n[e]-i[e])<=vM})}function ly(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 lf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var xM=/,?([a-z]),?/gi,uy=parseFloat,en=Math,Mr=en.PI,Hi=en.min,zi=en.max,py=en.pow,Ar=en.abs,_M=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,wM=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,fy=Array.isArray||function(e){return e instanceof Array};function EM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function SM(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 RM(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),r=t.cache=t.cache||{},o=t.count=t.count||[];return EM(r,i)?(SM(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function CM(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(_M,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(wM,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=pf,n}function MM(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 AM(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 uf(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 pf(){return this.join(",").replace(xM,"$1")}function PM(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=pf,t}function dy(e,t,n,i,r,o,a,s,c){var l=1-c,u=py(l,3),p=py(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*r+d*a,h=u*t+p*3*c*i+l*3*c*c*o+d*s;return{x:Gc(g),y:Gc(h)}}function hy(e){var t=IM(...e);return uf(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 TM(e,t){return e=uf(e),t=uf(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 my(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function gy(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<u;g++){var h=l*p[g]+l,y=my(h,e,n,r,a),C=my(h,t,i,o,s),x=y*y+C*C;d+=f[g]*en.sqrt(x)}return l*d}function kM(e,t,n,i,r,o,a,s){if(!(zi(e,n)<Hi(r,a)||Hi(e,n)>zi(r,a)||zi(t,i)<Hi(o,s)||Hi(t,i)>zi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var p=Gc(c/u),f=Gc(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Hi(e,n).toFixed(2)||d>+zi(e,n).toFixed(2)||d<+Hi(r,a).toFixed(2)||d>+zi(r,a).toFixed(2)||g<+Hi(t,i).toFixed(2)||g>+zi(t,i).toFixed(2)||g<+Hi(o,s).toFixed(2)||g>+zi(o,s).toFixed(2)))return{x:p,y:f}}}}function Gc(e){return Math.round(e*1e11)/1e11}function OM(e,t,n){var i=hy(e),r=hy(t);if(!TM(i,r))return[];var o=gy(...e),a=gy(...t),s=vy(e)?1:~~(o/5)||1,c=vy(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=dy(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=dy(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var y=l[d],C=l[d+1],x=u[g],m=u[g+1],v=Ar(C.x-y.x)<.01?"y":"x",_=Ar(m.x-x.x)<.01?"y":"x",S=kM(y.x,y.y,C.x,C.y,x.x,x.y,m.x,m.y),k;if(S){if(k=S.x.toFixed(9)+"#"+S.y.toFixed(9),p[k])continue;p[k]=!0;var O=y.t+Ar((S[v]-y[v])/(C[v]-y[v]))*(C.t-y.t),N=x.t+Ar((S[_]-x[_])/(m[_]-x[_]))*(m.t-x.t);O>=0&&O<=1&&N>=0&&N<=1&&f.push({x:S.x,y:S.y,t1:O,t2:N})}}return f}function yy(e,t,n){e=_y(e),t=_y(t);for(var i,r,o,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(p=[i,r,...y.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var C=0,x=t.length;C<x;C++){var m=t[C];if(m[0]=="M")o=l=m[1],a=u=m[2];else{m[0]=="C"?(f=[o,a,...m.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,l,u,l,u],o=l,a=u);var v=OM(p,f);{for(var _=0,S=v.length;_<S;_++)v[_].segment1=g,v[_].segment2=C,v[_].bez1=p,v[_].bez2=f;d=d.concat(v)}}}}}return d}function DM(e){return fy(e)&&fy(e[0])}function LM(e){if(MM(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=pf,t}function vy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Vc(e,t,n,i){return[e,t,n,i,n,i]}function by(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function xy(e,t,n,i,r,o,a,s,c,l){var u=Mr*120/180,p=Mr/180*(+r||0),f=[],d,g=RM(function($,R,w){var G=$*en.cos(w)-R*en.sin(w),W=$*en.sin(w)+R*en.cos(w);return{x:G,y:W}});if(l)k=l[0],O=l[1],_=l[2],S=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,C=h*h/(n*n)+y*y/(i*i);C>1&&(C=en.sqrt(C),n=C*n,i=C*i);var x=n*n,m=i*i,v=(o==a?-1:1)*en.sqrt(Ar((x*m-x*y*y-m*h*h)/(x*y*y+m*h*h))),_=v*n*y/i+(e+s)/2,S=v*-i*h/n+(t+c)/2,k=en.asin(((t-S)/i).toFixed(9)),O=en.asin(((c-S)/i).toFixed(9));k=e<_?Mr-k:k,O=s<_?Mr-O:O,k<0&&(k=Mr*2+k),O<0&&(O=Mr*2+O),a&&k>O&&(k=k-Mr*2),!a&&O>k&&(O=O-Mr*2)}var N=O-k;if(Ar(N)>u){var P=O,D=s,j=c;O=k+u*(a&&O>k?1:-1),s=_+n*en.cos(O),c=S+i*en.sin(O),f=xy(s,c,n,i,r,0,a,D,j,[O,P,_,S])}N=O-k;var ee=en.cos(k),ge=en.sin(k),Pe=en.cos(O),De=en.sin(O),Ye=en.tan(N/4),ot=4/3*n*Ye,Me=4/3*i*Ye,X=[e,t],ne=[e+ot*ge,t-Me*ee],q=[s+ot*De,c-Me*Pe],K=[s,c];if(ne[0]=2*X[0]-ne[0],ne[1]=2*X[1]-ne[1],l)return[ne,q,K].concat(f);f=[ne,q,K].concat(f).join().split(",");for(var ae=[],fe=0,Te=f.length;fe<Te;fe++)ae[fe]=fe%2?g(f[fe-1],f[fe],p).y:g(f[fe],f[fe+1],p).x;return ae}function IM(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,y,C,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,f=3*i-3*t),Ar(u)<1e-12){if(Ar(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}y=p*p-4*f*u,C=en.sqrt(y),!(y<0)&&(g=(-p+C)/(2*u),0<g&&g<1&&c.push(g),h=(-p-C)/(2*u),0<h&&h<1&&c.push(h))}for(var m=c.length,v=m,_;m--;)d=c[m],_=1-d,l[0][m]=_*_*_*e+3*_*_*d*n+3*_*d*d*r+d*d*d*a,l[1][m]=_*_*_*t+3*_*_*d*i+3*_*d*d*o+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Hi(...l[0]),y0:Hi(...l[1]),x1:zi(...l[0]),y1:zi(...l[1])}}function _y(e){if(DM(e)||(e=CM(e)),AM(e))return e;for(var t=PM(LM(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,y;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...xy(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),f=["C",h,y,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...by(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...by(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Vc(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Vc(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Vc(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Vc(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)o[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=uy(u[p-4])||n.x,n.by=uy(u[p-3])||n.y}return t}function Rt(e){return fn(e)&&qn(e,"waypoints")}function et(e){return fn(e)&&qn(e,"labelTarget")}function BM(e){return fn(e)&&Bo(e.parent)}function wy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function rr(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Wc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function NM(e){return rr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function $M(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=HM(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function je(e){return Rt(e)?$M(e):NM(e)}function Rn(e,t,n){n=n||0,fn(n)||(n={x:n,y:n});var i=Be(e),r=Be(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function ts(e,t,n){var i=FM(e,t);return i.length===1||i.length===2&&es(i[0],i[1])<1?rr(i[0]):i.length>1?(i=Li(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),rr(i[n?0:i.length-1])):null}function FM(e,t){return yy(e,t)}function jM(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],es(n,r)===0||cf(i,r,n)?e.splice(t,1):t++;return e}function HM(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Uc(e,t){return Math.round(e*t)/t}function Ey(e){return ze(e)?e+"px":e}function zM(e){for(;e.parent;)e=e.parent;return e}function GM(e){e=U({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),$n(n,{position:"relative",overflow:"hidden",width:Ey(e.width),height:Ey(e.height)}),t.appendChild(n),n}function Sy(e,t,n){const i=Oe("g");ct(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const VM="base",Ry=0,WM=1,UM={shape:["x","y","width","height"],connection:["waypoints"]};function He(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}He.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],He.prototype._init=function(e){const t=this._eventBus,n=this._container=GM(e),i=this._svg=Oe("svg");Se(i,{width:"100%",height:"100%"}),Dn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),We(n,i);const r=this._viewport=Sy(i,"viewport");e.deferUpdate&&(this._viewboxChanged=rp(this._viewboxChanged,300)),this._restoreFocus=rp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},He.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},He.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},He.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=sy(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},He.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},He.prototype.restoreFocus=function(){this._restoreFocus()},He.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},He.prototype.isFocused=function(){return this._focused},He.prototype.getDefaultLayer=function(){return this.getLayer(VM,Ry)},He.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},He.prototype._getChildIndex=function(e){return Yn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},He.prototype._createLayer=function(e,t){typeof t>"u"&&(t=WM);const n=this._getChildIndex(t);return{group:Sy(this._viewport,"layer-"+e,n),index:t,visible:!0}},He.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},He.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(cn(n),t.visible=!1),n},He.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],cn(t.group))},He.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},He.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(zM(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},He.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},He.prototype._findPlaneForRoot=function(e){return Tt(this._planes,function(t){return t.rootElement===e})},He.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},He.prototype._resolveElements=function(e){return Fe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},He.prototype.getContainer=function(){return this._container},He.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),ct(r).add(t)):(e.markers.delete(t),ct(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},He.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},He.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},He.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},He.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},He.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},He.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Ry);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},He.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},He.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},He.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},He.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},He.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},He.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=UM[e];if(!io(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},He.prototype._setParent=function(e,t,n){Xt(t.children,e,n),e.parent=t},He.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},He.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},He.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},He.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),qt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},He.prototype.removeShape=function(e){return this._removeElement(e,"shape")},He.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},He.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},He.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},He.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},He.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Xa(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Xa(t),r=a?a.matrix:ZC(),s=Uc(r.a,1e3),c=Uc(-r.e||0,1e3),l=Uc(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},He.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=U({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Cy(t,n)}),{x:n.e,y:n.f}},He.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Jt(o),s=Be(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Be(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),y=Math.max(0,s.bottom-f.bottom),C=Math.min(0,s.top-f.top);u=g||h,p=y||C}this.scroll({dx:-u*l,dy:-p*l})},He.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Uc(i.a,1e3)};function Cy(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}He.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},He.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=U(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),Cy(this._viewport,u),u},He.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},He.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},He.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ta="data-element-id";function li(e){this._elements={},this._eventBus=e}li.$inject=["eventBus"],li.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,ta,i),n&&Se(n,ta,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},li.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,ta,""),i.secondaryGfx&&Se(i.secondaryGfx,ta,""),delete t[n])},li.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)},li.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,ta,i),t},li.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,ta);var n=this._elements[t];return n&&n.element},li.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},li.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},li.prototype.getAll=function(){return this.filter(function(e){return e})},li.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},li.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},li.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 qM(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function YM(e){return e.__refs_collection===!0}function KM(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function My(e,t,n){var i=qM(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function XM(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function mi(e,t){if(!(this instanceof mi))return new mi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}mi.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?My(this,t,e):XM(this,t,e)},mi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return YM(n)||My(this,t,e),n},mi.prototype.ensureBound=function(e,t){KM(e,t)||this.bind(e,t)},mi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},mi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var ff=new mi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ay=new mi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Py=new mi({name:"attachers",collection:!0},{name:"host"}),Ty=new mi({name:"outgoing",collection:!0},{name:"source"}),ky=new mi({name:"incoming",collection:!0},{name:"target"});function na(){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)}}),ff.bind(this,"parent"),Ay.bind(this,"labels"),Ty.bind(this,"outgoing"),ky.bind(this,"incoming")}function ns(){na.call(this),ff.bind(this,"children"),Py.bind(this,"host"),Py.bind(this,"attachers")}Ee(ns,na);function Oy(){na.call(this),ff.bind(this,"children")}Ee(Oy,ns);function Dy(){ns.call(this),Ay.bind(this,"labelTarget")}Ee(Dy,ns);function Ly(){na.call(this),Ty.bind(this,"source"),ky.bind(this,"target")}Ee(Ly,na);var ZM={connection:Ly,shape:ns,label:Dy,root:Oy};function QM(e,t){var n=ZM[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}function JM(e){return e instanceof na}function or(){this._uid=12}or.prototype.createRoot=function(e){return this.create("root",e)},or.prototype.createLabel=function(e){return this.create("label",e)},or.prototype.createShape=function(e){return this.create("shape",e)},or.prototype.createConnection=function(e){return this.create("connection",e)},or.prototype.create=function(e,t){return t=U({},t||{}),t.id||(t.id=e+"_"+this._uid++),QM(e,t)};var qc="__fn",Iy=1e3,eA=Array.prototype.slice;function Xn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Xn.prototype.on=function(e,t,n,i){if(e=Fe(e)?e:[e],dn(t)&&(i=n,n=t,t=Iy),!ze(t))throw new Error("priority must be a number");var r=n;i&&(r=zn(n,i),r[qc]=n[qc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Xn.prototype.once=function(e,t,n,i){var r=this;if(dn(t)&&(i=n,n=t,t=Iy),!ze(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[qc]=n,this.on(e,t,o)},Xn.prototype.off=function(e,t){e=Fe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Xn.prototype.createEvent=function(e){var t=new is;return t.init(e),t},Xn.prototype.fire=function(e,t){var n,i,r,o;if(o=eA.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 is?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Xn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Xn.prototype._destroy=function(){this._listeners={}},Xn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Xn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=tA(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Xn.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},Xn.prototype._getListeners=function(e){return this._listeners[e]},Xn.prototype._setListeners=function(e,t){this._listeners[e]=t},Xn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[qc]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function is(){}is.prototype.stopPropagation=function(){this.cancelBubble=!0},is.prototype.preventDefault=function(){this.defaultPrevented=!0},is.prototype.init=function(e){U(this,e||{})};function tA(e,t){return e.apply(null,t)}function fo(e){return e.childNodes[0]}function nA(e){return e.parentNode.childNodes[1]}function Yc(e,t,n,i,r){var o=Ka();o.setTranslate(t,n);var a=Ka();a.setRotate(i||0,0,0);var s=Ka();s.setScale(1,1),Xa(e,[o,a,s])}function Cn(e,t,n){var i=Ka();i.setTranslate(t,n),Xa(e,i)}function By(e,t){var n=Ka();n.setRotate(t,0,0),Xa(e,n)}function ui(e,t){this._eventBus=e,this._elementRegistry=t}ui.$inject=["eventBus","elementRegistry"],ui.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=nA(t),n||(n=Oe("g"),ct(n).add("djs-children"),We(t.parentNode,n))):n=t,n},ui.prototype._clear=function(e){var t=fo(e);return Bc(t),t},ui.prototype._createContainer=function(e,t,n,i){var r=Oe("g");ct(r).add("djs-group"),typeof n<"u"?iA(r,t,t.childNodes[n]):We(t,r);var o=Oe("g");ct(o).add("djs-element"),ct(o).add("djs-"+e),i&&ct(o).add("djs-frame"),We(r,o);var a=Oe("g");return ct(a).add("djs-visual"),We(o,a),o},ui.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,cy(t))},ui.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Yn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),z(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;z(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},ui.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},ui.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},ui.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},ui.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},ui.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Cn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},ui.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);cn(t.parentNode)};function iA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const rA={__depends__:[yM],__init__:["canvas"],canvas:["type",He],elementRegistry:["type",li],elementFactory:["type",or],eventBus:["type",Xn],graphicsFactory:["type",ui]};function oA(e){var t=new ay(e);return t.init(),t}function aA(e){e=e||{};var t={config:["value",e]},n=[t,rA].concat(e.modules||[]);return oA(n)}function Tr(e,t){this._injector=t||aA(e),this.get("eventBus").fire("diagram.init")}Tr.prototype.get=function(e,t){return this._injector.get(e,t)},Tr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Tr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Tr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Ln(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Gn(e,t){return e.$instanceOf(t)}function sA(e){return Tt(e.rootElements,function(t){return Gn(t,"bpmn:Process")||Gn(t,"bpmn:Collaboration")})}function cA(e){var t={},n=[],i={};function r(q,K){return function(ae){q(ae,K)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,K){var ae=q.gfx;if(ae)throw new Error(`already rendered ${Ln(q)}`);return e.element(q,i[q.id],K)}function c(q,K){return e.root(q,i[q.id],K)}function l(q,K){try{var ae=i[q.id]&&s(q,K);return o(q),ae}catch(fe){u(fe.message,{element:q,error:fe}),console.error(`failed to import ${Ln(q)}`,fe)}}function u(q,K){e.error(q,K)}var p=this.registerDi=function(K){var ae=K.bpmnElement;ae?i[ae.id]?u(`multiple DI elements defined for ${Ln(ae)}`,{element:ae}):i[ae.id]=K:u(`no bpmnElement referenced in ${Ln(K)}`,{element:K})};function f(q){d(q.plane)}function d(q){p(q),z(q.planeElement,g)}function g(q){p(q)}this.handleDefinitions=function(K,ae){var fe=K.diagrams;if(ae&&fe.indexOf(ae)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ae&&fe&&fe.length&&(ae=fe[0]),!ae)throw new Error("no diagram to display");i={},f(ae);var Te=ae.plane;if(!Te)throw new Error(`no plane for ${Ln(ae)}`);var $=Te.bpmnElement;if(!$)if($=sA(K),$)u(`correcting missing bpmnElement on ${Ln(Te)} to ${Ln($)}`),Te.bpmnElement=$,p(Te);else throw new Error("no process or collaboration to display");var R=c($,Te);if(Gn($,"bpmn:Process")||Gn($,"bpmn:SubProcess"))y($,R);else if(Gn($,"bpmn:Collaboration"))X($,R),C(K.rootElements,R);else throw new Error(`unsupported bpmnElement for ${Ln(Te)}: ${Ln($)}`);h(n)};var h=this.handleDeferred=function(){for(var K;n.length;)K=n.shift(),K()};function y(q,K){Ye(q,K),N(q.ioSpecification,K),O(q.artifacts,K),o(q)}function C(q,K){var ae=it(q,function(fe){return!a(fe)&&Gn(fe,"bpmn:Process")&&fe.laneSets});ae.forEach(r(y,K))}function x(q,K){l(q,K)}function m(q,K){z(q,r(x,K))}function v(q,K){l(q,K)}function _(q,K){l(q,K)}function S(q,K){l(q,K)}function k(q,K){l(q,K)}function O(q,K){z(q,function(ae){Gn(ae,"bpmn:Association")?n.push(function(){k(ae,K)}):k(ae,K)})}function N(q,K){q&&(z(q.dataInputs,r(_,K)),z(q.dataOutputs,r(S,K)))}var P=this.handleSubProcess=function(K,ae){Ye(K,ae),O(K.artifacts,ae)};function D(q,K){var ae=l(q,K);Gn(q,"bpmn:SubProcess")&&P(q,ae||K),Gn(q,"bpmn:Activity")&&N(q.ioSpecification,K),n.push(function(){z(q.dataInputAssociations,r(v,K)),z(q.dataOutputAssociations,r(v,K))})}function j(q,K){l(q,K)}function ee(q,K){l(q,K)}function ge(q,K){n.push(function(){var ae=l(q,K);q.childLaneSet&&Pe(q.childLaneSet,ae||K),ne(q)})}function Pe(q,K){z(q.lanes,r(ge,K))}function De(q,K){z(q,r(Pe,K))}function Ye(q,K){ot(q.flowElements,K),q.laneSets&&De(q.laneSets,K)}function ot(q,K){z(q,function(ae){Gn(ae,"bpmn:SequenceFlow")?n.push(function(){j(ae,K)}):Gn(ae,"bpmn:BoundaryEvent")?n.unshift(function(){D(ae,K)}):Gn(ae,"bpmn:FlowNode")?D(ae,K):Gn(ae,"bpmn:DataObject")||(Gn(ae,"bpmn:DataStoreReference")||Gn(ae,"bpmn:DataObjectReference")?ee(ae,K):u(`unrecognized flowElement ${Ln(ae)} in context ${Ln(K&&K.businessObject)}`,{element:ae,context:K}))})}function Me(q,K){var ae=l(q,K),fe=q.processRef;fe&&y(fe,ae||K)}function X(q,K){z(q.participants,r(Me,K)),n.push(function(){m(q.messageFlows,K)}),O(q.artifacts,K)}function ne(q){z(q.flowNodeRef,function(K){var ae=K.get("lanes");ae&&ae.push(q)})}}function lA(e,t,n){var i,r,o,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,C){return i.add(h,y,C)},error:function(h,y){s.push({message:h,context:y})}},f=new cA(p);u=u||l.diagrams&&l.diagrams[0];var d=uA(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function uA(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=pA(n));var r;M(i,"bpmn:Collaboration")?r=i:r=Tt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Tt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=Tn(r.participants,function(l){return l.processRef}),o.push(r));var a=Ny(o),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function Ny(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(Ny(n.flowElements)))}),t}function pA(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var fA='<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>',$y=fA,Fy={verticalAlign:"middle"},jy={color:"#404040"},dA={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},hA={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},mA={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"},gA='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+$y+'</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>',Gi;function yA(){Gi=Lt(gA),$n(Gi,dA),$n(Et("svg",Gi),Fy),$n(Et(".backdrop",Gi),hA),$n(Et(".notice",Gi),mA),$n(Et(".link",Gi),jy,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function vA(){Gi||(yA(),Kn.bind(Gi,".backdrop","click",function(e){document.body.removeChild(Gi)})),document.body.appendChild(Gi)}const Kc=5,Hy="djs-outline-hidden";function Ft(e){e=U({},xA,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),wA(this._container)}Ee(Ft,Tr),Ft.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Xc(s,o),s=bA(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Ft.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Ft.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Xc(o,[]),o}if(typeof t=="string"&&(i=_A(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Xc(o,[]),o}try{this.clear()}catch(o){throw Xc(o,[]),o}const{warnings:r}=await lA(this,n,i);return{warnings:r}},Ft.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},Ft.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Et(":scope > defs",i._svg),a=oy(r),s=o?"<defs>"+oy(o)+"</defs>":"",c=i.getContainer();$t(c).add(Hy);let l;try{l=r.getBBox()}finally{$t(c).remove(Hy)}const u=l.x-Kc,p=l.y-Kc,f=l.width+Kc*2,d=l.height+Kc*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
8
8
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
9
9
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
10
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Ht.prototype._setDefinitions=function(e){this._definitions=e},Ht.prototype.getModules=function(){return this._modules},Ht.prototype.clear=function(){this.getDefinitions()&&Tr.prototype.clear.call(this)},Ht.prototype.destroy=function(){Tr.prototype.destroy.call(this),zi(this._container)},Ht.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ht.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ht.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=wt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ht.prototype.getDefinitions=function(){return this._definitions},Ht.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ht.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=U(Ni(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:a});Tr.call(this,s),n&&n.container&&this.attachTo(n.container)},Ht.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ht.prototype._createContainer=function(e){const t=Dt('<div class="bjs-container"></div>');return $n(t,{width:Ny(e.width),height:Ny(e.height),position:e.position}),t},Ht.prototype._createModdle=function(e){const t=U({},this._moddleExtensions,e.moddleExtensions);return new wm(t)},Ht.prototype._modules=[];function Wc(e,t){return e.warnings=t,e}function dA(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 hA={width:"100%",height:"100%",position:"relative"};function Ny(e){return e+(ze(e)?"px":"")}function mA(e,t){return t&&Pt(e.diagrams,function(n){return n.id===t})||null}function gA(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Dy+"</a>",i=Dt(n);$n(wt("svg",i),Ly),$n(i,Iy,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ge.bind(i,"click",function(r){fA(),r.preventDefault()})}function ta(e){Ht.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)}Ee(ta,Ht),ta.prototype._createModdle=function(e){var t=Ht.prototype._createModdle.call(this,e);return t.ids=new Hi([32,36,1]),t},ta.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function at(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||ct(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!ue(e).processRef:!0}function yn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=ct(e).isHorizontal;return t===void 0?!0:t}}function yA(e){return e&&ue(e).isInterrupting!==!1}function Bn(e){return e&&!!ue(e).triggeredByEvent}function na(e,t){var n=ue(e).eventDefinitions;return br(n,function(i){return M(i,t)})}function vA(e){return na(e,"bpmn:ErrorEventDefinition")}function bA(e){return na(e,"bpmn:EscalationEventDefinition")}function xA(e){return na(e,"bpmn:CompensateEventDefinition")}var ho={width:90,height:20},$y=15;function kr(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function Uc(e){return Je(e.label)}function _A(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=wA(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=$y:a+=$y,{x:a,y:s}}function wA(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 sf(e){return e.waypoints?_A(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+ho.height/2}:{x:e.x+e.width/2,y:e.y+e.height+ho.height/2}}function EA(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(ho.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=sf(t),i=ho),U({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Fy(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function SA(e){var t=e.categoryValueRef;return t&&t.value||""}function pi(e){var t=e.businessObject,n=Fy(t);if(n)return n==="categoryValueRef"?SA(t):t[n]||""}function RA(e,t){var n=e.businessObject,i=Fy(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function CA(e){return Je(e)&&kr(e.labelTarget)}var ia=7;function jy(e){let t=[];return z(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function es(e){const t=new Map;return z(Jp(e),n=>{z(jy(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 cf="hsl(225, 10%, 15%)",MA="white";function Ui(e,t){return br(e.eventDefinitions,function(n){return n.$type===t})}function AA(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function PA(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function it(e,t,n){var i=ct(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||MA}function _e(e,t,n){var i=ct(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||cf}function ts(e,t,n,i){var r=ct(e),o=r.get("label");return i||o&&o.get("color:color")||t||_e(e,n)}function Hy(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return uo(r)}function lf(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return uo(a)}function TA(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return uo(s)}function kA(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return uo(o)}function ns(e,t={}){return{width:gi(e,t),height:Qn(e,t)}}function gi(e,t={}){return Yn(t,"width")?t.width:e.width}function Qn(e,t={}){return Yn(t,"height")?t.height:e.height}var OA=new Hi,DA=10,qc=3,LA=1.5,Yc=10,IA=4,ra=.95,BA=1,NA=.25;function mo(e,t,n,i,r,o,a){nr.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u($){return n.computeStyle($,{strokeLinecap:"round",strokeLinejoin:"round",stroke:cf,strokeWidth:2,fill:"white"})}function p($){return n.computeStyle($,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:cf,strokeWidth:2})}function f($,R){var{ref:w={x:0,y:0},scale:G=1,element:V,parentGfx:te=r._svg}=R,Re=Oe("marker",{id:$,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});We(Re,V);var Qe=wt(":scope > defs",te);Qe||(Qe=Oe("defs"),We(te,Qe)),We(Qe,Re)}function d($,R,w,G){var V=OA.nextPrefixed("marker-");return g($,V,R,w,G),"url(#"+V+")"}function g($,R,w,G,V){if(w==="sequenceflow-end"){var te=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:V,stroke:V,strokeWidth:1})});f(R,{element:te,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(w==="messageflow-start"){var Re=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:V,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Re,ref:{x:6,y:6},parentGfx:$})}if(w==="messageflow-end"){var Qe=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:V,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Qe,ref:{x:8.5,y:5},parentGfx:$})}if(w==="association-start"){var ht=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:V,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:ht,ref:{x:1,y:10},scale:.5,parentGfx:$})}if(w==="association-end"){var Wt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:V,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:Wt,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(w==="conditional-flow-marker"){var xt=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:V})});f(R,{element:xt,ref:{x:-1,y:10},scale:.5,parentGfx:$})}if(w==="conditional-default-flow-marker"){var dn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:V,fill:"none"})});f(R,{element:dn,ref:{x:0,y:10},scale:.5,parentGfx:$})}}function h($,R,w,G,V={}){hn(G)&&(V=G,G=0),G=G||0,V=u(V);var te=R/2,Re=w/2,Qe=Oe("circle",{cx:te,cy:Re,r:Math.round((R+w)/4-G),...V});return We($,Qe),Qe}function y($,R,w,G,V,te){hn(V)&&(te=V,V=0),V=V||0,te=u(te);var Re=Oe("rect",{x:V,y:V,width:R-V*2,height:w-V*2,rx:G,ry:G,...te});return We($,Re),Re}function C($,R,w,G){var V=R/2,te=w/2,Re=[{x:V,y:0},{x:R,y:te},{x:V,y:w},{x:0,y:te}],Qe=Re.map(function(Wt){return Wt.x+","+Wt.y}).join(" ");G=u(G);var ht=Oe("polygon",{...G,points:Qe});return We($,ht),ht}function x($,R,w,G){w=p(w);var V=qa(R,w,G);return We($,V),V}function m($,R,w){return x($,R,w,5)}function v($,R,w){w=p(w);var G=Oe("path",{...w,d:R});return We($,G),G}function _($,R,w,G){return v(R,w,U({"data-marker":$},G))}function E($){return Te[$]}function T($){return function(R,w,G){return E($)(R,w,G)}}var O={"bpmn:MessageEventDefinition":function($,R,w={},G){var V=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.235,my:.315}}),te=G?_e(R,c,w.stroke):it(R,s,w.fill),Re=G?it(R,s,w.fill):_e(R,c,w.stroke),Qe=v($,V,{fill:te,stroke:Re,strokeWidth:1});return Qe},"bpmn:TimerEventDefinition":function($,R,w={}){var G=w.width||R.width,V=w.height||R.height,te=w.width?1:2,Re=h($,G,V,.2*V,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:te}),Qe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:V,position:{mx:.5,my:.5}});v($,Qe,{stroke:_e(R,c,w.stroke),strokeWidth:te});for(var ht=0;ht<12;ht++){var Wt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:V,position:{mx:.5,my:.5}}),xt=G/2,dn=V/2;v($,Wt,{strokeWidth:1,stroke:_e(R,c,w.stroke),transform:"rotate("+ht*30+","+dn+","+xt+")"})}return Re},"bpmn:EscalationEventDefinition":function($,R,w={},G){var V=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.5,my:.2}}),te=G?_e(R,c,w.stroke):it(R,s,w.fill);return v($,V,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function($,R,w={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.5,my:.222}});return v($,G,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function($,R,w={},G){var V=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.57,my:.263}}),te=G?_e(R,c,w.stroke):it(R,s,w.fill);return v($,V,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function($,R,w={},G){var V=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.2,my:.722}}),te=G?_e(R,c,w.stroke):it(R,s,w.fill);return v($,V,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function($,R,w={},G){var V=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.638,my:-.055}}),te=G?_e(R,c,w.stroke):"none",Re=v($,V,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1});return ky(Re,45),Re},"bpmn:CompensateEventDefinition":function($,R,w={},G){var V=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.22,my:.5}}),te=G?_e(R,c,w.stroke):it(R,s,w.fill);return v($,V,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function($,R,w={},G){var V=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.5,my:.2}}),te=G?_e(R,c,w.stroke):it(R,s,w.fill);return v($,V,{strokeWidth:1,fill:te,stroke:_e(R,c,w.stroke)})},"bpmn:MultipleEventDefinition":function($,R,w={},G){var V=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.211,my:.36}}),te=G?_e(R,c,w.stroke):it(R,s,w.fill);return v($,V,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function($,R,w={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.458,my:.194}});return v($,G,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function($,R,w={}){var G=h($,R.width,R.height,8,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:4});return G}};function N($,R,w={},G){var V=ue($),te=AA(V),Re=G||$;return V.get("eventDefinitions")&&V.get("eventDefinitions").length>1?V.get("parallelMultiple")?O["bpmn:ParallelMultipleEventDefinition"](R,Re,w,te):O["bpmn:MultipleEventDefinition"](R,Re,w,te):Ui(V,"bpmn:MessageEventDefinition")?O["bpmn:MessageEventDefinition"](R,Re,w,te):Ui(V,"bpmn:TimerEventDefinition")?O["bpmn:TimerEventDefinition"](R,Re,w,te):Ui(V,"bpmn:ConditionalEventDefinition")?O["bpmn:ConditionalEventDefinition"](R,Re,w,te):Ui(V,"bpmn:SignalEventDefinition")?O["bpmn:SignalEventDefinition"](R,Re,w,te):Ui(V,"bpmn:EscalationEventDefinition")?O["bpmn:EscalationEventDefinition"](R,Re,w,te):Ui(V,"bpmn:LinkEventDefinition")?O["bpmn:LinkEventDefinition"](R,Re,w,te):Ui(V,"bpmn:ErrorEventDefinition")?O["bpmn:ErrorEventDefinition"](R,Re,w,te):Ui(V,"bpmn:CancelEventDefinition")?O["bpmn:CancelEventDefinition"](R,Re,w,te):Ui(V,"bpmn:CompensateEventDefinition")?O["bpmn:CompensateEventDefinition"](R,Re,w,te):Ui(V,"bpmn:TerminateEventDefinition")?O["bpmn:TerminateEventDefinition"](R,Re,w,te):null}var P={ParticipantMultiplicityMarker:function($,R,w={}){var G=gi(R,w),V=Qn(R,w),te=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:(G/2-6)/G,my:(V-15)/V}});_("participant-multiplicity",$,te,{strokeWidth:2,fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke)})},SubProcessMarker:function($,R,w={}){var G=y($,14,14,0,{strokeWidth:1,fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke)});Mn(G,R.width/2-7.5,R.height-20);var V=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2-7.5)/R.width,my:(R.height-20)/R.height}});_("sub-process",$,V,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke)})},ParallelMarker:function($,R,w){var G=gi(R,w),V=Qn(R,w),te=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:(G/2+w.parallel)/G,my:(V-20)/V}});_("parallel",$,te,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke)})},SequentialMarker:function($,R,w){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+w.seq)/R.width,my:(R.height-19)/R.height}});_("sequential",$,G,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke)})},CompensationMarker:function($,R,w){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+w.compensation)/R.width,my:(R.height-13)/R.height}});_("compensation",$,G,{strokeWidth:1,fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke)})},LoopMarker:function($,R,w){var G=gi(R,w),V=Qn(R,w),te=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:(G/2+w.loop)/G,my:(V-7)/V}});_("loop",$,te,{strokeWidth:1.5,fill:"none",stroke:_e(R,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function($,R,w){var G=gi(R,w),V=Qn(R,w),te=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:(G/2+w.adhoc)/G,my:(V-15)/V}});_("adhoc",$,te,{strokeWidth:1,fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke)})}};function D($,R,w,G){P[$](R,w,G)}function F($,R,w=[],G={}){G={fill:G.fill,stroke:G.stroke,width:gi(R,G),height:Qn(R,G)};var V=ue(R),te=w.includes("SubProcessMarker");te?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},V.get("isForCompensation")&&w.push("CompensationMarker"),M(V,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),te||U(G,{compensation:G.compensation-18}));var Re=V.get("loopCharacteristics"),Qe=Re&&Re.get("isSequential");Re&&(U(G,{compensation:G.compensation-18}),w.includes("AdhocMarker")&&U(G,{seq:-23,loop:-18,parallel:-24}),Qe===void 0&&w.push("LoopMarker"),Qe===!1&&w.push("ParallelMarker"),Qe===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&U(G,{compensation:-8}),z(w,function(ht){D(ht,$,R,G)})}function J($,R,w={}){w=U({size:{width:100}},w);var G=o.createText(R||"",w);return st(G).add("djs-label"),We($,G),G}function ge($,R,w,G={}){var V=ue(R),te=ns({x:R.x,y:R.y,width:R.width,height:R.height},G);return J($,V.name,{align:w,box:te,padding:7,style:{fill:ts(R,l,c,G.stroke)}})}function Ae($,R,w={}){var G={width:R.width,height:R.height,x:R.width/2+R.x,y:R.height/2+R.y};return J($,pi(R),{box:G,style:U({},o.getExternalStyle(),{fill:ts(R,l,c,w.stroke)})})}function De($,R,w,G={}){var V=yn(w),te=J($,R,{box:{height:30,width:V?Qn(w,G):gi(w,G)},align:"center-middle",style:{fill:ts(w,l,c,G.stroke)}});if(V){var Re=-1*Qn(w,G);Gc(te,0,-Re,270)}}function qe($,R,w={}){var{width:G,height:V}=ns(R,w);return y($,G,V,Yc,{...w,fill:it(R,s,w.fill),fillOpacity:ra,stroke:_e(R,c,w.stroke)})}function rt($,R,w={}){var G=ue(R),V=it(R,s,w.fill),te=_e(R,c,w.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(w.markerEnd=d($,"association-end",V,te)),G.get("associationDirection")==="Both"&&(w.markerStart=d($,"association-start",V,te)),w=ut(w,["markerStart","markerEnd"]),m($,R.waypoints,{...w,stroke:te,strokeDasharray:"0, 5"})}function Me($,R,w={}){var G=it(R,s,w.fill),V=_e(R,c,w.stroke),te=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}}),Re=v($,te,{fill:G,fillOpacity:ra,stroke:V}),Qe=ue(R);if(PA(Qe)){var ht=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.33,my:(R.height-18)/R.height}});v($,ht,{strokeWidth:2,fill:G,stroke:V})}return Re}function X($,R,w={}){return h($,R.width,R.height,{fillOpacity:ra,...w,fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke)})}function ne($,R,w={}){return C($,R.width,R.height,{fill:it(R,s,w.fill),fillOpacity:ra,stroke:_e(R,c,w.stroke)})}function q($,R,w={}){var G=y($,gi(R,w),Qn(R,w),0,{fill:it(R,s,w.fill),fillOpacity:w.fillOpacity||ra,stroke:_e(R,c,w.stroke),strokeWidth:1.5}),V=ue(R);if(M(V,"bpmn:Lane")){var te=V.get("name");De($,te,R,w)}return G}function K($,R,w={}){var G=qe($,R,w),V=at(R);if(Bn(R)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!V)){var te=ue(R).flowElements||[],Re=te.filter(Qe=>M(Qe,"bpmn:StartEvent"));Re.length===1&&oe(Re[0],$,w,R)}return ge($,R,V?"center-top":"center-middle",w),V?F($,R,void 0,w):F($,R,["SubProcessMarker"],w),G}function oe($,R,w,G){var V=22,te={fill:it(G,s,w.fill),stroke:_e(G,c,w.stroke),width:V,height:V},Re=ue($).isInterrupting,Qe=Re?0:3,ht=Re?1:1.2,Wt=20,xt=(V-Wt)/2,dn="translate("+xt+","+xt+")";h(R,Wt,Wt,{fill:te.fill,stroke:te.stroke,strokeWidth:ht,strokeDasharray:Qe,transform:dn}),N($,R,te,G)}function fe($,R,w={}){var G=qe($,R,w);return ge($,R,"center-middle",w),F($,R,void 0,w),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function($,R,w={}){return at(R)?w=ut(w,["fill","stroke","width","height"]):w=ut(w,["fill","stroke"]),K($,R,w)},"bpmn:Association":function($,R,w={}){return w=ut(w,["fill","stroke"]),rt($,R,w)},"bpmn:BoundaryEvent":function($,R,w={}){var{renderIcon:G=!0}=w;w=ut(w,["fill","stroke"]);var V=ue(R),te=V.get("cancelActivity");w={strokeWidth:1.5,fill:it(R,s,w.fill),fillOpacity:BA,stroke:_e(R,c,w.stroke)},te||(w.strokeDasharray="6");var Re=X($,R,w);return h($,R.width,R.height,qc,{...w,fill:"none"}),G&&N(R,$,w),Re},"bpmn:BusinessRuleTask":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=fe($,R,w),V=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),te=v($,V);Se(te,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Qe=v($,Re);return Se(Qe,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function($,R,w={}){return w=ut(w,["fill","stroke"]),K($,R,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=ne($,R,w),V=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.26}});return v($,V,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:DataInput":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),V=Me($,R,w);return v($,G,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:1}),V},"bpmn:DataInputAssociation":function($,R,w={}){return w=ut(w,["fill","stroke"]),rt($,R,{...w,markerEnd:d($,"association-end",it(R,s,w.fill),_e(R,c,w.stroke))})},"bpmn:DataObject":function($,R,w={}){return w=ut(w,["fill","stroke"]),Me($,R,w)},"bpmn:DataObjectReference":T("bpmn:DataObject"),"bpmn:DataOutput":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),V=Me($,R,w);return v($,G,{strokeWidth:1,fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke)}),V},"bpmn:DataOutputAssociation":function($,R,w={}){return w=ut(w,["fill","stroke"]),rt($,R,{...w,markerEnd:d($,"association-end",it(R,s,w.fill),_e(R,c,w.stroke))})},"bpmn:DataStoreReference":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:0,my:.133}});return v($,G,{fill:it(R,s,w.fill),fillOpacity:ra,stroke:_e(R,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function($,R,w={}){var{renderIcon:G=!0}=w;w=ut(w,["fill","stroke"]);var V=X($,R,{...w,strokeWidth:4});return G&&N(R,$,w),V},"bpmn:EventBasedGateway":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=ue(R),V=ne($,R,w);h($,R.width,R.height,R.height*.2,{fill:it(R,"none",w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1});var te=G.get("eventGatewayType"),Re=!!G.get("instantiate");function Qe(){var Wt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:R.width,containerHeight:R.height,position:{mx:.36,my:.44}});v($,Wt,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:2})}if(te==="Parallel"){var ht=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}});v($,ht,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:1})}else te==="Exclusive"&&(Re||h($,R.width,R.height,R.height*.26,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:1}),Qe());return V},"bpmn:ExclusiveGateway":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=ne($,R,w),V=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.32,my:.3}}),te=ct(R);return te.get("isMarkerVisible")&&v($,V,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:Gateway":function($,R,w={}){return w=ut(w,["fill","stroke"]),ne($,R,w)},"bpmn:Group":function($,R,w={}){return w=ut(w,["fill","stroke","width","height"]),y($,R.width,R.height,Yc,{stroke:_e(R,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:gi(R,w),height:Qn(R,w)})},"bpmn:InclusiveGateway":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=ne($,R,w);return h($,R.width,R.height,R.height*.24,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function($,R,w={}){var{renderIcon:G=!0}=w;w=ut(w,["fill","stroke"]);var V=X($,R,{...w,strokeWidth:1.5});return h($,R.width,R.height,qc,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:1.5}),G&&N(R,$,w),V},"bpmn:IntermediateCatchEvent":T("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":T("bpmn:IntermediateEvent"),"bpmn:Lane":function($,R,w={}){return w=ut(w,["fill","stroke","width","height"]),q($,R,{...w,fillOpacity:NA})},"bpmn:ManualTask":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=fe($,R,w),V=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v($,V,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=ue(R),V=ct(R),te=it(R,s,w.fill),Re=_e(R,c,w.stroke),Qe=m($,R.waypoints,{markerEnd:d($,"messageflow-end",te,Re),markerStart:d($,"messageflow-start",te,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var ht=Qe.getPointAtLength(Qe.getTotalLength()/2),Wt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ht.x,y:ht.y}}),xt={strokeWidth:1};V.get("messageVisibleKind")==="initiating"?(xt.fill=te,xt.stroke=Re):(xt.fill=Re,xt.stroke=te);var dn=v($,Wt,xt),wn=G.get("messageRef"),jn=wn.get("name"),Ct=J($,jn,{align:"center-top",fitBox:!0,style:{fill:Re}}),Yt=dn.getBBox(),vn=Ct.getBBox(),ka=ht.x-vn.width/2,Hn=ht.y+Yt.height/2+DA;Gc(Ct,ka,Hn,0)}return Qe},"bpmn:ParallelGateway":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=ne($,R,w),V=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.2}});return v($,V,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:Participant":function($,R,w={}){w=ut(w,["fill","stroke","width","height"]);var G=q($,R,w),V=at(R),te=yn(R),Re=ue(R),Qe=Re.get("name");if(V){var ht=te?[{x:30,y:0},{x:30,y:Qn(R,w)}]:[{x:0,y:30},{x:gi(R,w),y:30}];x($,ht,{stroke:_e(R,c,w.stroke),strokeWidth:LA}),De($,Qe,R,w)}else{var Wt=ns(R,w);te||(Wt.height=gi(R,w),Wt.width=Qn(R,w));var xt=J($,Qe,{box:Wt,align:"center-middle",style:{fill:ts(R,l,c,w.stroke)}});if(!te){var dn=-1*Qn(R,w);Gc(xt,0,-dn,270)}}return Re.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",$,R,w),G},"bpmn:ReceiveTask":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=ue(R),V=fe($,R,w),te;return G.get("instantiate")?(h($,28,28,20*.22,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),te=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):te=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v($,te,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),V},"bpmn:ScriptTask":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=fe($,R,w),V=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v($,V,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:SendTask":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=fe($,R,w),V=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v($,V,{fill:_e(R,c,w.stroke),stroke:it(R,s,w.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=it(R,s,w.fill),V=_e(R,c,w.stroke),te=m($,R.waypoints,{markerEnd:d($,"sequenceflow-end",G,V),stroke:V}),Re=ue(R),{source:Qe}=R;if(Qe){var ht=ue(Qe);Re.get("conditionExpression")&&M(ht,"bpmn:Activity")&&Se(te,{markerStart:d($,"conditional-flow-marker",G,V)}),ht.get("default")&&(M(ht,"bpmn:Gateway")||M(ht,"bpmn:Activity"))&&ht.get("default")===Re&&Se(te,{markerStart:d($,"conditional-default-flow-marker",G,V)})}return te},"bpmn:ServiceTask":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=fe($,R,w);h($,10,10,{fill:it(R,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var V=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v($,V,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),h($,10,10,{fill:it(R,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var te=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v($,te,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function($,R,w={}){var{renderIcon:G=!0}=w;w=ut(w,["fill","stroke"]);var V=ue(R);V.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var te=X($,R,w);return G&&N(R,$,w),te},"bpmn:SubProcess":function($,R,w={}){return at(R)?w=ut(w,["fill","stroke","width","height"]):w=ut(w,["fill","stroke"]),K($,R,w)},"bpmn:Task":function($,R,w={}){return w=ut(w,["fill","stroke"]),fe($,R,w)},"bpmn:TextAnnotation":function($,R,w={}){w=ut(w,["fill","stroke"]);var{width:G,height:V}=ns(R,w),te=y($,G,V,0,0,{fill:"none",stroke:"none"}),Re=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:0,my:0}});v($,Re,{stroke:_e(R,c,w.stroke)});var Qe=ue(R),ht=Qe.get("text")||"";return J($,ht,{align:"left-top",box:ns(R,w),padding:ia,style:{fill:ts(R,l,c,w.stroke)}}),te},"bpmn:Transaction":function($,R,w={}){at(R)?w=ut(w,["fill","stroke","width","height"]):w=ut(w,["fill","stroke"]);var G=K($,R,{strokeWidth:1.5,...w}),V=n.style(["no-fill","no-events"],{stroke:_e(R,c,w.stroke),strokeWidth:1.5}),te=at(R);return te||(w={}),y($,gi(R,w),Qn(R,w),Yc-qc,qc,V),G},"bpmn:UserTask":function($,R,w={}){w=ut(w,["fill","stroke"]);var G=fe($,R,w),V=15,te=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:V,y:te}});v($,Re,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:.5});var Qe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:V,y:te}});v($,Qe,{fill:it(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:.5});var ht=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:V,y:te}});return v($,ht,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:.5}),G},label:function($,R,w={}){return Ae($,R,w)}};this._drawPath=v,this._renderer=E}Ee(mo,nr),mo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],mo.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},mo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},mo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},mo.prototype.getShapePath=function(e){return Je(e)?lf(e,IA):M(e,"bpmn:Event")?Hy(e):M(e,"bpmn:Activity")?lf(e,Yc):M(e,"bpmn:Gateway")?TA(e):kA(e)};function ut(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var $A=0,FA={width:150,height:50};function jA(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function HA(e){return hn(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var uf=null;function zA(){return uf||(uf=document.createElement("canvas").getContext("2d")),uf}function GA(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(zy(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function zy(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function VA(e,t){var n=zA();if(!n)return{width:0,height:0};n.font=GA(t),"letterSpacing"in n&&(n.letterSpacing=zy(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function WA(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=VA(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return UA(e,r,i,o);r=YA(r,o.width,t)}}function UA(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var Gy="";function qA(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===Gy)&&r.pop();break}var a=r[r.length-1];return a&&a===Gy&&(r[r.length-1]="-"),r.join("")}function YA(e,t,n){var i=Math.max(e.length*(n/t),1),r=qA(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Kc(e){this._config=U({},{size:FA,padding:$A,style:{},align:"center-top"},e||{})}Kc.prototype.createText=function(e,t){return this.layoutText(e,t).element},Kc.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Kc.prototype.layoutText=function(e,t){for(var n=U({},this._config.size,t.box),i=U({},this._config.style,t.style),r=jA(t.align||this._config.align),o=HA(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=KA(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(WA(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Kn(l,function(y,C,x){return y+(s||C.height)},0)+o.top+o.bottom,f=Kn(l,function(y,C,x){return C.width>y?C.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");Se(g,i),z(l,function(y){var C;switch(d+=s||y.height,r.horizontal){case"left":C=o.left;break;case"right":C=(a?f:u)-o.right-y.width;break;default:C=Math.max(((a?f:u)-y.width)/2+o.left,0)}var x=Oe("tspan");Se(x,{x:C,y:d}),x.textContent=y.text,We(g,x)});var h={width:f,height:p};return{dimensions:h,element:g}};function KA(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var XA=12,ZA=1.2,QA=40;function Vy(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:XA,fontWeight:"normal",lineHeight:ZA},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=U({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Kc({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,ho.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:ia});return{x:a.x,y:a.y,width:a.width,height:Math.max(QA,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,U({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Vy.$inject=["config.textRenderer"];function JA(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=iP(i.d,{mx:r,my:o,e:a});return p}}var eP=/\{([^{}]+)\}/g,tP=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function nP(e,t,n){var i=n;return t.replace(tP,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function iP(e,t){return String(e).replace(eP,function(n,i){return nP(n,i,t)})}const rP={__init__:["bpmnRenderer"],bpmnRenderer:["type",mo],textRenderer:["type",Vy],pathMap:["type",JA]};function oP(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const is={translate:["value",oP]};function Xc(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function aP(e,t,n){var i=e.waypoint;return!i||i.length<2?[je(t),je(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Wy(e,t,n){return new Error(`element ${In(t)} referenced by ${In(e)}#${n} not yet drawn`)}function ar(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}ar.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],ar.prototype.add=function(e,t,n){var i,r,o;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Xc(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!at(e,t),c=cP(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Xc(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(o=0),M(e,"bpmn:DataStoreReference")&&(sP(n,je(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Xc(e,t,{hidden:r,source:u,target:p,waypoints:aP(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${In(t)} for element ${In(e)}`);return kr(e)&&pi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},ar.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${In(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Wy(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},ar.prototype.addLabel=function(e,t,n){var i,r,o;return i=EA(t,n),r=pi(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Xc(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!pi(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},ar.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Wy(e,i,t+"Ref"):new Error(`${In(e)}#${t} Ref not specified`)},ar.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},ar.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},ar.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function sP(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 cP(e){return M(e,"bpmn:Group")}const Uy={__depends__:[rP,{__depends__:[is],bpmnImporter:["type",ar]}]};function rs(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ki(e,t){return{x:e.x-t.x,y:e.y-t.y}}function pf(e){return Math.log(e)/Math.log(10)}var lP=1e3;function le(e){this._eventBus=e}le.$inject=["eventBus"];function uP(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}le.prototype.on=function(e,t,n,i,r,o){if((mn(t)||ze(t))&&(o=r,r=i,i=n,n=t,t=null),mn(n)&&(o=r,r=i,i=n,n=lP),hn(r)&&(o=r,r=!1),!mn(i))throw new Error("handlerFn must be a function");Fe(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?uP(i,o):i,o)})},le.prototype.canExecute=sr("canExecute"),le.prototype.preExecute=sr("preExecute"),le.prototype.preExecuted=sr("preExecuted"),le.prototype.execute=sr("execute"),le.prototype.executed=sr("executed"),le.prototype.postExecute=sr("postExecute"),le.prototype.postExecuted=sr("postExecuted"),le.prototype.revert=sr("revert"),le.prototype.reverted=sr("reverted");function sr(e){return function(n,i,r,o,a){(mn(n)||ze(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var ff=["top","bottom","left","right"],Zc=10;function df(e,t){le.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Uc(r)&&!Et(r)){var o=dP(r);o&&i(r,o)}}function i(r,o){var a=je(r),s=r.label,c=je(s);if(s.parent){var l=Le(r),u;switch(o){case"top":u={x:a.x,y:l.top-Zc-s.height/2};break;case"left":u={x:l.left-Zc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Zc+s.height/2};break;case"right":u={x:l.right+Zc+s.width/2,y:a.y};break}var p=ki(u,c);t.moveShape(s,p)}}}Ee(df,le),df.$inject=["eventBus","modeling"];function pP(e){var t=e.host,n=je(e),i=Cn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=ff.filter(function(a){return r.indexOf(a)===-1});return o}function fP(e){var t=je(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return qy(t,i)});return n}function dP(e){var t=je(e.label),n=je(e),i=qy(n,t);if(hP(i)){var r=fP(e);if(e.host){var o=pP(e);r=r.concat(o)}var a=ff.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Cn(e.label,e)!=="intersect"?void 0:i:a[0]}}function qy(e,t){return Cn(t,e,5)}function hP(e){return ff.indexOf(e)!==-1}function hf(e){le.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ee(hf,le),hf.$inject=["eventBus"];var mP=1500;function mf(e,t,n){e.invoke(le,this),this.preExecute("elements.delete",mP,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=nt(r,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(o,l=>{const u=new Set(Io(Qo(Array.from(s),en(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(mf,le),mf.$inject=["injector","eventBus","canvas"];function gf(e,t){e.invoke(le,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=nt(r.incoming.concat(r.outgoing),function(a){return M(a,"bpmn:Association")});z(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(gf,le),gf.$inject=["injector","modeling"];function oa(e,t){for(qn(t)&&(t=[t]);e=e.parent;)if(tt(e,t))return e;return null}function Yy(e,t){var n=oa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=oa(e,i),n)return yn(n);if(tt(e,i))return yn(e);var r;for(r=ue(e);r&&!M(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ue(a);return s&&s.get("processRef")===r});return o?yn(o):!0}var Ky=500;function Qc(e,t){t.invoke(le,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ky,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Xy(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",Ky,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Xy(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Qc.$inject=["bpmnReplace","injector"],Ee(Qc,le),Qc.prototype._replaceShape=function(e,t){var n=gP(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function gP(e){var t=ue(e),n=t.eventDefinitions;return n&&n[0]}function Xy(e,t){return!Je(e)&&tt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function yf(e,t){le.call(this,e);function n(i){return nt(i.attachers,function(r){return M(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);M(r,"bpmn:EventBasedGateway")&&M(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;M(r,"bpmn:Gateway")&&M(o,"bpmn:EventBasedGateway")&&z(o.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}yf.$inject=["eventBus","modeling"],Ee(yf,le);function Zy(e){return e.create("bpmn:Category")}function yP(e){return e.create("bpmn:CategoryValue")}function Qy(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=yP(e)),n.$parent||(n.$parent=Zy(e)),n}function vP(e,t,n){return Xt(t.get("categoryValue"),e),e.$parent=t,Xt(n.get("rootElements"),t),t.$parent=n,e}function bP(e){var t=e.$parent;return t&&(qt(t.get("categoryValue"),e),e.$parent=null),e}function xP(e){var t=e.$parent;return t&&(qt(t.get("rootElements"),e),e.$parent=null),e}var _P=500;function vf(e,t,n){n.invoke(le,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(ue).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&vP(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&xP(l),c&&!r(c,u)&&bP(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ue(l))},!0),this.executed(["shape.move","shape.resize"],_P,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,ue(l))},!0),this.executed("group.updateRefs",function(c){Jy(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Jy(c).forEach(function(l){s(l.categoryValue,l.category,ue(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ue(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}vf.$inject=["bpmnjs","elementRegistry","injector"],Ee(vf,le);function Jy(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function bf(e,t,n){le.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const C=y.source,x=y.target;aa(C)&&os(x)&&u(x)}function r(y){const C=y.connection,x=y.source,m=y.target;aa(x)&&Jc(m)&&(l(m),f(x,[C]))}function o(y){const C=y.newTarget,x=y.oldSource,m=y.oldTarget;if(m!==C){const v=x;os(m)&&u(m),aa(v)&&Jc(C)&&l(C)}}function a(y){const{element:C}=y;os(C)?(p(C),d(C)):Jc(C)&&g(C)}function s(y){const{newData:C,oldShape:x}=y;if(aa(y.oldShape)&&C.eventDefinitionType!=="bpmn:CompensateEventDefinition"||C.type!=="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>os(v));m&&m.target&&(y._connectionTarget=m.target)}else if(!aa(y.oldShape)&&C.eventDefinitionType==="bpmn:CompensateEventDefinition"&&C.type==="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>Jc(v));m&&m.target&&(y._connectionTarget=m.target),h(x)}}function c(y){const{_connectionTarget:C,newShape:x}=y;C&&t.connect(x,C)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const C of y.incoming)n.canConnect(C.source,y)||t.removeConnection(C);for(const C of y.outgoing)n.canConnect(y,C.target)||t.removeConnection(C)}function f(y,C){y.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>os(v.target)&&!C.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const C=y.attachers.slice();C.length&&t.removeElements(C)}function g(y){const C=y.incoming.filter(x=>aa(x.source));t.removeElements(C)}function h(y){const C=y.outgoing.filter(x=>M(x,"bpmn:SequenceFlow"));t.removeElements(C)}}Ee(bf,le),bf.$inject=["eventBus","modeling","bpmnRules"];function os(e){const t=ue(e);return t&&t.get("isForCompensation")}function aa(e){return e&&M(e,"bpmn:BoundaryEvent")&&na(e,"bpmn:CompensateEventDefinition")}function Jc(e){return e&&M(e,"bpmn:Activity")&&!Bn(e)}function xf(e){e.invoke(le,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;M(i,"bpmn:Lane")&&!M(r,"bpmn:Lane")&&(n.parent=oa(i,"bpmn:Participant"))})}xf.$inject=["injector"],Ee(xf,le);function _f(e,t){le.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(M(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}_f.$inject=["eventBus","bpmnFactory"],Ee(_f,le);var wf=20,Ef=20,ev=30,el=2e3;function Sf(e,t,n){le.call(this,t),t.on(["create.start","shape.move.start"],el,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!Je(p)&&!Et(p)});if(c.length){var l=en(c),u=wP(a,l);U(a,u),o.createConstraints=EP(a,l)}}}),t.on("create.start",el,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",el,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return M(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",el,function(r){var o=r.elements,a=r.parent,s=SP(o),c;s&&M(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ue(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;M(a,"bpmn:Participant")&&M(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ue(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&ue(s).set("processRef",ue(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&ue(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Sf.$inject=["canvas","eventBus","modeling"],Ee(Sf,le);function wP(e,t){t={width:t.width+wf*2+ev,height:t.height+Ef*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 EP(e,t){return t=Le(t),{bottom:t.top+e.height/2-Ef,left:t.right-e.width/2+wf,top:t.bottom-e.height/2+Ef,right:t.left+e.width/2-wf-ev}}function SP(e){return Pt(e,function(t){return M(t,"bpmn:Participant")})}var tv="__targetRef_placeholder";function Rf(e,t){le.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],nv(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],nv(o));function n(a,s,c){var l=a.get("dataInputAssociations");return Pt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Pt(c,function(u){return u.name===tv});return!l&&s&&(l=t.create("bpmn:Property",{name:tv}),Xt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||qt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,C;h&&h!==p&&r(h,l),d&&d!==p&&r(d,l),p?(C=i(p,!0),y.targetRef=C):y.targetRef=null}}Rf.$inject=["eventBus","bpmnFactory"],Ee(Rf,le);function nv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function tl(e){this._bpmnUpdater=e}tl.$inject=["bpmnUpdater"],tl.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},tl.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function Cf(e,t,n,i){le.call(this,i),t.registerHandler("dataStore.updateContainment",tl);function r(){return n.filter(function(s){return M(s,"bpmn:Participant")&&ue(s).processRef})[0]}function o(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ct(s),newSemanticParent:u.processRef||u,newDiParent:ct(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:CP(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();tt(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&o(u).filter(function(p){return RP(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=o(l);p.forEach(function(f){M(u,"bpmn:Process")&&a(f,u)})})}Cf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(Cf,le);function RP(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 CP(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var nl=Math.max,il=Math.min,MP=20;function iv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function AP(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function PP(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 rl(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ze(r)&&(i=(/top|left/.test(e)?il:nl)(i,r)),ze(o)&&(i=(/top|left/.test(e)?nl:il)(i,o)),i}function TP(e,t){if(!t)return e;var n=Le(e);return jc({top:rl("top",n,t),right:rl("right",n,t),bottom:rl("bottom",n,t),left:rl("left",n,t)})}function kP(e,t,n,i){var r=Le(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Le(i):o,s={top:il(o.top,a.top),left:il(o.left,a.left),bottom:nl(o.bottom,a.bottom),right:nl(o.right,a.right)};return jc(s)}function as(e,t){return typeof e<"u"?e:MP}function OP(e,t){var n,i,r,o;return typeof t=="object"?(n=as(t.left),i=as(t.right),r=as(t.top),o=as(t.bottom)):n=i=r=o=as(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function DP(e){return!(e.waypoints||e.type==="label")}function rv(e,t){var n;if(e.length===void 0?n=nt(e.children,DP):n=e,n.length)return OP(en(n),t)}var Or=Math.abs;function LP(e,t){return iv(Le(t),Le(e))}var IP=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],yi=30;function ol(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(ol(n,t),t.push(n))}),t}function Dr(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function vi(e){return oa(e,IP)||e}function BP(e,t){var n=vi(e),i=M(n,"bpmn:Process")?[]:[n],r=ol(n,i),o=Le(e),a=Le(t),s=LP(e,t),c=[],l=yn(e);return r.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Le(u);s.top&&(Or(h.bottom-o.top)<10&&(d=a.top-h.bottom),Or(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(Or(h.right-o.left)<10&&(f=a.left-h.right),Or(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(Or(h.top-o.bottom)<10&&(p=a.bottom-h.top),Or(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Or(h.left-o.right)<10&&(g=a.right-h.left),Or(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:PP(u,{top:p,right:f,bottom:d,left:g})})}}),c}var NP=500;function Mf(e,t){le.call(this,e);function n(i,r){var o=yn(i),a=Dr(r),s=[],c=[],l=[],u=[];if(po(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",NP,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;M(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Mf.$inject=["eventBus","spaceTool"],Ee(Mf,le);var ov=500;function al(e,t){t.invoke(le,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ov,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return av(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",ov,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;av(a,FP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}al.$inject=["bpmnReplace","injector"],Ee(al,le),al.prototype._replaceShape=function(e){var t=$P(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function $P(e){var t=ue(e),n=t.eventDefinitions;return n&&n[0]}function av(e,t){return!Je(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function FP(e,t){return e.indexOf(t)!==-1}var sl=Math.round,jP=Math.max;function HP(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 zP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var sv=10;function GP(e,t){var n,i;for(n=0;i=e[n];n++)if(Xa(i,t)<=sv)return{point:e[n],bendpoint:!0,index:n};return null}function VP(e,t){var n=fy(HP(t,sv),zP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=jP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:sl(i.x+r.x)/2,y:sl(i.y+r.y)/2},index:i.segment2}:{point:{x:sl(i.x),y:sl(i.y)},index:i.segment2}:null}function Af(e,t){return GP(e,t)||VP(e,t)}function Pf(e,t,n){le.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,g,h=r.outgoing.slice(),y=r.incoming.slice(),C;ze(a.width)?C=je(a):C=a;var x=Af(s,C);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:C,(c.length===1||!cv(r,c[c.length-1]))&&c.push(lv(u)),(l.length===1||!cv(r,l[0]))&&l.unshift(lv(u))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||C),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||C),g=o));var m=[].concat(d&&nt(y,function(v){return v.source===d.source})||[],g&&nt(h,function(v){return v.target===g.target})||[]);m.length&&n.removeElements(m)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=je(c),u={x:l.x+s.x,y:l.y+s.y},p=Pt(o.children,function(f){var d=t.canInsert(a,f);return d&&Af(f.waypoints,u)});p&&(r.targetFlow=p,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}Ee(Pf,le),Pf.$inject=["eventBus","bpmnRules","modeling"];function cv(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 lv(e){return U({},e)}function Tf(e,t){le.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&sa(r)){var c=[];M(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&sa(l)):c=a.incoming.filter(l=>l!==r&&sa(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(M(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(sa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(sa).forEach(function(s){const c=a.incoming.filter(sa).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Tf.$inject=["eventBus","modeling"],Ee(Tf,le);function sa(e){return M(e,"bpmn:SequenceFlow")}var cl=1500,uv=2e3;function pv(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"],cl,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!tt(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=vi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||tt(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],cl,function(i){var r=i.hover;M(r,"bpmn:Lane")&&(i.hover=vi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],cl,function(i){var r=i.context,o=i.hover,a=r.type;M(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=vi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],cl,function(i){var r=i.context,o=r.start;M(o,"bpmn:Lane")&&(r.start=vi(o)||o)}),t.on("shape.move.start",uv,function(i){var r=i.shape;M(r,"bpmn:Lane")&&(i.shape=vi(r)||r)}),t.on("spaceTool.move",uv,function(i){var r=i.hover;r&&M(r,"bpmn:Lane")&&(i.hover=vi(r))})}pv.$inject=["elementRegistry","eventBus","canvas"];var fv=770;function kf(e,t,n,i){n.invoke(le,this);function r(s,c){var l=ue(s),u=c.categoryValue||l.categoryValueRef;u||(u=Qy(e,l));var p=c.category||u.$parent||Zy(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function o(s,c){var l=ue(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ue(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=ue(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ue(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ue(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||ue(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",fv,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=ue(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",fv,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})}kf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(kf,le);function Of(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function dv(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Of(i,r,o,a),l=Of(i,r,o,s),u;c&&l?hv(c,o)>hv(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],je(i.source)),t(r[r.length-1],r[r.length-2],je(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}dv.$inject=["eventBus"];function hv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Df(e){le.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ue(i),o=ct(i);if(tt(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Df.$inject=["eventBus"],Ee(Df,le);function mv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function gv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function WP(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 UP(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function Lf(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=UP([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function yv(e,t){var n=Lf(e,t),i={x:n.x-e.x,y:n.y-e.y};return mv(i)}function ss(e,t){return mv({x:e.x-t.x,y:e.y-t.y})}var vv=Math.sqrt,bv=Math.min,qP=Math.max,xv=Math.abs;function _v(e){return Math.pow(e,2)}function cs(e,t){return vv(_v(e.x-t.x)+_v(e.y-t.y))}function YP(e,t){var n=0,i,r,o,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Ev(i,r)?l=[i]:(o=cs(e,i),a=cs(e,r),c=bv(o,a),l=KP(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Ev(i,l[0])?n:n+1}),l.length===2&&(s=ZP(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:cs(i,s)/cs(i,r)}),p=cs(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function KP(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=vv(d),h=-p+g,y=-p-g,C={x:e.x-r*h,y:e.y-o*h};if(d===0)return[C];var x={x:e.x-r*y,y:e.y-o*y};return[C,x].filter(function(m){return XP(m,e,t)})}function XP(e,t,n){return wv(e.x,t.x,n.x)&&wv(e.y,t.y,n.y)}function wv(e,t,n){return e>=bv(t,n)-ll&&e<=qP(t,n)+ll}function ZP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var ll=.1;function Ev(e,t){return xv(e.x-t.x)<=ll&&xv(e.y-t.y)<=ll}function QP(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var p=Rv(t,l);p<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Sv(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=YP(e,n),c=s.segmentIndex,l=QP(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Cv(n,c),p=Cv(t,l),f=s.position,d=eT(u,f),g=JP(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,C=n[y];if(t.indexOf(C)!==-1)return a;if(h===0){var x=t[y];return r=x.x-s.position.x,o=x.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=Rv(n,y))}var m={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=WP({x:e.x-f.x,y:e.y-f.y},g);return r=m.x+v.x-e.x,o=m.y+v.y-e.y,{point:rr(m),delta:rr({x:r,y:o})}}function Rv(e,t){var n=ss(e[t-1],e[t]),i=ss(e[t],e[t+1]),r=n/(n+i);return r}function JP(e,t){var n=gv(e),i=gv(t);return i-n}function Cv(e,t){return[e[t],e[t+1]]}function eT(e,t){var n=ss(e[0],e[1]),i=ss(e[0],t);return n===0?0:i/n}function tT(e,t,n,i){var r=je(e);return Sv(r,t,n,i).delta}function ls(e,t,n){var i=rs(t),r=rs(n),o=ki(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return rr({x:r.x+a.x,y:r.y+a.y})}function Mv(e,t,n){var i=rs(e),r=rs(t),o=rs(n),a=ki(e,i),s=ki(i,r),c=nT(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return rr({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function nT(e,t,n){var i=Le(t),r=Le(n);if(iT(i,r))return null;var o=Cn(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=Cn(n,s),c!==o?null:a}function iT(e,t){return rT(e,t)||oT(e,t)}function rT(e,t){return e.right!==t.right&&e.left!==t.left}function oT(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Av="name",Pv="text";function If(e,t,n,i){le.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ue(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Av in l&&t.updateLabel(c,l[Av]),Pv in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Pv]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Je(l)||!kr(l)||pi(l)&&t.updateLabel(l,pi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=U({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),tT(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=o(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ue(c);u&&kr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Je(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(pi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Uc(c)){var p=c.label,f=je(p),d=cT(u),g=sT(f,d),h=aT(g,u,l);t.moveShape(p,h)}})}Ee(If,le),If.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function aT(e,t,n){var i=ls(e,t,n);return rr(ki(i,e))}function sT(e,t){if(t.length){var n=lT(e,t);return Lf(e,n)}}function cT(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 lT(e,t){var n=t.map(function(r){return{line:r,distance:yv(e,r)}}),i=Bi(n,"distance");return i[0].line}function uT(e,t,n,i){return Sv(e,t,n,i).point}function Bf(e,t){le.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=U({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),uT(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ee(Bf,le),Bf.$inject=["eventBus","modeling"];function ul(e,t,n){var i=fl(e),r=kv(i,t),o=i[0];return r.length?r[r.length-1]:ls(o.original||o,n,t)}function pl(e,t,n){var i=fl(e),r=kv(i,t),o=i[i.length-1];return r.length?r[0]:ls(o.original||o,n,t)}function Nf(e,t,n){var i=fl(e),r=Tv(t,n),o=i[0];return ls(o.original||o,r,t)}function $f(e,t,n){var i=fl(e),r=Tv(t,n),o=i[i.length-1];return ls(o.original||o,r,t)}function Tv(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function kv(e,t){var n=kn(e,fT);return nt(n,function(i){return pT(i,t)})}function pT(e,t){return Cn(t,e,1)==="intersect"}function fT(e){return e.original||e}function Ff(e,t){le.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(dT(i,r)){var o=hT(i);o.incoming.forEach(function(a){var s=pl(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ul(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Ff.$inject=["eventBus","modeling"],Ee(Ff,le);function dT(e,t){return M(e,"bpmn:Participant")&&at(e)&&M(t,"bpmn:Participant")&&!at(t)}function hT(e){var t=Ya([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){M(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){M(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const mT=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Ov(e){const t=ue(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&Bn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:mT.some(i=>M(n[0],i))}function Dv(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function jf(e,t){e.invoke(le,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Ov(r))return;const a=Dv(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ue(i).get(a),l=ue(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}jf.$inject=["injector","modeling"],Ee(jf,le);function Hf(e,t){le.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ct(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(Hf,le),Hf.$inject=["eventBus","modeling"];function zf(e,t,n){le.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!M(o,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=gT(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(zf,le),zf.$inject=["eventBus","bpmnRules","modeling"];function ca(e){return e.original||e}function gT(e,t){var n=Of(ca(e[e.length-2]),ca(e[e.length-1]),ca(t[1]),ca(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ca(e[0]),ca(t[t.length-1])]}function Gf(e,t){le.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;M(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Gf.$inject=["eventBus","modeling"],Ee(Gf,le);function Vf(e,t,n,i){le.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,r&&s(u,g))}function s(c,l){var u=r.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Pt(p.outgoing,No({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Ee(Vf,le),Vf.$inject=["eventBus","modeling","bpmnRules","injector"];function dl(e,t,n,i,r,o){i.invoke(le,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Kn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){Bn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ee(dl,le),dl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;z(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},dl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var yT=1500,vT={width:140,height:120},Wf={width:300,height:60},Uf={width:60,height:300},hl={width:300,height:150},ml={width:150,height:300},Lv={width:140,height:120},Iv={width:100,height:40};function Bv(e){e.on("resize.start",yT,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=ET(i,r,o)),M(i,"bpmn:SubProcess")&&at(i)&&(n.minDimensions=Lv),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=Iv)})}Bv.$inject=["eventBus"];var Lr=Math.abs,bT=Math.min,xT=Math.max;function Nv(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function la(e,t,n){return Nv(e,t,n,bT)}function ua(e,t,n){return Nv(e,t,n,xT)}var _T={top:20,left:50,right:20,bottom:20},wT={top:50,left:20,right:20,bottom:20};function ET(e,t,n){var i=vi(e),r=!0,o=!0,a=ol(i,[i]),s=Le(e),c={},l={},u=yn(e),p=u?Wf:Uf;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Le(g);u?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&Lr(s.top-h.bottom)<10&&ua(c,"top",h.top+p.height),Lr(s.top-h.top)<5&&la(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Lr(s.right-h.left)<10&&la(c,"right",h.right-p.width),Lr(s.right-h.right)<5&&ua(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Lr(s.bottom-h.top)<10&&la(c,"bottom",h.bottom-p.height),Lr(s.bottom-h.bottom)<5&&ua(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Lr(s.left-h.right)<10&&ua(c,"left",h.left+p.width),Lr(s.left-h.left)<5&&la(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?_T:wT;return f.forEach(function(g){var h=Le(g);/n/.test(t)&&(!u||r)&&la(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&ua(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&ua(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&la(l,"left",h.left-d.left)}),{min:l,max:c}}function $v(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function pa(e){return e.originalEvent||e.srcEvent}function qf(e){$v(e),$v(pa(e))}function go(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 Fv(){return/mac/i.test(navigator.platform)}function jv(e,t){return(pa(e)||e).button===t}function Ir(e){return jv(e,0)}function ST(e){return jv(e,1)}function us(e){var t=pa(e)||e;return Ir(e)?Fv()?t.metaKey:t.ctrlKey:!1}function gl(e){var t=pa(e)||e;return Ir(e)&&t.shiftKey}var Hv=1001;function zv(e,t){e.on("resize.start",Hv+500,function(n){var i=n.context,r=i.shape;(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))&&(i.balanced=!us(n))}),e.on("resize.end",Hv,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))return o&&(a=yy(a),t.resizeLane(r,a,i.balanced)),!1})}zv.$inject=["eventBus","modeling"];var RT=500;function Yf(e,t,n,i,r){n.invoke(le,this);function o(u){return tt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||CT(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Pt(f,No({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(o(p)){var f=ue(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),Xt(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");qt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=ue(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",RT,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(f,d),delete p.referencedRootElement)})}Yf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(Yf,le);function CT(e,t){return Fe(t)||(t=[t]),br(t,function(n){return na(e,n)})}var Gv=Math.max;function Vv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(o[s]=AT(a,i,r)),M(a,"bpmn:Lane")&&(o[s]=yn(a)?Wf:Uf),M(a,"bpmn:SubProcess")&&at(a)&&(o[s]=Lv),M(a,"bpmn:TextAnnotation")&&(o[s]=Iv),M(a,"bpmn:Group")&&(o[s]=vT)}),o})}Vv.$inject=["eventBus"];function MT(e){return e==="x"}function AT(e,t,n){var i=yn(e);if(!kT(e))return i?hl:ml;var r=MT(t),o={};return r?i?o=hl:o={width:TT(e,n,r),height:ml.height}:i?o={width:hl.width,height:PT(e,n,r)}:o=ml,o}function PT(e,t,n){var i;return i=OT(e,t,n),Gv(hl.height,i)}function TT(e,t,n){var i;return i=DT(e,t,n),Gv(ml.width,i)}function kT(e){return!!Dr(e).length}function OT(e,t,n){var i=Dr(e),r;return r=Kf(i,t,n),e.height-r.height+Wf.height}function DT(e,t,n){var i=Dr(e),r;return r=Kf(i,t,n),e.width-r.width+Uf.width}function Kf(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=Dr(r),o.length?Kf(o,t,n):r}var Wv="_plane";function Uv(e){var t=e.id;return LT(t)}function qi(e){var t=e.id;return M(e,"bpmn:SubProcess")?qv(t):t}function yo(e){return qv(e)}function yl(e){var t=ct(e);return M(t,"bpmndi:BPMNPlane")}function qv(e){return e+Wv}function LT(e){return e.replace(new RegExp(Wv+"$"),"")}var Yv=400,IT=600,Kv={x:180,y:160};function cr(e,t,n,i,r,o,a){le.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return M(p,"bpmn:SubProcess")&&!at(p)}function l(p){var f=p.shape,d=p.newRootElement,g=ue(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=ue(f);s._removeDiagram(d);var g=p.newRootElement=a.get(qi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;z(f,function(d){if(c(d)){var g=a.get(qi(d));if(!(!g||!d.children||!d.children.length)){var h=Xv(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!at(f)||z(es([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(qi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(qi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(qi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(yl(f)){a.updateId(f,yo(y)),a.updateId(h,y);return}var C=a.get(yo(h));C&&a.updateId(yo(h),yo(y))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(yl(f)){a.updateId(f,yo(h)),a.updateId(y,h);return}var C=a.get(yo(y));C&&a.updateId(C,yo(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(yl(f)){var d=f,g=a.get(Uv(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Yv,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Yv,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",IT,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(at(f))s._moveChildrenToShape(d.children.slice(),f),z(es(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),z(h.associations,y=>{n.moveConnection(y,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Xv(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=qi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,y=M(ct(h),"bpmndi:BPMNPlane");if(y){var C=Uv(h),x=Pt(g,function(m){return m.id===C});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ee(cr,le),cr.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=en(i),o;if(!t.x)o={x:Kv.x-r.x,y:Kv.y-r.y};else{var a=je(t),s=je(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},cr.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(jy(e).map(i=>i.annotation));n.size&&z(es(e.children),i=>{n.has(i.annotation)&&z(i.associations,r=>{t.removeConnection(r)})})},cr.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},cr.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},cr.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:qi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},cr.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Pt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},cr.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function BT(e){var t=[];return z(es(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Xv(e){return e.children.slice().concat(BT(e.children)).concat(NT(e))}function NT(e){return Jp(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Xf(e,t){e.invoke(le,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!M(r,"bpmn:SubProcess")||M(r,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!at(r))){var o=$T(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Xf.$inject=["injector","modeling"],Ee(Xf,le);function $T(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Zf(e,t){le.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&M(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!M(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,pi(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ee(Zf,le),Zf.$inject=["eventBus","textRenderer"];function Qf(e,t){le.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(at(i))return;var r=Ya(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){o(l,!0)}),z(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,je(i)):t.reconnectStart(a,i,je(i)))}},!0)}Ee(Qf,le),Qf.$inject=["eventBus","modeling"];var Jf=500;function ed(e,t,n){le.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,p;return u=FT(c).concat([a]),p=rv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Jf,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?ct(c).isExpanded=!1:(i(c.children),ct(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Jf,function(a){var s=a.context,c=s.shape;c.collapsed?ct(c).isExpanded=!1:ct(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Jf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ee(ed,le),ed.$inject=["eventBus","elementFactory","modeling"];function FT(e){return e.filter(function(t){return!t.hidden})}function td(e,t,n,i){t.invoke(le,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Je(a)||(M(a,"bpmn:Participant")&&at(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;M(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(td,le),td.$inject=["canvas","injector","moddle","modeling"];function nd(e,t){le.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;jT(r,o)&&t.updateProperties(o,{default:null})})}Ee(nd,le),nd.$inject=["eventBus","modeling"];function jT(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=ue(t),i=ue(e);return n.get("default")===i}var HT=500,zT=5e3,Zv=["shape.create","shape.delete","shape.move","shape.resize"],Qv=[...Zv,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function id(e,t){le.call(this,e);var n;function i(){return n=n||new GT,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(Qv,zT,function(){i()}),this.postExecuted(Qv,HT,function(){o()}),this.preExecute(Zv,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}id.$inject=["eventBus","modeling"],Ee(id,le);function GT(){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 VT=500,WT=5e3,Jv=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],eb=[...Jv,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function rd(e,t){le.call(this,e);var n;function i(){return n=n||new UT,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(eb,WT,function(){i()}),this.postExecuted(eb,VT,function(){o()}),this.preExecute(Jv,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&r().addGroup(s)})}rd.$inject=["eventBus","modeling"],Ee(rd,le);function UT(){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 od(e,t){le.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)qT(o)&&!KT(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(od,le),od.$inject=["eventBus","modeling"];function qT(e){const t=ue(e);return t&&t.isForCompensation}function YT(e){return e&&M(e,"bpmn:BoundaryEvent")&&na(e,"bpmn:CompensateEventDefinition")}function KT(e){return e.incoming.filter(n=>YT(n.source)).length>0}const XT={__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",df],appendBehavior:["type",hf],associationBehavior:["type",gf],attachEventBehavior:["type",Qc],artifactBehavior:["type",mf],boundaryEventBehavior:["type",yf],categoryRootElementReferenceBehavior:["type",vf],compensateBoundaryEventBehaviour:["type",bf],createBehavior:["type",xf],createDataObjectBehavior:["type",_f],createParticipantBehavior:["type",Sf],dataInputAssociationBehavior:["type",Rf],dataStoreBehavior:["type",Cf],deleteLaneBehavior:["type",Mf],detachEventBehavior:["type",al],dropOnFlowBehavior:["type",Pf],eventBasedGatewayBehavior:["type",Tf],fixHoverBehavior:["type",pv],groupBehavior:["type",kf],importDockingFix:["type",dv],isHorizontalFix:["type",Df],labelBehavior:["type",If],layoutConnectionBehavior:["type",Bf],messageFlowBehavior:["type",Ff],nonInterruptingBehavior:["type",jf],removeElementBehavior:["type",zf],removeEmbeddedLabelBoundsBehavior:["type",Hf],removeParticipantBehavior:["type",Gf],replaceConnectionBehavior:["type",Vf],replaceElementBehaviour:["type",dl],resizeBehavior:["type",Bv],resizeLaneBehavior:["type",zv],rootElementReferenceBehavior:["type",Yf],spaceToolBehavior:["type",Vv],subProcessPlaneBehavior:["type",cr],subProcessStartEventBehavior:["type",Xf],textAnnotationBehavior:["type",Zf],toggleCollapseConnectionBehaviour:["type",Qf],toggleElementCollapseBehaviour:["type",ed],unclaimIdBehavior:["type",td],unsetDefaultFlowBehavior:["type",nd],updateFlowNodeRefsBehavior:["type",id],updateCategoryValueRefsBehavior:["type",rd],setCompensationActivityAfterPasteBehavior:["type",od]};function ad(e){this._commandStack=e.get("commandStack",!1)}ad.$inject=["injector"],ad.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Yi={__init__:["rules"],rules:["type",ad]};function bi(e){le.call(this,e),this.init()}bi.$inject=["eventBus"],Ee(bi,le),bi.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},bi.prototype.init=function(){};function tb(e,t){var n=Cn(e,t,-15);return n!=="intersect"?n:null}function An(e){bi.call(this,e)}Ee(An,bi),An.$inject=["eventBus"],An.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return ZT(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return bl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return bl(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return hb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Et(i)&&!xl(t,i)?!1:io(t,function(r){return Et(r)?bl(r.source,r.target,r):r.host?ps(r,r.host,null,n):ud(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return cb(a)&&!n.includes(a.host)})?!1:ps(n,t,null,i)||fb(n,t,i)||db(n,t)||xl(n,t)}),this.addRule("shape.create",function(e){return ud(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ps(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return bb(n,t)})},An.prototype.canConnectMessageFlow=yb,An.prototype.canConnectSequenceFlow=vb,An.prototype.canConnectDataAssociation=pd,An.prototype.canConnectAssociation=mb,An.prototype.canConnectCompensationAssociation=gb,An.prototype.canMove=db,An.prototype.canAttach=ps,An.prototype.canReplace=fb,An.prototype.canDrop=fa,An.prototype.canInsert=xl,An.prototype.canCreate=ud,An.prototype.canConnect=bl,An.prototype.canResize=hb,An.prototype.canCopy=bb;function ZT(e){return sd(e)?null:tt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function sd(e){return!e||Je(e)}function nb(e){do{if(M(e,"bpmn:Process"))return ue(e);if(M(e,"bpmn:Participant"))return ue(e).processRef||ue(e)}while(e=e.parent)}function cd(e){return M(e,"bpmn:TextAnnotation")}function ld(e){return M(e,"bpmn:Group")&&!e.labelTarget}function ib(e){return M(e,"bpmn:BoundaryEvent")&&Ki(e,"bpmn:CompensateEventDefinition")}function vl(e){return ue(e).isForCompensation}function QT(e,t){var n=nb(e),i=nb(t);return n===i}function JT(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&ab(e,"bpmn:MessageEventDefinition"))}function ek(e){return M(e,"bpmn:InteractionNode")&&!vl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&ab(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!Ki(e,"bpmn:MessageEventDefinition"))}function rb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return ue(t);if(M(t,"bpmn:Participant"))return ue(t).processRef}return null}function ob(e,t){var n=rb(e),i=rb(t);return n===i}function Ki(e,t){var n=ue(e);return!!Pt(n.eventDefinitions||[],function(i){return M(i,t)})}function ab(e,t){var n=ue(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function tk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!Bn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&Ki(e,"bpmn:LinkEventDefinition"))&&!ib(e)&&!vl(e)}function nk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!Bn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&Ki(e,"bpmn:LinkEventDefinition"))&&!vl(e)}function ik(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(Ki(e,"bpmn:MessageEventDefinition")||Ki(e,"bpmn:TimerEventDefinition")||Ki(e,"bpmn:ConditionalEventDefinition")||Ki(e,"bpmn:SignalEventDefinition"))}function rk(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function sb(e,t){var n=rk(t);return n.indexOf(e)!==-1}function bl(e,t,n){if(sd(e)||sd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(yb(e,t))return{type:"bpmn:MessageFlow"};if(vb(e,t))return{type:"bpmn:SequenceFlow"}}var i=pd(e,t);return i||(gb(e,t)?{type:"bpmn:Association",associationDirection:"One"}:mb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function fa(e,t){return Je(e)||ld(e)?!0:M(t,"bpmn:Participant")&&!at(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):tt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!ok(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?at(t):tt(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?br(ue(t).get("participants"),function(n){return!!n.get("processRef")}):tt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?tt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function ok(e){return ue(e).cancelActivity&&(lb(e)||ub(e))}function cb(e){return!Je(e)&&M(e,"bpmn:BoundaryEvent")}function ak(e){return M(e,"bpmn:Lane")}function sk(e){return cb(e)||M(e,"bpmn:IntermediateThrowEvent")&&lb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&ub(e)}function lb(e){var t=ue(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ub(e){return pb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function pb(e,t){return t.some(function(n){return Ki(e,n)})}function ck(e){return M(e,"bpmn:ReceiveTask")&&Pt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function ps(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Je(r)||!sk(r)||Bn(t)||!M(t,"bpmn:Activity")||vl(t)||i&&!tb(i,t)||ck(t)?!1:"attach"}function fb(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(r){Bn(t)||M(r,"bpmn:StartEvent")&&r.type!=="label"&&fa(r,t)&&(yA(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(vA(r)||bA(r)||xA(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),pb(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||Ki(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(M(r,"bpmn:EndEvent")&&fa(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),M(r,"bpmn:BoundaryEvent")&&ps(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function db(e,t){return br(e,ak)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return fa(n,t)})}function ud(e,t,n,i){return t?Je(e)||ld(e)?!0:fa(e,t)||xl(e,t):!1}function hb(e,t,n){return M(e,"bpmn:SubProcess")?at(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:cd(e)?n?n==="e"||n==="w":!0:ld(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function lk(e,t){var n=cd(e),i=cd(t);return(n||i)&&n!==i}function mb(e,t){return sb(t,e)||sb(e,t)?!1:lk(e,t)?!0:!!pd(e,t)}function gb(e,t){return ob(e,t)&&ib(e)&&M(t,"bpmn:Activity")&&!pk(t,e)&&!Bn(t)}function yb(e,t){return _b(e)&&!_b(t)?!1:JT(e)&&ek(t)&&!QT(e,t)}function vb(e,t){return tk(e)&&nk(t)&&ob(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!ik(t))}function pd(e,t){return tt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function xl(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:tt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&fa(e,t.parent)}function fd(e,t){return e&&t&&e.indexOf(t)!==-1}function bb(e,t){return Je(t)?!0:!(M(t,"bpmn:Lane")&&!fd(e,t.parent)||M(t,"bpmn:MessageFlow")&&!uk(e,t))}function uk(e,t){var n=xb(t.source),i=xb(t.target);return fd(e,n)&&fd(e,i)}function xb(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function _b(e){return oa(e,"bpmn:Process")||oa(e,"bpmn:Collaboration")}function pk(e,t){return e.attachers.includes(t)}const fk={__depends__:[Yi],__init__:["bpmnRules"],bpmnRules:["type",An]};var dk=2e3;function wb(e,t){e.on("saveXML.start",dk,n);function n(){var i=t.getRootElements();z(i,function(r){var o=ct(r),a,s;a=Ya([r]),a=nt(a,function(c){return c!==r&&!c.labelTarget}),s=kn(a,ct),o.set("planeElement",s)})}}wb.$inject=["eventBus","canvas"];const hk={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",wb]};function _l(e){le.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}_l.prototype.getOrdering=function(e,t){return null},Ee(_l,le);function dd(e,t){_l.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=Pt(n,function(c){return tt(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var l=s;l&&!tt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=em(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}dd.$inject=["eventBus","canvas"],Ee(dd,_l);const mk={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",dd]};function fs(){}fs.prototype.get=function(){return this._data},fs.prototype.set=function(e){this._data=e},fs.prototype.clear=function(){var e=this._data;return delete this._data,e},fs.prototype.isEmpty=function(){return!this._data};const gk={clipboard:["type",fs]};var Eb=1500;function Sb(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Eb,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Eb,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=go(a),c=document.elementFromPoint(s.x,s.y),yk(c)}}Sb.$inject=["elementRegistry","eventBus","injector"];function yk(e){return lo(e,"svg, .djs-element",!0)}const vk={__init__:["hoverFix"],hoverFix:["type",Sb]};function bk(e){return!0}function wl(e){return Ir(e)||ST(e)}var Rb=500;function Cb(e,t,n){var i=this;function r(O,N,P){if(!s(O,N)){var D,F,J;P?F=t.getGraphics(P):(D=N.delegateTarget||N.target,D&&(F=D,P=t.get(F))),!(!F||!P)&&(J=e.fire(O,{element:P,gfx:F,originalEvent:N}),J===!1&&(N.stopPropagation(),N.preventDefault()))}}var o={};function a(O){return o[O]}function s(O,N){var P=l[O]||Ir;return!P(N)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":bk,"element.mousedown":wl,"element.mouseup":wl,"element.click":wl,"element.dblclick":wl};function u(O,N,P){var D=c[O];if(!D)throw new Error("unmapped DOM event name <"+O+">");return r(D,N,P)}var p="svg, .djs-element";function f(O,N,P,D){var F=o[P]=function(J){r(P,J)};D&&(l[P]=D),F.$delegate=Xn.bind(O,p,N,F)}function d(O,N,P){var D=a(P);D&&Xn.unbind(O,N,D.$delegate)}function g(O){z(c,function(N,P){f(O,P,N)})}function h(O){z(c,function(N,P){d(O,P,N)})}e.on("canvas.destroy",function(O){h(O.svg)}),e.on("canvas.init",function(O){g(O.svg)}),e.on(["shape.added","connection.added"],function(O){var N=O.element,P=O.gfx;e.fire("interactionEvents.createHit",{element:N,gfx:P})}),e.on(["shape.changed","connection.changed"],Rb,function(O){var N=O.element,P=O.gfx;e.fire("interactionEvents.updateHit",{element:N,gfx:P})}),e.on("interactionEvents.createHit",Rb,function(O){var N=O.element,P=O.gfx;i.createDefaultHit(N,P)}),e.on("interactionEvents.updateHit",function(O){var N=O.element,P=O.gfx;i.updateDefaultHit(N,P)});var y=_("djs-hit djs-hit-stroke"),C=_("djs-hit djs-hit-click-stroke"),x=_("djs-hit djs-hit-all"),m=_("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":C,stroke:y,"no-move":m};function _(O,N){return N=U({stroke:"white",strokeWidth:15},N||{}),n.cls(O,["no-fill","no-border"],N)}function E(O,N){var P=v[N];if(!P)throw new Error("invalid hit type <"+N+">");return Se(O,P),O}function T(O,N){We(O,N)}this.removeHits=function(O){var N=Dc(".djs-hit",O);z(N,un)},this.createDefaultHit=function(O,N){var P=O.waypoints,D=O.isFrame,F;return P?this.createWaypointsHit(N,P):(F=D?"stroke":"all",this.createBoxHit(N,F,{width:O.width,height:O.height}))},this.createWaypointsHit=function(O,N){var P=qa(N);return E(P,"stroke"),T(O,P),P},this.createBoxHit=function(O,N,P){P=U({x:0,y:0},P);var D=Oe("rect");return E(D,N),Se(D,P),T(O,D),D},this.updateDefaultHit=function(O,N){var P=wt(".djs-hit",N);if(P)return O.waypoints?Qp(P,O.waypoints):Se(P,{width:O.width,height:O.height}),P},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Cb.$inject=["eventBus","elementRegistry","styles"];const El={__init__:["interactionEvents"],interactionEvents:["type",Cb]};function da(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}da.$inject=["eventBus","canvas"],da.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()})}},da.prototype.get=function(){return Array.from(this._selectedElements)},da.prototype.isSelected=function(e){return this._selectedElements.has(e)},da.prototype.select=function(e,t){var n=this.get();Fe(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?z(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Mb="hover",Ab="selected";function Pb(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Mb)}),t.on("element.out",function(r){i(r.element,Mb)}),t.on("selection.changed",function(r){function o(l){i(l,Ab)}function a(l){n(l,Ab)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Pb.$inject=["canvas","eventBus"];function Tb(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Fe(l)?t.select(l):t.select(s.filter(xk))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=Pt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Ir(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=gl(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Tb.$inject=["eventBus","selection","canvas","elementRegistry"];function xk(e){return!e.hidden}const xi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[El],selection:["type",da],selectionVisuals:["type",Pb],selectionBehavior:["type",Tb]};var _k=/^djs-cursor-.*$/;function Sl(e){var t=$t(document.body);t.removeMatching(_k),e&&t.add("djs-cursor-"+e)}function kb(){Sl(null)}var wk=5e3;function Ob(e,t){t=t||"element.click";function n(){return!1}return e.once(t,wk,n),function(){e.off(t,n)}}var Ek=["c","C"],Sk=["v","V"],Rk=["d","D"],Ck=["x","X"],Mk=["y","Y"],Db=["z","Z"];function Ak(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Jn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function pn(e,t){return e=Fe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function hd(e){return e.shiftKey}function Pk(e){return Jn(e)&&pn(Ek,e)}function Tk(e){return Jn(e)&&pn(Sk,e)}function kk(e){return Jn(e)&&pn(Rk,e)}function Ok(e){return Jn(e)&&pn(Ck,e)}function Dk(e){return Jn(e)&&!hd(e)&&pn(Db,e)}function Lk(e){return Jn(e)&&(pn(Mk,e)||pn(Db,e)&&hd(e))}var ha=Math.round,Lb="djs-drag-active";function vo(e){e.preventDefault()}function Ik(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Bk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ib(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(m){var v=t.viewbox(),_=t._container.getBoundingClientRect();return{x:v.x+(m.x-_.left)/v.scale,y:v.y+(m.y-_.top)/v.scale}}function s(m,v){v=v||o;var _=e.createEvent(U({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+m,_)===!1?!1:e.fire(v.prefix+"."+m,_)}function c(m){var v=m.filter(function(_){return i.get(_.id)});v.length&&n.select(v)}function l(m,v){var _=o.payload,E=o.displacement,T=o.globalStart,O=go(m),N=ki(O,T),P=o.localStart,D=a(O),F=ki(D,P);if(!o.active&&(v||Bk(N)>o.threshold)){if(U(_,{x:ha(P.x+E.x),y:ha(P.y+E.y),dx:0,dy:0},{originalEvent:m}),s("start")===!1)return y();o.active=!0,o.keepSelection||(_.previousSelection=n.get(),n.select(null)),o.cursor&&Sl(o.cursor),t.addMarker(t.getRootElement(),Lb)}qf(m),o.active&&(U(_,{x:ha(D.x+E.x),y:ha(D.y+E.y),dx:ha(F.x),dy:ha(F.y)},{originalEvent:m}),s("move"))}function u(m){var v,_=!0;o.active&&(m&&(o.payload.originalEvent=m,qf(m)),_=s("end")),_===!1&&s("rejected"),v=C(_!==!0),s("ended",v)}function p(m){pn("Escape",m)&&(vo(m),y())}function f(m){var v;o.active&&(v=Ob(e),setTimeout(v,400),vo(m)),u(m)}function d(m){l(m)}function g(m){var v=o.payload;v.hoverGfx=m.gfx,v.hover=m.element,s("hover")}function h(m){s("out");var v=o.payload;v.hoverGfx=null,v.hover=null}function y(m){var v;if(o){var _=o.active;_&&s("cancel"),v=C(m),_&&s("canceled",v)}}function C(m){var v,_;s("cleanup"),kb(),o.trapClick?_=f:_=u,Ge.unbind(document,"mousemove",l),Ge.unbind(document,"dragstart",vo),Ge.unbind(document,"selectstart",vo),Ge.unbind(document,"mousedown",_,!0),Ge.unbind(document,"mouseup",_,!0),Ge.unbind(document,"keyup",p),Ge.unbind(document,"touchstart",d,!0),Ge.unbind(document,"touchcancel",y,!0),Ge.unbind(document,"touchmove",l,!0),Ge.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Lb);var E=o.payload.previousSelection;return m!==!1&&E&&!n.get().length&&c(E),v=o,o=null,v}function x(m,v,_,E){o&&y(!1),typeof v=="string"&&(E=_,_=v,v=null),E=U({},r,E||{});var T=E.data||{},O,N,P,D,F;if(E.trapClick?D=f:D=u,m?(O=pa(m)||m,N=go(m),qf(m),O.type==="dragstart"&&vo(O)):(O=null,N={x:0,y:0}),P=a(N),v||(v=P),F=Ik(O),o=U({prefix:_,data:T,payload:{},globalStart:N,displacement:ki(v,P),localStart:P,isTouch:F},E),E.manual||(F?(Ge.bind(document,"touchstart",d,!0),Ge.bind(document,"touchcancel",y,!0),Ge.bind(document,"touchmove",l,!0),Ge.bind(document,"touchend",u,!0)):(Ge.bind(document,"mousemove",l),Ge.bind(document,"dragstart",vo),Ge.bind(document,"selectstart",vo),Ge.bind(document,"mousedown",D,!0),Ge.bind(document,"mouseup",D,!0)),Ge.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;E.autoActivate&&l(m,!0)}e.on("diagram.destroy",y),this.init=x,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(m){U(r,m)}}Ib.$inject=["eventBus","canvas","selection","elementRegistry"];const lr={__depends__:[vk,xi],dragging:["type",Ib]};function ma(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ma.prototype.next=function(){return this._prefix+ ++this._counter};const Nk=new ma("ps");var $k=["marker-start","marker-mid","marker-end"],Fk=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Br(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Br.$inject=["elementRegistry","eventBus","canvas","styles"],Br.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")},Br.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Br.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Yg(n);return this._cloneMarkers(fo(r),i),Se(r,this._styles.cls(i,[])),We(t,r),Se(r,"data-preview-support-element-id",e.id),r},Br.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return We(t,n),Se(n,"data-preview-support-element-id",e.id),n},Br.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),Gk(e)&&$k.forEach(function(r){if(Se(e,r)){var o=jk(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Br.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,Nk.next()].join("-"),a=wt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Yg(n);s.id=o,st(s).add(r);var c=wt(":scope > defs",e);c||(c=Oe("defs"),We(e,c)),We(c,s);var l=zk(s.id);Se(t,i,l)};function jk(e,t,n){var i=Hk(Se(e,t));return wt("marker#"+i,n||document)}function Hk(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function zk(e){return"url(#"+e+")"}function Gk(e){return Fk.indexOf(e.nodeName)!==-1}const ga={__init__:["previewSupport"],previewSupport:["type",Br]};var Vk="drop-ok",Bb="drop-not-ok",Nb="attach-ok",$b="new-parent",Fb="create",Wk=2e3;function jb(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=nt(c,function(x){var m=x.labelTarget;return!x.parent&&!(Je(x)&&c.indexOf(m)!==-1)});var d=Pt(c,function(x){return!Et(x)}),g=!1,h=!1,y=!1;zb(c)&&(g=r.allowed("shape.attach",{position:u,shape:d,target:l})),g||(zb(c)?y=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var C=f.connectionTarget;return y||g?(d&&p&&(h=r.allowed("connection.create",{source:C===p?d:p,target:C===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[Nb,Vk,Bb,$b].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Hb(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&o(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,Nb):a(p,h?$b:Bb))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,C=l.hints||{};if(g===!1||!d)return!1;Hb(c);var x={x:c.x,y:c.y};y?p=i.appendShape(u,p,x,d,{attach:h,connection:y===!0?{}:y,connectionTarget:C.connectionTarget}):(f=i.createElements(f,x,d,U({},C,{attach:h})),p=Pt(f,function(m){return!Et(m)})),U(l,{elements:f,shape:p}),U(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Fb&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],Wk,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Fe(l)||(l=[l]);var p=Pt(l,function(g){return!Et(g)});if(p){u=U({elements:l,hints:{},shape:p},u||{}),z(l,function(g){ze(g.x)||(g.x=0),ze(g.y)||(g.y=0)});var f=nt(l,function(g){return!g.hidden}),d=en(f);z(l,function(g){Et(g)&&(g.waypoints=kn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),U(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Fb,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}jb.$inject=["canvas","dragging","eventBus","modeling","rules"];function Hb(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 zb(e){return e&&e.length===1&&!Et(e[0])}var Uk=750;function Gb(e,t,n,i,r){function o(a){var s=Oe("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(fo(u),l)):(u=n._createContainer("shape",c),n.drawShape(fo(u),l),Mn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",Uk,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),We(p,u)),Mn(u,a.x,a.y)):un(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&un(c)})}Gb.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Rl={__depends__:[lr,ga,Yi,xi],__init__:["create","createPreview"],create:["type",jb],createPreview:["type",Gb]};function md(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}md.$inject=["eventBus"],md.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||qk(0,0)};function qk(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const ds={__init__:["mouse"],mouse:["type",md]};var Vb=2e3;function ei(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),Yk(u)&&(l.priority=2,l.host=u.host.id),Et(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=Kk(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){ze(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",Vb,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Vb,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;U(l,{createElementsBehavior:!1})})}ei.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ei.prototype.copy=function(e,t={}){var n,i;return Fe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Fe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ei.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},ei.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ei.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},ei.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},ei.prototype._paste=function(e,t,n,i){z(e,function(o){ze(o.x)||(o.x=0),ze(o.y)||(o.y=0)});var r=en(e);return z(e,function(o){Et(o)&&(o.waypoints=kn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),U(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,U({},i))},ei.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return z(e,function(o,a){o=Bi(o,"priority"),z(o,function(s){var c=U({},Ni(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Et(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Je(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},ei.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ni(e,["id"]));return t},ei.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ni(e,["id"]));return t},ei.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ni(e,["id"]));return t},ei.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Et(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},ei.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Nc(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var g={element:p,depth:f};r.push(g),o.set(p,g);return}if(d.depth<f){r=l(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}po(a,function(p,f,d){if(Je(p))return;z(p.labels,function(y){c(y,d)});function g(y){y&&y.length&&z(y,function(C){z(C.labels,function(x){c(x,d)}),c(C,d)})}z([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=kn(r,function(p){return p.element});var u=new Set(e);return r=kn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),r=Bi(r,function(p){return p.descriptor.priority}),e=kn(r,function(p){return p.element}),z(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){Ub(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Ub(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function Yk(e){return!!e.host}function Kk(e){return kn(e.waypoints,function(t){return t=Wb(t),t.original&&(t.original=Wb(t.original)),t})}function Wb(e){return U({},e)}function Ub(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const Xk={__depends__:[gk,Rl,ds,Yi],__init__:["copyPaste"],copyPaste:["type",ei]};function gd(e,t,n){Fe(n)||(n=[n]),z(n,function(i){no(e[i])||(t[i]=e[i])})}var yd=750;function qb(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",yd,function(c){var l=c.descriptor,u=c.element,p=ue(u);if(Je(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(ct(u),!0);d.bpmnElement=f,gd(f,l,"name"),gd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var p=ue(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(ue(c).attachedToRef=ue(l[c.host])),Ni(u,Kn(u,function(f,d,g){var h=d.element,y=d.property;return g===c.id&&(h.set(y,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(Je(u)){u.businessObject=ue(l[u.labelTarget]),u.di=ct(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,gd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",yd,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=ue(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&z(es(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",yd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}qb.$inject=["bpmnFactory","eventBus","moddleCopy"];const Zk=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],Qk=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function hs(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return Bi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=hn(r)&&r.$descriptor;if(a&&Qk.includes(a))return o;if(a&&Zk.includes(a)||a&&s&&!Pt(s.properties,No({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(M(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}hs.$inject=["eventBus","bpmnFactory","moddle"],hs.prototype.copyElement=function(e,t,n,i=!1){n&&!Fe(n)&&(n=[n]),n=n||vd(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Fe(r)&&(n=r),z(n,o=>{let a;Yn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!cn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},hs.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return hn(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Fe(e)?Kn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):hn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},hs.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 vd(e,t){return Kn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Yb={__depends__:[Xk],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",qb],moddleCopy:["type",hs]};var Kb=Math.round;function bd(e,t){this._modeling=e,this._eventBus=t}bd.$inject=["modeling","eventBus"],bd.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Kb(s+o/2),u=Kb(c+a/2),p=i.replaceShape(e,U({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Xb(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Xb.$inject=["selection","eventBus"];const Jk={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Xb],replace:["type",bd]};function e2(e,t,n){Fe(n)||(n=[n]),z(n,function(i){no(e[i])||(t[i]=e[i])})}var t2=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function n2(e,t){var n=e&&Yn(e,"collapsed")?e.collapsed:!at(e),i;return t&&(Yn(t,"collapsed")||Yn(t,"isExpanded"))?i=Yn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Zb(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Cl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&n2(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),e2(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=vd(p.$descriptor),h=vd(f.$descriptor,!0),y=i2(g,h);U(f,Pi(c,t2));var C=nt(y,function(v){return v==="eventDefinitions"?Qb(s,c.eventDefinitionType):v==="loopCharacteristics"?!Bn(f):Yn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!Bn(f):!0});if(f=n.copyElement(p,f,C),c.eventDefinitionType&&(Qb(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(Cl(p))d.isExpanded=at(s);else if(c&&Yn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}at(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Cl(p)&&!Cl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var m=yn(s);ct(s).isHorizontal||(ct(d).isHorizontal=m),d.width=m?s.width:t.getDefaultSize(d).width,d.height=m?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,tt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&tt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}Zb.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Cl(e){return M(e,"bpmn:SubProcess")}function Qb(e,t){var n=ue(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function i2(e,t){return e.filter(function(n){return t.includes(n)})}const Jb={__depends__:[Yb,Jk,xi],bpmnReplace:["type",Zb]};var r2=250;function bo(e){this._eventBus=e,this._tools=[],this._active=null}bo.$inject=["eventBus"],bo.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)},bo.prototype.isActive=function(e){return e&&this._active===e},bo.prototype.length=function(e){return this._tools.length},bo.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},bo.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),z(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,r2,function(r){this._active&&(o2(r)||this.setActive(null))},this)};function o2(e){var t=e.originalEvent&&e.originalEvent.target;return t&&lo(t,'.group[data-group="tools"]')}const Ml={__depends__:[lr],__init__:["toolManager"],toolManager:["type",bo]};function a2(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 s2(e,t){var n=[],i=new Set(e);z(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;z(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function c2(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var xd=Math.abs,l2=Math.round,ur={x:"width",y:"height"},ex="crosshair",Nr={n:"top",w:"left",s:"bottom",e:"right"},u2=1500,Al={n:"s",w:"e",s:"n",e:"w"},Pl=20;function _i(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",u2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&nx(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){nx(c);var h={x:0,y:0};h[u]=l2(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}_i.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],_i.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:ex,data:{context:{reactivate:n}},trapClick:!1})},_i.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:ex,data:{context:{}}})},_i.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},_i.prototype.init=function(e,t){var n=xd(e.dx)>xd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(xd(i)<5)return!1;i<0&&(i*=-1),us(e)&&(i*=-1);var o=a2(n,i),a=this._canvas.getRootElement();!gl(e)&&e.hover&&(a=e.hover);var s=[...Ya(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=p2(c,n,o,r,l);return U(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Sl("resize-"+(n==="x"?"ew":"ns")),!0},_i.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||Je(d))){if(Et(d)){u.push(d);return}var g=d[t],h=g+d[ur[t]];if(f2(d)&&(n>0&&je(d)[t]>i||n<0&&je(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),z(o,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,y=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:o,resizingShapes:a}},_i.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},_i.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function tx(e){return{top:e.top-Pl,right:e.right+Pl,bottom:e.bottom+Pl,left:e.left-Pl}}function nx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ze(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ze(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ze(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ze(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function p2(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),p=new Set(a);return z(a,function(f){var d=f.attachers,g=f.children,h=Le(f),y=nt(g,function(F){return!Et(F)&&!Je(F)&&!u.has(F)&&!p.has(F)}),C=nt(g,function(F){return!Et(F)&&!Je(F)&&u.has(F)}),x,m,v,_=[],E=[],T,O,N,P;y.length&&(m=tx(Le(en(y))),x=i-h[Nr[n]]+m[Nr[n]],n==="n"?s.bottom=l=ze(l)?Math.min(l,x):x:n==="w"?s.right=l=ze(l)?Math.min(l,x):x:n==="s"?s.top=c=ze(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ze(c)?Math.max(c,x):x)),C.length&&(v=tx(Le(en(C))),x=i-v[Nr[Al[n]]]+h[Nr[Al[n]]],n==="n"?s.bottom=l=ze(l)?Math.min(l,x):x:n==="w"?s.right=l=ze(l)?Math.min(l,x):x:n==="s"?s.top=c=ze(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ze(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(F){u.has(F)?_.push(F):E.push(F)}),_.length&&(T=Le(en(_.map(je))),O=h[Nr[Al[n]]]-(T[Nr[Al[n]]]-i)),E.length&&(N=Le(en(E.map(je))),P=N[Nr[n]]-(h[Nr[n]]-i)),n==="n"?(x=Math.min(O||1/0,P||1/0),s.bottom=l=ze(l)?Math.min(l,x):x):n==="w"?(x=Math.min(O||1/0,P||1/0),s.right=l=ze(l)?Math.min(l,x):x):n==="s"?(x=Math.max(O||-1/0,P||-1/0),s.top=c=ze(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(O||-1/0,P||-1/0),s.left=c=ze(c)?Math.max(c,x):x));var D=r&&r[f.id];D&&(n==="n"?(x=i+f[ur[t]]-D[ur[t]],s.bottom=l=ze(l)?Math.min(l,x):x):n==="w"?(x=i+f[ur[t]]-D[ur[t]],s.right=l=ze(l)?Math.min(l,x):x):n==="s"?(x=i-f[ur[t]]+D[ur[t]],s.top=c=ze(c)?Math.max(c,x):x):n==="e"&&(x=i-f[ur[t]]+D[ur[t]],s.left=c=ze(c)?Math.max(c,x):x))}),s}}function f2(e){return!!e.host}var _d="djs-dragging",ix="djs-resizing",d2=250,Tl=Math.max;function rx(e,t,n,i,r){function o(a,s){z(a,function(c){r.addDragger(c,s),n.addMarker(c,_d)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),We(s,u);var p=Oe("path");Se(p,"d",l.x),st(p).add("djs-crosshair"),We(u,p);var f=Oe("path");Se(f,"d",l.y),st(f).add("djs-crosshair"),We(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Mn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&un(c)}),e.on("spaceTool.move",d2,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),Se(c,"d","M0,0 L0,0"),st(c).add("djs-crosshair"),We(f,c),s.line=c;var d=Oe("g");Se(d,i.cls("djs-drag-group",["no-events"])),We(n.getActiveLayer(),d),o(u,d);var g=new Set(u);z(p,function(E){g.add(E)});var h=new Set,y=s.movingConnections=[];g.forEach(function(E){z(E.outgoing,function(T){h.has(T)||!Et(T)||!g.has(T.target)||(h.add(T),y.push(T))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var C=Oe("g");Se(C,i.cls("djs-frame-group",["no-events"])),We(n.getActiveLayer(),C);var x=[];z(p,function(E){var T=r.addFrame(E,C),O=T.getBBox();x.push({element:T,initialBounds:O}),n.addMarker(E,ix)}),s.frameGroup=C,s.frames=x}var m={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:m[l]});var v={x:"y",y:"x"},_={x:a.dx,y:a.dy};_[v[s.axis]]=0,Mn(s.dragGroup,_.x,_.y),z(s.frames,function(E){var T=E.element,O=E.initialBounds,N,P;s.direction==="e"?Se(T,{width:Tl(O.width+_.x,5)}):(N=Tl(O.width-_.x,5),Se(T,{width:N,x:O.x+O.width-N})),s.direction==="s"?Se(T,{height:Tl(O.height+_.y,5)}):(P=Tl(O.height-_.y,5),Se(T,{height:P,y:O.y+O.height-P}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,_d)}),z(l,function(g){n.removeMarker(g,_d)}),f&&(un(p),un(f)),z(u,function(g){n.removeMarker(g,ix)}),d&&un(d)})}rx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const h2={__init__:["spaceToolPreview"],__depends__:[lr,Yi,Ml,ga,ds],spaceTool:["type",_i],spaceToolPreview:["type",rx]};function kl(e,t){e.invoke(_i,this),this._canvas=t}kl.$inject=["injector","canvas"],Ee(kl,_i),kl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Io(Qo(r.children.filter(l=>M(l,"bpmn:Artifact")),en(o))));const s=[...e,...a];var c=_i.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||m2(l)&&(t==="y"&&yn(l)||t==="x"&&!yn(l)))}),c};function m2(e){return M(e,"bpmn:Participant")&&!ue(e).processRef}const ox={__depends__:[h2],spaceTool:["type",kl]};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 r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},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 r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},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,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},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:tm("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=Fe(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 g2={commandStack:["type",zt]};function $r(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var y2=250,ax=1400;function wd(e,t,n){le.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",ax,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=sx(a),o.validatedShapes=sx(s)}),i&&t.on("shape.move.start",y2,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",ax,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;$r(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=ef(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Xt(s.labels,a,c),a.labelTarget=s)})}Ee(wd,le),wd.$inject=["injector","eventBus","modeling"];function sx(e){var t=new Set(e);return nt(e,function(n){return!t.has(n.labelTarget)})}const v2={__init__:["labelSupport"],labelSupport:["type",wd]};var b2=251,cx=1401,lx="attach-ok";function Ed(e,t,n,i,r){le.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",cx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=x2(c),s.validatedShapes=_2(l)}),o&&t.on("shape.move.start",b2,function(a){var s=a.context,c=s.shapes,l=Sd(c);z(l,function(u){o.makeDraggable(s,u,!0),z(u.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,lx),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,lx)}))}}),this.preExecuted("elements.move",cx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Sd(l);z(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=nt(c,function(p){var f=p.host;return w2(p)&&!E2(c,f)}),z(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),z(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;$r(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&z(l.attachers,function(u){var p=Mv(u,c,l);r.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=Mv(d,l,u);r.moveShape(d,g,d.parent),z(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;$r(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(Ed,le),Ed.$inject=["injector","eventBus","canvas","rules","modeling"];function Sd(e){return Xu(kn(e,function(t){return t.attachers||[]}))}function x2(e){var t=Sd(e);return i1("id",e,t)}function _2(e){var t=Bo(e,"id");return nt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function w2(e){return!!e.host}function E2(e,t){return e.indexOf(t)!==-1}const S2={__depends__:[Yi],__init__:["attachSupport"],attachSupport:["type",Ed]};function ux(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(ny(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}ux.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Rd={__init__:["changeSupport"],changeSupport:["type",ux]};function wi(e){this._model=e}wi.$inject=["moddle"],wi.prototype._needsId=function(e){return tt(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},wi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":tt(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},wi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},wi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},wi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",U({bpmnElement:e,bounds:this.createDiBounds()},t))},wi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},wi.prototype.createDiWaypoints=function(e){var t=this;return kn(e,function(n){return t.createDiWaypoint(n)})},wi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Pi(e,["x","y"]))},wi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",U({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},wi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",U({bpmnElement:e},t))};function ti(e,t,n){le.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},y;!g.cropped&&h.createElementsBehavior!==!1&&(y=g.connection,y.waypoints=n.getCroppedWaypoints(y),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,y=g.parent||g.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ni(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ni(a));function s(d){var g=d.context,h=g.oldRoot,y=h.children;z(y,function(C){M(C,"bpmn:BaseElement")&&i.updateParent(C)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],ni(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],ni(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],ni(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ni(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ni(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ni(u)),this.executed("connection.reconnect",ni(function(d){var g=d.context,h=g.connection,y=g.oldSource,C=g.newSource,x=ue(h),m=ue(y),v=ue(C);x.conditionExpression&&!tt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),y!==C&&m.default===x&&(g.oldDefault=m.default,delete m.default)})),this.reverted("connection.reconnect",ni(function(d){var g=d.context,h=g.connection,y=g.oldSource,C=g.newSource,x=ue(h),m=ue(y),v=ue(C);g.oldConditionExpression&&(x.conditionExpression=g.oldConditionExpression),g.oldDefault&&(m.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],ni(p)),this.reverted(["element.updateAttachment"],ni(p)),this.executed("element.updateLabel",ni(f)),this.reverted("element.updateLabel",ni(f));function f(d){const{element:g}=d.context,h=pi(g),y=ct(g),C=y&&y.get("label");kr(g)||yl(g)||(h&&!C?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&C&&y.set("label",void 0))}}Ee(ti,le),ti.$inject=["eventBus","bpmnFactory","connectionDocking"],ti.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ti.prototype.updateParent=function(e,t){if(!Je(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ct(e),o=n&&n.businessObject,a=ct(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),M(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},ti.prototype.updateBounds=function(e){var t=ct(e),n=C2(e);if(n){var i=ki(n,t.get("bounds"));U(n,{x:e.x+i.x,y:e.y+i.y})}var r=Je(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),U(o,{x:e.x,y:e.y,width:e.width,height:e.height})},ti.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),qt(i,e)),M(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Xt(r,e))}},ti.prototype.updateDiConnection=function(e,t,n){var i=ct(e),r=ct(t),o=ct(n);i.sourceElement&&i.sourceElement.bpmnElement!==ue(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ue(n)&&(i.targetElement=n&&o)},ti.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(qt(n,e),e.$parent=null)}};function R2(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ti.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},ti.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=R2(e.$parent||t),e.$parent&&(qt(o.get("rootElements"),r),r.$parent=null),t&&(Xt(o.get("rootElements"),r),r.$parent=o))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),qt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);qt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ti.prototype.updateConnectionWaypoints=function(e){var t=ct(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ti.prototype.updateConnection=function(e){var t=e.connection,n=ue(t),i=t.source,r=ue(i),o=t.target,a=ue(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(qt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(qt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},ti.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function ni(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function C2(e){if(M(e,"bpmn:Activity")){var t=ct(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Fr(e,t){or.call(this),this._bpmnFactory=e,this._moddle=t}Ee(Fr,or),Fr.$inject=["bpmnFactory","moddle"],Fr.prototype._baseCreate=or.prototype.create,Fr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,U({type:"label",di:n},ho,t))}return this.createElement(e,t)},Fr.prototype.createElement=function(e,t){t=U({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!A2(r)){var o=U({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}M(i,"bpmn:Group")&&(t=U({isFrame:!0},t)),t=M2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Cd(r,t,"isExpanded")),tt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Cd(r,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!at(i,r)),M(i,"bpmn:ExclusiveGateway")&&(Yn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),cn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),cn(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=U({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Fr.prototype.getDefaultSize=function(e,t){var n=ue(e);if(t=t||ct(e),M(n,"bpmn:SubProcess"))return at(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return at(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Fr.prototype.createParticipantShape=function(e){return hn(e)||(e={isExpanded:e}),e=U({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function M2(e,t,n){return z(n,function(i){t=Cd(e,t,i)}),t}function Cd(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ni(t,[n]))}function A2(e){return tt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Ol(e,t){this._modeling=e,this._canvas=t}Ol.$inject=["modeling","canvas"],Ol.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(r){var o={x:0,y:0};cn(i.left)?o.x=i.left-r.x:cn(i.right)?o.x=i.right-r.width-r.x:cn(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:cn(i.top)?o.y=i.top-r.y:cn(i.bottom)?o.y=i.bottom-r.height-r.y:cn(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Ol.prototype.postExecute=function(e){};function Dl(e){this._modeling=e}Dl.$inject=["modeling"],Dl.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Dl.prototype.postExecute=function(e){var t=e.hints||{};P2(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 P2(e,t){return br(e.outgoing,function(n){return n.target===t})}function Ll(e,t){this._canvas=e,this._layouter=t}Ll.$inject=["canvas","layouter"],Ll.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Ll.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Il=Math.round;function Md(e){this._modeling=e}Md.$inject=["modeling"],Md.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;z(t,function(p){ze(p.x)||(p.x=0),ze(p.y)||(p.y=0)});var s=nt(t,function(p){return!p.hidden}),c=en(s);z(t,function(p){Et(p)&&(p.waypoints=kn(p.waypoints,function(f){return{x:Il(f.x-c.x-c.width/2+r.x),y:Il(f.y-c.y-c.height/2+r.y)}})),U(p,{x:Il(p.x-c.x-c.width/2+r.x),y:Il(p.y-c.y-c.height/2+r.y)})});var l=new Set(Nc(t)),u={};z(t,function(p){if(Et(p)){u[p.id]=ze(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,o):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,o);return}var f=U({},o);l.has(p)||(f.autoResize=!1),Je(p)&&(f=Ni(f,["attach"])),u[p.id]=ze(i)?a.createShape(p,Pi(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Pi(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Io(u)};var px=Math.round;function jr(e){this._canvas=e}jr.$inject=["canvas"],jr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?U(t,n):U(t,{x:n.x-px(t.width/2),y:n.y-px(t.height/2)}),this._canvas.addShape(t,i,r),t},jr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ms(e){jr.call(this,e)}Ee(ms,jr),ms.$inject=["canvas"];var T2=jr.prototype.execute;ms.prototype.execute=function(e){var t=e.shape;return O2(t),t.labelTarget=e.labelTarget,T2.call(this,e)};var k2=jr.prototype.revert;ms.prototype.revert=function(e){return e.shape.labelTarget=null,k2.call(this,e)};function O2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function gs(e,t){this._canvas=e,this._modeling=t}gs.$inject=["canvas","modeling"],gs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;$r(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),$r(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},gs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ef(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},gs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Xt(n.children,t,i),this._canvas.addConnection(t,n),t};function Ad(e,t){this._modeling=e,this._elementRegistry=t}Ad.$inject=["modeling","elementRegistry"],Ad.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ys(e,t){this._canvas=e,this._modeling=t}ys.$inject=["canvas","modeling"],ys.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;$r(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),$r(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),$r(n.children,function(i){Et(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ys.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ef(i.children,n),t.removeShape(n),n},ys.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Xt(i.children,n,r),t.addShape(n,i),n};function Bl(e){this._modeling=e}Bl.$inject=["modeling"];var fx={x:"y",y:"x"};Bl.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,C){y.range.min=Math.min(C[i],y.range.min),y.range.max=Math.max(C[i]+C[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,C){var x={y:0};x[i]=y-a(C),x[i]&&(x[fx[i]]=0,t.moveElements([C],x,C.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(y,C){var x,m,v;if(y.elements.length<2){C&&C!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}x=Bi(y.elements,i),m=x[0],C===p&&(m=x[s(x)]),v=a(m),y.range=null,z(x,function(_){if(l(v,_),y.range===null){y.range={min:_[i],max:_[i]+_[r]};return}o(y,_)}),C&&C!==n.length-1&&(h+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(y,C){var x={},m;y===u||y===f||(m=n[C-1],y.range.max=0,z(y.elements,function(v,_){x[fx[i]]=0,x[i]=m.range.max-v[i]+d,y.range.min!==v[i]&&(x[i]+=v[i]-y.range.min),x[i]&&t.moveElements([v],x,v.parent),y.range.max=Math.max(v[i]+v[r],_?y.range.max:0)}))})},Bl.prototype.postExecute=function(e){};function Nl(e,t){this._layouter=e,this._canvas=t}Nl.$inject=["layouter","canvas"],Nl.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return U(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Nl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Pd(){}Pd.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=qt(o.children,t),Xt(i.children,t,r),t.parent=i,z(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Pd.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return qt(n.children,t),Xt(i.children,t,r),t.parent=i,z(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Td(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Td.prototype.add=function(e,t){return this.addAll([e],t)},Td.prototype.addAll=function(e,t){var n=cM(e,!!t,this);return U(this,n),this};function vs(e){this._modeling=e}vs.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},vs.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),z(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,l[p.id]&&!u&&n):o.layoutConnection(p,{connectionStart:f&&Nf(p,p.source,t),connectionEnd:d&&$f(p,p.target,t)})})},vs.prototype.getClosure=function(e){return new Td().addAll(e,!0)};function $l(e){this._helper=new vs(e)}$l.$inject=["modeling"],$l.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},$l.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 xo(e){this._modeling=e,this._helper=new vs(e)}xo.$inject=["modeling"],xo.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=Pi(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=qt(o.children,t),Xt(i.children,t,r),U(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},xo.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(z(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:$f(o,t,n)})}),z(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Nf(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},xo.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Xt(n.children,t,i),U(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},xo.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},xo.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function bs(e){this._modeling=e}bs.$inject=["modeling"],bs.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Fe(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},bs.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||dx(Fe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||dx(Fe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},bs.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function dx(e){return e.original||e}function pr(e,t){this._modeling=e,this._rules=t}pr.$inject=["modeling","rules"],pr.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,y){return i.allowed("connection.reconnect",{connection:y,source:g,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();z(f,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,pl(g,s,u),a)}),z(d,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,ul(g,s,u),a)})},pr.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},pr.prototype.execute=function(e){},pr.prototype.revert=function(e){},pr.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},pr.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},pr.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function xs(e){this._modeling=e}xs.$inject=["modeling"],xs.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},U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},xs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(z(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:pl(o,n,i)})}),z(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ul(o,n,i)})}))},xs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Hr(e){this._modeling=e}Hr.$inject=["modeling"],Hr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),z(r,function(s){a[s.id]=L2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(s2(i,r),t,n,o,i,r,a)},Hr.prototype.execute=function(){},Hr.prototype.revert=function(){},Hr.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Hr.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(r){var o=c2(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);z(e,function(u){var p=u.source,f=u.target,d=D2(u),g=mx(n),h={},y=c.has(p)||l.has(p),C=c.has(f)||l.has(f);y&&C?(d=kn(d,function(x){return gx(x,i,n)&&(x[g]=x[g]+t[g]),x.original&&gx(x.original,i,n)&&(x.original[g]=x.original[g]+t[g]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||C)&&(c.has(p)?h.connectionStart=Nf(u,p,t):c.has(f)?h.connectionEnd=$f(u,f,t):l.has(p)?h.connectionStart=ul(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=pl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function hx(e){return U({},e)}function D2(e){return kn(e.waypoints,function(t){return t=hx(t),t.original&&(t.original=hx(t.original)),t})}function mx(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function gx(e,t,n){var i=mx(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function L2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Fl(e){this._modeling=e}Fl.$inject=["modeling"],Fl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=yx(n),t.collapsed=!t.collapsed;var i=vx(n,t.collapsed);return[t].concat(i)},Fl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=bx(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function yx(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=U({},t,yx(n.children)))}),t}function vx(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(vx(i.children,i.collapsed||t)))}),n}function bx(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(bx(i.children,t)))}),n}function jl(e){this._modeling=e}jl.$inject=["modeling"],jl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=xx(i,t),_x(n,t),t.host=n,t},jl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,xx(n,t),_x(i,t,r),t};function xx(e,t){return qt(e&&e.attachers,t)}function _x(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Xt(i,t,n)}}function kd(){}kd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},kd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function St(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}St.$inject=["eventBus","elementFactory","commandStack"],St.prototype.getHandlers=function(){return{"shape.append":Dl,"shape.create":jr,"shape.delete":ys,"shape.move":xo,"shape.resize":xs,"shape.replace":pr,"shape.toggleCollapse":Fl,spaceTool:Hr,"label.create":ms,"connection.create":Ll,"connection.delete":gs,"connection.move":Pd,"connection.layout":Nl,"connection.updateWaypoints":kd,"connection.reconnect":bs,"elements.create":Md,"elements.move":$l,"elements.delete":Ad,"elements.distribute":Bl,"elements.align":Ol,"element.updateAttachment":jl}},St.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},St.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},St.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},St.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},St.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},St.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},St.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},St.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},St.prototype.createElements=function(e,t,n,i,r){Fe(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},St.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},St.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},St.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},St.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},St.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},St.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},St.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},St.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},St.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},St.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},St.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},St.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},St.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,U(i,{docking:"source"}))},St.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,U(i,{docking:"target"}))},St.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},St.prototype._create=function(e,t){return qM(t)?t:this._elementFactory.create(e,t)},St.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function _s(e){this._elementRegistry=e}_s.$inject=["elementRegistry"],_s.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||I2(n,ic(i));return wx(n,i),e.oldProperties=o,e.changed=r,r},_s.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return wx(n,t),i},_s.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?B2(e,t):[]};function I2(e,t){return Kn(t,function(n,i){return n[i]=e.get(i),n},{})}function wx(e,t){z(t,function(n,i){e.set(i,n)})}function B2(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&ue(n).dataObjectRef===e})}var ws="default",fr="id",Ex="di",N2={width:0,height:0};function Es(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Es.$inject=["elementRegistry","moddle","modeling","textRenderer"],Es.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=z2(e.properties),s=e.oldProperties||$2(t,a);return Sx(a,o)&&(r.unclaim(o[fr]),i.updateId(t,a[fr]),r.claim(a[fr],o)),ws in a&&(a[ws]&&n.push(i.get(a[ws].id)),o[ws]&&n.push(i.get(o[ws].id))),Rx(t,a),e.oldProperties=s,e.changed=n,n},Es.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ue(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,N2)}},Es.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Rx(t,i),Sx(n,r)&&(a.unclaim(n[fr]),o.updateId(t,i[fr]),a.claim(i[fr],r)),e.changed};function Sx(e,t){return fr in e&&e[fr]!==t[fr]}function $2(e,t){var n=ic(t),i=e.businessObject,r=ct(e);return Kn(n,function(o,a){return a!==Ex?o[a]=i.get(a):o[a]=F2(r,ic(t.di)),o},{})}function F2(e,t){return Kn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Rx(e,t){var n=e.businessObject,i=ct(e);z(t,function(r,o){o!==Ex?n.set(o,r):i&&j2(i,r)})}function j2(e,t){z(t,function(n,i){e.set(i,n)})}var H2=["default"];function z2(e){var t=U({},e);return H2.forEach(function(n){n in e&&(t[n]=ue(t[n]))}),t}function Hl(e,t){this._canvas=e,this._modeling=t}Hl.$inject=["canvas","modeling"],Hl.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ct(r);return t.setRootElement(n),t.removeRootElement(r),Xt(a.rootElements,i),i.$parent=a,qt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Hl.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ct(n);return t.setRootElement(r),t.removeRootElement(n),qt(a.rootElements,i),i.$parent=null,Xt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Od(e,t){this._modeling=e,this._spaceTool=t}Od.$inject=["modeling","spaceTool"],Od.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=vi(i),a=o===i,s=a?i:i.parent,c=Dr(s),l=yn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+yi,y:i.y,width:i.width-yi,height:i.height}:{x:i.x,y:i.y+yi,width:i.width,height:i.height-yi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];po(o,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:nt(v.children,function(_){return _!==i})});var f,d,g,h,y;r==="top"?(f=-120,d=i.y,g=d+10,h="n",y="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",y="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",y="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",y="x");var C=t.calculateAdjustments(p,y,f,g),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(C.movingShapes,C.resizingShapes,x,h,g);var m=l?{x:i.x+(a?yi:0),y:d-(r==="top"?120:0),width:i.width-(a?yi:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?yi:0),width:120,height:i.height-(a?yi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},m,s)};function Dd(e){this._modeling=e}Dd.$inject=["modeling"],Dd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Dr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=yn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+yi,y:n.y+f*c,width:n.width-yi,height:l}:{x:n.x+f*c,y:n.y+yi,width:l,height:n.height-yi},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Ss(e,t){this._modeling=e,this._spaceTool=t}Ss.$inject=["modeling","spaceTool"],Ss.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ss.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=BP(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ss.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Le(e),r=Le(t),o=iv(r,i),a=vi(e),s=[],c=[];po(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Rs="flowNodeRef",Ld="lanes";function zl(){}zl.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Le(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var p=vi(u);return r[p.id]||(r[p.id]=ol(p)),r[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=vi(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(Ld),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Rs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},zl.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(Ld);n.remove.forEach(function(o){qt(r,o),qt(o.get(Rs),i)}),n.add.forEach(function(o){Xt(r,o),Xt(o.get(Rs),i)})}),[]},zl.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Ld);n.add.forEach(function(o){qt(r,o),qt(o.get(Rs),i)}),n.remove.forEach(function(o){Xt(r,o),Xt(o.get(Rs),i)})}),[]};var Id="categoryValueRef";function Cs(e,t){this._bpmnFactory=e,this._elementRegistry=t}Cs.$inject=["bpmnFactory","elementRegistry"],Cs.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(x,m,v){if(m){var _=a.get(x);_||(_={},a.set(x,_)),!(v&&_.present)&&(!v&&_.past||(v?_.present={categoryValue:m,root:Bd(x)}:_.past={categoryValue:m}))}}function c(x){r.set(x,ue(x))}function l(){n.filter(function(x){return M(x,"bpmn:FlowElement")&&!Je(x)&&x.parent}).forEach(c)}function u(x){var m=ue(x),v=m.get("categoryValueRef");return v||(v=Qy(i,m),o.push(G2(x,v))),v}function p(x){return x.reduce(function(m,v){var _=Bd(v),E=m.get(_);return E||(E=[],m.set(_,E)),E.push(v),m},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return M(x,"bpmn:Group")&&!Je(x)&&x.parent}).forEach(function(x){var m=ue(x).get("categoryValueRef");if(!m){var v=Bd(x),_=f.get(v)||[],E=Qo(_,x),T=Object.keys(E).length>0;T&&(m=u(x))}s(x,m,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(x,m){return m.present&&x.add(m.present.categoryValue),m.past&&x.add(m.past.categoryValue),x},new Set),h=new Map,y=p(d);a.forEach(function(x,m){var v=x.present;if(v){var _=y.get(v.root)||[],E=Qo(_,m);_.forEach(function(T){if(E[T.id]){var O=h.get(T);O||(O=new Set,h.set(T,O)),O.add(v.categoryValue)}})}});var C=d.reduce(function(x,m){var v=r.get(m),_=v.get(Id),E=new Set(_),T=h.get(m)||new Set,O=Array.from(T).filter(function(P){return!E.has(P)}),N=_.filter(function(P){return g.has(P)&&!T.has(P)});return(O.length||N.length)&&x.push({businessObject:v,categoryValuesToAdd:O,categoryValuesToRemove:N}),x},[]);return{flowElements:C,groups:o}},Cs.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),V2(t.groups),U2(t.flowElements),[]},Cs.prototype.revert=function(e){var t=e.updates;return q2(t.flowElements),W2(t.groups),[]};function G2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function V2(e){e.forEach(function(t){ue(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function W2(e){e.forEach(function(t){ue(t.groupShape).categoryValueRef=null})}function U2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Id);t.categoryValuesToRemove.forEach(function(r){qt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Xt(i,r,!0)})})}function q2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Id);t.categoryValuesToAdd.forEach(function(r){qt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Xt(i,r,!0)})})}function Bd(e){for(;e.parent;)e=e.parent;return e}function Gl(e){this._moddle=e}Gl.$inject=["moddle"],Gl.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Gl.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var Y2={fill:void 0,stroke:void 0};function Nd(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(qn(t)){var n=K2(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Nd.$inject=["commandStack"],Nd.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Y2,i=this,r={};"fill"in n&&U(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&U(r,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(o){var a=Et(o)?Pi(r,["border-color"]):r,s=ct(o);if(X2(a),Je(o)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!tt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function K2(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 X2(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var Z2={width:0,height:0};function Cx(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return RA(u,l),[u,p]}function r(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!Je(l)&&kr(l)&&!Uc(l)&&!Mx(p)){var f=7,d=sf(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=pi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Je(u)&&!M(u,"bpmn:TextAnnotation"))){if(Je(u)&&Mx(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=pi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,Z2)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Cx.$inject=["modeling","textRenderer","bpmnFactory"];function Mx(e){return!e||!e.trim()}function Pn(e,t,n,i){St.call(this,e,t,n),this._bpmnRules=i}Ee(Pn,St),Pn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Pn.prototype.getHandlers=function(){var e=St.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=_s,e["element.updateProperties"]=Es,e["canvas.updateRoot"]=Hl,e["lane.add"]=Od,e["lane.resize"]=Ss,e["lane.split"]=Dd,e["lane.updateRefs"]=zl,e["group.updateRefs"]=Cs,e["id.updateClaim"]=Gl,e["element.setColor"]=Nd,e["element.updateLabel"]=Cx,e},Pn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Pn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Pn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Pn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Pn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Pn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Pn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Pn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Pn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Pn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Pn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Pn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Pn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Pn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Ax(){}Ax.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||je(t.source||e.source),t.connectionEnd||je(t.target||e.target)]};var Vl=20,Q2=5,Wl=Math.round,Px=20,J2={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function eO(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function tO(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Tx(e,t,n){var i=Cn(t,e,Q2),r=n.split(":")[0],o=Wl((t.x-e.x)/2+e.x),a=Wl((t.y-e.y)/2+e.y),s,c,l=tO(r,i),u=/h|r|l/.test(r),p=!1,f=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=eO(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+Vl*(/l/.test(r)?-1:1),y:f?a+Vl:a}):(f=o===e.x,s={x:f?o+Vl:o,y:e.y+Vl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:$d(e,s,c).concat(s),directions:c,turnNextDirections:f}}function nO(e,t,n){return Tx(e,t,n)}function iO(e,t,n){var i=Tx(t,e,kx(n));return{waypoints:i.waypoints.slice().reverse(),directions:kx(i.directions),turnNextDirections:i.turnNextDirections}}function rO(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=$d(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function kx(e){return e.split(":").reverse().join(":")}function oO(e,t,n){var i=Wl((t.x-e.x)/2+e.x),r=Wl((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function $d(e,t,n){if(n=n||"h:h",!hO(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Dx(n)){var i=nO(e,t,n),r=iO(e,t,n),o=rO(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return oO(e,t,n)}function aO(e,t,n){var i=$d(e,t,n);return i.unshift(e),i.push(t),Ix(i)}function sO(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=t1(o,"straight")[0]||"h:h",s=J2[a]||0,c=Cn(e,t,s),l=dO(c,a);n=n||je(e),i=i||je(t);var u=l.split(":"),p=Lx(n,e,u[0],mO(c)),f=Lx(i,t,u[1],c);return aO(p,f,l)}function cO(e,t,n,i,r,o){Fe(n)&&(r=n,o=i,n=je(e),i=je(t)),o=U({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&uO(e,t,n,i,o),c||(c=o.connectionEnd&&fO(t,e,i,r),c)||(c=o.connectionStart&&pO(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:sO(e,t,n,i,o)}function lO(e,t,n){return e>=t&&e<=n}function Ox(e,t,n){var i={x:"width",y:"height"};return lO(t[e],n[e],n[e]+n[i[e]])}function uO(e,t,n,i,r){var o={},a,s;return s=Cn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Ox(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:Ox(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function pO(e,t,n,i){return Fd(e,t,n,i)}function fO(e,t,n,i){var r=i.slice().reverse();return r=Fd(e,t,n,r),r?r.reverse():null}function Fd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!Pt(u,function(p,f){var d=u[f-1];return d&&Xa(p,d)<3})}function o(u,p,f){var d=ir(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(ry(u[d],p,Px)||ry(u[d],f,Px))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Fd(e,t,n,l)),c&&ir(c)?null:c}function dO(e,t){if(Dx(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 hO(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Dx(e){return e&&/t|r|b|l/.test(e)}function mO(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 Lx(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 Ix(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return tf(r,o,n,0)||t.push(n),t},[])}var gO=-10,yO=40,vO={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},bO={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},jd={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ms={top:"t",right:"r",bottom:"b",left:"l"};function Ul(e){this._elementRegistry=e}Ee(Ul,Ax),Ul.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(o||(o=Bx(r&&r[0],n)),a||(a=Bx(r&&r[r.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&r&&!Nx(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=Yy(n,s)?vO:bO;return M(e,"bpmn:MessageFlow")?c=_O(n,i,u):(M(e,"bpmn:SequenceFlow")||Nx(n,i))&&(n===i?c={preferredLayouts:MO(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:AO(n,i,a,u)}:As(n)||As(i)?c={preferredLayouts:u.subProcess,preserveDocking:EO(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=U(c,t),l=Ix(cO(n,i,o,a,r,c))),l||[o,a]};function xO(e){var t=e.host;return Cn(je(e),t,gO)}function _O(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:wO(e,t)}}function wO(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":As(t)?"source":As(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function EO(e){return As(e)?"target":"source"}function Bx(e,t){return e?e.original||e:je(t)}function Nx(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function As(e){return M(e,"bpmn:SubProcess")&&at(e)}function _o(e,t){return e===t}function SO(e,t){return t.indexOf(e)!==-1}function ya(e){var t=/right|left/.exec(e);return t&&t[0]}function va(e){var t=/top|bottom/.exec(e);return t&&t[0]}function $x(e,t){return jd[e]===t}function RO(e,t){var n=ya(e),i=jd[n];return t.indexOf(i)!==-1}function CO(e,t){var n=va(e),i=jd[n];return t.indexOf(i)!==-1}function Fx(e){return e==="right"||e==="left"}function MO(e,t,n){var i=t.waypoints,r=i&&i.length&&Cn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function AO(e,t,n,i){var r=je(e),o=je(t),a=xO(e),s,c,l=_o(e.host,t),u=SO(a,["top","right","bottom","left"]),p=Cn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?PO(a,u,e,t,n,i):(s=TO(a,p,u,i.isHorizontal),c=kO(a,p,u,i.isHorizontal),[s+":"+c])}function PO(e,t,n,i,r,o){var a=t?e:o.isHorizontal?va(e):ya(e),s=Ms[a],c;return t?Fx(e)?c=jx("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=jx("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function jx(e,t,n,i){var r=yO;return!(Hd(e,i,n,r)||Hd(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Hd(e,i,je(t),r))}function Hd(e,t,n,i){return Math.abs(t[e]-n[e])<i}function TO(e,t,n,i){if(n)return Ms[e];var r=va(e),o=ya(e),a=va(t),s=ya(t);if(i){if(_o(r,a)||$x(o,s))return Ms[r]}else if(_o(o,s)||$x(r,a))return Ms[o];return Ms[i?o:r]}function kO(e,t,n,i){if(n)return Fx(e)?RO(e,t)||_o(e,t)?"h":"v":CO(e,t)||_o(e,t)?"v":"h";var r=va(e),o=ya(e),a=va(t),s=ya(t);return a&&!s?"v":s&&!a?"h":i?_o(r,a)?"h":"v":_o(o,s)?"v":"h"}Ul.$inject=["elementRegistry"];function Hx(e){return U({original:e.point.original||e.point},e.actual)}function zr(e,t){this._elementRegistry=e,this._graphicsFactory=t}zr.$inject=["elementRegistry","graphicsFactory"],zr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Hx(i)),o.push(Hx(r)),o},zr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},zr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Za(i,r,n)},zr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},zr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},zr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const zd={__init__:["modeling","bpmnUpdater"],__depends__:[XT,fk,hk,mk,Jb,g2,v2,S2,xi,Rd,ox],bpmnFactory:["type",wi],bpmnUpdater:["type",ti],elementFactory:["type",Fr],modeling:["type",Pn],layouter:["type",Ul],connectionDocking:["type",zr]};var OO=10,zx=50,DO=250;function Gd(e,t,n,i){for(var r;r=LO(e,n,t);)n=i(t,n,r);return n}function Vd(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function LO(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=BO(e);return Pt(r,function(o){if(o===n)return!1;var a=Cn(o,i,OO);return a==="intersect"})}function IO(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||zx,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||DO,c=t.reference||"start";o||(o=FO);function l(g,h){return r==="n"?c==="start"?Le(g).top-Le(h).bottom:c==="center"?Le(g).top-je(h).y:Le(g).top-Le(h).top:r==="w"?c==="start"?Le(g).left-Le(h).right:c==="center"?Le(g).left-je(h).x:Le(g).left-Le(h).left:r==="s"?c==="start"?Le(h).top-Le(g).bottom:c==="center"?je(h).y-Le(g).bottom:Le(h).bottom-Le(g).bottom:c==="start"?Le(h).left-Le(g).right:c==="center"?je(h).x-Le(g).right:Le(h).right-Le(g).right}var u=e.incoming.filter(o).map(function(g){var h=a(g),y=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:y,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),y=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:y,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Kn(f,function(g,h){var y=h.distance,C=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*C,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return d.distance||i}function BO(e){var t=Wd(e);return e.host&&(t=t.concat(Wd(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Wd(i))},[]))),t}function Wd(e){return $O(e).concat(NO(e))}function NO(e){return e.incoming.map(function(t){return t.source})}function $O(e){return e.outgoing.map(function(t){return t.target})}function FO(){return!0}var jO=100;function Gx(e,t,n){e.on("autoPlace",jO,function(i){var r=i.shape,o=i.source;return HO(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}Gx.$inject=["eventBus","modeling","canvas"];function HO(e,t,n){n||(n={});var i=n.defaultDistance||zx,r=je(e),o=Le(e);return{x:o.right+i+t.width/2,y:r.y}}function Vx(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Vx.$inject=["eventBus","selection"];const zO={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Gx],autoPlaceSelectionBehavior:["type",Vx]};function Wx(e,t,n){var i=Yy(e,n);if(M(t,"bpmn:TextAnnotation"))return VO(e,t,i);if(tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return WO(e,t,i);if(M(t,"bpmn:FlowNode"))return GO(e,t,i)}function GO(e,t,n){var i=Le(e),r=je(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=IO(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=Cn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+Ux(l,c,o)}:{x:r.x+Ux(l,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Gd(e,t,u,Vd(f))}function Ux(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function VO(e,t,n){var i=Le(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};Et(e)&&(r=je(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Gd(e,t,r,Vd(a))}function WO(e,t,n){var i=Le(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Gd(e,t,r,Vd(a))}function qx(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Wx(r,i,t)})}qx.$inject=["eventBus","elementRegistry"];const ql={__depends__:[zO],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",qx]},Yx=[Uy,is,zd,ql,ap];function UO(e={}){Rm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ta({container:t,moddleExtensions:e.moddleExtensions??pc,additionalModules:[...Yx,...e.additionalModules??[]]})}const Kx={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","label-over-shape":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},qO={이:["이","가"],을:["을","를"],와:["과","와"]};function YO(e,t){const[n,i]=qO[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const KO={"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":"연관선"},XO="요소";function Ud(e){return(e&&KO[e.type])??XO}const Xx=20;function ZO(e){const t=e.replace(/\s+/g," ").trim();return t.length>Xx?`${t.slice(0,Xx)}…`:t}function Yl(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:ZO(r.name),a=o===void 0?i+Ud(r):o,s=o===void 0?a:`「${o}」`;return n?s+YO(a,n).slice(a.length):s}function QO(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&Ud(o)===Ud(a);return[Yl(e,t,i),Yl(e,n,r,s?"다른 ":"")]}function JO(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 eD(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const Kl={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function tD(e,t){const n=(r,o)=>Yl(t,r,o),i=(r,o,a,s)=>QO(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${Kl[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${Kl[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Kl[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Kl[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function nD(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Yl(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const Zx="기타",qd={error:0,warning:1,info:2};function Qx(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${lt(i)}`,source:"geometry",code:i.kind,severity:JO(i),targetRefs:eD(i),category:Kx[i.kind]??Zx,message:tD(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:Kx[i.ruleId]??Zx,message:nD(i,t)});return n}function Jx(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function ba(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Yd(e,t){if(t===void 0||e.length===0)return!1;const n=ba(e[0],t);return e.some(i=>ba(i,t)!==n)}function e_(e,t){const n=Yd(e,t);return e.slice().sort((i,r)=>(n?Number(ba(r,t))-Number(ba(i,t)):0)||qd[i.severity]-qd[r.severity])}const t_="i18n-untranslated",n_="i18n-review-requested",i_=[["untranslated",t_],["reviewRequested",n_]];class Kd{constructor(t,n,i,r,o,a,s,c){fi(this,"config");fi(this,"displayLocale");this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=r.drawShape.bind(r);r.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=o.activate.bind(o);o.activate=f=>this.withDisplayText(f,()=>u(f));const p=o.update.bind(o);o.update=(f,d,g,h)=>{const y=this.resolve(f);if(!y||y.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(oc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(oc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,r,o;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((r=n==null?void 0:n.get)==null?void 0:r.call(n,"xml:lang"))??((o=n==null?void 0:n.$attrs)==null?void 0:o["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=ro(n);if(!i)return;const r=this.displayLocale,o=i.target[i.key]??"",a=Fo(n).filter(f=>On(f)),s=f=>f.body??"",c=a.find(f=>On(f)===r&&s(f)),l=xr(n).some(f=>f.locale===r)?"reviewRequested":"ok";if(!o)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===o).map(On);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(r)?{text:o,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:o,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var o;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let r=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((o=this.resolve(a))==null?void 0:o.status)===n&&r++}finally{this.displayLocale=i}return r}withDisplayText(t,n,i){var f;if(!this.config)return n();const r=this.resolve(t),o=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(o)for(const[d,g]of i_)o.toggle(g,(r==null?void 0:r.status)===d);if(!r||r.native)return n();const{target:a,key:s}=ro((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===r.text)return n();a[s]=r.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,r.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:r}=t,o=this.textRenderer.getExternalLabelBounds(t,n);return t.width=o.width,t.height=o.height,{dx:(i-o.width)/2,restore:()=>(t.width=i,t.height=r)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,r]of i_)i.classList.remove(r);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}}}fi(Kd,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const r_={__depends__:[ap],__init__:["i18nDisplay"],i18nDisplay:["type",Kd]};var iD=new ma("ov"),rD=500;function _n(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=iD,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=oD(n.getContainer()),this._init()}_n.$inject=["config.overlays","eventBus","canvas","elementRegistry"],_n.prototype.get=function(e){if(qn(e)&&(e={id:e}),qn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?nt(t.overlays,No({type:e.type})):t.overlays.slice():[]}else return e.type?nt(this._overlays,No({type:e.type})):e.id?this._overlays[e.id]:null},_n.prototype.add=function(e,t,n){if(hn(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=U({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},_n.prototype.remove=function(e){var t=this.get(e)||[];Fe(t)||(t=[t]);var n=this;z(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(zi(i.html),zi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},_n.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},_n.prototype.show=function(){Xl(this._overlayRoot)},_n.prototype.hide=function(){Xl(this._overlayRoot,!1)},_n.prototype.clear=function(){this._overlays={},this._overlayContainers=[],kc(this._overlayRoot)},_n.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=en(t);i=o.x,r=o.y}o_(n,i,r),Ln(e.html,"data-container-id",t.id)},_n.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=en(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=en(i).height:s=i.height,o=t.bottom*-1+s}o_(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},_n.prototype._createOverlayContainer=function(e){var t=Dt('<div class="djs-overlays" />');$n(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},_n.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";a_(this._overlayRoot,n)},_n.prototype._getOverlayContainer=function(e,t){var n=Pt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},_n.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),qn(i)&&(i=Dt(i)),o=this._getOverlayContainer(n),r=Dt('<div class="djs-overlay" data-overlay-id="'+t+'">'),$n(r,{position:"absolute"}),r.appendChild(i),e.type&&$t(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Xl(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},_n.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(cn(r)&&r>t.scale||cn(o)&&o<t.scale))&&(c=!1),Xl(a,c),this._updateOverlayScale(e,t)},_n.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),cn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),cn(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),cn(a)&&(s="scale("+a+","+a+")"),a_(o,s)},_n.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},_n.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});z(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){zi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",rD,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(z(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&$t(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function oD(e){var t=Dt('<div class="djs-overlay-container" />');return $n(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function o_(e,t,n){$n(e,{left:t+"px",top:n+"px"})}function Xl(e,t){e.style.display=t===!1?"none":""}function a_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Zl={__init__:["overlays"],overlays:["type",_n]};function Xd(e,t){t.invoke(le,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)})}Ee(Xd,le),Xd.$inject=["canvas","injector"];const aD={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Xd]};function Ps(e){return CSS.escape(e)}var sD={"&":"&","<":"<",">":">",'"':""","'":"'"};function s_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return sD[t]})}var cD="bjs-breadcrumbs-shown";function c_(e,t,n){var i=Dt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=$t(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ue(l),p=Pt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=lD(c));var l=a.flatMap(function(p){var f=n.findRoot(qi(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(y){var C=ue(y);return C&&C.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=s_(p.name||p.id),h=Dt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;o.toggle(cD,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}c_.$inject=["eventBus","elementRegistry","canvas"];function lD(e){for(var t=ue(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function l_(e,t){var n=null,i=new uD;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!M(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}l_.$inject=["eventBus","canvas"];function uD(){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 u_={x:180,y:160};function wo(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}wo.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)})}},wo.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;M(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),fD(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},wo.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=pD(e),i={x:n.x-u_.x,y:n.y-u_.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},wo.prototype._moveToDiPlane=function(e,t){var n=p_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},wo.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},wo.$inject=["eventBus","moddle"];function p_(e){return M(e,"bpmndi:BPMNDiagram")?e:p_(e.$parent)}function pD(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=Le(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),jc(t)}function fD(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||tt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Ql=250,dD='<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>',hD="bjs-drilldown-empty";function Gr(e,t,n,i,r){le.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Ql,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Ql,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Ql,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Ql,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ee(Gr,le),Gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Gr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(qi(e))},Gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ue(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;$t(i.html).toggle(hD,!r)}},Gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ue(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Dt('<button type="button" class="bjs-drilldown">'+dD+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(qi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const mD={__depends__:[Zl,Rd,aD],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",c_],drilldownCentering:["type",l_],drilldownOverlayBehavior:["type",Gr],subprocessCompatibility:["type",wo]};function Vr(e){Ht.call(this,e)}Ee(Vr,Ht),Vr.prototype._modules=[Uy,mD,Zl,xi,is],Vr.prototype._moddleExtensions={};var Jl="keyboard.keydown",gD="keyboard.keyup",yD=1e3,f_="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 Fn(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(f_));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Fn.$inject=["config.keyboard","eventBus"],Fn.prototype._keydownHandler=function(e){this._keyHandler(e,Jl)},Fn.prototype._keyupHandler=function(e){this._keyHandler(e,gD)},Fn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Jl,i),n&&e.preventDefault()}},Fn.prototype._isEventIgnored=function(e){return!1},Fn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(f_)),this.unbind(),e=this._node=this._target,Ge.bind(e,"keydown",this._keydownHandler),Ge.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Fn.prototype.getBinding=function(){return this._node},Fn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ge.unbind(e,"keydown",this._keydownHandler),Ge.unbind(e,"keyup",this._keyupHandler)),this._node=null},Fn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Fn.prototype.addListener=function(e,t,n){mn(e)&&(n=t,t=e,e=yD),this._eventBus.on(n||Jl,e,t)},Fn.prototype.removeListener=function(e,t){this._eventBus.off(t||Jl,e)},Fn.prototype.hasModifier=Ak,Fn.prototype.isCmd=Jn,Fn.prototype.isShift=hd,Fn.prototype.isKey=pn;var vD=500;function xa(e,t){var n=this;e.on("editorActions.init",vD,function(i){var r=i.editorActions;n.registerBindings(t,r)})}xa.$inject=["eventBus","keyboard"],xa.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(Dk(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(Lk(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(Pk(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(Tk(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(kk(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(Ok(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(pn(["+","Add","="],r)&&Jn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(pn(["-","Subtract"],r)&&Jn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(pn("0",r)&&Jn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(pn(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Zd={__init__:["keyboard","keyboardBindings"],keyboard:["type",Fn],keyboardBindings:["type",xa]};var bD={moveSpeed:50,moveSpeedAccelerated:200};function d_(e,t,n){var i=this;this._config=U({},bD,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}d_.$inject=["config.keyboardMove","keyboard","canvas"];const h_={__depends__:[Zd],__init__:["keyboardMove"],keyboardMove:["type",d_]};var xD=15;function m_(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,l=n.button,u=go(s),p=ki(u,c);if(!n.dragging&&_D(p)>xD&&(n.dragging=!0,l===0&&Ob(e),Sl("grab")),n.dragging){var f=n.last||n.start;p=ki(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function o(s){Ge.unbind(document,"mousemove",r),Ge.unbind(document,"mouseup",o),n=null,kb()}function a(s){if(!lo(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:go(s)},Ge.bind(document,"mousemove",r),Ge.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}m_.$inject=["eventBus","canvas"];function _D(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const g_={__init__:["moveCanvas"],moveCanvas:["type",m_]};function y_(e,t){var n=pf(e.min),i=pf(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function wD(e,t){return Math.max(e.min,Math.min(e.max,t))}var ED=Math.sign||function(e){return e>=0?1:-1},Qd={min:.2,max:4},v_=10,SD=.1,RD=.75;function Xi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Gn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||RD;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Xi.$inject=["config.zoomScroll","eventBus","canvas"],Xi.prototype.scroll=function(t){this._canvas.scroll(t)},Xi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Xi.prototype.zoom=function(t,n){var i=y_(Qd,v_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>SD&&(this._zoom(t,n,i),this._totalDelta=0)},Xi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Fv()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*ED(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},Xi.prototype.stepZoom=function(t,n){var i=y_(Qd,v_);this._zoom(t,n,i)},Xi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=pf(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(wD(Qd,s),t)},Xi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ge[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Xi.prototype._init=function(e){this.toggle(e)};const b_={__init__:["zoomScroll"],zoomScroll:["type",Xi]};function Ts(e){Vr.call(this,e)}Ee(Ts,Vr),Ts.prototype._navigationModules=[h_,g_,b_],Ts.prototype._modules=[].concat(Vr.prototype._modules,Ts.prototype._navigationModules);function Jd(e){return e&&e[e.length-1]}function x_(e){return e.y}function __(e){return e.x}var CD={left:__,center:__,right:function(e){return e.x+e.width},top:x_,middle:x_,bottom:function(e){return e.y+e.height}};function _a(e,t){this._modeling=e,this._rules=t}_a.$inject=["modeling","rules"],_a.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}},_a.prototype._isType=function(e,t){return t.indexOf(e)!==-1},_a.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Jd(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(z(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Bi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Jd(c).center,o;l=t[0],t=Bi(t,function(f){return f[i]+f[r]}),u=Jd(t),o[e]=p(l,u)}return o},_a.prototype.trigger=function(e,t){var n=this._modeling,i,r=nt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Fe(i)&&(r=i),!(r.length<2||!i)){var o=CD[t],a=Bi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const MD={__init__:["alignElements"],alignElements:["type",_a]},AD=new ma;function wa(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}wa.$inject=["eventBus"],wa.prototype.schedule=function(e,t=AD.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},wa.prototype._schedule=function(e,t){const n=PD();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},wa.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},wa.prototype._cancel=function(e){clearTimeout(e.executionId)};function PD(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const TD={scheduler:["type",wa]};var kD="djs-element-hidden",eu=".entry",OD=1e3,w_=8,DD=300;function nn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}nn.$inject=["canvas","elementRegistry","eventBus","scheduler"],nn.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=Fe(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=Fe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},nn.prototype._createContainer=function(){var e=Dt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},nn.prototype.registerProvider=function(e,t){t||(t=e,e=OD),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},nn.prototype.getEntries=function(e){var t=this._getProviders(),n=Fe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(r){if(mn(r[n])){var o=r[n](e);mn(o)?i=o(i):z(o,function(a,s){i[s]=a})}}),i},nn.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Ln(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},DD);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},nn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(mn(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},nn.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))}},nn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},nn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(r,o){var a=r.group||"default",s=Dt(r.html||'<div class="entry" draggable="true"></div>'),c;Ln(s,"data-action",o),c=wt("[data-group="+Ps(a)+"]",n),c||(c=Dt('<div class="group"></div>'),Ln(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&LD(s,r.className),r.title&&Ln(s,"title",r.title),r.imageUrl&&(i=Dt("<img>"),Ln(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),$t(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},nn.prototype._createHtml=function(e){var t=this,n=Dt('<div class="djs-context-pad"></div>');return Xn.bind(n,eu,"click",function(i){t.trigger("click",i)}),Xn.bind(n,eu,"dragstart",function(i){t.trigger("dragstart",i)}),Xn.bind(n,eu,"mouseover",function(i){t.trigger("mouseover",i)}),Xn.bind(n,eu,"mouseout",function(i){t.trigger("mouseout",i)}),Ge.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},nn.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()&&BD(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},nn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},nn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Fe(e)!==Fe(n)?!1:Fe(e)?e.length===n.length&&io(e,function(i){return n.includes(i)}):n===e},nn.prototype.isShown=function(){return this.isOpen()&&$t(this._current.html).has("open")},nn.prototype.show=function(){this.isOpen()&&($t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},nn.prototype.hide=function(){this.isOpen()&&($t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},nn.prototype._getPosition=function(e){if(!Fe(e)&&Et(e)){var t=this._canvas.viewbox(),n=ID(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+w_*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+w_*this._canvas.zoom(),top:s.top-a.top}},nn.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")},nn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Fe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,kD)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},nn.prototype._getTargetBounds=function(e){var t=this,n=Fe(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function LD(e,t){var n=$t(e);t=Fe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function ID(e){return e.waypoints[e.waypoints.length-1]}function BD(e,t){return e=Fe(e)?e:[e],t=Fe(t)?t:[t],e.length===t.length&&io(e,function(n){return t.includes(n)})}const E_={__depends__:[El,TD,Zl],contextPad:["type",nn]};var tu,Gt,S_,Wr,R_,C_,M_,eh,nu,ks,A_,th,nh,ih,iu={},ru=[],ND=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ou=Array.isArray;function dr(e,t){for(var n in t)e[n]=t[n];return e}function rh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function P_(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?tu.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return au(e,a,i,r,null)}function au(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++S_,__i:-1,__u:0};return r==null&&Gt.vnode!=null&&Gt.vnode(o),o}function su(e){return e.children}function cu(e,t){this.props=e,this.context=t}function Eo(e,t){if(t==null)return e.__?Eo(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"?Eo(e):null}function $D(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=dr({},t);o.__v=t.__v+1,Gt.vnode&&Gt.vnode(o),oh(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Eo(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,N_(i,o,r),t.__e=t.__=null,o.__e!=n&&T_(o)}}function T_(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}),T_(e)}function k_(e){(!e.__d&&(e.__d=!0)&&Wr.push(e)&&!lu.__r++||R_!=Gt.debounceRendering)&&((R_=Gt.debounceRendering)||C_)(lu)}function lu(){try{for(var e,t=1;Wr.length;)Wr.length>t&&Wr.sort(M_),e=Wr.shift(),t=Wr.length,$D(e)}finally{Wr.length=lu.__r=0}}function O_(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,g,h,y,C=i&&i.__k||ru,x=t.length;for(c=FD(n,t,C,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&C[d.__i]||iu,d.__i=p,y=oh(e,d,f,r,o,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&ah(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=D_(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function FD(e,t,n,i,r){var o,a,s,c,l,u=n.length,p=u,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=au(null,a,null,null,null):ou(a)?a=e.__k[o]=au(su,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=au(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=jD(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?f--:r<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Eo(s)),F_(s,s));return i}function D_(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=D_(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Eo(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function jD(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function L_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ND.test(t)?n:n+"px"}function uu(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||L_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||L_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(A_,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[ks]=i[ks]:(n[ks]=th,e.addEventListener(t,o?ih:nh,o)):e.removeEventListener(t,o?ih:nh,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function I_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[nu]==null)t[nu]=th++;else if(t[nu]<n[ks])return;return n(Gt.event?Gt.event(t):t)}}}function oh(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,g,h,y,C,x,m,v,_,E,T,O,N,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Gt.__b)&&u(t);e:if(typeof P=="function"){p=a.length;try{if(x=t.props,m=P.prototype&&P.prototype.render,v=(u=P.contextType)&&i[u.__c],_=u?v?v.props.value:u.__:i,n.__c?C=(f=t.__c=n.__c).__=f.__E:(m?t.__c=f=new P(x,_):(t.__c=f=new cu(x,_),f.constructor=P,f.render=zD),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),m&&f.__s==null&&(f.__s=f.state),m&&P.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=dr({},f.__s)),dr(f.__s,P.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=t,d)m&&P.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),m&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(m&&P.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,_),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,_)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),ru.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Eo(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,_),m&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,y)})}if(f.context=_,f.props=x,f.__P=e,f.__e=!1,E=Gt.__r,T=0,m)f.state=f.__s,f.__d=!1,E&&E(t),u=f.render(f.props,f.state,f.context),ru.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,E&&E(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++T<25);f.state=f.__s,f.getChildContext!=null&&(i=dr(dr({},i),f.getChildContext())),m&&!d&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(g,h)),O=u!=null&&u.type===su&&u.key==null?$_(u.props.children):u,s=O_(e,ou(O)?O:[O],t,n,i,r,o,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),C&&(f.__E=f.__=null)}catch(D){if(a.length=p,t.__v=null,c||o!=null){if(D.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(N=o.length;N--;)rh(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||B_(t),Gt.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=HD(n.__e,t,n,i,r,o,a,c,l);return(u=Gt.diffed)&&u(t),128&t.__u?void 0:s}function B_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(B_))}function N_(e,t,n){for(var i=0;i<n.length;i++)ah(n[i],n[++i],n[++i]);Gt.__c&&Gt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Gt.__e(o,r.__v)}})}function $_(e){return typeof e!="object"||e==null||e.__b>0?e:ou(e)?e.map($_):e.constructor!==void 0?null:dr({},e)}function HD(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,g,h,y=n.props||iu,C=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(C);e=document.createElementNS(r,x,C.is&&C),s&&(Gt.__m&&Gt.__m(t,o),s=!1),o=null}if(x==null)y===C||s&&e.data==C||(e.data=C);else{if(o=x=="textarea"&&C.defaultValue!=null?null:o&&tu.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in C||l=="value"&&"defaultValue"in C||l=="checked"&&"defaultChecked"in C||uu(e,l,null,d,r);for(l in C)d=C[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||uu(e,l,d,y[l],r);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),O_(t.type=="template"?e.content:e,ou(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Eo(n,0),s,c),o!=null)for(l=o.length;l--;)rh(o[l]);s&&x!="textarea"||(l="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||x=="progress"&&!g||x=="option"&&g!=y[l])&&uu(e,l,g,y[l],r),l="checked",h!=null&&h!=e[l]&&uu(e,l,h,y[l],r))}return e}function ah(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Gt.__e(r,n)}}function F_(e,t,n){var i,r;if(Gt.unmount&&Gt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ah(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Gt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&F_(i[r],t,n||typeof e.type!="function");n||rh(e.__e),e.__c=e.__=e.__e=void 0}function zD(e,t,n){return this.constructor(e,n)}function j_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Gt.__&&Gt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],oh(t,e=t.__k=P_(su,null,[e]),r||iu,iu,t.namespaceURI,r?null:t.firstChild?tu.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),N_(o,e,a),e.props.children=null}tu=ru.slice,Gt={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},S_=0,cu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dr({},this.state),typeof e=="function"&&(e=e(dr({},n),this.props)),e&&dr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),k_(this))},cu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),k_(this))},cu.prototype.render=su,Wr=[],C_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,M_=function(e,t){return e.__v.__b-t.__v.__b},lu.__r=0,eh=Math.random().toString(8),nu="__d"+eh,ks="__a"+eh,A_=/(PointerCapture)$|Capture$/i,th=0,nh=I_(!1),ih=I_(!0);var H_=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,H_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},z_=new Map;function GD(e){var t=z_.get(this);return t||(t=new Map,z_.set(this,t)),(t=H_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][p+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Ft.prototype._setDefinitions=function(e){this._definitions=e},Ft.prototype.getModules=function(){return this._modules},Ft.prototype.clear=function(){this.getDefinitions()&&Tr.prototype.clear.call(this)},Ft.prototype.destroy=function(){Tr.prototype.destroy.call(this),ji(this._container)},Ft.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ft.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ft.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=Et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ft.prototype.getDefinitions=function(){return this._definitions},Ft.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ft.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=U(Ii(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:a});Tr.call(this,s),n&&n.container&&this.attachTo(n.container)},Ft.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ft.prototype._createContainer=function(e){const t=Lt('<div class="bjs-container"></div>');return $n(t,{width:zy(e.width),height:zy(e.height),position:e.position}),t},Ft.prototype._createModdle=function(e){const t=U({},this._moddleExtensions,e.moddleExtensions);return new Mm(t)},Ft.prototype._modules=[];function Xc(e,t){return e.warnings=t,e}function bA(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 xA={width:"100%",height:"100%",position:"relative"};function zy(e){return e+(ze(e)?"px":"")}function _A(e,t){return t&&Tt(e.diagrams,function(n){return n.id===t})||null}function wA(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+$y+"</a>",i=Lt(n);$n(Et("svg",i),Fy),$n(i,jy,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ge.bind(i,"click",function(r){vA(),r.preventDefault()})}function ia(e){Ft.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)}Ee(ia,Ft),ia.prototype._createModdle=function(e){var t=Ft.prototype._createModdle.call(this,e);return t.ids=new Fi([32,36,1]),t},ia.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function st(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||lt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!ue(e).processRef:!0}function gn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=lt(e).isHorizontal;return t===void 0?!0:t}}function EA(e){return e&&ue(e).isInterrupting!==!1}function In(e){return e&&!!ue(e).triggeredByEvent}function ra(e,t){var n=ue(e).eventDefinitions;return br(n,function(i){return M(i,t)})}function SA(e){return ra(e,"bpmn:ErrorEventDefinition")}function RA(e){return ra(e,"bpmn:EscalationEventDefinition")}function CA(e){return ra(e,"bpmn:CompensateEventDefinition")}var ho={width:90,height:20},Gy=15;function kr(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function Zc(e){return et(e.label)}function MA(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=AA(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Gy:a+=Gy,{x:a,y:s}}function AA(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 df(e){return e.waypoints?MA(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+ho.height/2}:{x:e.x+e.width/2,y:e.y+e.height+ho.height/2}}function PA(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(ho.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=df(t),i=ho),U({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Vy(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function TA(e){var t=e.categoryValueRef;return t&&t.value||""}function pi(e){var t=e.businessObject,n=Vy(t);if(n)return n==="categoryValueRef"?TA(t):t[n]||""}function kA(e,t){var n=e.businessObject,i=Vy(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function OA(e){return et(e)&&kr(e.labelTarget)}var oa=7;function Wy(e){let t=[];return z(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function rs(e){const t=new Map;return z(af(e),n=>{z(Wy(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 hf="hsl(225, 10%, 15%)",DA="white";function Vi(e,t){return br(e.eventDefinitions,function(n){return n.$type===t})}function LA(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function IA(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function rt(e,t,n){var i=lt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||DA}function _e(e,t,n){var i=lt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||hf}function os(e,t,n,i){var r=lt(e),o=r.get("label");return i||o&&o.get("color:color")||t||_e(e,n)}function Uy(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return uo(r)}function mf(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return uo(a)}function BA(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return uo(s)}function NA(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return uo(o)}function as(e,t={}){return{width:gi(e,t),height:Zn(e,t)}}function gi(e,t={}){return qn(t,"width")?t.width:e.width}function Zn(e,t={}){return qn(t,"height")?t.height:e.height}var $A=new Fi,FA=10,Qc=3,jA=1.5,Jc=10,HA=4,aa=.95,zA=1,GA=.25;function mo(e,t,n,i,r,o,a){nr.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u($){return n.computeStyle($,{strokeLinecap:"round",strokeLinejoin:"round",stroke:hf,strokeWidth:2,fill:"white"})}function p($){return n.computeStyle($,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:hf,strokeWidth:2})}function f($,R){var{ref:w={x:0,y:0},scale:G=1,element:W,parentGfx:te=r._svg}=R,Re=Oe("marker",{id:$,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});We(Re,W);var Je=Et(":scope > defs",te);Je||(Je=Oe("defs"),We(te,Je)),We(Je,Re)}function d($,R,w,G){var W=$A.nextPrefixed("marker-");return g($,W,R,w,G),"url(#"+W+")"}function g($,R,w,G,W){if(w==="sequenceflow-end"){var te=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:W,stroke:W,strokeWidth:1})});f(R,{element:te,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(w==="messageflow-start"){var Re=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Re,ref:{x:6,y:6},parentGfx:$})}if(w==="messageflow-end"){var Je=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Je,ref:{x:8.5,y:5},parentGfx:$})}if(w==="association-start"){var ht=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:ht,ref:{x:1,y:10},scale:.5,parentGfx:$})}if(w==="association-end"){var Gt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:Gt,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(w==="conditional-flow-marker"){var _t=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:W})});f(R,{element:_t,ref:{x:-1,y:10},scale:.5,parentGfx:$})}if(w==="conditional-default-flow-marker"){var pn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:W,fill:"none"})});f(R,{element:pn,ref:{x:0,y:10},scale:.5,parentGfx:$})}}function h($,R,w,G,W={}){fn(G)&&(W=G,G=0),G=G||0,W=u(W);var te=R/2,Re=w/2,Je=Oe("circle",{cx:te,cy:Re,r:Math.round((R+w)/4-G),...W});return We($,Je),Je}function y($,R,w,G,W,te){fn(W)&&(te=W,W=0),W=W||0,te=u(te);var Re=Oe("rect",{x:W,y:W,width:R-W*2,height:w-W*2,rx:G,ry:G,...te});return We($,Re),Re}function C($,R,w,G){var W=R/2,te=w/2,Re=[{x:W,y:0},{x:R,y:te},{x:W,y:w},{x:0,y:te}],Je=Re.map(function(Gt){return Gt.x+","+Gt.y}).join(" ");G=u(G);var ht=Oe("polygon",{...G,points:Je});return We($,ht),ht}function x($,R,w,G){w=p(w);var W=Za(R,w,G);return We($,W),W}function m($,R,w){return x($,R,w,5)}function v($,R,w){w=p(w);var G=Oe("path",{...w,d:R});return We($,G),G}function _($,R,w,G){return v(R,w,U({"data-marker":$},G))}function S($){return Te[$]}function k($){return function(R,w,G){return S($)(R,w,G)}}var O={"bpmn:MessageEventDefinition":function($,R,w={},G){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.235,my:.315}}),te=G?_e(R,c,w.stroke):rt(R,s,w.fill),Re=G?rt(R,s,w.fill):_e(R,c,w.stroke),Je=v($,W,{fill:te,stroke:Re,strokeWidth:1});return Je},"bpmn:TimerEventDefinition":function($,R,w={}){var G=w.width||R.width,W=w.height||R.height,te=w.width?1:2,Re=h($,G,W,.2*W,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:te}),Je=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:W,position:{mx:.5,my:.5}});v($,Je,{stroke:_e(R,c,w.stroke),strokeWidth:te});for(var ht=0;ht<12;ht++){var Gt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:W,position:{mx:.5,my:.5}}),_t=G/2,pn=W/2;v($,Gt,{strokeWidth:1,stroke:_e(R,c,w.stroke),transform:"rotate("+ht*30+","+pn+","+_t+")"})}return Re},"bpmn:EscalationEventDefinition":function($,R,w={},G){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.5,my:.2}}),te=G?_e(R,c,w.stroke):rt(R,s,w.fill);return v($,W,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function($,R,w={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.5,my:.222}});return v($,G,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function($,R,w={},G){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.57,my:.263}}),te=G?_e(R,c,w.stroke):rt(R,s,w.fill);return v($,W,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function($,R,w={},G){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.2,my:.722}}),te=G?_e(R,c,w.stroke):rt(R,s,w.fill);return v($,W,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function($,R,w={},G){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.638,my:-.055}}),te=G?_e(R,c,w.stroke):"none",Re=v($,W,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1});return By(Re,45),Re},"bpmn:CompensateEventDefinition":function($,R,w={},G){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.22,my:.5}}),te=G?_e(R,c,w.stroke):rt(R,s,w.fill);return v($,W,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function($,R,w={},G){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.5,my:.2}}),te=G?_e(R,c,w.stroke):rt(R,s,w.fill);return v($,W,{strokeWidth:1,fill:te,stroke:_e(R,c,w.stroke)})},"bpmn:MultipleEventDefinition":function($,R,w={},G){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.211,my:.36}}),te=G?_e(R,c,w.stroke):rt(R,s,w.fill);return v($,W,{fill:te,stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function($,R,w={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||R.width,containerHeight:w.height||R.height,position:{mx:.458,my:.194}});return v($,G,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function($,R,w={}){var G=h($,R.width,R.height,8,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:4});return G}};function N($,R,w={},G){var W=ue($),te=LA(W),Re=G||$;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?O["bpmn:ParallelMultipleEventDefinition"](R,Re,w,te):O["bpmn:MultipleEventDefinition"](R,Re,w,te):Vi(W,"bpmn:MessageEventDefinition")?O["bpmn:MessageEventDefinition"](R,Re,w,te):Vi(W,"bpmn:TimerEventDefinition")?O["bpmn:TimerEventDefinition"](R,Re,w,te):Vi(W,"bpmn:ConditionalEventDefinition")?O["bpmn:ConditionalEventDefinition"](R,Re,w,te):Vi(W,"bpmn:SignalEventDefinition")?O["bpmn:SignalEventDefinition"](R,Re,w,te):Vi(W,"bpmn:EscalationEventDefinition")?O["bpmn:EscalationEventDefinition"](R,Re,w,te):Vi(W,"bpmn:LinkEventDefinition")?O["bpmn:LinkEventDefinition"](R,Re,w,te):Vi(W,"bpmn:ErrorEventDefinition")?O["bpmn:ErrorEventDefinition"](R,Re,w,te):Vi(W,"bpmn:CancelEventDefinition")?O["bpmn:CancelEventDefinition"](R,Re,w,te):Vi(W,"bpmn:CompensateEventDefinition")?O["bpmn:CompensateEventDefinition"](R,Re,w,te):Vi(W,"bpmn:TerminateEventDefinition")?O["bpmn:TerminateEventDefinition"](R,Re,w,te):null}var P={ParticipantMultiplicityMarker:function($,R,w={}){var G=gi(R,w),W=Zn(R,w),te=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:(G/2-6)/G,my:(W-15)/W}});_("participant-multiplicity",$,te,{strokeWidth:2,fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke)})},SubProcessMarker:function($,R,w={}){var G=y($,14,14,0,{strokeWidth:1,fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke)});Cn(G,R.width/2-7.5,R.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2-7.5)/R.width,my:(R.height-20)/R.height}});_("sub-process",$,W,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke)})},ParallelMarker:function($,R,w){var G=gi(R,w),W=Zn(R,w),te=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:(G/2+w.parallel)/G,my:(W-20)/W}});_("parallel",$,te,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke)})},SequentialMarker:function($,R,w){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+w.seq)/R.width,my:(R.height-19)/R.height}});_("sequential",$,G,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke)})},CompensationMarker:function($,R,w){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+w.compensation)/R.width,my:(R.height-13)/R.height}});_("compensation",$,G,{strokeWidth:1,fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke)})},LoopMarker:function($,R,w){var G=gi(R,w),W=Zn(R,w),te=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:(G/2+w.loop)/G,my:(W-7)/W}});_("loop",$,te,{strokeWidth:1.5,fill:"none",stroke:_e(R,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function($,R,w){var G=gi(R,w),W=Zn(R,w),te=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:(G/2+w.adhoc)/G,my:(W-15)/W}});_("adhoc",$,te,{strokeWidth:1,fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke)})}};function D($,R,w,G){P[$](R,w,G)}function j($,R,w=[],G={}){G={fill:G.fill,stroke:G.stroke,width:gi(R,G),height:Zn(R,G)};var W=ue(R),te=w.includes("SubProcessMarker");te?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},W.get("isForCompensation")&&w.push("CompensationMarker"),M(W,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),te||U(G,{compensation:G.compensation-18}));var Re=W.get("loopCharacteristics"),Je=Re&&Re.get("isSequential");Re&&(U(G,{compensation:G.compensation-18}),w.includes("AdhocMarker")&&U(G,{seq:-23,loop:-18,parallel:-24}),Je===void 0&&w.push("LoopMarker"),Je===!1&&w.push("ParallelMarker"),Je===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&U(G,{compensation:-8}),z(w,function(ht){D(ht,$,R,G)})}function ee($,R,w={}){w=U({size:{width:100}},w);var G=o.createText(R||"",w);return ct(G).add("djs-label"),We($,G),G}function ge($,R,w,G={}){var W=ue(R),te=as({x:R.x,y:R.y,width:R.width,height:R.height},G);return ee($,W.name,{align:w,box:te,padding:7,style:{fill:os(R,l,c,G.stroke)}})}function Pe($,R,w={}){var G={width:R.width,height:R.height,x:R.width/2+R.x,y:R.height/2+R.y};return ee($,pi(R),{box:G,style:U({},o.getExternalStyle(),{fill:os(R,l,c,w.stroke)})})}function De($,R,w,G={}){var W=gn(w),te=ee($,R,{box:{height:30,width:W?Zn(w,G):gi(w,G)},align:"center-middle",style:{fill:os(w,l,c,G.stroke)}});if(W){var Re=-1*Zn(w,G);Yc(te,0,-Re,270)}}function Ye($,R,w={}){var{width:G,height:W}=as(R,w);return y($,G,W,Jc,{...w,fill:rt(R,s,w.fill),fillOpacity:aa,stroke:_e(R,c,w.stroke)})}function ot($,R,w={}){var G=ue(R),W=rt(R,s,w.fill),te=_e(R,c,w.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(w.markerEnd=d($,"association-end",W,te)),G.get("associationDirection")==="Both"&&(w.markerStart=d($,"association-start",W,te)),w=pt(w,["markerStart","markerEnd"]),m($,R.waypoints,{...w,stroke:te,strokeDasharray:"0, 5"})}function Me($,R,w={}){var G=rt(R,s,w.fill),W=_e(R,c,w.stroke),te=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}}),Re=v($,te,{fill:G,fillOpacity:aa,stroke:W}),Je=ue(R);if(IA(Je)){var ht=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.33,my:(R.height-18)/R.height}});v($,ht,{strokeWidth:2,fill:G,stroke:W})}return Re}function X($,R,w={}){return h($,R.width,R.height,{fillOpacity:aa,...w,fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke)})}function ne($,R,w={}){return C($,R.width,R.height,{fill:rt(R,s,w.fill),fillOpacity:aa,stroke:_e(R,c,w.stroke)})}function q($,R,w={}){var G=y($,gi(R,w),Zn(R,w),0,{fill:rt(R,s,w.fill),fillOpacity:w.fillOpacity||aa,stroke:_e(R,c,w.stroke),strokeWidth:1.5}),W=ue(R);if(M(W,"bpmn:Lane")){var te=W.get("name");De($,te,R,w)}return G}function K($,R,w={}){var G=Ye($,R,w),W=st(R);if(In(R)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var te=ue(R).flowElements||[],Re=te.filter(Je=>M(Je,"bpmn:StartEvent"));Re.length===1&&ae(Re[0],$,w,R)}return ge($,R,W?"center-top":"center-middle",w),W?j($,R,void 0,w):j($,R,["SubProcessMarker"],w),G}function ae($,R,w,G){var W=22,te={fill:rt(G,s,w.fill),stroke:_e(G,c,w.stroke),width:W,height:W},Re=ue($).isInterrupting,Je=Re?0:3,ht=Re?1:1.2,Gt=20,_t=(W-Gt)/2,pn="translate("+_t+","+_t+")";h(R,Gt,Gt,{fill:te.fill,stroke:te.stroke,strokeWidth:ht,strokeDasharray:Je,transform:pn}),N($,R,te,G)}function fe($,R,w={}){var G=Ye($,R,w);return ge($,R,"center-middle",w),j($,R,void 0,w),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function($,R,w={}){return st(R)?w=pt(w,["fill","stroke","width","height"]):w=pt(w,["fill","stroke"]),K($,R,w)},"bpmn:Association":function($,R,w={}){return w=pt(w,["fill","stroke"]),ot($,R,w)},"bpmn:BoundaryEvent":function($,R,w={}){var{renderIcon:G=!0}=w;w=pt(w,["fill","stroke"]);var W=ue(R),te=W.get("cancelActivity");w={strokeWidth:1.5,fill:rt(R,s,w.fill),fillOpacity:zA,stroke:_e(R,c,w.stroke)},te||(w.strokeDasharray="6");var Re=X($,R,w);return h($,R.width,R.height,Qc,{...w,fill:"none"}),G&&N(R,$,w),Re},"bpmn:BusinessRuleTask":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=fe($,R,w),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),te=v($,W);Se(te,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Je=v($,Re);return Se(Je,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function($,R,w={}){return w=pt(w,["fill","stroke"]),K($,R,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=ne($,R,w),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.26}});return v($,W,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:DataInput":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),W=Me($,R,w);return v($,G,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function($,R,w={}){return w=pt(w,["fill","stroke"]),ot($,R,{...w,markerEnd:d($,"association-end",rt(R,s,w.fill),_e(R,c,w.stroke))})},"bpmn:DataObject":function($,R,w={}){return w=pt(w,["fill","stroke"]),Me($,R,w)},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),W=Me($,R,w);return v($,G,{strokeWidth:1,fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke)}),W},"bpmn:DataOutputAssociation":function($,R,w={}){return w=pt(w,["fill","stroke"]),ot($,R,{...w,markerEnd:d($,"association-end",rt(R,s,w.fill),_e(R,c,w.stroke))})},"bpmn:DataStoreReference":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:0,my:.133}});return v($,G,{fill:rt(R,s,w.fill),fillOpacity:aa,stroke:_e(R,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function($,R,w={}){var{renderIcon:G=!0}=w;w=pt(w,["fill","stroke"]);var W=X($,R,{...w,strokeWidth:4});return G&&N(R,$,w),W},"bpmn:EventBasedGateway":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=ue(R),W=ne($,R,w);h($,R.width,R.height,R.height*.2,{fill:rt(R,"none",w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1});var te=G.get("eventGatewayType"),Re=!!G.get("instantiate");function Je(){var Gt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:R.width,containerHeight:R.height,position:{mx:.36,my:.44}});v($,Gt,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:2})}if(te==="Parallel"){var ht=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}});v($,ht,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:1})}else te==="Exclusive"&&(Re||h($,R.width,R.height,R.height*.26,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:1}),Je());return W},"bpmn:ExclusiveGateway":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=ne($,R,w),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.32,my:.3}}),te=lt(R);return te.get("isMarkerVisible")&&v($,W,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:Gateway":function($,R,w={}){return w=pt(w,["fill","stroke"]),ne($,R,w)},"bpmn:Group":function($,R,w={}){return w=pt(w,["fill","stroke","width","height"]),y($,R.width,R.height,Jc,{stroke:_e(R,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:gi(R,w),height:Zn(R,w)})},"bpmn:InclusiveGateway":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=ne($,R,w);return h($,R.width,R.height,R.height*.24,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function($,R,w={}){var{renderIcon:G=!0}=w;w=pt(w,["fill","stroke"]);var W=X($,R,{...w,strokeWidth:1.5});return h($,R.width,R.height,Qc,{fill:"none",stroke:_e(R,c,w.stroke),strokeWidth:1.5}),G&&N(R,$,w),W},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function($,R,w={}){return w=pt(w,["fill","stroke","width","height"]),q($,R,{...w,fillOpacity:GA})},"bpmn:ManualTask":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=fe($,R,w),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v($,W,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=ue(R),W=lt(R),te=rt(R,s,w.fill),Re=_e(R,c,w.stroke),Je=m($,R.waypoints,{markerEnd:d($,"messageflow-end",te,Re),markerStart:d($,"messageflow-start",te,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var ht=Je.getPointAtLength(Je.getTotalLength()/2),Gt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ht.x,y:ht.y}}),_t={strokeWidth:1};W.get("messageVisibleKind")==="initiating"?(_t.fill=te,_t.stroke=Re):(_t.fill=Re,_t.stroke=te);var pn=v($,Gt,_t),_n=G.get("messageRef"),jn=_n.get("name"),At=ee($,jn,{align:"center-top",fitBox:!0,style:{fill:Re}}),Yt=pn.getBBox(),yn=At.getBBox(),Da=ht.x-yn.width/2,Hn=ht.y+Yt.height/2+FA;Yc(At,Da,Hn,0)}return Je},"bpmn:ParallelGateway":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=ne($,R,w),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.2}});return v($,W,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:Participant":function($,R,w={}){w=pt(w,["fill","stroke","width","height"]);var G=q($,R,w),W=st(R),te=gn(R),Re=ue(R),Je=Re.get("name");if(W){var ht=te?[{x:30,y:0},{x:30,y:Zn(R,w)}]:[{x:0,y:30},{x:gi(R,w),y:30}];x($,ht,{stroke:_e(R,c,w.stroke),strokeWidth:jA}),De($,Je,R,w)}else{var Gt=as(R,w);te||(Gt.height=gi(R,w),Gt.width=Zn(R,w));var _t=ee($,Je,{box:Gt,align:"center-middle",style:{fill:os(R,l,c,w.stroke)}});if(!te){var pn=-1*Zn(R,w);Yc(_t,0,-pn,270)}}return Re.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",$,R,w),G},"bpmn:ReceiveTask":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=ue(R),W=fe($,R,w),te;return G.get("instantiate")?(h($,28,28,20*.22,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),te=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):te=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v($,te,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=fe($,R,w),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v($,W,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:SendTask":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=fe($,R,w),W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v($,W,{fill:_e(R,c,w.stroke),stroke:rt(R,s,w.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=rt(R,s,w.fill),W=_e(R,c,w.stroke),te=m($,R.waypoints,{markerEnd:d($,"sequenceflow-end",G,W),stroke:W}),Re=ue(R),{source:Je}=R;if(Je){var ht=ue(Je);Re.get("conditionExpression")&&M(ht,"bpmn:Activity")&&Se(te,{markerStart:d($,"conditional-flow-marker",G,W)}),ht.get("default")&&(M(ht,"bpmn:Gateway")||M(ht,"bpmn:Activity"))&&ht.get("default")===Re&&Se(te,{markerStart:d($,"conditional-default-flow-marker",G,W)})}return te},"bpmn:ServiceTask":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=fe($,R,w);h($,10,10,{fill:rt(R,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v($,W,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),h($,10,10,{fill:rt(R,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var te=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v($,te,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function($,R,w={}){var{renderIcon:G=!0}=w;w=pt(w,["fill","stroke"]);var W=ue(R);W.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var te=X($,R,w);return G&&N(R,$,w),te},"bpmn:SubProcess":function($,R,w={}){return st(R)?w=pt(w,["fill","stroke","width","height"]):w=pt(w,["fill","stroke"]),K($,R,w)},"bpmn:Task":function($,R,w={}){return w=pt(w,["fill","stroke"]),fe($,R,w)},"bpmn:TextAnnotation":function($,R,w={}){w=pt(w,["fill","stroke"]);var{width:G,height:W}=as(R,w),te=y($,G,W,0,0,{fill:"none",stroke:"none"}),Re=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:0,my:0}});v($,Re,{stroke:_e(R,c,w.stroke)});var Je=ue(R),ht=Je.get("text")||"";return ee($,ht,{align:"left-top",box:as(R,w),padding:oa,style:{fill:os(R,l,c,w.stroke)}}),te},"bpmn:Transaction":function($,R,w={}){st(R)?w=pt(w,["fill","stroke","width","height"]):w=pt(w,["fill","stroke"]);var G=K($,R,{strokeWidth:1.5,...w}),W=n.style(["no-fill","no-events"],{stroke:_e(R,c,w.stroke),strokeWidth:1.5}),te=st(R);return te||(w={}),y($,gi(R,w),Zn(R,w),Jc-Qc,Qc,W),G},"bpmn:UserTask":function($,R,w={}){w=pt(w,["fill","stroke"]);var G=fe($,R,w),W=15,te=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:te}});v($,Re,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:.5});var Je=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:te}});v($,Je,{fill:rt(R,s,w.fill),stroke:_e(R,c,w.stroke),strokeWidth:.5});var ht=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:te}});return v($,ht,{fill:_e(R,c,w.stroke),stroke:_e(R,c,w.stroke),strokeWidth:.5}),G},label:function($,R,w={}){return Pe($,R,w)}};this._drawPath=v,this._renderer=S}Ee(mo,nr),mo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],mo.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},mo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},mo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},mo.prototype.getShapePath=function(e){return et(e)?mf(e,HA):M(e,"bpmn:Event")?Uy(e):M(e,"bpmn:Activity")?mf(e,Jc):M(e,"bpmn:Gateway")?BA(e):NA(e)};function pt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var VA=0,WA={width:150,height:50};function UA(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function qA(e){return fn(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var gf=null;function YA(){return gf||(gf=document.createElement("canvas").getContext("2d")),gf}function KA(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(qy(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function qy(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function XA(e,t){var n=YA();if(!n)return{width:0,height:0};n.font=KA(t),"letterSpacing"in n&&(n.letterSpacing=qy(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function ZA(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=XA(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return QA(e,r,i,o);r=eP(r,o.width,t)}}function QA(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var Yy="";function JA(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===Yy)&&r.pop();break}var a=r[r.length-1];return a&&a===Yy&&(r[r.length-1]="-"),r.join("")}function eP(e,t,n){var i=Math.max(e.length*(n/t),1),r=JA(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function el(e){this._config=U({},{size:WA,padding:VA,style:{},align:"center-top"},e||{})}el.prototype.createText=function(e,t){return this.layoutText(e,t).element},el.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},el.prototype.layoutText=function(e,t){for(var n=U({},this._config.size,t.box),i=U({},this._config.style,t.style),r=UA(t.align||this._config.align),o=qA(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=tP(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(ZA(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Yn(l,function(y,C,x){return y+(s||C.height)},0)+o.top+o.bottom,f=Yn(l,function(y,C,x){return C.width>y?C.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");Se(g,i),z(l,function(y){var C;switch(d+=s||y.height,r.horizontal){case"left":C=o.left;break;case"right":C=(a?f:u)-o.right-y.width;break;default:C=Math.max(((a?f:u)-y.width)/2+o.left,0)}var x=Oe("tspan");Se(x,{x:C,y:d}),x.textContent=y.text,We(g,x)});var h={width:f,height:p};return{dimensions:h,element:g}};function tP(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var nP=12,iP=1.2,rP=40;function Ky(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:nP,fontWeight:"normal",lineHeight:iP},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=U({},t,{fontSize:n},e&&e.externalStyle||{}),r=new el({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,ho.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:oa});return{x:a.x,y:a.y,width:a.width,height:Math.max(rP,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,U({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Ky.$inject=["config.textRenderer"];function oP(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=lP(i.d,{mx:r,my:o,e:a});return p}}var aP=/\{([^{}]+)\}/g,sP=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function cP(e,t,n){var i=n;return t.replace(sP,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function lP(e,t){return String(e).replace(aP,function(n,i){return cP(n,i,t)})}const uP={__init__:["bpmnRenderer"],bpmnRenderer:["type",mo],textRenderer:["type",Ky],pathMap:["type",oP]};function pP(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ss={translate:["value",pP]};function tl(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function fP(e,t,n){var i=e.waypoint;return!i||i.length<2?[je(t),je(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Xy(e,t,n){return new Error(`element ${Ln(t)} referenced by ${Ln(e)}#${n} not yet drawn`)}function ar(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}ar.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],ar.prototype.add=function(e,t,n){var i,r,o;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(tl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!st(e,t),c=hP(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(tl(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(o=0),M(e,"bpmn:DataStoreReference")&&(dP(n,je(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(tl(e,t,{hidden:r,source:u,target:p,waypoints:fP(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Ln(t)} for element ${Ln(e)}`);return kr(e)&&pi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},ar.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Ln(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Xy(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},ar.prototype.addLabel=function(e,t,n){var i,r,o;return i=PA(t,n),r=pi(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(tl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!pi(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},ar.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Xy(e,i,t+"Ref"):new Error(`${Ln(e)}#${t} Ref not specified`)},ar.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},ar.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},ar.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function dP(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 hP(e){return M(e,"bpmn:Group")}const Zy={__depends__:[uP,{__depends__:[ss],bpmnImporter:["type",ar]}]};function cs(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ti(e,t){return{x:e.x-t.x,y:e.y-t.y}}function yf(e){return Math.log(e)/Math.log(10)}var mP=1e3;function le(e){this._eventBus=e}le.$inject=["eventBus"];function gP(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}le.prototype.on=function(e,t,n,i,r,o){if((dn(t)||ze(t))&&(o=r,r=i,i=n,n=t,t=null),dn(n)&&(o=r,r=i,i=n,n=mP),fn(r)&&(o=r,r=!1),!dn(i))throw new Error("handlerFn must be a function");Fe(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?gP(i,o):i,o)})},le.prototype.canExecute=sr("canExecute"),le.prototype.preExecute=sr("preExecute"),le.prototype.preExecuted=sr("preExecuted"),le.prototype.execute=sr("execute"),le.prototype.executed=sr("executed"),le.prototype.postExecute=sr("postExecute"),le.prototype.postExecuted=sr("postExecuted"),le.prototype.revert=sr("revert"),le.prototype.reverted=sr("reverted");function sr(e){return function(n,i,r,o,a){(dn(n)||ze(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var vf=["top","bottom","left","right"],nl=10;function bf(e,t){le.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Zc(r)&&!Rt(r)){var o=bP(r);o&&i(r,o)}}function i(r,o){var a=je(r),s=r.label,c=je(s);if(s.parent){var l=Be(r),u;switch(o){case"top":u={x:a.x,y:l.top-nl-s.height/2};break;case"left":u={x:l.left-nl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+nl+s.height/2};break;case"right":u={x:l.right+nl+s.width/2,y:a.y};break}var p=Ti(u,c);t.moveShape(s,p)}}}Ee(bf,le),bf.$inject=["eventBus","modeling"];function yP(e){var t=e.host,n=je(e),i=Rn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=vf.filter(function(a){return r.indexOf(a)===-1});return o}function vP(e){var t=je(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return Qy(t,i)});return n}function bP(e){var t=je(e.label),n=je(e),i=Qy(n,t);if(xP(i)){var r=vP(e);if(e.host){var o=yP(e);r=r.concat(o)}var a=vf.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Rn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Qy(e,t){return Rn(t,e,5)}function xP(e){return vf.indexOf(e)!==-1}function xf(e){le.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ee(xf,le),xf.$inject=["eventBus"];var _P=1500;function _f(e,t,n){e.invoke(le,this),this.preExecute("elements.delete",_P,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=it(r,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(o,l=>{const u=new Set(No(ea(Array.from(s),Jt(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(_f,le),_f.$inject=["injector","eventBus","canvas"];function wf(e,t){e.invoke(le,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=it(r.incoming.concat(r.outgoing),function(a){return M(a,"bpmn:Association")});z(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(wf,le),wf.$inject=["injector","modeling"];function sa(e,t){for(Un(t)&&(t=[t]);e=e.parent;)if(nt(e,t))return e;return null}function Jy(e,t){var n=sa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=sa(e,i),n)return gn(n);if(nt(e,i))return gn(e);var r;for(r=ue(e);r&&!M(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ue(a);return s&&s.get("processRef")===r});return o?gn(o):!0}var ev=500;function il(e,t){t.invoke(le,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ev,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return tv(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",ev,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];tv(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}il.$inject=["bpmnReplace","injector"],Ee(il,le),il.prototype._replaceShape=function(e,t){var n=wP(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function wP(e){var t=ue(e),n=t.eventDefinitions;return n&&n[0]}function tv(e,t){return!et(e)&&nt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ef(e,t){le.call(this,e);function n(i){return it(i.attachers,function(r){return M(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);M(r,"bpmn:EventBasedGateway")&&M(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;M(r,"bpmn:Gateway")&&M(o,"bpmn:EventBasedGateway")&&z(o.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Ef.$inject=["eventBus","modeling"],Ee(Ef,le);function nv(e){return e.create("bpmn:Category")}function EP(e){return e.create("bpmn:CategoryValue")}function iv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=EP(e)),n.$parent||(n.$parent=nv(e)),n}function SP(e,t,n){return Xt(t.get("categoryValue"),e),e.$parent=t,Xt(n.get("rootElements"),t),t.$parent=n,e}function RP(e){var t=e.$parent;return t&&(qt(t.get("categoryValue"),e),e.$parent=null),e}function CP(e){var t=e.$parent;return t&&(qt(t.get("rootElements"),e),e.$parent=null),e}var MP=500;function Sf(e,t,n){n.invoke(le,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(ue).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&SP(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&CP(l),c&&!r(c,u)&&RP(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ue(l))},!0),this.executed(["shape.move","shape.resize"],MP,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,ue(l))},!0),this.executed("group.updateRefs",function(c){rv(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){rv(c).forEach(function(l){s(l.categoryValue,l.category,ue(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ue(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Sf.$inject=["bpmnjs","elementRegistry","injector"],Ee(Sf,le);function rv(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Rf(e,t,n){le.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const C=y.source,x=y.target;ca(C)&&ls(x)&&u(x)}function r(y){const C=y.connection,x=y.source,m=y.target;ca(x)&&rl(m)&&(l(m),f(x,[C]))}function o(y){const C=y.newTarget,x=y.oldSource,m=y.oldTarget;if(m!==C){const v=x;ls(m)&&u(m),ca(v)&&rl(C)&&l(C)}}function a(y){const{element:C}=y;ls(C)?(p(C),d(C)):rl(C)&&g(C)}function s(y){const{newData:C,oldShape:x}=y;if(ca(y.oldShape)&&C.eventDefinitionType!=="bpmn:CompensateEventDefinition"||C.type!=="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>ls(v));m&&m.target&&(y._connectionTarget=m.target)}else if(!ca(y.oldShape)&&C.eventDefinitionType==="bpmn:CompensateEventDefinition"&&C.type==="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>rl(v));m&&m.target&&(y._connectionTarget=m.target),h(x)}}function c(y){const{_connectionTarget:C,newShape:x}=y;C&&t.connect(x,C)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const C of y.incoming)n.canConnect(C.source,y)||t.removeConnection(C);for(const C of y.outgoing)n.canConnect(y,C.target)||t.removeConnection(C)}function f(y,C){y.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>ls(v.target)&&!C.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const C=y.attachers.slice();C.length&&t.removeElements(C)}function g(y){const C=y.incoming.filter(x=>ca(x.source));t.removeElements(C)}function h(y){const C=y.outgoing.filter(x=>M(x,"bpmn:SequenceFlow"));t.removeElements(C)}}Ee(Rf,le),Rf.$inject=["eventBus","modeling","bpmnRules"];function ls(e){const t=ue(e);return t&&t.get("isForCompensation")}function ca(e){return e&&M(e,"bpmn:BoundaryEvent")&&ra(e,"bpmn:CompensateEventDefinition")}function rl(e){return e&&M(e,"bpmn:Activity")&&!In(e)}function Cf(e){e.invoke(le,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;M(i,"bpmn:Lane")&&!M(r,"bpmn:Lane")&&(n.parent=sa(i,"bpmn:Participant"))})}Cf.$inject=["injector"],Ee(Cf,le);function Mf(e,t){le.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(M(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Mf.$inject=["eventBus","bpmnFactory"],Ee(Mf,le);var Af=20,Pf=20,ov=30,ol=2e3;function Tf(e,t,n){le.call(this,t),t.on(["create.start","shape.move.start"],ol,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!et(p)&&!Rt(p)});if(c.length){var l=Jt(c),u=AP(a,l);U(a,u),o.createConstraints=PP(a,l)}}}),t.on("create.start",ol,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",ol,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return M(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",ol,function(r){var o=r.elements,a=r.parent,s=TP(o),c;s&&M(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ue(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;M(a,"bpmn:Participant")&&M(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ue(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&ue(s).set("processRef",ue(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&ue(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Tf.$inject=["canvas","eventBus","modeling"],Ee(Tf,le);function AP(e,t){t={width:t.width+Af*2+ov,height:t.height+Pf*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 PP(e,t){return t=Be(t),{bottom:t.top+e.height/2-Pf,left:t.right-e.width/2+Af,top:t.bottom-e.height/2+Pf,right:t.left+e.width/2-Af-ov}}function TP(e){return Tt(e,function(t){return M(t,"bpmn:Participant")})}var av="__targetRef_placeholder";function kf(e,t){le.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],sv(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],sv(o));function n(a,s,c){var l=a.get("dataInputAssociations");return Tt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Tt(c,function(u){return u.name===av});return!l&&s&&(l=t.create("bpmn:Property",{name:av}),Xt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||qt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,C;h&&h!==p&&r(h,l),d&&d!==p&&r(d,l),p?(C=i(p,!0),y.targetRef=C):y.targetRef=null}}kf.$inject=["eventBus","bpmnFactory"],Ee(kf,le);function sv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function al(e){this._bpmnUpdater=e}al.$inject=["bpmnUpdater"],al.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},al.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function Of(e,t,n,i){le.call(this,i),t.registerHandler("dataStore.updateContainment",al);function r(){return n.filter(function(s){return M(s,"bpmn:Participant")&&ue(s).processRef})[0]}function o(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:lt(s),newSemanticParent:u.processRef||u,newDiParent:lt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:OP(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();nt(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&o(u).filter(function(p){return kP(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=o(l);p.forEach(function(f){M(u,"bpmn:Process")&&a(f,u)})})}Of.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(Of,le);function kP(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 OP(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var sl=Math.max,cl=Math.min,DP=20;function cv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function LP(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function IP(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 ll(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ze(r)&&(i=(/top|left/.test(e)?cl:sl)(i,r)),ze(o)&&(i=(/top|left/.test(e)?sl:cl)(i,o)),i}function BP(e,t){if(!t)return e;var n=Be(e);return Wc({top:ll("top",n,t),right:ll("right",n,t),bottom:ll("bottom",n,t),left:ll("left",n,t)})}function NP(e,t,n,i){var r=Be(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Be(i):o,s={top:cl(o.top,a.top),left:cl(o.left,a.left),bottom:sl(o.bottom,a.bottom),right:sl(o.right,a.right)};return Wc(s)}function us(e,t){return typeof e<"u"?e:DP}function $P(e,t){var n,i,r,o;return typeof t=="object"?(n=us(t.left),i=us(t.right),r=us(t.top),o=us(t.bottom)):n=i=r=o=us(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function FP(e){return!(e.waypoints||e.type==="label")}function lv(e,t){var n;if(e.length===void 0?n=it(e.children,FP):n=e,n.length)return $P(Jt(n),t)}var Or=Math.abs;function jP(e,t){return cv(Be(t),Be(e))}var HP=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],yi=30;function ul(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(ul(n,t),t.push(n))}),t}function Dr(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function vi(e){return sa(e,HP)||e}function zP(e,t){var n=vi(e),i=M(n,"bpmn:Process")?[]:[n],r=ul(n,i),o=Be(e),a=Be(t),s=jP(e,t),c=[],l=gn(e);return r.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Be(u);s.top&&(Or(h.bottom-o.top)<10&&(d=a.top-h.bottom),Or(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(Or(h.right-o.left)<10&&(f=a.left-h.right),Or(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(Or(h.top-o.bottom)<10&&(p=a.bottom-h.top),Or(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Or(h.left-o.right)<10&&(g=a.right-h.left),Or(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:IP(u,{top:p,right:f,bottom:d,left:g})})}}),c}var GP=500;function Df(e,t){le.call(this,e);function n(i,r){var o=gn(i),a=Dr(r),s=[],c=[],l=[],u=[];if(po(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",GP,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;M(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Df.$inject=["eventBus","spaceTool"],Ee(Df,le);var uv=500;function pl(e,t){t.invoke(le,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",uv,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return pv(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",uv,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;pv(a,WP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}pl.$inject=["bpmnReplace","injector"],Ee(pl,le),pl.prototype._replaceShape=function(e){var t=VP(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function VP(e){var t=ue(e),n=t.eventDefinitions;return n&&n[0]}function pv(e,t){return!et(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function WP(e,t){return e.indexOf(t)!==-1}var fl=Math.round,UP=Math.max;function qP(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 YP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var fv=10;function KP(e,t){var n,i;for(n=0;i=e[n];n++)if(es(i,t)<=fv)return{point:e[n],bendpoint:!0,index:n};return null}function XP(e,t){var n=yy(qP(t,fv),YP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=UP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:fl(i.x+r.x)/2,y:fl(i.y+r.y)/2},index:i.segment2}:{point:{x:fl(i.x),y:fl(i.y)},index:i.segment2}:null}function Lf(e,t){return KP(e,t)||XP(e,t)}function If(e,t,n){le.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,g,h=r.outgoing.slice(),y=r.incoming.slice(),C;ze(a.width)?C=je(a):C=a;var x=Lf(s,C);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:C,(c.length===1||!dv(r,c[c.length-1]))&&c.push(hv(u)),(l.length===1||!dv(r,l[0]))&&l.unshift(hv(u))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||C),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||C),g=o));var m=[].concat(d&&it(y,function(v){return v.source===d.source})||[],g&&it(h,function(v){return v.target===g.target})||[]);m.length&&n.removeElements(m)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=je(c),u={x:l.x+s.x,y:l.y+s.y},p=Tt(o.children,function(f){var d=t.canInsert(a,f);return d&&Lf(f.waypoints,u)});p&&(r.targetFlow=p,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}Ee(If,le),If.$inject=["eventBus","bpmnRules","modeling"];function dv(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 hv(e){return U({},e)}function Bf(e,t){le.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&la(r)){var c=[];M(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&la(l)):c=a.incoming.filter(l=>l!==r&&la(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(M(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(la).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(la).forEach(function(s){const c=a.incoming.filter(la).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Bf.$inject=["eventBus","modeling"],Ee(Bf,le);function la(e){return M(e,"bpmn:SequenceFlow")}var dl=1500,mv=2e3;function gv(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"],dl,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!nt(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=vi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||nt(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],dl,function(i){var r=i.hover;M(r,"bpmn:Lane")&&(i.hover=vi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],dl,function(i){var r=i.context,o=i.hover,a=r.type;M(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=vi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],dl,function(i){var r=i.context,o=r.start;M(o,"bpmn:Lane")&&(r.start=vi(o)||o)}),t.on("shape.move.start",mv,function(i){var r=i.shape;M(r,"bpmn:Lane")&&(i.shape=vi(r)||r)}),t.on("spaceTool.move",mv,function(i){var r=i.hover;r&&M(r,"bpmn:Lane")&&(i.hover=vi(r))})}gv.$inject=["elementRegistry","eventBus","canvas"];var yv=770;function Nf(e,t,n,i){n.invoke(le,this);function r(s,c){var l=ue(s),u=c.categoryValue||l.categoryValueRef;u||(u=iv(e,l));var p=c.category||u.$parent||nv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function o(s,c){var l=ue(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ue(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=ue(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ue(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ue(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||ue(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",yv,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=ue(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",yv,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})}Nf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(Nf,le);function $f(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function vv(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=$f(i,r,o,a),l=$f(i,r,o,s),u;c&&l?bv(c,o)>bv(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],je(i.source)),t(r[r.length-1],r[r.length-2],je(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}vv.$inject=["eventBus"];function bv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ff(e){le.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ue(i),o=lt(i);if(nt(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Ff.$inject=["eventBus"],Ee(Ff,le);function xv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function _v(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function ZP(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 QP(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function jf(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=QP([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function wv(e,t){var n=jf(e,t),i={x:n.x-e.x,y:n.y-e.y};return xv(i)}function ps(e,t){return xv({x:e.x-t.x,y:e.y-t.y})}var Ev=Math.sqrt,Sv=Math.min,JP=Math.max,Rv=Math.abs;function Cv(e){return Math.pow(e,2)}function fs(e,t){return Ev(Cv(e.x-t.x)+Cv(e.y-t.y))}function eT(e,t){var n=0,i,r,o,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Av(i,r)?l=[i]:(o=fs(e,i),a=fs(e,r),c=Sv(o,a),l=tT(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Av(i,l[0])?n:n+1}),l.length===2&&(s=iT(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:fs(i,s)/fs(i,r)}),p=fs(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function tT(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=Ev(d),h=-p+g,y=-p-g,C={x:e.x-r*h,y:e.y-o*h};if(d===0)return[C];var x={x:e.x-r*y,y:e.y-o*y};return[C,x].filter(function(m){return nT(m,e,t)})}function nT(e,t,n){return Mv(e.x,t.x,n.x)&&Mv(e.y,t.y,n.y)}function Mv(e,t,n){return e>=Sv(t,n)-hl&&e<=JP(t,n)+hl}function iT(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var hl=.1;function Av(e,t){return Rv(e.x-t.x)<=hl&&Rv(e.y-t.y)<=hl}function rT(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var p=Tv(t,l);p<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Pv(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=eT(e,n),c=s.segmentIndex,l=rT(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=kv(n,c),p=kv(t,l),f=s.position,d=aT(u,f),g=oT(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,C=n[y];if(t.indexOf(C)!==-1)return a;if(h===0){var x=t[y];return r=x.x-s.position.x,o=x.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=Tv(n,y))}var m={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=ZP({x:e.x-f.x,y:e.y-f.y},g);return r=m.x+v.x-e.x,o=m.y+v.y-e.y,{point:rr(m),delta:rr({x:r,y:o})}}function Tv(e,t){var n=ps(e[t-1],e[t]),i=ps(e[t],e[t+1]),r=n/(n+i);return r}function oT(e,t){var n=_v(e),i=_v(t);return i-n}function kv(e,t){return[e[t],e[t+1]]}function aT(e,t){var n=ps(e[0],e[1]),i=ps(e[0],t);return n===0?0:i/n}function sT(e,t,n,i){var r=je(e);return Pv(r,t,n,i).delta}function ds(e,t,n){var i=cs(t),r=cs(n),o=Ti(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return rr({x:r.x+a.x,y:r.y+a.y})}function Ov(e,t,n){var i=cs(e),r=cs(t),o=cs(n),a=Ti(e,i),s=Ti(i,r),c=cT(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return rr({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function cT(e,t,n){var i=Be(t),r=Be(n);if(lT(i,r))return null;var o=Rn(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=Rn(n,s),c!==o?null:a}function lT(e,t){return uT(e,t)||pT(e,t)}function uT(e,t){return e.right!==t.right&&e.left!==t.left}function pT(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Dv="name",Lv="text";function Hf(e,t,n,i){le.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ue(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Dv in l&&t.updateLabel(c,l[Dv]),Lv in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Lv]||"");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;et(l)||!kr(l)||pi(l)&&t.updateLabel(l,pi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=U({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),sT(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=o(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ue(c);u&&kr(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(!(!et(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(pi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Zc(c)){var p=c.label,f=je(p),d=hT(u),g=dT(f,d),h=fT(g,u,l);t.moveShape(p,h)}})}Ee(Hf,le),Hf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function fT(e,t,n){var i=ds(e,t,n);return rr(Ti(i,e))}function dT(e,t){if(t.length){var n=mT(e,t);return jf(e,n)}}function hT(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 mT(e,t){var n=t.map(function(r){return{line:r,distance:wv(e,r)}}),i=Li(n,"distance");return i[0].line}function gT(e,t,n,i){return Pv(e,t,n,i).point}function zf(e,t){le.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=U({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),gT(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ee(zf,le),zf.$inject=["eventBus","modeling"];function ml(e,t,n){var i=yl(e),r=Bv(i,t),o=i[0];return r.length?r[r.length-1]:ds(o.original||o,n,t)}function gl(e,t,n){var i=yl(e),r=Bv(i,t),o=i[i.length-1];return r.length?r[0]:ds(o.original||o,n,t)}function Gf(e,t,n){var i=yl(e),r=Iv(t,n),o=i[0];return ds(o.original||o,r,t)}function Vf(e,t,n){var i=yl(e),r=Iv(t,n),o=i[i.length-1];return ds(o.original||o,r,t)}function Iv(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function yl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Bv(e,t){var n=Tn(e,vT);return it(n,function(i){return yT(i,t)})}function yT(e,t){return Rn(t,e,1)==="intersect"}function vT(e){return e.original||e}function Wf(e,t){le.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(bT(i,r)){var o=xT(i);o.incoming.forEach(function(a){var s=gl(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ml(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Wf.$inject=["eventBus","modeling"],Ee(Wf,le);function bT(e,t){return M(e,"bpmn:Participant")&&st(e)&&M(t,"bpmn:Participant")&&!st(t)}function xT(e){var t=Qa([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){M(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){M(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const _T=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Nv(e){const t=ue(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&In(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:_T.some(i=>M(n[0],i))}function $v(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Uf(e,t){e.invoke(le,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Nv(r))return;const a=$v(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ue(i).get(a),l=ue(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Uf.$inject=["injector","modeling"],Ee(Uf,le);function qf(e,t){le.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=lt(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(qf,le),qf.$inject=["eventBus","modeling"];function Yf(e,t,n){le.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!M(o,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=wT(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(Yf,le),Yf.$inject=["eventBus","bpmnRules","modeling"];function ua(e){return e.original||e}function wT(e,t){var n=$f(ua(e[e.length-2]),ua(e[e.length-1]),ua(t[1]),ua(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ua(e[0]),ua(t[t.length-1])]}function Kf(e,t){le.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;M(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Kf.$inject=["eventBus","modeling"],Ee(Kf,le);function Xf(e,t,n,i){le.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,r&&s(u,g))}function s(c,l){var u=r.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Tt(p.outgoing,Fo({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Ee(Xf,le),Xf.$inject=["eventBus","modeling","bpmnRules","injector"];function vl(e,t,n,i,r,o){i.invoke(le,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Yn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){In(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ee(vl,le),vl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;z(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},vl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var ET=1500,ST={width:140,height:120},Zf={width:300,height:60},Qf={width:60,height:300},bl={width:300,height:150},xl={width:150,height:300},Fv={width:140,height:120},jv={width:100,height:40};function Hv(e){e.on("resize.start",ET,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=PT(i,r,o)),M(i,"bpmn:SubProcess")&&st(i)&&(n.minDimensions=Fv),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=jv)})}Hv.$inject=["eventBus"];var Lr=Math.abs,RT=Math.min,CT=Math.max;function zv(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function pa(e,t,n){return zv(e,t,n,RT)}function fa(e,t,n){return zv(e,t,n,CT)}var MT={top:20,left:50,right:20,bottom:20},AT={top:50,left:20,right:20,bottom:20};function PT(e,t,n){var i=vi(e),r=!0,o=!0,a=ul(i,[i]),s=Be(e),c={},l={},u=gn(e),p=u?Zf:Qf;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Be(g);u?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&Lr(s.top-h.bottom)<10&&fa(c,"top",h.top+p.height),Lr(s.top-h.top)<5&&pa(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Lr(s.right-h.left)<10&&pa(c,"right",h.right-p.width),Lr(s.right-h.right)<5&&fa(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Lr(s.bottom-h.top)<10&&pa(c,"bottom",h.bottom-p.height),Lr(s.bottom-h.bottom)<5&&fa(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Lr(s.left-h.right)<10&&fa(c,"left",h.left+p.width),Lr(s.left-h.left)<5&&pa(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?MT:AT;return f.forEach(function(g){var h=Be(g);/n/.test(t)&&(!u||r)&&pa(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&fa(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&fa(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&pa(l,"left",h.left-d.left)}),{min:l,max:c}}function Gv(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function da(e){return e.originalEvent||e.srcEvent}function Jf(e){Gv(e),Gv(da(e))}function go(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 Vv(){return/mac/i.test(navigator.platform)}function Wv(e,t){return(da(e)||e).button===t}function Ir(e){return Wv(e,0)}function TT(e){return Wv(e,1)}function hs(e){var t=da(e)||e;return Ir(e)?Vv()?t.metaKey:t.ctrlKey:!1}function _l(e){var t=da(e)||e;return Ir(e)&&t.shiftKey}var Uv=1001;function qv(e,t){e.on("resize.start",Uv+500,function(n){var i=n.context,r=i.shape;(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))&&(i.balanced=!hs(n))}),e.on("resize.end",Uv,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))return o&&(a=wy(a),t.resizeLane(r,a,i.balanced)),!1})}qv.$inject=["eventBus","modeling"];var kT=500;function ed(e,t,n,i,r){n.invoke(le,this);function o(u){return nt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||OT(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Tt(f,Fo({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(nt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(nt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(o(p)){var f=ue(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),Xt(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");qt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=ue(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",kT,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(f,d),delete p.referencedRootElement)})}ed.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(ed,le);function OT(e,t){return Fe(t)||(t=[t]),br(t,function(n){return ra(e,n)})}var Yv=Math.max;function Kv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(o[s]=LT(a,i,r)),M(a,"bpmn:Lane")&&(o[s]=gn(a)?Zf:Qf),M(a,"bpmn:SubProcess")&&st(a)&&(o[s]=Fv),M(a,"bpmn:TextAnnotation")&&(o[s]=jv),M(a,"bpmn:Group")&&(o[s]=ST)}),o})}Kv.$inject=["eventBus"];function DT(e){return e==="x"}function LT(e,t,n){var i=gn(e);if(!NT(e))return i?bl:xl;var r=DT(t),o={};return r?i?o=bl:o={width:BT(e,n,r),height:xl.height}:i?o={width:bl.width,height:IT(e,n,r)}:o=xl,o}function IT(e,t,n){var i;return i=$T(e,t,n),Yv(bl.height,i)}function BT(e,t,n){var i;return i=FT(e,t,n),Yv(xl.width,i)}function NT(e){return!!Dr(e).length}function $T(e,t,n){var i=Dr(e),r;return r=td(i,t,n),e.height-r.height+Zf.height}function FT(e,t,n){var i=Dr(e),r;return r=td(i,t,n),e.width-r.width+Qf.width}function td(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=Dr(r),o.length?td(o,t,n):r}var Xv="_plane";function Zv(e){var t=e.id;return jT(t)}function Wi(e){var t=e.id;return M(e,"bpmn:SubProcess")?Qv(t):t}function yo(e){return Qv(e)}function wl(e){var t=lt(e);return M(t,"bpmndi:BPMNPlane")}function Qv(e){return e+Xv}function jT(e){return e.replace(new RegExp(Xv+"$"),"")}var Jv=400,HT=600,eb={x:180,y:160};function cr(e,t,n,i,r,o,a){le.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return M(p,"bpmn:SubProcess")&&!st(p)}function l(p){var f=p.shape,d=p.newRootElement,g=ue(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=ue(f);s._removeDiagram(d);var g=p.newRootElement=a.get(Wi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;z(f,function(d){if(c(d)){var g=a.get(Wi(d));if(!(!g||!d.children||!d.children.length)){var h=tb(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!st(f)||z(rs([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Wi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Wi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(Wi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(wl(f)){a.updateId(f,yo(y)),a.updateId(h,y);return}var C=a.get(yo(h));C&&a.updateId(yo(h),yo(y))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(wl(f)){a.updateId(f,yo(h)),a.updateId(y,h);return}var C=a.get(yo(y));C&&a.updateId(C,yo(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(wl(f)){var d=f,g=a.get(Zv(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Jv,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(st(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Jv,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(st(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",HT,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(st(f))s._moveChildrenToShape(d.children.slice(),f),z(rs(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),z(h.associations,y=>{n.moveConnection(y,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=tb(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=Wi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,y=M(lt(h),"bpmndi:BPMNPlane");if(y){var C=Zv(h),x=Tt(g,function(m){return m.id===C});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ee(cr,le),cr.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Jt(i),o;if(!t.x)o={x:eb.x-r.x,y:eb.y-r.y};else{var a=je(t),s=je(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},cr.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Wy(e).map(i=>i.annotation));n.size&&z(rs(e.children),i=>{n.has(i.annotation)&&z(i.associations,r=>{t.removeConnection(r)})})},cr.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},cr.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},cr.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Wi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},cr.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Tt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},cr.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function zT(e){var t=[];return z(rs(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function tb(e){return e.children.slice().concat(zT(e.children)).concat(GT(e))}function GT(e){return af(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function nd(e,t){e.invoke(le,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!M(r,"bpmn:SubProcess")||M(r,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!st(r))){var o=VT(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}nd.$inject=["injector","modeling"],Ee(nd,le);function VT(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function id(e,t){le.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&M(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!M(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,pi(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ee(id,le),id.$inject=["eventBus","textRenderer"];function rd(e,t){le.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(st(i))return;var r=Qa(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){o(l,!0)}),z(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,je(i)):t.reconnectStart(a,i,je(i)))}},!0)}Ee(rd,le),rd.$inject=["eventBus","modeling"];var od=500;function ad(e,t,n){le.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,p;return u=WT(c).concat([a]),p=lv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],od,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?lt(c).isExpanded=!1:(i(c.children),lt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],od,function(a){var s=a.context,c=s.shape;c.collapsed?lt(c).isExpanded=!1:lt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],od,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ee(ad,le),ad.$inject=["eventBus","elementFactory","modeling"];function WT(e){return e.filter(function(t){return!t.hidden})}function sd(e,t,n,i){t.invoke(le,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;et(a)||(M(a,"bpmn:Participant")&&st(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;M(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(sd,le),sd.$inject=["canvas","injector","moddle","modeling"];function cd(e,t){le.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;UT(r,o)&&t.updateProperties(o,{default:null})})}Ee(cd,le),cd.$inject=["eventBus","modeling"];function UT(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=ue(t),i=ue(e);return n.get("default")===i}var qT=500,YT=5e3,nb=["shape.create","shape.delete","shape.move","shape.resize"],ib=[...nb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function ld(e,t){le.call(this,e);var n;function i(){return n=n||new KT,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(ib,YT,function(){i()}),this.postExecuted(ib,qT,function(){o()}),this.preExecute(nb,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}ld.$inject=["eventBus","modeling"],Ee(ld,le);function KT(){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 XT=500,ZT=5e3,rb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],ob=[...rb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function ud(e,t){le.call(this,e);var n;function i(){return n=n||new QT,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(ob,ZT,function(){i()}),this.postExecuted(ob,XT,function(){o()}),this.preExecute(rb,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&r().addGroup(s)})}ud.$inject=["eventBus","modeling"],Ee(ud,le);function QT(){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 pd(e,t){le.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)JT(o)&&!tk(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(pd,le),pd.$inject=["eventBus","modeling"];function JT(e){const t=ue(e);return t&&t.isForCompensation}function ek(e){return e&&M(e,"bpmn:BoundaryEvent")&&ra(e,"bpmn:CompensateEventDefinition")}function tk(e){return e.incoming.filter(n=>ek(n.source)).length>0}const nk={__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",bf],appendBehavior:["type",xf],associationBehavior:["type",wf],attachEventBehavior:["type",il],artifactBehavior:["type",_f],boundaryEventBehavior:["type",Ef],categoryRootElementReferenceBehavior:["type",Sf],compensateBoundaryEventBehaviour:["type",Rf],createBehavior:["type",Cf],createDataObjectBehavior:["type",Mf],createParticipantBehavior:["type",Tf],dataInputAssociationBehavior:["type",kf],dataStoreBehavior:["type",Of],deleteLaneBehavior:["type",Df],detachEventBehavior:["type",pl],dropOnFlowBehavior:["type",If],eventBasedGatewayBehavior:["type",Bf],fixHoverBehavior:["type",gv],groupBehavior:["type",Nf],importDockingFix:["type",vv],isHorizontalFix:["type",Ff],labelBehavior:["type",Hf],layoutConnectionBehavior:["type",zf],messageFlowBehavior:["type",Wf],nonInterruptingBehavior:["type",Uf],removeElementBehavior:["type",Yf],removeEmbeddedLabelBoundsBehavior:["type",qf],removeParticipantBehavior:["type",Kf],replaceConnectionBehavior:["type",Xf],replaceElementBehaviour:["type",vl],resizeBehavior:["type",Hv],resizeLaneBehavior:["type",qv],rootElementReferenceBehavior:["type",ed],spaceToolBehavior:["type",Kv],subProcessPlaneBehavior:["type",cr],subProcessStartEventBehavior:["type",nd],textAnnotationBehavior:["type",id],toggleCollapseConnectionBehaviour:["type",rd],toggleElementCollapseBehaviour:["type",ad],unclaimIdBehavior:["type",sd],unsetDefaultFlowBehavior:["type",cd],updateFlowNodeRefsBehavior:["type",ld],updateCategoryValueRefsBehavior:["type",ud],setCompensationActivityAfterPasteBehavior:["type",pd]};function fd(e){this._commandStack=e.get("commandStack",!1)}fd.$inject=["injector"],fd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Ui={__init__:["rules"],rules:["type",fd]};function bi(e){le.call(this,e),this.init()}bi.$inject=["eventBus"],Ee(bi,le),bi.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},bi.prototype.init=function(){};function ab(e,t){var n=Rn(e,t,-15);return n!=="intersect"?n:null}function Mn(e){bi.call(this,e)}Ee(Mn,bi),Mn.$inject=["eventBus"],Mn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return ik(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return Sl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Sl(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 bb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Rt(i)&&!Rl(t,i)?!1:io(t,function(r){return Rt(r)?Sl(r.source,r.target,r):r.host?ms(r,r.host,null,n):gd(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return db(a)&&!n.includes(a.host)})?!1:ms(n,t,null,i)||yb(n,t,i)||vb(n,t)||Rl(n,t)}),this.addRule("shape.create",function(e){return gd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ms(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Sb(n,t)})},Mn.prototype.canConnectMessageFlow=wb,Mn.prototype.canConnectSequenceFlow=Eb,Mn.prototype.canConnectDataAssociation=yd,Mn.prototype.canConnectAssociation=xb,Mn.prototype.canConnectCompensationAssociation=_b,Mn.prototype.canMove=vb,Mn.prototype.canAttach=ms,Mn.prototype.canReplace=yb,Mn.prototype.canDrop=ha,Mn.prototype.canInsert=Rl,Mn.prototype.canCreate=gd,Mn.prototype.canConnect=Sl,Mn.prototype.canResize=bb,Mn.prototype.canCopy=Sb;function ik(e){return dd(e)?null:nt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function dd(e){return!e||et(e)}function sb(e){do{if(M(e,"bpmn:Process"))return ue(e);if(M(e,"bpmn:Participant"))return ue(e).processRef||ue(e)}while(e=e.parent)}function hd(e){return M(e,"bpmn:TextAnnotation")}function md(e){return M(e,"bpmn:Group")&&!e.labelTarget}function cb(e){return M(e,"bpmn:BoundaryEvent")&&qi(e,"bpmn:CompensateEventDefinition")}function El(e){return ue(e).isForCompensation}function rk(e,t){var n=sb(e),i=sb(t);return n===i}function ok(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&pb(e,"bpmn:MessageEventDefinition"))}function ak(e){return M(e,"bpmn:InteractionNode")&&!El(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&pb(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!qi(e,"bpmn:MessageEventDefinition"))}function lb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return ue(t);if(M(t,"bpmn:Participant"))return ue(t).processRef}return null}function ub(e,t){var n=lb(e),i=lb(t);return n===i}function qi(e,t){var n=ue(e);return!!Tt(n.eventDefinitions||[],function(i){return M(i,t)})}function pb(e,t){var n=ue(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function sk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!In(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&qi(e,"bpmn:LinkEventDefinition"))&&!cb(e)&&!El(e)}function ck(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!In(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&qi(e,"bpmn:LinkEventDefinition"))&&!El(e)}function lk(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(qi(e,"bpmn:MessageEventDefinition")||qi(e,"bpmn:TimerEventDefinition")||qi(e,"bpmn:ConditionalEventDefinition")||qi(e,"bpmn:SignalEventDefinition"))}function uk(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function fb(e,t){var n=uk(t);return n.indexOf(e)!==-1}function Sl(e,t,n){if(dd(e)||dd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(wb(e,t))return{type:"bpmn:MessageFlow"};if(Eb(e,t))return{type:"bpmn:SequenceFlow"}}var i=yd(e,t);return i||(_b(e,t)?{type:"bpmn:Association",associationDirection:"One"}:xb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function ha(e,t){return et(e)||md(e)?!0:M(t,"bpmn:Participant")&&!st(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):nt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!pk(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?st(t):nt(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?br(ue(t).get("participants"),function(n){return!!n.get("processRef")}):nt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?nt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function pk(e){return ue(e).cancelActivity&&(hb(e)||mb(e))}function db(e){return!et(e)&&M(e,"bpmn:BoundaryEvent")}function fk(e){return M(e,"bpmn:Lane")}function dk(e){return db(e)||M(e,"bpmn:IntermediateThrowEvent")&&hb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&mb(e)}function hb(e){var t=ue(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function mb(e){return gb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function gb(e,t){return t.some(function(n){return qi(e,n)})}function hk(e){return M(e,"bpmn:ReceiveTask")&&Tt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function ms(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return et(r)||!dk(r)||In(t)||!M(t,"bpmn:Activity")||El(t)||i&&!ab(i,t)||hk(t)?!1:"attach"}function yb(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(r){In(t)||M(r,"bpmn:StartEvent")&&r.type!=="label"&&ha(r,t)&&(EA(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(SA(r)||RA(r)||CA(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),gb(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||qi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(M(r,"bpmn:EndEvent")&&ha(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),M(r,"bpmn:BoundaryEvent")&&ms(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function vb(e,t){return br(e,fk)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return ha(n,t)})}function gd(e,t,n,i){return t?et(e)||md(e)?!0:ha(e,t)||Rl(e,t):!1}function bb(e,t,n){return M(e,"bpmn:SubProcess")?st(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:hd(e)?n?n==="e"||n==="w":!0:md(e)?!0:et(e)?n?n==="e"||n==="w":!0:!1}function mk(e,t){var n=hd(e),i=hd(t);return(n||i)&&n!==i}function xb(e,t){return fb(t,e)||fb(e,t)?!1:mk(e,t)?!0:!!yd(e,t)}function _b(e,t){return ub(e,t)&&cb(e)&&M(t,"bpmn:Activity")&&!yk(t,e)&&!In(t)}function wb(e,t){return Cb(e)&&!Cb(t)?!1:ok(e)&&ak(t)&&!rk(e,t)}function Eb(e,t){return sk(e)&&ck(t)&&ub(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!lk(t))}function yd(e,t){return nt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&nt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:nt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&nt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Rl(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:nt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!et(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&ha(e,t.parent)}function vd(e,t){return e&&t&&e.indexOf(t)!==-1}function Sb(e,t){return et(t)?!0:!(M(t,"bpmn:Lane")&&!vd(e,t.parent)||M(t,"bpmn:MessageFlow")&&!gk(e,t))}function gk(e,t){var n=Rb(t.source),i=Rb(t.target);return vd(e,n)&&vd(e,i)}function Rb(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function Cb(e){return sa(e,"bpmn:Process")||sa(e,"bpmn:Collaboration")}function yk(e,t){return e.attachers.includes(t)}const vk={__depends__:[Ui],__init__:["bpmnRules"],bpmnRules:["type",Mn]};var bk=2e3;function Mb(e,t){e.on("saveXML.start",bk,n);function n(){var i=t.getRootElements();z(i,function(r){var o=lt(r),a,s;a=Qa([r]),a=it(a,function(c){return c!==r&&!c.labelTarget}),s=Tn(a,lt),o.set("planeElement",s)})}}Mb.$inject=["eventBus","canvas"];const xk={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Mb]};function Cl(e){le.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Cl.prototype.getOrdering=function(e,t){return null},Ee(Cl,le);function bd(e,t){Cl.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=Tt(n,function(c){return nt(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var l=s;l&&!nt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=om(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}bd.$inject=["eventBus","canvas"],Ee(bd,Cl);const _k={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",bd]};function gs(){}gs.prototype.get=function(){return this._data},gs.prototype.set=function(e){this._data=e},gs.prototype.clear=function(){var e=this._data;return delete this._data,e},gs.prototype.isEmpty=function(){return!this._data};const wk={clipboard:["type",gs]};var Ab=1500;function Pb(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Ab,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Ab,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=go(a),c=document.elementFromPoint(s.x,s.y),Ek(c)}}Pb.$inject=["elementRegistry","eventBus","injector"];function Ek(e){return lo(e,"svg, .djs-element",!0)}const Sk={__init__:["hoverFix"],hoverFix:["type",Pb]};function Rk(e){return!0}function Ml(e){return Ir(e)||TT(e)}var Tb=500;function kb(e,t,n){var i=this;function r(O,N,P){if(!s(O,N)){var D,j,ee;P?j=t.getGraphics(P):(D=N.delegateTarget||N.target,D&&(j=D,P=t.get(j))),!(!j||!P)&&(ee=e.fire(O,{element:P,gfx:j,originalEvent:N}),ee===!1&&(N.stopPropagation(),N.preventDefault()))}}var o={};function a(O){return o[O]}function s(O,N){var P=l[O]||Ir;return!P(N)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":Rk,"element.mousedown":Ml,"element.mouseup":Ml,"element.click":Ml,"element.dblclick":Ml};function u(O,N,P){var D=c[O];if(!D)throw new Error("unmapped DOM event name <"+O+">");return r(D,N,P)}var p="svg, .djs-element";function f(O,N,P,D){var j=o[P]=function(ee){r(P,ee)};D&&(l[P]=D),j.$delegate=Kn.bind(O,p,N,j)}function d(O,N,P){var D=a(P);D&&Kn.unbind(O,N,D.$delegate)}function g(O){z(c,function(N,P){f(O,P,N)})}function h(O){z(c,function(N,P){d(O,P,N)})}e.on("canvas.destroy",function(O){h(O.svg)}),e.on("canvas.init",function(O){g(O.svg)}),e.on(["shape.added","connection.added"],function(O){var N=O.element,P=O.gfx;e.fire("interactionEvents.createHit",{element:N,gfx:P})}),e.on(["shape.changed","connection.changed"],Tb,function(O){var N=O.element,P=O.gfx;e.fire("interactionEvents.updateHit",{element:N,gfx:P})}),e.on("interactionEvents.createHit",Tb,function(O){var N=O.element,P=O.gfx;i.createDefaultHit(N,P)}),e.on("interactionEvents.updateHit",function(O){var N=O.element,P=O.gfx;i.updateDefaultHit(N,P)});var y=_("djs-hit djs-hit-stroke"),C=_("djs-hit djs-hit-click-stroke"),x=_("djs-hit djs-hit-all"),m=_("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":C,stroke:y,"no-move":m};function _(O,N){return N=U({stroke:"white",strokeWidth:15},N||{}),n.cls(O,["no-fill","no-border"],N)}function S(O,N){var P=v[N];if(!P)throw new Error("invalid hit type <"+N+">");return Se(O,P),O}function k(O,N){We(O,N)}this.removeHits=function(O){var N=$c(".djs-hit",O);z(N,cn)},this.createDefaultHit=function(O,N){var P=O.waypoints,D=O.isFrame,j;return P?this.createWaypointsHit(N,P):(j=D?"stroke":"all",this.createBoxHit(N,j,{width:O.width,height:O.height}))},this.createWaypointsHit=function(O,N){var P=Za(N);return S(P,"stroke"),k(O,P),P},this.createBoxHit=function(O,N,P){P=U({x:0,y:0},P);var D=Oe("rect");return S(D,N),Se(D,P),k(O,D),D},this.updateDefaultHit=function(O,N){var P=Et(".djs-hit",N);if(P)return O.waypoints?of(P,O.waypoints):Se(P,{width:O.width,height:O.height}),P},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}kb.$inject=["eventBus","elementRegistry","styles"];const Al={__init__:["interactionEvents"],interactionEvents:["type",kb]};function ma(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}ma.$inject=["eventBus","canvas"],ma.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},ma.prototype.get=function(){return Array.from(this._selectedElements)},ma.prototype.isSelected=function(e){return this._selectedElements.has(e)},ma.prototype.select=function(e,t){var n=this.get();Fe(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?z(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Ob="hover",Db="selected";function Lb(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Ob)}),t.on("element.out",function(r){i(r.element,Ob)}),t.on("selection.changed",function(r){function o(l){i(l,Db)}function a(l){n(l,Db)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Lb.$inject=["canvas","eventBus"];function Ib(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Fe(l)?t.select(l):t.select(s.filter(Ck))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=Tt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Ir(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=_l(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Ib.$inject=["eventBus","selection","canvas","elementRegistry"];function Ck(e){return!e.hidden}const xi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Al],selection:["type",ma],selectionVisuals:["type",Lb],selectionBehavior:["type",Ib]};var Mk=/^djs-cursor-.*$/;function Pl(e){var t=$t(document.body);t.removeMatching(Mk),e&&t.add("djs-cursor-"+e)}function Bb(){Pl(null)}var Ak=5e3;function Nb(e,t){t=t||"element.click";function n(){return!1}return e.once(t,Ak,n),function(){e.off(t,n)}}var Pk=["c","C"],Tk=["v","V"],kk=["d","D"],Ok=["x","X"],Dk=["y","Y"],$b=["z","Z"];function Lk(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Qn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function ln(e,t){return e=Fe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function xd(e){return e.shiftKey}function Ik(e){return Qn(e)&&ln(Pk,e)}function Bk(e){return Qn(e)&&ln(Tk,e)}function Nk(e){return Qn(e)&&ln(kk,e)}function $k(e){return Qn(e)&&ln(Ok,e)}function Fk(e){return Qn(e)&&!xd(e)&&ln($b,e)}function jk(e){return Qn(e)&&(ln(Dk,e)||ln($b,e)&&xd(e))}var ga=Math.round,Fb="djs-drag-active";function vo(e){e.preventDefault()}function Hk(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function zk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jb(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(m){var v=t.viewbox(),_=t._container.getBoundingClientRect();return{x:v.x+(m.x-_.left)/v.scale,y:v.y+(m.y-_.top)/v.scale}}function s(m,v){v=v||o;var _=e.createEvent(U({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+m,_)===!1?!1:e.fire(v.prefix+"."+m,_)}function c(m){var v=m.filter(function(_){return i.get(_.id)});v.length&&n.select(v)}function l(m,v){var _=o.payload,S=o.displacement,k=o.globalStart,O=go(m),N=Ti(O,k),P=o.localStart,D=a(O),j=Ti(D,P);if(!o.active&&(v||zk(N)>o.threshold)){if(U(_,{x:ga(P.x+S.x),y:ga(P.y+S.y),dx:0,dy:0},{originalEvent:m}),s("start")===!1)return y();o.active=!0,o.keepSelection||(_.previousSelection=n.get(),n.select(null)),o.cursor&&Pl(o.cursor),t.addMarker(t.getRootElement(),Fb)}Jf(m),o.active&&(U(_,{x:ga(D.x+S.x),y:ga(D.y+S.y),dx:ga(j.x),dy:ga(j.y)},{originalEvent:m}),s("move"))}function u(m){var v,_=!0;o.active&&(m&&(o.payload.originalEvent=m,Jf(m)),_=s("end")),_===!1&&s("rejected"),v=C(_!==!0),s("ended",v)}function p(m){ln("Escape",m)&&(vo(m),y())}function f(m){var v;o.active&&(v=Nb(e),setTimeout(v,400),vo(m)),u(m)}function d(m){l(m)}function g(m){var v=o.payload;v.hoverGfx=m.gfx,v.hover=m.element,s("hover")}function h(m){s("out");var v=o.payload;v.hoverGfx=null,v.hover=null}function y(m){var v;if(o){var _=o.active;_&&s("cancel"),v=C(m),_&&s("canceled",v)}}function C(m){var v,_;s("cleanup"),Bb(),o.trapClick?_=f:_=u,Ge.unbind(document,"mousemove",l),Ge.unbind(document,"dragstart",vo),Ge.unbind(document,"selectstart",vo),Ge.unbind(document,"mousedown",_,!0),Ge.unbind(document,"mouseup",_,!0),Ge.unbind(document,"keyup",p),Ge.unbind(document,"touchstart",d,!0),Ge.unbind(document,"touchcancel",y,!0),Ge.unbind(document,"touchmove",l,!0),Ge.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Fb);var S=o.payload.previousSelection;return m!==!1&&S&&!n.get().length&&c(S),v=o,o=null,v}function x(m,v,_,S){o&&y(!1),typeof v=="string"&&(S=_,_=v,v=null),S=U({},r,S||{});var k=S.data||{},O,N,P,D,j;if(S.trapClick?D=f:D=u,m?(O=da(m)||m,N=go(m),Jf(m),O.type==="dragstart"&&vo(O)):(O=null,N={x:0,y:0}),P=a(N),v||(v=P),j=Hk(O),o=U({prefix:_,data:k,payload:{},globalStart:N,displacement:Ti(v,P),localStart:P,isTouch:j},S),S.manual||(j?(Ge.bind(document,"touchstart",d,!0),Ge.bind(document,"touchcancel",y,!0),Ge.bind(document,"touchmove",l,!0),Ge.bind(document,"touchend",u,!0)):(Ge.bind(document,"mousemove",l),Ge.bind(document,"dragstart",vo),Ge.bind(document,"selectstart",vo),Ge.bind(document,"mousedown",D,!0),Ge.bind(document,"mouseup",D,!0)),Ge.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;S.autoActivate&&l(m,!0)}e.on("diagram.destroy",y),this.init=x,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(m){U(r,m)}}jb.$inject=["eventBus","canvas","selection","elementRegistry"];const lr={__depends__:[Sk,xi],dragging:["type",jb]};function ya(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ya.prototype.next=function(){return this._prefix+ ++this._counter};const Gk=new ya("ps");var Vk=["marker-start","marker-mid","marker-end"],Wk=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Br(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Br.$inject=["elementRegistry","eventBus","canvas","styles"],Br.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")},Br.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Br.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Jg(n);return this._cloneMarkers(fo(r),i),Se(r,this._styles.cls(i,[])),We(t,r),Se(r,"data-preview-support-element-id",e.id),r},Br.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return We(t,n),Se(n,"data-preview-support-element-id",e.id),n},Br.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),Kk(e)&&Vk.forEach(function(r){if(Se(e,r)){var o=Uk(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Br.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,Gk.next()].join("-"),a=Et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Jg(n);s.id=o,ct(s).add(r);var c=Et(":scope > defs",e);c||(c=Oe("defs"),We(e,c)),We(c,s);var l=Yk(s.id);Se(t,i,l)};function Uk(e,t,n){var i=qk(Se(e,t));return Et("marker#"+i,n||document)}function qk(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Yk(e){return"url(#"+e+")"}function Kk(e){return Wk.indexOf(e.nodeName)!==-1}const va={__init__:["previewSupport"],previewSupport:["type",Br]};var Xk="drop-ok",Hb="drop-not-ok",zb="attach-ok",Gb="new-parent",Vb="create",Zk=2e3;function Wb(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=it(c,function(x){var m=x.labelTarget;return!x.parent&&!(et(x)&&c.indexOf(m)!==-1)});var d=Tt(c,function(x){return!Rt(x)}),g=!1,h=!1,y=!1;qb(c)&&(g=r.allowed("shape.attach",{position:u,shape:d,target:l})),g||(qb(c)?y=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var C=f.connectionTarget;return y||g?(d&&p&&(h=r.allowed("connection.create",{source:C===p?d:p,target:C===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[zb,Xk,Hb,Gb].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Ub(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&o(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,zb):a(p,h?Gb:Hb))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,C=l.hints||{};if(g===!1||!d)return!1;Ub(c);var x={x:c.x,y:c.y};y?p=i.appendShape(u,p,x,d,{attach:h,connection:y===!0?{}:y,connectionTarget:C.connectionTarget}):(f=i.createElements(f,x,d,U({},C,{attach:h})),p=Tt(f,function(m){return!Rt(m)})),U(l,{elements:f,shape:p}),U(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Vb&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],Zk,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Fe(l)||(l=[l]);var p=Tt(l,function(g){return!Rt(g)});if(p){u=U({elements:l,hints:{},shape:p},u||{}),z(l,function(g){ze(g.x)||(g.x=0),ze(g.y)||(g.y=0)});var f=it(l,function(g){return!g.hidden}),d=Jt(f);z(l,function(g){Rt(g)&&(g.waypoints=Tn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),U(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Vb,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Wb.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ub(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 qb(e){return e&&e.length===1&&!Rt(e[0])}var Qk=750;function Yb(e,t,n,i,r){function o(a){var s=Oe("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(fo(u),l)):(u=n._createContainer("shape",c),n.drawShape(fo(u),l),Cn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",Qk,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),We(p,u)),Cn(u,a.x,a.y)):cn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&cn(c)})}Yb.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Tl={__depends__:[lr,va,Ui,xi],__init__:["create","createPreview"],create:["type",Wb],createPreview:["type",Yb]};function _d(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}_d.$inject=["eventBus"],_d.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Jk(0,0)};function Jk(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const ys={__init__:["mouse"],mouse:["type",_d]};var Kb=2e3;function Jn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),e2(u)&&(l.priority=2,l.host=u.host.id),Rt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=t2(u)),et(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){ze(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",Kb,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Kb,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;U(l,{createElementsBehavior:!1})})}Jn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Jn.prototype.copy=function(e,t={}){var n,i;return Fe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Fe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Jn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Jn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Jn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Jn.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},Jn.prototype._paste=function(e,t,n,i){z(e,function(o){ze(o.x)||(o.x=0),ze(o.y)||(o.y=0)});var r=Jt(e);return z(e,function(o){Rt(o)&&(o.waypoints=Tn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),U(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,U({},i))},Jn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return z(e,function(o,a){o=Li(o,"priority"),z(o,function(s){var c=U({},Ii(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Rt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(et(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Jn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ii(e,["id"]));return t},Jn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ii(e,["id"]));return t},Jn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ii(e,["id"]));return t},Jn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Rt(e)&&(!n.has(e.source)||!n.has(e.target))||et(e)&&!n.has(e.labelTarget))},Jn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=zc(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var g={element:p,depth:f};r.push(g),o.set(p,g);return}if(d.depth<f){r=l(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}po(a,function(p,f,d){if(et(p))return;z(p.labels,function(y){c(y,d)});function g(y){y&&y.length&&z(y,function(C){z(C.labels,function(x){c(x,d)}),c(C,d)})}z([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Tn(r,function(p){return p.element});var u=new Set(e);return r=Tn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),r=Li(r,function(p){return p.descriptor.priority}),e=Tn(r,function(p){return p.element}),z(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){Zb(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Zb(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function e2(e){return!!e.host}function t2(e){return Tn(e.waypoints,function(t){return t=Xb(t),t.original&&(t.original=Xb(t.original)),t})}function Xb(e){return U({},e)}function Zb(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const n2={__depends__:[wk,Tl,ys,Ui],__init__:["copyPaste"],copyPaste:["type",Jn]};function wd(e,t,n){Fe(n)||(n=[n]),z(n,function(i){no(e[i])||(t[i]=e[i])})}var Ed=750;function Qb(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Ed,function(c){var l=c.descriptor,u=c.element,p=ue(u);if(et(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(lt(u),!0);d.bpmnElement=f,wd(f,l,"name"),wd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var p=ue(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(ue(c).attachedToRef=ue(l[c.host])),Ii(u,Yn(u,function(f,d,g){var h=d.element,y=d.property;return g===c.id&&(h.set(y,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(et(u)){u.businessObject=ue(l[u.labelTarget]),u.di=lt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,wd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Ed,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=ue(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&z(rs(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Ed,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}Qb.$inject=["bpmnFactory","eventBus","moddleCopy"];const i2=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],r2=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function vs(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return Li(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=fn(r)&&r.$descriptor;if(a&&r2.includes(a))return o;if(a&&i2.includes(a)||a&&s&&!Tt(s.properties,Fo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(M(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}vs.$inject=["eventBus","bpmnFactory","moddle"],vs.prototype.copyElement=function(e,t,n,i=!1){n&&!Fe(n)&&(n=[n]),n=n||Sd(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Fe(r)&&(n=r),z(n,o=>{let a;qn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!an(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},vs.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return fn(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Fe(e)?Yn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):fn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},vs.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 Sd(e,t){return Yn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Jb={__depends__:[n2],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Qb],moddleCopy:["type",vs]};var ex=Math.round;function Rd(e,t){this._modeling=e,this._eventBus=t}Rd.$inject=["modeling","eventBus"],Rd.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=ex(s+o/2),u=ex(c+a/2),p=i.replaceShape(e,U({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function tx(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}tx.$inject=["selection","eventBus"];const o2={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",tx],replace:["type",Rd]};function a2(e,t,n){Fe(n)||(n=[n]),z(n,function(i){no(e[i])||(t[i]=e[i])})}var s2=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function c2(e,t){var n=e&&qn(e,"collapsed")?e.collapsed:!st(e),i;return t&&(qn(t,"collapsed")||qn(t,"isExpanded"))?i=qn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function nx(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(kl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&c2(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),a2(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Sd(p.$descriptor),h=Sd(f.$descriptor,!0),y=l2(g,h);U(f,Ai(c,s2));var C=it(y,function(v){return v==="eventDefinitions"?ix(s,c.eventDefinitionType):v==="loopCharacteristics"?!In(f):qn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!In(f):!0});if(f=n.copyElement(p,f,C),c.eventDefinitionType&&(ix(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(kl(p))d.isExpanded=st(s);else if(c&&qn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}st(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(kl(p)&&!kl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var m=gn(s);lt(s).isHorizontal||(lt(d).isHorizontal=m),d.width=m?s.width:t.getDefaultSize(d).width,d.height=m?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,nt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&nt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}nx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function kl(e){return M(e,"bpmn:SubProcess")}function ix(e,t){var n=ue(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function l2(e,t){return e.filter(function(n){return t.includes(n)})}const rx={__depends__:[Jb,o2,xi],bpmnReplace:["type",nx]};var u2=250;function bo(e){this._eventBus=e,this._tools=[],this._active=null}bo.$inject=["eventBus"],bo.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)},bo.prototype.isActive=function(e){return e&&this._active===e},bo.prototype.length=function(e){return this._tools.length},bo.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},bo.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),z(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,u2,function(r){this._active&&(p2(r)||this.setActive(null))},this)};function p2(e){var t=e.originalEvent&&e.originalEvent.target;return t&&lo(t,'.group[data-group="tools"]')}const Ol={__depends__:[lr],__init__:["toolManager"],toolManager:["type",bo]};function f2(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 d2(e,t){var n=[],i=new Set(e);z(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;z(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function h2(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Cd=Math.abs,m2=Math.round,ur={x:"width",y:"height"},ox="crosshair",Nr={n:"top",w:"left",s:"bottom",e:"right"},g2=1500,Dl={n:"s",w:"e",s:"n",e:"w"},Ll=20;function _i(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",g2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&sx(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){sx(c);var h={x:0,y:0};h[u]=m2(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}_i.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],_i.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:ox,data:{context:{reactivate:n}},trapClick:!1})},_i.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:ox,data:{context:{}}})},_i.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},_i.prototype.init=function(e,t){var n=Cd(e.dx)>Cd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Cd(i)<5)return!1;i<0&&(i*=-1),hs(e)&&(i*=-1);var o=f2(n,i),a=this._canvas.getRootElement();!_l(e)&&e.hover&&(a=e.hover);var s=[...Qa(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=y2(c,n,o,r,l);return U(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Pl("resize-"+(n==="x"?"ew":"ns")),!0},_i.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||et(d))){if(Rt(d)){u.push(d);return}var g=d[t],h=g+d[ur[t]];if(v2(d)&&(n>0&&je(d)[t]>i||n<0&&je(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),z(o,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,y=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:o,resizingShapes:a}},_i.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},_i.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function ax(e){return{top:e.top-Ll,right:e.right+Ll,bottom:e.bottom+Ll,left:e.left-Ll}}function sx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ze(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ze(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ze(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ze(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function y2(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),p=new Set(a);return z(a,function(f){var d=f.attachers,g=f.children,h=Be(f),y=it(g,function(j){return!Rt(j)&&!et(j)&&!u.has(j)&&!p.has(j)}),C=it(g,function(j){return!Rt(j)&&!et(j)&&u.has(j)}),x,m,v,_=[],S=[],k,O,N,P;y.length&&(m=ax(Be(Jt(y))),x=i-h[Nr[n]]+m[Nr[n]],n==="n"?s.bottom=l=ze(l)?Math.min(l,x):x:n==="w"?s.right=l=ze(l)?Math.min(l,x):x:n==="s"?s.top=c=ze(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ze(c)?Math.max(c,x):x)),C.length&&(v=ax(Be(Jt(C))),x=i-v[Nr[Dl[n]]]+h[Nr[Dl[n]]],n==="n"?s.bottom=l=ze(l)?Math.min(l,x):x:n==="w"?s.right=l=ze(l)?Math.min(l,x):x:n==="s"?s.top=c=ze(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ze(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(j){u.has(j)?_.push(j):S.push(j)}),_.length&&(k=Be(Jt(_.map(je))),O=h[Nr[Dl[n]]]-(k[Nr[Dl[n]]]-i)),S.length&&(N=Be(Jt(S.map(je))),P=N[Nr[n]]-(h[Nr[n]]-i)),n==="n"?(x=Math.min(O||1/0,P||1/0),s.bottom=l=ze(l)?Math.min(l,x):x):n==="w"?(x=Math.min(O||1/0,P||1/0),s.right=l=ze(l)?Math.min(l,x):x):n==="s"?(x=Math.max(O||-1/0,P||-1/0),s.top=c=ze(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(O||-1/0,P||-1/0),s.left=c=ze(c)?Math.max(c,x):x));var D=r&&r[f.id];D&&(n==="n"?(x=i+f[ur[t]]-D[ur[t]],s.bottom=l=ze(l)?Math.min(l,x):x):n==="w"?(x=i+f[ur[t]]-D[ur[t]],s.right=l=ze(l)?Math.min(l,x):x):n==="s"?(x=i-f[ur[t]]+D[ur[t]],s.top=c=ze(c)?Math.max(c,x):x):n==="e"&&(x=i-f[ur[t]]+D[ur[t]],s.left=c=ze(c)?Math.max(c,x):x))}),s}}function v2(e){return!!e.host}var Md="djs-dragging",cx="djs-resizing",b2=250,Il=Math.max;function lx(e,t,n,i,r){function o(a,s){z(a,function(c){r.addDragger(c,s),n.addMarker(c,Md)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),We(s,u);var p=Oe("path");Se(p,"d",l.x),ct(p).add("djs-crosshair"),We(u,p);var f=Oe("path");Se(f,"d",l.y),ct(f).add("djs-crosshair"),We(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Cn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&cn(c)}),e.on("spaceTool.move",b2,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),Se(c,"d","M0,0 L0,0"),ct(c).add("djs-crosshair"),We(f,c),s.line=c;var d=Oe("g");Se(d,i.cls("djs-drag-group",["no-events"])),We(n.getActiveLayer(),d),o(u,d);var g=new Set(u);z(p,function(S){g.add(S)});var h=new Set,y=s.movingConnections=[];g.forEach(function(S){z(S.outgoing,function(k){h.has(k)||!Rt(k)||!g.has(k.target)||(h.add(k),y.push(k))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var C=Oe("g");Se(C,i.cls("djs-frame-group",["no-events"])),We(n.getActiveLayer(),C);var x=[];z(p,function(S){var k=r.addFrame(S,C),O=k.getBBox();x.push({element:k,initialBounds:O}),n.addMarker(S,cx)}),s.frameGroup=C,s.frames=x}var m={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:m[l]});var v={x:"y",y:"x"},_={x:a.dx,y:a.dy};_[v[s.axis]]=0,Cn(s.dragGroup,_.x,_.y),z(s.frames,function(S){var k=S.element,O=S.initialBounds,N,P;s.direction==="e"?Se(k,{width:Il(O.width+_.x,5)}):(N=Il(O.width-_.x,5),Se(k,{width:N,x:O.x+O.width-N})),s.direction==="s"?Se(k,{height:Il(O.height+_.y,5)}):(P=Il(O.height-_.y,5),Se(k,{height:P,y:O.y+O.height-P}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,Md)}),z(l,function(g){n.removeMarker(g,Md)}),f&&(cn(p),cn(f)),z(u,function(g){n.removeMarker(g,cx)}),d&&cn(d)})}lx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const x2={__init__:["spaceToolPreview"],__depends__:[lr,Ui,Ol,va,ys],spaceTool:["type",_i],spaceToolPreview:["type",lx]};function Bl(e,t){e.invoke(_i,this),this._canvas=t}Bl.$inject=["injector","canvas"],Ee(Bl,_i),Bl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=No(ea(r.children.filter(l=>M(l,"bpmn:Artifact")),Jt(o))));const s=[...e,...a];var c=_i.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||_2(l)&&(t==="y"&&gn(l)||t==="x"&&!gn(l)))}),c};function _2(e){return M(e,"bpmn:Participant")&&!ue(e).processRef}const ux={__depends__:[x2],spaceTool:["type",Bl]};function jt(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)}jt.$inject=["eventBus","injector"],jt.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()},jt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},jt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},jt.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()}},jt.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()}},jt.prototype.register=function(e,t){this._setHandler(e,t)},jt.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)},jt.prototype.canUndo=function(){return!!this._getUndoAction()},jt.prototype.canRedo=function(){return!!this._getRedoAction()},jt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},jt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},jt.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)})},jt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},jt.prototype._createId=function(){return this._uid++},jt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},jt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},jt.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)},jt.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:am("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},jt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Fe(e)?e:[e],t.dirty=t.dirty.concat(e))},jt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},jt.prototype._revertedAction=function(e){this._stackIdx--},jt.prototype._getHandler=function(e){return this._handlerMap[e]},jt.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 w2={commandStack:["type",jt]};function $r(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 E2=250,px=1400;function Ad(e,t,n){le.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",px,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=fx(a),o.validatedShapes=fx(s)}),i&&t.on("shape.move.start",E2,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",px,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;$r(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=sf(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Xt(s.labels,a,c),a.labelTarget=s)})}Ee(Ad,le),Ad.$inject=["injector","eventBus","modeling"];function fx(e){var t=new Set(e);return it(e,function(n){return!t.has(n.labelTarget)})}const S2={__init__:["labelSupport"],labelSupport:["type",Ad]};var R2=251,dx=1401,hx="attach-ok";function Pd(e,t,n,i,r){le.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",dx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=C2(c),s.validatedShapes=M2(l)}),o&&t.on("shape.move.start",R2,function(a){var s=a.context,c=s.shapes,l=Td(c);z(l,function(u){o.makeDraggable(s,u,!0),z(u.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,hx),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,hx)}))}}),this.preExecuted("elements.move",dx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Td(l);z(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=it(c,function(p){var f=p.host;return A2(p)&&!P2(c,f)}),z(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),z(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;$r(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&z(l.attachers,function(u){var p=Ov(u,c,l);r.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=Ov(d,l,u);r.moveShape(d,g,d.parent),z(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;$r(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(Pd,le),Pd.$inject=["injector","eventBus","canvas","rules","modeling"];function Td(e){return np(Tn(e,function(t){return t.attachers||[]}))}function C2(e){var t=Td(e);return l1("id",e,t)}function M2(e){var t=$o(e,"id");return it(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function A2(e){return!!e.host}function P2(e,t){return e.indexOf(t)!==-1}const T2={__depends__:[Ui],__init__:["attachSupport"],attachSupport:["type",Pd]};function mx(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(sy(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}mx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const kd={__init__:["changeSupport"],changeSupport:["type",mx]};function wi(e){this._model=e}wi.$inject=["moddle"],wi.prototype._needsId=function(e){return nt(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"])},wi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":nt(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))},wi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},wi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},wi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",U({bpmnElement:e,bounds:this.createDiBounds()},t))},wi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},wi.prototype.createDiWaypoints=function(e){var t=this;return Tn(e,function(n){return t.createDiWaypoint(n)})},wi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Ai(e,["x","y"]))},wi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",U({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},wi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",U({bpmnElement:e},t))};function ei(e,t,n){le.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},y;!g.cropped&&h.createElementsBehavior!==!1&&(y=g.connection,y.waypoints=n.getCroppedWaypoints(y),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,y=g.parent||g.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ti(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ti(a));function s(d){var g=d.context,h=g.oldRoot,y=h.children;z(y,function(C){M(C,"bpmn:BaseElement")&&i.updateParent(C)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],ti(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],ti(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],ti(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ti(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ti(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ti(u)),this.executed("connection.reconnect",ti(function(d){var g=d.context,h=g.connection,y=g.oldSource,C=g.newSource,x=ue(h),m=ue(y),v=ue(C);x.conditionExpression&&!nt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),y!==C&&m.default===x&&(g.oldDefault=m.default,delete m.default)})),this.reverted("connection.reconnect",ti(function(d){var g=d.context,h=g.connection,y=g.oldSource,C=g.newSource,x=ue(h),m=ue(y),v=ue(C);g.oldConditionExpression&&(x.conditionExpression=g.oldConditionExpression),g.oldDefault&&(m.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],ti(p)),this.reverted(["element.updateAttachment"],ti(p)),this.executed("element.updateLabel",ti(f)),this.reverted("element.updateLabel",ti(f));function f(d){const{element:g}=d.context,h=pi(g),y=lt(g),C=y&&y.get("label");kr(g)||wl(g)||(h&&!C?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&C&&y.set("label",void 0))}}Ee(ei,le),ei.$inject=["eventBus","bpmnFactory","connectionDocking"],ei.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ei.prototype.updateParent=function(e,t){if(!et(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=lt(e),o=n&&n.businessObject,a=lt(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),M(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},ei.prototype.updateBounds=function(e){var t=lt(e),n=O2(e);if(n){var i=Ti(n,t.get("bounds"));U(n,{x:e.x+i.x,y:e.y+i.y})}var r=et(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),U(o,{x:e.x,y:e.y,width:e.width,height:e.height})},ei.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),qt(i,e)),M(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Xt(r,e))}},ei.prototype.updateDiConnection=function(e,t,n){var i=lt(e),r=lt(t),o=lt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ue(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ue(n)&&(i.targetElement=n&&o)},ei.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(qt(n,e),e.$parent=null)}};function k2(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ei.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},ei.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=k2(e.$parent||t),e.$parent&&(qt(o.get("rootElements"),r),r.$parent=null),t&&(Xt(o.get("rootElements"),r),r.$parent=o))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),qt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);qt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ei.prototype.updateConnectionWaypoints=function(e){var t=lt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ei.prototype.updateConnection=function(e){var t=e.connection,n=ue(t),i=t.source,r=ue(i),o=t.target,a=ue(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(qt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(qt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},ei.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function ti(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function O2(e){if(M(e,"bpmn:Activity")){var t=lt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Fr(e,t){or.call(this),this._bpmnFactory=e,this._moddle=t}Ee(Fr,or),Fr.$inject=["bpmnFactory","moddle"],Fr.prototype._baseCreate=or.prototype.create,Fr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,U({type:"label",di:n},ho,t))}return this.createElement(e,t)},Fr.prototype.createElement=function(e,t){t=U({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!L2(r)){var o=U({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}M(i,"bpmn:Group")&&(t=U({isFrame:!0},t)),t=D2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Od(r,t,"isExpanded")),nt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Od(r,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!st(i,r)),M(i,"bpmn:ExclusiveGateway")&&(qn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),an(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),an(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=U({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Fr.prototype.getDefaultSize=function(e,t){var n=ue(e);if(t=t||lt(e),M(n,"bpmn:SubProcess"))return st(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return st(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Fr.prototype.createParticipantShape=function(e){return fn(e)||(e={isExpanded:e}),e=U({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function D2(e,t,n){return z(n,function(i){t=Od(e,t,i)}),t}function Od(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ii(t,[n]))}function L2(e){return nt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Nl(e,t){this._modeling=e,this._canvas=t}Nl.$inject=["modeling","canvas"],Nl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(r){var o={x:0,y:0};an(i.left)?o.x=i.left-r.x:an(i.right)?o.x=i.right-r.width-r.x:an(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:an(i.top)?o.y=i.top-r.y:an(i.bottom)?o.y=i.bottom-r.height-r.y:an(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Nl.prototype.postExecute=function(e){};function $l(e){this._modeling=e}$l.$inject=["modeling"],$l.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},$l.prototype.postExecute=function(e){var t=e.hints||{};I2(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 I2(e,t){return br(e.outgoing,function(n){return n.target===t})}function Fl(e,t){this._canvas=e,this._layouter=t}Fl.$inject=["canvas","layouter"],Fl.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Fl.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var jl=Math.round;function Dd(e){this._modeling=e}Dd.$inject=["modeling"],Dd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;z(t,function(p){ze(p.x)||(p.x=0),ze(p.y)||(p.y=0)});var s=it(t,function(p){return!p.hidden}),c=Jt(s);z(t,function(p){Rt(p)&&(p.waypoints=Tn(p.waypoints,function(f){return{x:jl(f.x-c.x-c.width/2+r.x),y:jl(f.y-c.y-c.height/2+r.y)}})),U(p,{x:jl(p.x-c.x-c.width/2+r.x),y:jl(p.y-c.y-c.height/2+r.y)})});var l=new Set(zc(t)),u={};z(t,function(p){if(Rt(p)){u[p.id]=ze(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,o):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,o);return}var f=U({},o);l.has(p)||(f.autoResize=!1),et(p)&&(f=Ii(f,["attach"])),u[p.id]=ze(i)?a.createShape(p,Ai(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Ai(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=No(u)};var gx=Math.round;function jr(e){this._canvas=e}jr.$inject=["canvas"],jr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?U(t,n):U(t,{x:n.x-gx(t.width/2),y:n.y-gx(t.height/2)}),this._canvas.addShape(t,i,r),t},jr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function bs(e){jr.call(this,e)}Ee(bs,jr),bs.$inject=["canvas"];var B2=jr.prototype.execute;bs.prototype.execute=function(e){var t=e.shape;return $2(t),t.labelTarget=e.labelTarget,B2.call(this,e)};var N2=jr.prototype.revert;bs.prototype.revert=function(e){return e.shape.labelTarget=null,N2.call(this,e)};function $2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xs(e,t){this._canvas=e,this._modeling=t}xs.$inject=["canvas","modeling"],xs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;$r(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),$r(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=sf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Xt(n.children,t,i),this._canvas.addConnection(t,n),t};function Ld(e,t){this._modeling=e,this._elementRegistry=t}Ld.$inject=["modeling","elementRegistry"],Ld.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function _s(e,t){this._canvas=e,this._modeling=t}_s.$inject=["canvas","modeling"],_s.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;$r(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),$r(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),$r(n.children,function(i){Rt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},_s.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=sf(i.children,n),t.removeShape(n),n},_s.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Xt(i.children,n,r),t.addShape(n,i),n};function Hl(e){this._modeling=e}Hl.$inject=["modeling"];var yx={x:"y",y:"x"};Hl.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,C){y.range.min=Math.min(C[i],y.range.min),y.range.max=Math.max(C[i]+C[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,C){var x={y:0};x[i]=y-a(C),x[i]&&(x[yx[i]]=0,t.moveElements([C],x,C.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(y,C){var x,m,v;if(y.elements.length<2){C&&C!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}x=Li(y.elements,i),m=x[0],C===p&&(m=x[s(x)]),v=a(m),y.range=null,z(x,function(_){if(l(v,_),y.range===null){y.range={min:_[i],max:_[i]+_[r]};return}o(y,_)}),C&&C!==n.length-1&&(h+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(y,C){var x={},m;y===u||y===f||(m=n[C-1],y.range.max=0,z(y.elements,function(v,_){x[yx[i]]=0,x[i]=m.range.max-v[i]+d,y.range.min!==v[i]&&(x[i]+=v[i]-y.range.min),x[i]&&t.moveElements([v],x,v.parent),y.range.max=Math.max(v[i]+v[r],_?y.range.max:0)}))})},Hl.prototype.postExecute=function(e){};function zl(e,t){this._layouter=e,this._canvas=t}zl.$inject=["layouter","canvas"],zl.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return U(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},zl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Id(){}Id.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=qt(o.children,t),Xt(i.children,t,r),t.parent=i,z(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Id.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return qt(n.children,t),Xt(i.children,t,r),t.parent=i,z(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Bd(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Bd.prototype.add=function(e,t){return this.addAll([e],t)},Bd.prototype.addAll=function(e,t){var n=hM(e,!!t,this);return U(this,n),this};function ws(e){this._modeling=e}ws.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ws.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),z(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,l[p.id]&&!u&&n):o.layoutConnection(p,{connectionStart:f&&Gf(p,p.source,t),connectionEnd:d&&Vf(p,p.target,t)})})},ws.prototype.getClosure=function(e){return new Bd().addAll(e,!0)};function Gl(e){this._helper=new ws(e)}Gl.$inject=["modeling"],Gl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Gl.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 xo(e){this._modeling=e,this._helper=new ws(e)}xo.$inject=["modeling"],xo.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=Ai(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=qt(o.children,t),Xt(i.children,t,r),U(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},xo.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(z(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Vf(o,t,n)})}),z(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Gf(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},xo.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Xt(n.children,t,i),U(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},xo.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},xo.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Es(e){this._modeling=e}Es.$inject=["modeling"],Es.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Fe(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Es.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||vx(Fe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||vx(Fe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Es.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function vx(e){return e.original||e}function pr(e,t){this._modeling=e,this._rules=t}pr.$inject=["modeling","rules"],pr.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,y){return i.allowed("connection.reconnect",{connection:y,source:g,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();z(f,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,gl(g,s,u),a)}),z(d,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,ml(g,s,u),a)})},pr.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},pr.prototype.execute=function(e){},pr.prototype.revert=function(e){},pr.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},pr.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},pr.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ss(e){this._modeling=e}Ss.$inject=["modeling"],Ss.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},U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ss.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(z(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:gl(o,n,i)})}),z(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ml(o,n,i)})}))},Ss.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Hr(e){this._modeling=e}Hr.$inject=["modeling"],Hr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),z(r,function(s){a[s.id]=j2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(d2(i,r),t,n,o,i,r,a)},Hr.prototype.execute=function(){},Hr.prototype.revert=function(){},Hr.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Hr.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(r){var o=h2(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);z(e,function(u){var p=u.source,f=u.target,d=F2(u),g=xx(n),h={},y=c.has(p)||l.has(p),C=c.has(f)||l.has(f);y&&C?(d=Tn(d,function(x){return _x(x,i,n)&&(x[g]=x[g]+t[g]),x.original&&_x(x.original,i,n)&&(x.original[g]=x.original[g]+t[g]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||C)&&(c.has(p)?h.connectionStart=Gf(u,p,t):c.has(f)?h.connectionEnd=Vf(u,f,t):l.has(p)?h.connectionStart=ml(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=gl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function bx(e){return U({},e)}function F2(e){return Tn(e.waypoints,function(t){return t=bx(t),t.original&&(t.original=bx(t.original)),t})}function xx(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function _x(e,t,n){var i=xx(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function j2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Vl(e){this._modeling=e}Vl.$inject=["modeling"],Vl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=wx(n),t.collapsed=!t.collapsed;var i=Ex(n,t.collapsed);return[t].concat(i)},Vl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Sx(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function wx(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=U({},t,wx(n.children)))}),t}function Ex(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Ex(i.children,i.collapsed||t)))}),n}function Sx(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Sx(i.children,t)))}),n}function Wl(e){this._modeling=e}Wl.$inject=["modeling"],Wl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Rx(i,t),Cx(n,t),t.host=n,t},Wl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Rx(n,t),Cx(i,t,r),t};function Rx(e,t){return qt(e&&e.attachers,t)}function Cx(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Xt(i,t,n)}}function Nd(){}Nd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Nd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ct(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ct.$inject=["eventBus","elementFactory","commandStack"],Ct.prototype.getHandlers=function(){return{"shape.append":$l,"shape.create":jr,"shape.delete":_s,"shape.move":xo,"shape.resize":Ss,"shape.replace":pr,"shape.toggleCollapse":Vl,spaceTool:Hr,"label.create":bs,"connection.create":Fl,"connection.delete":xs,"connection.move":Id,"connection.layout":zl,"connection.updateWaypoints":Nd,"connection.reconnect":Es,"elements.create":Dd,"elements.move":Gl,"elements.delete":Ld,"elements.distribute":Hl,"elements.align":Nl,"element.updateAttachment":Wl}},Ct.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ct.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Ct.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ct.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Ct.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Ct.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ct.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},Ct.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},Ct.prototype.createElements=function(e,t,n,i,r){Fe(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},Ct.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Ct.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},Ct.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ct.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ct.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ct.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ct.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ct.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ct.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Ct.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},Ct.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ct.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},Ct.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,U(i,{docking:"source"}))},Ct.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,U(i,{docking:"target"}))},Ct.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ct.prototype._create=function(e,t){return JM(t)?t:this._elementFactory.create(e,t)},Ct.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Rs(e){this._elementRegistry=e}Rs.$inject=["elementRegistry"],Rs.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||H2(n,cc(i));return Mx(n,i),e.oldProperties=o,e.changed=r,r},Rs.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Mx(n,t),i},Rs.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?z2(e,t):[]};function H2(e,t){return Yn(t,function(n,i){return n[i]=e.get(i),n},{})}function Mx(e,t){z(t,function(n,i){e.set(i,n)})}function z2(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&ue(n).dataObjectRef===e})}var Cs="default",fr="id",Ax="di",G2={width:0,height:0};function Ms(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ms.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ms.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=Y2(e.properties),s=e.oldProperties||V2(t,a);return Px(a,o)&&(r.unclaim(o[fr]),i.updateId(t,a[fr]),r.claim(a[fr],o)),Cs in a&&(a[Cs]&&n.push(i.get(a[Cs].id)),o[Cs]&&n.push(i.get(o[Cs].id))),Tx(t,a),e.oldProperties=s,e.changed=n,n},Ms.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ue(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,G2)}},Ms.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Tx(t,i),Px(n,r)&&(a.unclaim(n[fr]),o.updateId(t,i[fr]),a.claim(i[fr],r)),e.changed};function Px(e,t){return fr in e&&e[fr]!==t[fr]}function V2(e,t){var n=cc(t),i=e.businessObject,r=lt(e);return Yn(n,function(o,a){return a!==Ax?o[a]=i.get(a):o[a]=W2(r,cc(t.di)),o},{})}function W2(e,t){return Yn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Tx(e,t){var n=e.businessObject,i=lt(e);z(t,function(r,o){o!==Ax?n.set(o,r):i&&U2(i,r)})}function U2(e,t){z(t,function(n,i){e.set(i,n)})}var q2=["default"];function Y2(e){var t=U({},e);return q2.forEach(function(n){n in e&&(t[n]=ue(t[n]))}),t}function Ul(e,t){this._canvas=e,this._modeling=t}Ul.$inject=["canvas","modeling"],Ul.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=lt(r);return t.setRootElement(n),t.removeRootElement(r),Xt(a.rootElements,i),i.$parent=a,qt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Ul.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=lt(n);return t.setRootElement(r),t.removeRootElement(n),qt(a.rootElements,i),i.$parent=null,Xt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function $d(e,t){this._modeling=e,this._spaceTool=t}$d.$inject=["modeling","spaceTool"],$d.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=vi(i),a=o===i,s=a?i:i.parent,c=Dr(s),l=gn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+yi,y:i.y,width:i.width-yi,height:i.height}:{x:i.x,y:i.y+yi,width:i.width,height:i.height-yi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];po(o,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:it(v.children,function(_){return _!==i})});var f,d,g,h,y;r==="top"?(f=-120,d=i.y,g=d+10,h="n",y="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",y="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",y="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",y="x");var C=t.calculateAdjustments(p,y,f,g),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(C.movingShapes,C.resizingShapes,x,h,g);var m=l?{x:i.x+(a?yi:0),y:d-(r==="top"?120:0),width:i.width-(a?yi:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?yi:0),width:120,height:i.height-(a?yi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},m,s)};function Fd(e){this._modeling=e}Fd.$inject=["modeling"],Fd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Dr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=gn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+yi,y:n.y+f*c,width:n.width-yi,height:l}:{x:n.x+f*c,y:n.y+yi,width:l,height:n.height-yi},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function As(e,t){this._modeling=e,this._spaceTool=t}As.$inject=["modeling","spaceTool"],As.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},As.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=zP(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},As.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Be(e),r=Be(t),o=cv(r,i),a=vi(e),s=[],c=[];po(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Ps="flowNodeRef",jd="lanes";function ql(){}ql.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Be(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var p=vi(u);return r[p.id]||(r[p.id]=ul(p)),r[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=vi(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(jd),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Ps).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},ql.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(jd);n.remove.forEach(function(o){qt(r,o),qt(o.get(Ps),i)}),n.add.forEach(function(o){Xt(r,o),Xt(o.get(Ps),i)})}),[]},ql.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(jd);n.add.forEach(function(o){qt(r,o),qt(o.get(Ps),i)}),n.remove.forEach(function(o){Xt(r,o),Xt(o.get(Ps),i)})}),[]};var Hd="categoryValueRef";function Ts(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ts.$inject=["bpmnFactory","elementRegistry"],Ts.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(x,m,v){if(m){var _=a.get(x);_||(_={},a.set(x,_)),!(v&&_.present)&&(!v&&_.past||(v?_.present={categoryValue:m,root:zd(x)}:_.past={categoryValue:m}))}}function c(x){r.set(x,ue(x))}function l(){n.filter(function(x){return M(x,"bpmn:FlowElement")&&!et(x)&&x.parent}).forEach(c)}function u(x){var m=ue(x),v=m.get("categoryValueRef");return v||(v=iv(i,m),o.push(K2(x,v))),v}function p(x){return x.reduce(function(m,v){var _=zd(v),S=m.get(_);return S||(S=[],m.set(_,S)),S.push(v),m},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return M(x,"bpmn:Group")&&!et(x)&&x.parent}).forEach(function(x){var m=ue(x).get("categoryValueRef");if(!m){var v=zd(x),_=f.get(v)||[],S=ea(_,x),k=Object.keys(S).length>0;k&&(m=u(x))}s(x,m,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(x,m){return m.present&&x.add(m.present.categoryValue),m.past&&x.add(m.past.categoryValue),x},new Set),h=new Map,y=p(d);a.forEach(function(x,m){var v=x.present;if(v){var _=y.get(v.root)||[],S=ea(_,m);_.forEach(function(k){if(S[k.id]){var O=h.get(k);O||(O=new Set,h.set(k,O)),O.add(v.categoryValue)}})}});var C=d.reduce(function(x,m){var v=r.get(m),_=v.get(Hd),S=new Set(_),k=h.get(m)||new Set,O=Array.from(k).filter(function(P){return!S.has(P)}),N=_.filter(function(P){return g.has(P)&&!k.has(P)});return(O.length||N.length)&&x.push({businessObject:v,categoryValuesToAdd:O,categoryValuesToRemove:N}),x},[]);return{flowElements:C,groups:o}},Ts.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),X2(t.groups),Q2(t.flowElements),[]},Ts.prototype.revert=function(e){var t=e.updates;return J2(t.flowElements),Z2(t.groups),[]};function K2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function X2(e){e.forEach(function(t){ue(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function Z2(e){e.forEach(function(t){ue(t.groupShape).categoryValueRef=null})}function Q2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Hd);t.categoryValuesToRemove.forEach(function(r){qt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Xt(i,r,!0)})})}function J2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Hd);t.categoryValuesToAdd.forEach(function(r){qt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Xt(i,r,!0)})})}function zd(e){for(;e.parent;)e=e.parent;return e}function Yl(e){this._moddle=e}Yl.$inject=["moddle"],Yl.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Yl.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var eO={fill:void 0,stroke:void 0};function Gd(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Un(t)){var n=tO(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Gd.$inject=["commandStack"],Gd.prototype.postExecute=function(e){var t=e.elements,n=e.colors||eO,i=this,r={};"fill"in n&&U(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&U(r,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(o){var a=Rt(o)?Ai(r,["border-color"]):r,s=lt(o);if(nO(a),et(o)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!nt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function tO(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 nO(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var iO={width:0,height:0};function kx(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return kA(u,l),[u,p]}function r(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!et(l)&&kr(l)&&!Zc(l)&&!Ox(p)){var f=7,d=df(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=pi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!et(u)&&!M(u,"bpmn:TextAnnotation"))){if(et(u)&&Ox(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=pi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,iO)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}kx.$inject=["modeling","textRenderer","bpmnFactory"];function Ox(e){return!e||!e.trim()}function An(e,t,n,i){Ct.call(this,e,t,n),this._bpmnRules=i}Ee(An,Ct),An.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],An.prototype.getHandlers=function(){var e=Ct.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Rs,e["element.updateProperties"]=Ms,e["canvas.updateRoot"]=Ul,e["lane.add"]=$d,e["lane.resize"]=As,e["lane.split"]=Fd,e["lane.updateRefs"]=ql,e["group.updateRefs"]=Ts,e["id.updateClaim"]=Yl,e["element.setColor"]=Gd,e["element.updateLabel"]=kx,e},An.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},An.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},An.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},An.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},An.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},An.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},An.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},An.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},An.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},An.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},An.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},An.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},An.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},An.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Dx(){}Dx.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||je(t.source||e.source),t.connectionEnd||je(t.target||e.target)]};var Kl=20,rO=5,Xl=Math.round,Lx=20,oO={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function aO(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function sO(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ix(e,t,n){var i=Rn(t,e,rO),r=n.split(":")[0],o=Xl((t.x-e.x)/2+e.x),a=Xl((t.y-e.y)/2+e.y),s,c,l=sO(r,i),u=/h|r|l/.test(r),p=!1,f=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=aO(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+Kl*(/l/.test(r)?-1:1),y:f?a+Kl:a}):(f=o===e.x,s={x:f?o+Kl:o,y:e.y+Kl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Vd(e,s,c).concat(s),directions:c,turnNextDirections:f}}function cO(e,t,n){return Ix(e,t,n)}function lO(e,t,n){var i=Ix(t,e,Bx(n));return{waypoints:i.waypoints.slice().reverse(),directions:Bx(i.directions),turnNextDirections:i.turnNextDirections}}function uO(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=Vd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Bx(e){return e.split(":").reverse().join(":")}function pO(e,t,n){var i=Xl((t.x-e.x)/2+e.x),r=Xl((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Vd(e,t,n){if(n=n||"h:h",!xO(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if($x(n)){var i=cO(e,t,n),r=lO(e,t,n),o=uO(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return pO(e,t,n)}function fO(e,t,n){var i=Vd(e,t,n);return i.unshift(e),i.push(t),jx(i)}function dO(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=s1(o,"straight")[0]||"h:h",s=oO[a]||0,c=Rn(e,t,s),l=bO(c,a);n=n||je(e),i=i||je(t);var u=l.split(":"),p=Fx(n,e,u[0],_O(c)),f=Fx(i,t,u[1],c);return fO(p,f,l)}function hO(e,t,n,i,r,o){Fe(n)&&(r=n,o=i,n=je(e),i=je(t)),o=U({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&gO(e,t,n,i,o),c||(c=o.connectionEnd&&vO(t,e,i,r),c)||(c=o.connectionStart&&yO(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:dO(e,t,n,i,o)}function mO(e,t,n){return e>=t&&e<=n}function Nx(e,t,n){var i={x:"width",y:"height"};return mO(t[e],n[e],n[e]+n[i[e]])}function gO(e,t,n,i,r){var o={},a,s;return s=Rn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Nx(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:Nx(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function yO(e,t,n,i){return Wd(e,t,n,i)}function vO(e,t,n,i){var r=i.slice().reverse();return r=Wd(e,t,n,r),r?r.reverse():null}function Wd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!Tt(u,function(p,f){var d=u[f-1];return d&&es(p,d)<3})}function o(u,p,f){var d=ir(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(ly(u[d],p,Lx)||ly(u[d],f,Lx))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Wd(e,t,n,l)),c&&ir(c)?null:c}function bO(e,t){if($x(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 xO(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function $x(e){return e&&/t|r|b|l/.test(e)}function _O(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 Fx(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 jx(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return cf(r,o,n,0)||t.push(n),t},[])}var wO=-10,EO=40,SO={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},RO={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},Ud={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ks={top:"t",right:"r",bottom:"b",left:"l"};function Zl(e){this._elementRegistry=e}Ee(Zl,Dx),Zl.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(o||(o=Hx(r&&r[0],n)),a||(a=Hx(r&&r[r.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&r&&!zx(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=Jy(n,s)?SO:RO;return M(e,"bpmn:MessageFlow")?c=MO(n,i,u):(M(e,"bpmn:SequenceFlow")||zx(n,i))&&(n===i?c={preferredLayouts:DO(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:LO(n,i,a,u)}:Os(n)||Os(i)?c={preferredLayouts:u.subProcess,preserveDocking:PO(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=U(c,t),l=jx(hO(n,i,o,a,r,c))),l||[o,a]};function CO(e){var t=e.host;return Rn(je(e),t,wO)}function MO(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:AO(e,t)}}function AO(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Os(t)?"source":Os(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function PO(e){return Os(e)?"target":"source"}function Hx(e,t){return e?e.original||e:je(t)}function zx(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Os(e){return M(e,"bpmn:SubProcess")&&st(e)}function _o(e,t){return e===t}function TO(e,t){return t.indexOf(e)!==-1}function ba(e){var t=/right|left/.exec(e);return t&&t[0]}function xa(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Gx(e,t){return Ud[e]===t}function kO(e,t){var n=ba(e),i=Ud[n];return t.indexOf(i)!==-1}function OO(e,t){var n=xa(e),i=Ud[n];return t.indexOf(i)!==-1}function Vx(e){return e==="right"||e==="left"}function DO(e,t,n){var i=t.waypoints,r=i&&i.length&&Rn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function LO(e,t,n,i){var r=je(e),o=je(t),a=CO(e),s,c,l=_o(e.host,t),u=TO(a,["top","right","bottom","left"]),p=Rn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?IO(a,u,e,t,n,i):(s=BO(a,p,u,i.isHorizontal),c=NO(a,p,u,i.isHorizontal),[s+":"+c])}function IO(e,t,n,i,r,o){var a=t?e:o.isHorizontal?xa(e):ba(e),s=ks[a],c;return t?Vx(e)?c=Wx("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Wx("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Wx(e,t,n,i){var r=EO;return!(qd(e,i,n,r)||qd(e,i,{x:n.x+n.width,y:n.y+n.height},r)||qd(e,i,je(t),r))}function qd(e,t,n,i){return Math.abs(t[e]-n[e])<i}function BO(e,t,n,i){if(n)return ks[e];var r=xa(e),o=ba(e),a=xa(t),s=ba(t);if(i){if(_o(r,a)||Gx(o,s))return ks[r]}else if(_o(o,s)||Gx(r,a))return ks[o];return ks[i?o:r]}function NO(e,t,n,i){if(n)return Vx(e)?kO(e,t)||_o(e,t)?"h":"v":OO(e,t)||_o(e,t)?"v":"h";var r=xa(e),o=ba(e),a=xa(t),s=ba(t);return a&&!s?"v":s&&!a?"h":i?_o(r,a)?"h":"v":_o(o,s)?"v":"h"}Zl.$inject=["elementRegistry"];function Ux(e){return U({original:e.point.original||e.point},e.actual)}function zr(e,t){this._elementRegistry=e,this._graphicsFactory=t}zr.$inject=["elementRegistry","graphicsFactory"],zr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Ux(i)),o.push(Ux(r)),o},zr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},zr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return ts(i,r,n)},zr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},zr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},zr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Yd={__init__:["modeling","bpmnUpdater"],__depends__:[nk,vk,xk,_k,rx,w2,S2,T2,xi,kd,ux],bpmnFactory:["type",wi],bpmnUpdater:["type",ei],elementFactory:["type",Fr],modeling:["type",An],layouter:["type",Zl],connectionDocking:["type",zr]};var $O=10,qx=50,FO=250;function Kd(e,t,n,i){for(var r;r=jO(e,n,t);)n=i(t,n,r);return n}function Xd(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function jO(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=zO(e);return Tt(r,function(o){if(o===n)return!1;var a=Rn(o,i,$O);return a==="intersect"})}function HO(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||qx,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||FO,c=t.reference||"start";o||(o=WO);function l(g,h){return r==="n"?c==="start"?Be(g).top-Be(h).bottom:c==="center"?Be(g).top-je(h).y:Be(g).top-Be(h).top:r==="w"?c==="start"?Be(g).left-Be(h).right:c==="center"?Be(g).left-je(h).x:Be(g).left-Be(h).left:r==="s"?c==="start"?Be(h).top-Be(g).bottom:c==="center"?je(h).y-Be(g).bottom:Be(h).bottom-Be(g).bottom:c==="start"?Be(h).left-Be(g).right:c==="center"?je(h).x-Be(g).right:Be(h).right-Be(g).right}var u=e.incoming.filter(o).map(function(g){var h=a(g),y=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:y,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),y=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:y,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Yn(f,function(g,h){var y=h.distance,C=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*C,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return d.distance||i}function zO(e){var t=Zd(e);return e.host&&(t=t.concat(Zd(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Zd(i))},[]))),t}function Zd(e){return VO(e).concat(GO(e))}function GO(e){return e.incoming.map(function(t){return t.source})}function VO(e){return e.outgoing.map(function(t){return t.target})}function WO(){return!0}var UO=100;function Yx(e,t,n){e.on("autoPlace",UO,function(i){var r=i.shape,o=i.source;return qO(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}Yx.$inject=["eventBus","modeling","canvas"];function qO(e,t,n){n||(n={});var i=n.defaultDistance||qx,r=je(e),o=Be(e);return{x:o.right+i+t.width/2,y:r.y}}function Kx(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Kx.$inject=["eventBus","selection"];const YO={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Yx],autoPlaceSelectionBehavior:["type",Kx]};function Xx(e,t,n){var i=Jy(e,n);if(M(t,"bpmn:TextAnnotation"))return XO(e,t,i);if(nt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return ZO(e,t,i);if(M(t,"bpmn:FlowNode"))return KO(e,t,i)}function KO(e,t,n){var i=Be(e),r=je(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=HO(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=Rn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+Zx(l,c,o)}:{x:r.x+Zx(l,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Kd(e,t,u,Xd(f))}function Zx(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function XO(e,t,n){var i=Be(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};Rt(e)&&(r=je(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Kd(e,t,r,Xd(a))}function ZO(e,t,n){var i=Be(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Kd(e,t,r,Xd(a))}function Qx(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Xx(r,i,t)})}Qx.$inject=["eventBus","elementRegistry"];const Ql={__depends__:[YO],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Qx]},Jx=[Zy,ss,Yd,Ql,fp];function QO(e={}){Tm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ia({container:t,moddleExtensions:e.moddleExtensions??gc,additionalModules:[...Jx,...e.additionalModules??[]]})}const e_={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","label-over-shape":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},JO={이:["이","가"],을:["을","를"],와:["과","와"]};function eD(e,t){const[n,i]=JO[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const tD={"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":"연관선"},nD="요소";function Qd(e){return(e&&tD[e.type])??nD}const t_=20;function iD(e){const t=e.replace(/\s+/g," ").trim();return t.length>t_?`${t.slice(0,t_)}…`:t}function Jl(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:iD(r.name),a=o===void 0?i+Qd(r):o,s=o===void 0?a:`「${o}」`;return n?s+eD(a,n).slice(a.length):s}function rD(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&Qd(o)===Qd(a);return[Jl(e,t,i),Jl(e,n,r,s?"다른 ":"")]}function oD(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 aD(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const eu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function sD(e,t){const n=(r,o)=>Jl(t,r,o),i=(r,o,a,s)=>rD(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${eu[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${eu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${eu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${eu[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function cD(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Jl(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const n_="기타",Jd={error:0,warning:1,info:2};function i_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ut(i)}`,source:"geometry",code:i.kind,severity:oD(i),targetRefs:aD(i),category:e_[i.kind]??n_,message:sD(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:e_[i.ruleId]??n_,message:cD(i,t)});return n}function r_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function _a(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function eh(e,t){if(t===void 0||e.length===0)return!1;const n=_a(e[0],t);return e.some(i=>_a(i,t)!==n)}function o_(e,t){const n=eh(e,t);return e.slice().sort((i,r)=>(n?Number(_a(r,t))-Number(_a(i,t)):0)||Jd[i.severity]-Jd[r.severity])}const a_="i18n-untranslated",s_="i18n-review-requested",c_=[["untranslated",a_],["reviewRequested",s_]];class th{constructor(t,n,i,r,o,a,s,c){fi(this,"config");fi(this,"displayLocale");this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=r.drawShape.bind(r);r.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=o.activate.bind(o);o.activate=f=>this.withDisplayText(f,()=>u(f));const p=o.update.bind(o);o.update=(f,d,g,h)=>{const y=this.resolve(f);if(!y||y.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(uc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(uc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,r,o;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((r=n==null?void 0:n.get)==null?void 0:r.call(n,"xml:lang"))??((o=n==null?void 0:n.$attrs)==null?void 0:o["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=ro(n);if(!i)return;const r=this.displayLocale,o=i.target[i.key]??"",a=Ho(n).filter(f=>kn(f)),s=f=>f.body??"",c=a.find(f=>kn(f)===r&&s(f)),l=xr(n).some(f=>f.locale===r)?"reviewRequested":"ok";if(!o)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===o).map(kn);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(r)?{text:o,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:o,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var o;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let r=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((o=this.resolve(a))==null?void 0:o.status)===n&&r++}finally{this.displayLocale=i}return r}withDisplayText(t,n,i){var f;if(!this.config)return n();const r=this.resolve(t),o=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(o)for(const[d,g]of c_)o.toggle(g,(r==null?void 0:r.status)===d);if(!r||r.native)return n();const{target:a,key:s}=ro((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===r.text)return n();a[s]=r.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,r.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:r}=t,o=this.textRenderer.getExternalLabelBounds(t,n);return t.width=o.width,t.height=o.height,{dx:(i-o.width)/2,restore:()=>(t.width=i,t.height=r)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,r]of c_)i.classList.remove(r);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}}}fi(th,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const l_={__depends__:[fp],__init__:["i18nDisplay"],i18nDisplay:["type",th]};var lD=new ya("ov"),uD=500;function xn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=lD,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=pD(n.getContainer()),this._init()}xn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],xn.prototype.get=function(e){if(Un(e)&&(e={id:e}),Un(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?it(t.overlays,Fo({type:e.type})):t.overlays.slice():[]}else return e.type?it(this._overlays,Fo({type:e.type})):e.id?this._overlays[e.id]:null},xn.prototype.add=function(e,t,n){if(fn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=U({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},xn.prototype.remove=function(e){var t=this.get(e)||[];Fe(t)||(t=[t]);var n=this;z(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(ji(i.html),ji(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},xn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},xn.prototype.show=function(){tu(this._overlayRoot)},xn.prototype.hide=function(){tu(this._overlayRoot,!1)},xn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Bc(this._overlayRoot)},xn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Jt(t);i=o.x,r=o.y}u_(n,i,r),Dn(e.html,"data-container-id",t.id)},xn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Jt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Jt(i).height:s=i.height,o=t.bottom*-1+s}u_(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},xn.prototype._createOverlayContainer=function(e){var t=Lt('<div class="djs-overlays" />');$n(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},xn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";p_(this._overlayRoot,n)},xn.prototype._getOverlayContainer=function(e,t){var n=Tt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},xn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Un(i)&&(i=Lt(i)),o=this._getOverlayContainer(n),r=Lt('<div class="djs-overlay" data-overlay-id="'+t+'">'),$n(r,{position:"absolute"}),r.appendChild(i),e.type&&$t(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();tu(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},xn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(an(r)&&r>t.scale||an(o)&&o<t.scale))&&(c=!1),tu(a,c),this._updateOverlayScale(e,t)},xn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),an(i)&&t.scale<i&&(a=(1/t.scale||1)*i),an(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),an(a)&&(s="scale("+a+","+a+")"),p_(o,s)},xn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},xn.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});z(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){ji(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",uD,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(z(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&$t(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function pD(e){var t=Lt('<div class="djs-overlay-container" />');return $n(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function u_(e,t,n){$n(e,{left:t+"px",top:n+"px"})}function tu(e,t){e.style.display=t===!1?"none":""}function p_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const nu={__init__:["overlays"],overlays:["type",xn]};function nh(e,t){t.invoke(le,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)})}Ee(nh,le),nh.$inject=["canvas","injector"];const fD={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",nh]};function Ds(e){return CSS.escape(e)}var dD={"&":"&","<":"<",">":">",'"':""","'":"'"};function f_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return dD[t]})}var hD="bjs-breadcrumbs-shown";function d_(e,t,n){var i=Lt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=$t(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ue(l),p=Tt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=mD(c));var l=a.flatMap(function(p){var f=n.findRoot(Wi(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(y){var C=ue(y);return C&&C.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=f_(p.name||p.id),h=Lt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;o.toggle(hD,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}d_.$inject=["eventBus","elementRegistry","canvas"];function mD(e){for(var t=ue(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function h_(e,t){var n=null,i=new gD;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!M(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}h_.$inject=["eventBus","canvas"];function gD(){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 m_={x:180,y:160};function wo(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}wo.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)})}},wo.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;M(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),vD(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},wo.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=yD(e),i={x:n.x-m_.x,y:n.y-m_.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},wo.prototype._moveToDiPlane=function(e,t){var n=g_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},wo.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},wo.$inject=["eventBus","moddle"];function g_(e){return M(e,"bpmndi:BPMNDiagram")?e:g_(e.$parent)}function yD(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Be(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Wc(t)}function vD(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||nt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var iu=250,bD='<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>',xD="bjs-drilldown-empty";function Gr(e,t,n,i,r){le.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",iu,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",iu,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],iu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],iu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ee(Gr,le),Gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Gr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(Wi(e))},Gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ue(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;$t(i.html).toggle(xD,!r)}},Gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ue(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Lt('<button type="button" class="bjs-drilldown">'+bD+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(Wi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const _D={__depends__:[nu,kd,fD],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",d_],drilldownCentering:["type",h_],drilldownOverlayBehavior:["type",Gr],subprocessCompatibility:["type",wo]};function Vr(e){Ft.call(this,e)}Ee(Vr,Ft),Vr.prototype._modules=[Zy,_D,nu,xi,ss],Vr.prototype._moddleExtensions={};var ru="keyboard.keydown",wD="keyboard.keyup",ED=1e3,y_="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 Fn(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(y_));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Fn.$inject=["config.keyboard","eventBus"],Fn.prototype._keydownHandler=function(e){this._keyHandler(e,ru)},Fn.prototype._keyupHandler=function(e){this._keyHandler(e,wD)},Fn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||ru,i),n&&e.preventDefault()}},Fn.prototype._isEventIgnored=function(e){return!1},Fn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(y_)),this.unbind(),e=this._node=this._target,Ge.bind(e,"keydown",this._keydownHandler),Ge.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Fn.prototype.getBinding=function(){return this._node},Fn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ge.unbind(e,"keydown",this._keydownHandler),Ge.unbind(e,"keyup",this._keyupHandler)),this._node=null},Fn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Fn.prototype.addListener=function(e,t,n){dn(e)&&(n=t,t=e,e=ED),this._eventBus.on(n||ru,e,t)},Fn.prototype.removeListener=function(e,t){this._eventBus.off(t||ru,e)},Fn.prototype.hasModifier=Lk,Fn.prototype.isCmd=Qn,Fn.prototype.isShift=xd,Fn.prototype.isKey=ln;var SD=500;function wa(e,t){var n=this;e.on("editorActions.init",SD,function(i){var r=i.editorActions;n.registerBindings(t,r)})}wa.$inject=["eventBus","keyboard"],wa.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(Fk(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(jk(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(Ik(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(Bk(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(Nk(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if($k(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(ln(["+","Add","="],r)&&Qn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(ln(["-","Subtract"],r)&&Qn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(ln("0",r)&&Qn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(ln(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const ih={__init__:["keyboard","keyboardBindings"],keyboard:["type",Fn],keyboardBindings:["type",wa]};var RD={moveSpeed:50,moveSpeedAccelerated:200};function v_(e,t,n){var i=this;this._config=U({},RD,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}v_.$inject=["config.keyboardMove","keyboard","canvas"];const b_={__depends__:[ih],__init__:["keyboardMove"],keyboardMove:["type",v_]};var CD=15;function x_(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,l=n.button,u=go(s),p=Ti(u,c);if(!n.dragging&&MD(p)>CD&&(n.dragging=!0,l===0&&Nb(e),Pl("grab")),n.dragging){var f=n.last||n.start;p=Ti(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function o(s){Ge.unbind(document,"mousemove",r),Ge.unbind(document,"mouseup",o),n=null,Bb()}function a(s){if(!lo(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:go(s)},Ge.bind(document,"mousemove",r),Ge.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}x_.$inject=["eventBus","canvas"];function MD(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const __={__init__:["moveCanvas"],moveCanvas:["type",x_]};function w_(e,t){var n=yf(e.min),i=yf(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function AD(e,t){return Math.max(e.min,Math.min(e.max,t))}var PD=Math.sign||function(e){return e>=0?1:-1},rh={min:.2,max:4},E_=10,TD=.1,kD=.75;function Yi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=zn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||kD;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Yi.$inject=["config.zoomScroll","eventBus","canvas"],Yi.prototype.scroll=function(t){this._canvas.scroll(t)},Yi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Yi.prototype.zoom=function(t,n){var i=w_(rh,E_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>TD&&(this._zoom(t,n,i),this._totalDelta=0)},Yi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Vv()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*PD(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},Yi.prototype.stepZoom=function(t,n){var i=w_(rh,E_);this._zoom(t,n,i)},Yi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=yf(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(AD(rh,s),t)},Yi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ge[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Yi.prototype._init=function(e){this.toggle(e)};const S_={__init__:["zoomScroll"],zoomScroll:["type",Yi]};function Ls(e){Vr.call(this,e)}Ee(Ls,Vr),Ls.prototype._navigationModules=[b_,__,S_],Ls.prototype._modules=[].concat(Vr.prototype._modules,Ls.prototype._navigationModules);function oh(e){return e&&e[e.length-1]}function R_(e){return e.y}function C_(e){return e.x}var OD={left:C_,center:C_,right:function(e){return e.x+e.width},top:R_,middle:R_,bottom:function(e){return e.y+e.height}};function Ea(e,t){this._modeling=e,this._rules=t}Ea.$inject=["modeling","rules"],Ea.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}},Ea.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ea.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=oh(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(z(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Li(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=oh(c).center,o;l=t[0],t=Li(t,function(f){return f[i]+f[r]}),u=oh(t),o[e]=p(l,u)}return o},Ea.prototype.trigger=function(e,t){var n=this._modeling,i,r=it(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Fe(i)&&(r=i),!(r.length<2||!i)){var o=OD[t],a=Li(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const DD={__init__:["alignElements"],alignElements:["type",Ea]},LD=new ya;function Sa(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Sa.$inject=["eventBus"],Sa.prototype.schedule=function(e,t=LD.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Sa.prototype._schedule=function(e,t){const n=ID();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Sa.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Sa.prototype._cancel=function(e){clearTimeout(e.executionId)};function ID(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const BD={scheduler:["type",Sa]};var ND="djs-element-hidden",ou=".entry",$D=1e3,M_=8,FD=300;function tn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}tn.$inject=["canvas","elementRegistry","eventBus","scheduler"],tn.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=Fe(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=Fe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},tn.prototype._createContainer=function(){var e=Lt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},tn.prototype.registerProvider=function(e,t){t||(t=e,e=$D),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},tn.prototype.getEntries=function(e){var t=this._getProviders(),n=Fe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(r){if(dn(r[n])){var o=r[n](e);dn(o)?i=o(i):z(o,function(a,s){i[s]=a})}}),i},tn.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Dn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},FD);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},tn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(dn(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},tn.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))}},tn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},tn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(r,o){var a=r.group||"default",s=Lt(r.html||'<div class="entry" draggable="true"></div>'),c;Dn(s,"data-action",o),c=Et("[data-group="+Ds(a)+"]",n),c||(c=Lt('<div class="group"></div>'),Dn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&jD(s,r.className),r.title&&Dn(s,"title",r.title),r.imageUrl&&(i=Lt("<img>"),Dn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),$t(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},tn.prototype._createHtml=function(e){var t=this,n=Lt('<div class="djs-context-pad"></div>');return Kn.bind(n,ou,"click",function(i){t.trigger("click",i)}),Kn.bind(n,ou,"dragstart",function(i){t.trigger("dragstart",i)}),Kn.bind(n,ou,"mouseover",function(i){t.trigger("mouseover",i)}),Kn.bind(n,ou,"mouseout",function(i){t.trigger("mouseout",i)}),Ge.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},tn.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()&&zD(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},tn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},tn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Fe(e)!==Fe(n)?!1:Fe(e)?e.length===n.length&&io(e,function(i){return n.includes(i)}):n===e},tn.prototype.isShown=function(){return this.isOpen()&&$t(this._current.html).has("open")},tn.prototype.show=function(){this.isOpen()&&($t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},tn.prototype.hide=function(){this.isOpen()&&($t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},tn.prototype._getPosition=function(e){if(!Fe(e)&&Rt(e)){var t=this._canvas.viewbox(),n=HD(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+M_*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+M_*this._canvas.zoom(),top:s.top-a.top}},tn.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")},tn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Fe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,ND)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},tn.prototype._getTargetBounds=function(e){var t=this,n=Fe(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function jD(e,t){var n=$t(e);t=Fe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function HD(e){return e.waypoints[e.waypoints.length-1]}function zD(e,t){return e=Fe(e)?e:[e],t=Fe(t)?t:[t],e.length===t.length&&io(e,function(n){return t.includes(n)})}const A_={__depends__:[Al,BD,nu],contextPad:["type",tn]};var au,Ht,P_,Wr,T_,k_,O_,ah,su,Is,D_,sh,ch,lh,cu={},lu=[],GD=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,uu=Array.isArray;function dr(e,t){for(var n in t)e[n]=t[n];return e}function uh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function L_(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?au.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return pu(e,a,i,r,null)}function pu(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++P_,__i:-1,__u:0};return r==null&&Ht.vnode!=null&&Ht.vnode(o),o}function fu(e){return e.children}function du(e,t){this.props=e,this.context=t}function Eo(e,t){if(t==null)return e.__?Eo(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"?Eo(e):null}function VD(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=dr({},t);o.__v=t.__v+1,Ht.vnode&&Ht.vnode(o),ph(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Eo(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,z_(i,o,r),t.__e=t.__=null,o.__e!=n&&I_(o)}}function I_(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}),I_(e)}function B_(e){(!e.__d&&(e.__d=!0)&&Wr.push(e)&&!hu.__r++||T_!=Ht.debounceRendering)&&((T_=Ht.debounceRendering)||k_)(hu)}function hu(){try{for(var e,t=1;Wr.length;)Wr.length>t&&Wr.sort(O_),e=Wr.shift(),t=Wr.length,VD(e)}finally{Wr.length=hu.__r=0}}function N_(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,g,h,y,C=i&&i.__k||lu,x=t.length;for(c=WD(n,t,C,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&C[d.__i]||cu,d.__i=p,y=ph(e,d,f,r,o,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&fh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=$_(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function WD(e,t,n,i,r){var o,a,s,c,l,u=n.length,p=u,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=pu(null,a,null,null,null):uu(a)?a=e.__k[o]=pu(fu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=pu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=UD(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?f--:r<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Eo(s)),V_(s,s));return i}function $_(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=$_(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Eo(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function UD(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function F_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||GD.test(t)?n:n+"px"}function mu(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||F_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||F_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(D_,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Is]=i[Is]:(n[Is]=sh,e.addEventListener(t,o?lh:ch,o)):e.removeEventListener(t,o?lh:ch,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function j_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[su]==null)t[su]=sh++;else if(t[su]<n[Is])return;return n(Ht.event?Ht.event(t):t)}}}function ph(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,g,h,y,C,x,m,v,_,S,k,O,N,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Ht.__b)&&u(t);e:if(typeof P=="function"){p=a.length;try{if(x=t.props,m=P.prototype&&P.prototype.render,v=(u=P.contextType)&&i[u.__c],_=u?v?v.props.value:u.__:i,n.__c?C=(f=t.__c=n.__c).__=f.__E:(m?t.__c=f=new P(x,_):(t.__c=f=new du(x,_),f.constructor=P,f.render=YD),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),m&&f.__s==null&&(f.__s=f.state),m&&P.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=dr({},f.__s)),dr(f.__s,P.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=t,d)m&&P.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),m&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(m&&P.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,_),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,_)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),lu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Eo(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,_),m&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,y)})}if(f.context=_,f.props=x,f.__P=e,f.__e=!1,S=Ht.__r,k=0,m)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),lu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(i=dr(dr({},i),f.getChildContext())),m&&!d&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(g,h)),O=u!=null&&u.type===fu&&u.key==null?G_(u.props.children):u,s=N_(e,uu(O)?O:[O],t,n,i,r,o,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),C&&(f.__E=f.__=null)}catch(D){if(a.length=p,t.__v=null,c||o!=null){if(D.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(N=o.length;N--;)uh(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||H_(t),Ht.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=qD(n.__e,t,n,i,r,o,a,c,l);return(u=Ht.diffed)&&u(t),128&t.__u?void 0:s}function H_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(H_))}function z_(e,t,n){for(var i=0;i<n.length;i++)fh(n[i],n[++i],n[++i]);Ht.__c&&Ht.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ht.__e(o,r.__v)}})}function G_(e){return typeof e!="object"||e==null||e.__b>0?e:uu(e)?e.map(G_):e.constructor!==void 0?null:dr({},e)}function qD(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,g,h,y=n.props||cu,C=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(C);e=document.createElementNS(r,x,C.is&&C),s&&(Ht.__m&&Ht.__m(t,o),s=!1),o=null}if(x==null)y===C||s&&e.data==C||(e.data=C);else{if(o=x=="textarea"&&C.defaultValue!=null?null:o&&au.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in C||l=="value"&&"defaultValue"in C||l=="checked"&&"defaultChecked"in C||mu(e,l,null,d,r);for(l in C)d=C[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||mu(e,l,d,y[l],r);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),N_(t.type=="template"?e.content:e,uu(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Eo(n,0),s,c),o!=null)for(l=o.length;l--;)uh(o[l]);s&&x!="textarea"||(l="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||x=="progress"&&!g||x=="option"&&g!=y[l])&&mu(e,l,g,y[l],r),l="checked",h!=null&&h!=e[l]&&mu(e,l,h,y[l],r))}return e}function fh(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Ht.__e(r,n)}}function V_(e,t,n){var i,r;if(Ht.unmount&&Ht.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||fh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ht.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&V_(i[r],t,n||typeof e.type!="function");n||uh(e.__e),e.__c=e.__=e.__e=void 0}function YD(e,t,n){return this.constructor(e,n)}function W_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ht.__&&Ht.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],ph(t,e=t.__k=L_(fu,null,[e]),r||cu,cu,t.namespaceURI,r?null:t.firstChild?au.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),z_(o,e,a),e.props.children=null}au=lu.slice,Ht={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},P_=0,du.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dr({},this.state),typeof e=="function"&&(e=e(dr({},n),this.props)),e&&dr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),B_(this))},du.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),B_(this))},du.prototype.render=fu,Wr=[],k_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,O_=function(e,t){return e.__v.__b-t.__v.__b},hu.__r=0,ah=Math.random().toString(8),su="__d"+ah,Is="__a"+ah,D_=/(PointerCapture)$|Capture$/i,sh=0,ch=j_(!1),lh=j_(!0);var U_=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,U_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},q_=new Map;function KD(e){var t=q_.get(this);return t||(t=new Map,q_.set(this,t)),(t=U_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][p+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Mt=KD.bind(L_),Ra,nn,dh,Y_,Bs=0,K_=[],un=Ht,X_=un.__b,Z_=un.__r,Q_=un.diffed,J_=un.__c,ew=un.unmount,tw=un.__;function gu(e,t){un.__h&&un.__h(nn,e,Bs||t),Bs=0;var n=nn.__H||(nn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function hh(e){return Bs=1,XD(iw,e)}function XD(e,t,n){var i=gu(Ra++,2);if(i.t=e,!i.__c&&(i.__=[iw(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=nn,!nn.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,l);return u?f||p:f}return!u||p};nn.__f=!0;var o=nn.shouldComponentUpdate,a=nn.componentWillUpdate;nn.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},nn.shouldComponentUpdate=r}return i.__N||i.__}function yu(e,t){var n=gu(Ra++,3);!un.__s&&yh(n.__H,t)&&(n.__=e,n.u=t,nn.__H.__h.push(n))}function mh(e,t){var n=gu(Ra++,4);!un.__s&&yh(n.__H,t)&&(n.__=e,n.u=t,nn.__h.push(n))}function vu(e){return Bs=5,hr(function(){return{current:e}},[])}function hr(e,t){var n=gu(Ra++,7);return yh(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ns(e,t){return Bs=8,hr(function(){return e},t)}function ZD(){for(var e;e=K_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(bu),t.__h.some(gh),t.__h=[]}catch(n){t.__h=[],un.__e(n,e.__v)}}}un.__b=function(e){nn=null,X_&&X_(e)},un.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),tw&&tw(e,t)},un.__r=function(e){Z_&&Z_(e),Ra=0;var t=(nn=e.__c).__H;t&&(dh===nn?(t.__h=[],nn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(bu),t.__h.some(gh),t.__h=[],Ra=0)),dh=nn},un.diffed=function(e){Q_&&Q_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(K_.push(t)!==1&&Y_===un.requestAnimationFrame||((Y_=un.requestAnimationFrame)||QD)(ZD)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),dh=nn=null},un.__c=function(e,t){t.some(function(n){try{n.__h.some(bu),n.__h=n.__h.filter(function(i){return!i.__||gh(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],un.__e(i,n.__v)}}),J_&&J_(e,t)},un.unmount=function(e){ew&&ew(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{bu(i)}catch(r){t=r}}),n.__H=void 0,t&&un.__e(t,n.__v))};var nw=typeof requestAnimationFrame=="function";function QD(e){var t,n=function(){clearTimeout(i),nw&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);nw&&(t=requestAnimationFrame(n))}function bu(e){var t=nn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),nn=t}function gh(e){var t=nn;e.__c=e.__(),nn=t}function yh(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function iw(e,t){return typeof t=="function"?t(e):t}function JD(e){const{navigationStack:t,setNavigationStack:n}=e,i=hr(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return Mt`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
|
-
${r&&
|
|
13
|
+
${r&&Mt`
|
|
14
14
|
<button
|
|
15
15
|
type="button"
|
|
16
16
|
class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</svg>
|
|
24
24
|
</button>
|
|
25
25
|
`}
|
|
26
|
-
${i.map((a,s)=>
|
|
26
|
+
${i.map((a,s)=>Mt`
|
|
27
27
|
<button
|
|
28
28
|
key=${s}
|
|
29
29
|
type="button"
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
</button>
|
|
36
36
|
<span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
|
|
37
37
|
`)}
|
|
38
|
-
${o&&
|
|
38
|
+
${o&&Mt`
|
|
39
39
|
<span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
|
|
40
40
|
${o}
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function
|
|
44
|
+
`}function rw(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=rw(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function xu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=rw(e))&&(i&&(i+=" "),i+=t);return i}function eL(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=hr(()=>tL(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Mt`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
47
|
-
${a.map(l=>
|
|
47
|
+
${a.map(l=>Mt`
|
|
48
48
|
<ul key=${l.id} class="djs-popup-header-group" data-header-group=${l.id}>
|
|
49
49
|
|
|
50
|
-
${l.entries.map(u=>
|
|
50
|
+
${l.entries.map(u=>Mt`
|
|
51
51
|
<li key=${u.id}>
|
|
52
52
|
<${s(u)?"button":"span"}
|
|
53
|
-
class=${
|
|
53
|
+
class=${nL(u,u===i)}
|
|
54
54
|
onClick=${p=>c(p,u)}
|
|
55
55
|
title=${u.title||u.label}
|
|
56
56
|
data-id=${u.id}
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
onFocus=${()=>s(u)&&r(u)}
|
|
61
61
|
onBlur=${()=>s(u)&&r(null)}
|
|
62
62
|
>
|
|
63
|
-
${u.imageUrl&&
|
|
64
|
-
${u.label?
|
|
63
|
+
${u.imageUrl&&Mt`<img class="djs-popup-entry-icon" src=${u.imageUrl} alt="" />`||u.imageHtml&&Mt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:u.imageHtml}} />`}
|
|
64
|
+
${u.label?Mt`
|
|
65
65
|
<span class="djs-popup-label">${u.label}</span>
|
|
66
66
|
`:null}
|
|
67
67
|
</${u.action?"button":"span"}>
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function tL(e){return e.reduce((t,n)=>{const i=n.group||"default",r=t.find(o=>o.id===i);return r?r.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function nL(e,t){return xu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function ow(e,t){return`${e}-entry-${t.id}`}function iL(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return Mt`
|
|
74
74
|
<li
|
|
75
|
-
class=${
|
|
75
|
+
class=${xu("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
77
|
+
id=${ow(t,n)}
|
|
78
78
|
role="option"
|
|
79
79
|
aria-selected=${i||void 0}
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -88,17 +88,17 @@
|
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
91
|
-
class=${
|
|
91
|
+
class=${xu("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
|
-
${n.imageUrl&&
|
|
93
|
+
${n.imageUrl&&Mt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Mt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
94
94
|
|
|
95
|
-
${n.label?
|
|
95
|
+
${n.label?Mt`
|
|
96
96
|
<span class="djs-popup-label">
|
|
97
97
|
${n.label}
|
|
98
98
|
</span>
|
|
99
99
|
`:null}
|
|
100
100
|
|
|
101
|
-
${n.documentationRef&&
|
|
101
|
+
${n.documentationRef&&Mt`
|
|
102
102
|
<a
|
|
103
103
|
class="djs-popup-entry-docs"
|
|
104
104
|
href=${n.documentationRef}
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
</a>
|
|
116
116
|
`}
|
|
117
117
|
</span>
|
|
118
|
-
${n.description&&
|
|
118
|
+
${n.description&&Mt`
|
|
119
119
|
<span
|
|
120
120
|
class="djs-popup-entry-description"
|
|
121
121
|
>
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
</span>
|
|
124
124
|
`}
|
|
125
125
|
</div>
|
|
126
|
-
${n.entries&&
|
|
126
|
+
${n.entries&&Mt`
|
|
127
127
|
<div class="djs-popup-entry-chevron" aria-hidden="true">
|
|
128
128
|
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
129
129
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function
|
|
134
|
+
`}function rL(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=vu();mh(()=>{if(!r||!r.current)return;const h=p.current;if(!h)return;const y=h.querySelector(".selected");y&&oL(y)},[t]);const f=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return Mt`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
@@ -142,9 +142,9 @@
|
|
|
142
142
|
aria-activedescendant=${l}
|
|
143
143
|
onMouseMove=${f}
|
|
144
144
|
>
|
|
145
|
-
${i.map(h=>
|
|
146
|
-
${h.name&&
|
|
147
|
-
<div key=${h.id} id=${
|
|
145
|
+
${i.map(h=>Mt`
|
|
146
|
+
${h.name&&Mt`
|
|
147
|
+
<div key=${h.id} id=${aw(o,h)} class="entry-header" title=${h.name}>
|
|
148
148
|
${h.name}
|
|
149
149
|
</div>
|
|
150
150
|
`}
|
|
@@ -152,10 +152,10 @@
|
|
|
152
152
|
class="djs-popup-group"
|
|
153
153
|
data-group=${h.id}
|
|
154
154
|
role="group"
|
|
155
|
-
aria-labelledby=${h.name?
|
|
155
|
+
aria-labelledby=${h.name?aw(o,h):void 0}
|
|
156
156
|
>
|
|
157
|
-
${h.entries.map(y=>
|
|
158
|
-
<${
|
|
157
|
+
${h.entries.map(y=>Mt`
|
|
158
|
+
<${iL}
|
|
159
159
|
key=${y.id}
|
|
160
160
|
idPrefix=${o}
|
|
161
161
|
entry=${y}
|
|
@@ -168,19 +168,19 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function
|
|
172
|
-
<${
|
|
171
|
+
`}function aw(e,t){return`${e}-group-${t.id}`}function oL(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const aL=new ya("djs-popup");function sL(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,y]=hh([]);yu(()=>{y([])},[f]);const[C,x]=hh(""),m=C.trim().length>0,v=hr(()=>uL(f),[f]),_=hr(()=>an(l)?v.length>5:!1,[l,v]),S=hr(()=>{const q=h.length?h[h.length-1].entries:f;return _?m?p(v.filter(({searchable:K})=>K!==!1),C,{keys:["label","search","description"]}).map(({item:K})=>K):q.filter(({rank:K=0})=>K>=0):q},[_,m,v,C,p,h,f]),k=hr(()=>m?S.length?[{id:"default",entries:S}]:[]:pL(S),[S,m]),[O,N]=hh(S[0]),P=vu(null),D=vu(!1),j=hr(()=>aL.next(),[]),ee=`${j}-results`,ge=O&&ow(j,O);yu(()=>{const q=P.current;q&&S.includes(q)?N(q):N(S[0]),P.current=null},[S]);const Pe=Ns(q=>{const K=lL(k);let fe=K.indexOf(O)+q;fe<0&&(fe=K.length-1),fe>=K.length&&(fe=0),D.current=!0,N(K[fe])},[k,O]),De=Ns(q=>{q>0&&O&&O.entries&&(D.current=!0,y(K=>[...K,O])),q<0&&h.length>0&&(D.current=!0,P.current=h[h.length+q],y(K=>K.slice(0,q)))},[O,h]),Ye=Ns((q,K,ae)=>{if(!(!K||K.disabled))return K.entries?(q.preventDefault(),De(1)):n(q,K,ae)},[n,De]),ot=Ns(q=>{if(q.key==="Enter"&&O){const K=q.target;return!!lo(K,"a, button",!0)||O.disabled?void 0:Ye(q,O)}if(q.key==="Backspace"){const K=q.target;if(!(Kp(K,"input")&&K.value!==""))return De(-1),q.preventDefault()}if(q.key==="ArrowUp")return Pe(-1),q.preventDefault();if(q.key==="ArrowDown")return Pe(1),q.preventDefault();if(q.key==="ArrowRight")return De(1),q.preventDefault();if(q.key==="ArrowLeft")return De(-1),q.preventDefault()},[O,Pe,De,Ye]),Me=Ns(q=>{Kp(q.target,"input")&&x(()=>q.target.value)},[x]);yu(()=>(d(),()=>{g()}),[]);const X=!m&&h.length>0,ne=(a||r.length>0)&&!X;return Mt`
|
|
172
|
+
<${sw}
|
|
173
173
|
onClose=${t}
|
|
174
174
|
onKeyup=${Me}
|
|
175
|
-
onKeydown=${
|
|
175
|
+
onKeydown=${ot}
|
|
176
176
|
className=${i}
|
|
177
177
|
position=${o}
|
|
178
178
|
width=${s}
|
|
179
179
|
scale=${c}
|
|
180
180
|
navigationStack=${h}
|
|
181
181
|
>
|
|
182
|
-
${ne&&
|
|
183
|
-
<${
|
|
182
|
+
${ne&&Mt`
|
|
183
|
+
<${eL}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${O}
|
|
@@ -188,16 +188,16 @@
|
|
|
188
188
|
title=${a}
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
|
-
${X&&
|
|
192
|
-
<${
|
|
191
|
+
${X&&Mt`
|
|
192
|
+
<${JD}
|
|
193
193
|
navigationStack=${h}
|
|
194
194
|
setNavigationStack=${y}
|
|
195
195
|
/>
|
|
196
196
|
`}
|
|
197
|
-
${f.length>0&&
|
|
197
|
+
${f.length>0&&Mt`
|
|
198
198
|
<div class="djs-popup-body">
|
|
199
199
|
|
|
200
|
-
${_&&
|
|
200
|
+
${_&&Mt`
|
|
201
201
|
<div class="djs-popup-search">
|
|
202
202
|
<svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
203
203
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -208,33 +208,33 @@
|
|
|
208
208
|
role="combobox"
|
|
209
209
|
aria-label="${a||"Search"}"
|
|
210
210
|
aria-expanded="true"
|
|
211
|
-
aria-controls=${
|
|
211
|
+
aria-controls=${ee}
|
|
212
212
|
aria-activedescendant=${ge||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
215
215
|
</div>
|
|
216
216
|
`}
|
|
217
217
|
|
|
218
|
-
${m&&
|
|
218
|
+
${m&&Mt`
|
|
219
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
220
|
-
${
|
|
220
|
+
${S.length} ${S.length===1?"result":"results"} found
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
225
|
-
groupedEntries=${
|
|
224
|
+
<${rL}
|
|
225
|
+
groupedEntries=${k}
|
|
226
226
|
selectedEntry=${O}
|
|
227
227
|
setSelectedEntry=${N}
|
|
228
228
|
keyboardSelection=${D}
|
|
229
|
-
onAction=${
|
|
230
|
-
idPrefix=${
|
|
231
|
-
id=${
|
|
229
|
+
onAction=${Ye}
|
|
230
|
+
idPrefix=${j}
|
|
231
|
+
id=${ee}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
233
|
tabIndex=${_?-1:0}
|
|
234
234
|
ariaActivedescendant=${_?void 0:ge||void 0}
|
|
235
235
|
/>
|
|
236
236
|
|
|
237
|
-
${O&&O.documentationRef&&
|
|
237
|
+
${O&&O.documentationRef&&Mt`
|
|
238
238
|
<div class="djs-popup-footer">
|
|
239
239
|
<a
|
|
240
240
|
class="djs-popup-footer-docs"
|
|
@@ -254,14 +254,14 @@
|
|
|
254
254
|
`}
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
|
-
${u&&
|
|
258
|
-
<div class="djs-popup-no-results">${
|
|
257
|
+
${u&&S.length===0&&Mt`
|
|
258
|
+
<div class="djs-popup-no-results">${dn(u)?u(C):u}</div>
|
|
259
259
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
260
|
+
</${sw}>
|
|
261
|
+
`}function sw(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=vu();return mh(()=>{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]),mh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),yu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!lo(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)}},[]),Mt`
|
|
262
262
|
<div
|
|
263
|
-
class=${
|
|
264
|
-
style=${
|
|
263
|
+
class=${xu("djs-popup",r)}
|
|
264
|
+
style=${cL(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,8 +269,8 @@
|
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function cL(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:an(t)?n:void 0,maxWidth:an(t)?"unset":void 0,"transform-origin":"top left"}}function lL(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function uL(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function pL(e){const t=[],n=o=>t.find(a=>o.id===a.id),i=o=>!!n(o),r=o=>typeof o=="string"?{id:o}:o;return e.forEach(o=>{const a=o.group?r(o.group):{id:"default"};i(a)?n(a).entries.push(o):t.push({...a,entries:[o]})}),t}var fL="data-id",cw=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],dL=1e3;function zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=an(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}zt.$inject=["config.popupMenu","eventBus","canvas","search"],zt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=lw(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);W_(Mt`
|
|
273
|
+
<${sL}
|
|
274
274
|
onClose=${f=>this.close(f)}
|
|
275
275
|
onSelect=${(f,d,g)=>this.trigger(f,d,g)}
|
|
276
276
|
position=${c}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...o}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},
|
|
287
|
+
`,this._current.container)},zt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},zt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},zt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}},zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},zt.prototype.reset=function(){const e=this._current.container;W_(null,e),ji(e)},zt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},zt.prototype._onOpened=function(){this._emit("opened")},zt.prototype._onClosed=function(){this._emit("closed")},zt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Lt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},zt.prototype._bindAutoClose=function(){this._eventBus.once(cw,this.close,this)},zt.prototype._unbindAutoClose=function(){this._eventBus.off(cw,this.close,this)},zt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),an(n)&&e<n&&(r=n),an(i)&&e>i&&(r=i)),r},zt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},zt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},zt.prototype.registerProvider=function(e,t,n){n||(n=t,t=dL),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},zt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},zt.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ii(o,["id"])});return}var r=i.getPopupMenuEntries(e);dn(r)?n=r(n):z(r,function(o,a){n[a]=o})}),n},zt.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ii(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);dn(r)?n=r(n):z(r,function(o,a){n[a]=o})}),n},zt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>dn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},zt.prototype.isOpen=function(){return!!this._current},zt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=lo(e.delegateTarget||e.target,".entry",!0),o=Dn(r,fL);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(dn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},zt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function lw(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=lw(r.entries,[...t,...uw(r.search)]):t.length&&(r.search=[...t,...uw(r.search)]),r})}function uw(e){return e?Fe(e)?e:[e]:[]}function hL(e,t,n){const{keys:i}=n;if(t=t.trim().toLowerCase(),!t)throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap(o=>{const a=mL(o,r,i);return a?{item:o,tokens:a}:[]}).sort(gL(i))}function mL(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Fe(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=mw(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):mw(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function gL(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=yL(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=pw;continue}const s=vL(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=pw;continue}}return i}}function yL(e,t){return fw(t)-fw(e)}const pw=.5,Ca={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function fw(e){const t=e.reduce((s,c)=>s+dw(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),r=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),o=i?r/i:0;return t*(1+o)}function dw(e){if(Fe(e))return Math.max(...e.map(dw));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Ca.FULL:e.wordEnd?Ca.START_FULL_WORD:Ca.START_WORD_PART:e.wordStart?Ca.WORD_START:Ca.WORD_PART)*t:Ca.NO_MATCH*t}function hw(e=""){return Fe(e)?e.join(", "):e}function vL(e,t){return hw(e).localeCompare(hw(t))}function mw(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(bL),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(p-1)),C=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:C,start:d,end:g,all:h});const x=h?t:[u];for(const m of x)i[m.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function bL(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const gw={search:["value",hL]},vh={__depends__:[gw],__init__:["popupMenu"],popupMenu:["type",zt]};var yw={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
|
|
288
288
|
<line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
289
289
|
<rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
290
290
|
<rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -312,8 +312,8 @@
|
|
|
312
312
|
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
313
313
|
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
314
314
|
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
315
|
-
</svg>`},hL=900;function Ra(e,t,n,i){e.registerProvider(hL,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ra.$inject=["contextPad","popupMenu","translate","canvas"],Ra.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Ra.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ra.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${fw.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);U(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ra.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var mL=["left","center","right","top","middle","bottom"];function Ls(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ls.$inject=["popupMenu","alignElements","translate","rules"],Ls.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Ls.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ls.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return z(mL,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:fw[o],action:function(){t.trigger(e,o),i.close()}}}),r};function gu(e){bi.call(this,e)}gu.$inject=["eventBus"],Ee(gu,bi),gu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=nt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Nc(n),n.length<2?!1:n})};const gL={__depends__:[MD,E_,fh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ra],alignElementsMenuProvider:["type",Ls],bpmnAlignElements:["type",gu]};function mr(e,t,n,i){le.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Xu(Io(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Bo(s,function(p){return p.parent.id});z(u,function(p,f){Fe(l)&&(p=p.filter(function(d){return Pt(l,No({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}mr.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(mr,le),mr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Le(en(e)),o=Le(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),jc(U({},o,a))},mr.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(yL(i,t)){var r=vL(Pi(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},mr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},mr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},mr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function yL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function vL(e,t){var n="";return e=Le(e),t=Le(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 yu(e){e.invoke(mr,this)}yu.$inject=["injector"],Ee(yu,mr),yu.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Is(e){bi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Is.$inject=["eventBus"],Ee(Is,bi),Is.prototype.canResize=function(e,t){return!1};function vu(e,t){Is.call(this,e),this._modeling=t}Ee(vu,Is),vu.$inject=["eventBus","modeling"],vu.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return z(e,function(i){if(M(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const bL={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",yu],bpmnAutoResizeProvider:["type",vu]};function Ca(e,t,n){this._canvas=n,this._opts=U({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ca.$inject=["config.autoScroll","eventBus","canvas"],Ca.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)xL(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function xL(e,t,n){return t<e&&e<n}Ca.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ca.prototype.setOptions=function(e){this._opts=U({},this._opts,e)},Ca.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=go(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const _L={__depends__:[lr],__init__:["autoScroll"],autoScroll:["type",Ca]};var dw="djs-bendpoint",hw="djs-segment-dragger";function wL(e,t){var n=go(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function dh(e,t,n){var i=wL(e,n),r=Af(t,i);return r}function hh(e,t){var n=Oe("g");st(n).add(dw),We(e,n);var i=Oe("circle");Se(i,{cx:0,cy:0,r:4}),st(i).add("djs-visual"),We(n,i);var r=Oe("circle");return Se(r,{cx:0,cy:0,r:10}),st(r).add("djs-hit"),We(n,r),t&&st(n).add(t),n}function EL(e,t,n,i){var r=Oe("g");We(e,r);var o=18,a=6,s=11,c=RL(t,n,i),l=a+s,u=Oe("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),st(u).add("djs-visual"),We(r,u);var p=Oe("rect");return Se(p,{x:-c/2,y:-l/2,width:c,height:l}),st(p).add("djs-hit"),We(r,p),ky(r,i==="v"?90:0),r}function mw(e,t,n){var i=Oe("g"),r=nf(t,n),o=ir(t,n);return We(e,i),EL(i,t,n,o),st(i).add(hw),st(i).add(o==="h"?"horizontal":"vertical"),Mn(i,r.x,r.y),i}function mh(e){return Math.abs(Math.round(e*2/3))}function SL(e,t){var n=CL(e,t);return Lf(e,n)}function RL(e,t,n){var i=t.x-e.x,r=t.y-e.y;return mh(n==="h"?i:r)}function CL(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=yv(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function gw(e,t,n,i,r){function o(m,v,_){var E=m.index,T=m.point,O,N,P,D,F,J;return E<=0||m.bendpoint?!1:(O=v[E-1],N=v[E],P=nf(O,N),D=ir(O,N),F=Math.abs(T.x-P.x),J=Math.abs(T.y-P.y),D&&F<=_&&J<=_)}function a(m,v){var _=m.waypoints,E,T,O,N;return v.index<=0||v.bendpoint||(E={start:_[v.index-1],end:_[v.index]},T=ir(E.start,E.end),!T)?null:(T==="h"?O=E.end.x-E.start.x:O=E.end.y-E.start.y,N=mh(O)/2,N)}function s(m,v){var _=v.waypoints,E=dh(t,_,m),T;if(E){T=a(v,E);var O;if(o(E,_,T)?O=r.start(m,v,E.index):O=i.start(m,v,E.index,!E.bendpoint),O!==!1)return!0}}function c(m,v,_){Ge.bind(m,v,function(E){n.triggerMouseEvent(v,E,_),E.stopPropagation()})}function l(m,v){var _=t.getLayer("overlays"),E=wt('.djs-bendpoints[data-element-id="'+Ps(m.id)+'"]',_);return!E&&v&&(E=Oe("g"),Se(E,{"data-element-id":m.id}),st(E).add("djs-bendpoints"),We(_,E),c(E,"mousedown",m),c(E,"click",m),c(E,"dblclick",m)),E}function u(m,v){return wt('.djs-segment-dragger[data-segment-idx="'+m+'"]',v)}function p(m,v){v.waypoints.forEach(function(_,E){var T=hh(m);We(m,T),Mn(T,_.x,_.y)}),hh(m,"floating")}function f(m,v){for(var _=v.waypoints,E,T,O,N=1;N<_.length;N++)E=_[N-1],T=_[N],ir(E,T)&&(O=mw(m,E,T),Se(O,{"data-segment-idx":N}),c(O,"mousemove",v))}function d(m){z(Dc("."+dw,m),function(v){un(v)})}function g(m){z(Dc("."+hw,m),function(v){un(v)})}function h(m){var v=l(m);return v||(v=l(m,!0),p(v,m),f(v,m)),v}function y(m){var v=l(m);v&&(g(v),d(v),f(v,m),p(v,m))}function C(m,v){var _=wt(".floating",m),E=v.point;_&&(Mn(_,E.x,E.y),st(_).add("positioned"))}function x(m,v,_){var E=u(v.index,m),T=_[v.index-1],O=_[v.index],N=v.point,P=nf(T,O),D=ir(T,O),F,J;E&&(F=ML(E),J={x:N.x-P.x,y:N.y-P.y},D==="v"&&(J={x:J.y,y:J.x}),Mn(F,J.x,J.y))}e.on("connection.changed",function(m){y(m.element)}),e.on("connection.remove",function(m){var v=l(m.element);v&&un(v)}),e.on("element.marker.update",function(m){var v=m.element,_;v.waypoints&&(_=h(v),m.add?st(_).add(m.marker):st(_).remove(m.marker))}),e.on("element.mousemove",function(m){var v=m.element,_=v.waypoints,E,T;if(_){if(E=l(v,!0),T=dh(t,_,m.originalEvent),!T)return;C(E,T),T.bendpoint||x(E,T,_)}}),e.on("element.mousedown",function(m){if(Ir(m)){var v=m.originalEvent,_=m.element;if(_.waypoints)return s(v,_)}}),e.on("selection.changed",function(m){var v=m.newSelection,_=v[0];_&&_.waypoints&&h(_)}),e.on("element.hover",function(m){var v=m.element;v.waypoints&&h(v)}),e.on("element.out",function(m){var v=m.element;if(v.waypoints){var _=l(v);if(_){var E=wt(".floating",_);E&&st(E).remove("positioned")}}}),e.on("element.updateId",function(m){var v=m.element,_=m.newId;if(v.waypoints){var E=l(v);E&&Se(E,{"data-element-id":_})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}gw.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function ML(e){return wt(".djs-visual",e)}var yw=Math.round,So="reconnectStart",Ro="reconnectEnd",Bs="updateWaypoints";function gh(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=So:!l&&c===d.length-1?g=Ro:g=Bs;var h=g===Bs?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:p,target:f});if(y===!1&&(y=r.allowed(h,{connection:s,source:f,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===Bs?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===So?p:l,target:f===Ro?p:u}),d){s.source=f===So?p:l,s.target=f===Ro?p:u;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===Ro?p:u,target:f===So?p:l})),d&&(s.source=f===Ro?p:u,s.target=f===So?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!==Bs&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,y=s.hints||{},C={x:yw(a.x),y:yw(a.y)};if(!c)return!1;h===Bs?(p?f.splice(l,0,C):f[l]=C,y.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,LM(f),y)):(h===So?(y.docking="source",bu(s)&&(y.docking="target",y.newWaypoints=f.reverse())):h===Ro&&(y.docking="target",bu(s)&&(y.docking="source",y.newWaypoints=f.reverse())),o.reconnect(u,d,g,C,y))},this)}gh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],gh.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function bu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===So)return t&&i&&t===i&&n!==i;if(r===Ro)return t&&n&&t===n&&n!==i}var AL="reconnectStart",PL="reconnectEnd",vw="updateWaypoints",Ns="connect-ok",xu="connect-not-ok",bw="connect-hover",xw="djs-updating",_w="djs-dragging",ww=1100;function Ew(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=hh(i.getLayer("overlays"));st(f).add("djs-dragging"),i.addMarker(c,_w),i.addMarker(c,xw)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,bw),l===vw)return;s?(i.removeMarker(c,xu),i.addMarker(c,Ns)):s===!1&&(i.removeMarker(c,Ns),i.addMarker(c,xu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],ww,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,bw),i.removeMarker(s,c?Ns:xu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),y={x:o.x,y:o.y},C=a.hints||{},x={};r&&(C.connectionStart&&(x.connectionStart=C.connectionStart),C.connectionEnd&&(x.connectionEnd=C.connectionEnd),p===AL?bu(a)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||d,x.target=g):p===PL?bu(a)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=d,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,h[c]=y),p===vw&&(h=e.cropWaypoints(f,h)),x.waypoints=h,r.drawPreview(a,s,x)),Mn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],ww,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,un(c),i.removeMarker(s,xw),i.removeMarker(s,_w),l&&(i.removeMarker(l,Ns),i.removeMarker(l,u?Ns:xu)),r&&r.cleanUp(a)})}Ew.$inject=["bendpointMove","injector","eventBus","canvas"];var Sw="connect-hover",Rw="djs-updating";function Cw(e,t,n){return yh(e,t,e[t]+n)}function yh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function TL(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return yh(t,i,s)}function Mw(e){return e==="x"?"y":"x"}function Aw(e,t,n){var i,r;return e.original?e.original:(i=je(t),r=Mw(n),yh(e,r,i[r]))}function Pw(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),y=d-1,C=d,x=f.waypoints,m=x[y],v=x[C],_=dh(n,x,p),E,T,O;if(E=ir(m,v),!!E)return T=E==="v"?"x":"y",y===0&&(m=Aw(m,f.source,T)),C===x.length-1&&(v=Aw(v,f.target,T)),_?O=_.point:O={x:(m.x+v.x)/2,y:(m.y+v.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:C,segmentStart:m,segmentEnd:v,axis:T,dragPosition:O},i.init(p,O,"connectionSegment.move",{cursor:T==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){r.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,y=g[h],C=p.segmentEndIndex+f,x=g[C],m=Mw(p.axis),v=TL(d,y,x,m);Mn(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,y){return tf(p[y-1],p[y+1],h)?(d=y<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=mw(g,f.segmentStart,f.segmentEnd),st(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Rw)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,y=f.segmentStart,C=f.segmentEnd,x=f.axis,m=f.originalWaypoints.slice(),v=Cw(y,x,p["d"+x]),_=Cw(C,x,p["d"+x]),E=m.length,T=0;m[g]=v,m[h]=_;var O,N;g<2&&(O=Cn(d.source,v),g===1?O==="intersect"&&(m.shift(),m[0]=v,T--):O!=="intersect"&&(m.unshift(y),T++)),h>E-3&&(N=Cn(d.target,_),h===E-2?N==="intersect"&&(m.pop(),m[m.length-1]=_):N!=="intersect"&&m.push(C)),f.newWaypoints=d.waypoints=s(d,m),l(f,T,p),f.newSegmentStartIndex=g+T,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Sw)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Sw)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&un(f.draggerGfx),n.removeMarker(d,Rw)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(_){return{original:_.original,x:Math.round(_.x),y:Math.round(_.y)}});var y=u(g,h),C=y.waypoints,x=s(d,C),m=y.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+m}};o.updateWaypoints(d,x,v)})}Pw.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var kL=Math.abs,Tw=Math.round;function OL(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],kL(r-e)<=n)return r}function kw(e){return{x:e.x,y:e.y}}function Ow(e){return{x:e.x+e.width,y:e.y+e.height}}function Ei(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Tw(e.x+e.width/2),y:Tw(e.y+e.height/2)}}function Ma(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function on(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function Dw(e){return e.children||[]}var DL=Math.abs,Lw=Math.round,vh=10;function Iw(e){function t(o,a){if(Fe(o)){for(var s=o.length;s--;)if(DL(o[s]-a)<=vh)return o[s]}else{o=+o;var c=a%o;if(c<vh)return a-c;if(c>o-vh)return a-c+o}return a}function n(o,a){if(o.waypoints)return SL(a,o);if(o.width)return{x:Lw(o.width/2+o.x),y:Lw(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;U(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&on(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&on(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!Et(s)||!c||!c.x||!c.y||(on(o,"x",c.x),on(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,l=c&&n(c,o),u=o.x,p=o.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;U(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(u)!==-1)&&on(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&on(o,"y",d)}})}Iw.$inject=["eventBus"];const LL={__depends__:[lr,Yi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",gw],bendpointMove:["type",gh],bendpointMovePreview:["type",Ew],connectionSegmentMove:["type",Pw],bendpointSnapping:["type",Iw]};function Bw(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!Lo(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Lo(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:bh(s)?u:l,connectionEnd:bh(s)?l:u};hn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){hn(c)||(l=c,c=je(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}Bw.$inject=["eventBus","dragging","modeling","rules"];function bh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var IL=1100,BL=900,Nw="connect-ok",$w="connect-not-ok";function Fw(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,l=o.start,u=o.startPosition,p=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},g=f,h=d;bh(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",BL,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Nw:$w)}),t.on(["connect.out","connect.cleanup"],IL,function(r){var o=r.hover;o&&(n.removeMarker(o,Nw),n.removeMarker(o,$w))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Fw.$inject=["injector","eventBus","canvas"];const xh={__depends__:[xi,Yi,lr],__init__:["connectPreview"],connect:["type",Bw],connectPreview:["type",Fw]};var NL="djs-dragger";function gr(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)}gr.$inject=["injector","canvas","graphicsFactory","elementFactory"],gr.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Lc(i),r||(r=e.getConnection=$L(function(h,y,C){return g.getConnection(h,y,C)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?je(o):c,a?je(a):l]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},gr.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||je(n),o=t.connectionEnd||je(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);We(e,s)},gr.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&Za(o,s,!0)||e,t=i&&Za(a,s,!1)||t,[e,t]},gr.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&un(e.connectionPreviewGfx)},gr.prototype.getConnection=function(e){var t=FL(e);return this._elementFactory.createConnection(t)},gr.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return Se(e,{pointerEvents:"none"}),st(e).add(NL),We(this._canvas.getActiveLayer(),e),e},gr.prototype.createNoopConnection=function(e,t){return qa([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function $L(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function FL(e){return hn(e)?e:{}}const jL={__init__:["connectionPreview"],connectionPreview:["type",gr]},_u="complex-preview";class jw{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(_u);n.filter(s=>!HL(s)).forEach(s=>{let c;Et(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(fo(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(fo(c),s),Mn(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);Et(s)?Mn(l,c.x,c.y):Mn(l,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape(fo(l),s,{width:c.width,height:c.height}),Mn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Lc(this._canvas.getLayer(_u)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(_u)}hide(){this._canvas.hideLayer(_u)}}jw.$inject=["canvas","graphicsFactory","previewSupport"];function HL(e){return e.hidden}const zL={__depends__:[ga],__init__:["complexPreview"],complexPreview:["type",jw]},Hw=Math.round;function wu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}wu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=o.createShape(U({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;U(l,{x:u.x-Hw(l.width/2),y:u.y-Hw(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=r.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Lo(d))})},wu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},wu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const GL={__depends__:[ql,zL,zd],__init__:["appendPreview"],appendPreview:["type",wu]};var zw=Math.min,Gw=Math.max;function _h(e){e.preventDefault()}function $s(e){e.stopPropagation()}function VL(e){return e.nodeType===Node.TEXT_NODE}function WL(e){return[].slice.call(e)}function Oi(e){this.container=e.container,this.parent=Dt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=wt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Gn(this.autoResize,this),this.handlePaste=Gn(this.handlePaste,this)}Oi.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Pi(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);U(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=Pi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return U(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&U(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ge.bind(a,"keydown",this.keyHandler),Ge.bind(a,"mousedown",$s),Ge.bind(a,"paste",r.handlePaste),Ge.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ge.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Oi.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},Oi.prototype.insertText=function(e){e=UL(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Oi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=WL(a.childNodes),c,l;if(VL(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&zi(g)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Oi.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Oi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Dt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){_h(g),$s(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ge.bind(document,"mousemove",f),Ge.bind(document,"mouseup",d)},f=function(g){_h(g),$s(g);var h=zw(Gw(l+g.clientX-s,i),o),y=zw(Gw(u+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){_h(g),$s(g),Ge.unbind(document,"mousemove",f,!1),Ge.unbind(document,"mouseup",d,!1)};Ge.bind(n,"mousedown",p)}U(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Oi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ge.unbind(t,"keydown",this.keyHandler),Ge.unbind(t,"mousedown",$s),Ge.unbind(t,"input",this.autoResize),Ge.unbind(t,"paste",this.handlePaste),Ge.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),zi(n)),zi(e)},Oi.prototype.getValue=function(){return this.content.innerText.trim()},Oi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Oi.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function UL(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function ii(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Oi({container:t.getContainer(),keyHandler:Gn(this._handleKey,this),resizeHandler:Gn(this._handleResize,this),focusoutHandler:Gn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ii.$inject=["eventBus","canvas"],ii.prototype.registerProvider=function(e){this._providers.push(e)},ii.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ii.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ii.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ii.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ii.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ii.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},ii.prototype.getValue=function(){return this._textbox.getValue()},ii.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()},ii.prototype._handleResize=function(e){this._fire("resize",e)},ii.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ii.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Pt(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 Vw={__depends__:[El],__init__:["directEditing"],directEditing:["type",ii]};function qL(e){return function(t){var n=t.target,i=ue(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===at(e);return!o||!a||!s||!c}}const YL={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 ce(e,t={}){var n=YL[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var KL=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing"),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-start"),ce("timer-start"),ce("conditional-start"),ce("signal-start")],XL=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing"),ce("none-end-event",{actionName:"replace-with-none-end"})],ZL=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-intermediate-catch"),ce("message-intermediate-throw"),ce("timer-intermediate-catch"),ce("escalation-intermediate-throw"),ce("conditional-intermediate-catch"),ce("link-intermediate-catch"),ce("link-intermediate-throw"),ce("compensation-intermediate-throw"),ce("signal-intermediate-catch"),ce("signal-intermediate-throw")],QL=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-end"),ce("escalation-end"),ce("error-end"),ce("cancel-end"),ce("compensation-end"),ce("signal-end"),ce("terminate-end")],JL=[ce("exclusive-gateway"),ce("parallel-gateway"),ce("inclusive-gateway"),ce("complex-gateway"),ce("event-based-gateway")],eI=[ce("transaction"),ce("event-subprocess"),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ce("collapsed-subprocess")],tI=[ce("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ce("transaction"),ce("event-subprocess"),ce("collapsed-ad-hoc-subprocess")],Ww=[ce("transaction"),ce("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ce("event-subprocess")],nI=Ww,Uw=[ce("task"),ce("user-task"),ce("service-task"),ce("send-task"),ce("receive-task"),ce("manual-task"),ce("rule-task"),ce("script-task"),ce("call-activity"),ce("collapsed-subprocess"),ce("expanded-subprocess"),ce("collapsed-ad-hoc-subprocess"),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],iI=[ce("data-store-reference")],rI=[ce("data-object-reference")],oI=[ce("message-boundary"),ce("timer-boundary"),ce("escalation-boundary"),ce("conditional-boundary"),ce("error-boundary"),ce("cancel-boundary"),ce("signal-boundary"),ce("compensation-boundary"),ce("non-interrupting-message-boundary"),ce("non-interrupting-timer-boundary"),ce("non-interrupting-escalation-boundary"),ce("non-interrupting-conditional-boundary"),ce("non-interrupting-signal-boundary")],aI=[ce("message-start"),ce("timer-start"),ce("conditional-start"),ce("signal-start"),ce("error-start"),ce("escalation-start"),ce("compensation-start"),ce("non-interrupting-message-start"),ce("non-interrupting-timer-start"),ce("non-interrupting-conditional-start"),ce("non-interrupting-signal-start"),ce("non-interrupting-escalation-start")],sI=[{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"}],cI=[ce("expanded-pool"),ce("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],lI={"bpmn:MessageEventDefinition":[ce("message-start"),ce("message-intermediate-catch"),ce("message-intermediate-throw"),ce("message-end")],"bpmn:TimerEventDefinition":[ce("timer-start"),ce("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ce("conditional-start"),ce("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ce("signal-start"),ce("signal-intermediate-catch"),ce("signal-intermediate-throw"),ce("signal-end")],"bpmn:ErrorEventDefinition":[ce("error-start"),ce("error-end")],"bpmn:EscalationEventDefinition":[ce("escalation-start"),ce("escalation-intermediate-throw"),ce("escalation-end")],"bpmn:CompensateEventDefinition":[ce("compensation-start"),ce("compensation-intermediate-throw"),ce("compensation-end")]};const qw={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},xL=900;function Ma(e,t,n,i){e.registerProvider(xL,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ma.$inject=["contextPad","popupMenu","translate","canvas"],Ma.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Ma.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ma.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${yw.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);U(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ma.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var _L=["left","center","right","top","middle","bottom"];function $s(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}$s.$inject=["popupMenu","alignElements","translate","rules"],$s.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},$s.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},$s.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return z(_L,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:yw[o],action:function(){t.trigger(e,o),i.close()}}}),r};function _u(e){bi.call(this,e)}_u.$inject=["eventBus"],Ee(_u,bi),_u.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=it(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=zc(n),n.length<2?!1:n})};const wL={__depends__:[DD,A_,vh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ma],alignElementsMenuProvider:["type",$s],bpmnAlignElements:["type",_u]};function mr(e,t,n,i){le.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=np(No(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=$o(s,function(p){return p.parent.id});z(u,function(p,f){Fe(l)&&(p=p.filter(function(d){return Tt(l,Fo({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}mr.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(mr,le),mr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Be(Jt(e)),o=Be(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Wc(U({},o,a))},mr.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(EL(i,t)){var r=SL(Ai(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},mr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},mr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},mr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function EL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function SL(e,t){var n="";return e=Be(e),t=Be(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function wu(e){e.invoke(mr,this)}wu.$inject=["injector"],Ee(wu,mr),wu.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Fs(e){bi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Fs.$inject=["eventBus"],Ee(Fs,bi),Fs.prototype.canResize=function(e,t){return!1};function Eu(e,t){Fs.call(this,e),this._modeling=t}Ee(Eu,Fs),Eu.$inject=["eventBus","modeling"],Eu.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return z(e,function(i){if(M(i,"bpmn:Lane")||et(i)){n=!1;return}}),n};const RL={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",wu],bpmnAutoResizeProvider:["type",Eu]};function Aa(e,t,n){this._canvas=n,this._opts=U({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Aa.$inject=["config.autoScroll","eventBus","canvas"],Aa.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)CL(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function CL(e,t,n){return t<e&&e<n}Aa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Aa.prototype.setOptions=function(e){this._opts=U({},this._opts,e)},Aa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=go(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const ML={__depends__:[lr],__init__:["autoScroll"],autoScroll:["type",Aa]};var vw="djs-bendpoint",bw="djs-segment-dragger";function AL(e,t){var n=go(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function bh(e,t,n){var i=AL(e,n),r=Lf(t,i);return r}function xh(e,t){var n=Oe("g");ct(n).add(vw),We(e,n);var i=Oe("circle");Se(i,{cx:0,cy:0,r:4}),ct(i).add("djs-visual"),We(n,i);var r=Oe("circle");return Se(r,{cx:0,cy:0,r:10}),ct(r).add("djs-hit"),We(n,r),t&&ct(n).add(t),n}function PL(e,t,n,i){var r=Oe("g");We(e,r);var o=18,a=6,s=11,c=kL(t,n,i),l=a+s,u=Oe("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),ct(u).add("djs-visual"),We(r,u);var p=Oe("rect");return Se(p,{x:-c/2,y:-l/2,width:c,height:l}),ct(p).add("djs-hit"),We(r,p),By(r,i==="v"?90:0),r}function xw(e,t,n){var i=Oe("g"),r=lf(t,n),o=ir(t,n);return We(e,i),PL(i,t,n,o),ct(i).add(bw),ct(i).add(o==="h"?"horizontal":"vertical"),Cn(i,r.x,r.y),i}function _h(e){return Math.abs(Math.round(e*2/3))}function TL(e,t){var n=OL(e,t);return jf(e,n)}function kL(e,t,n){var i=t.x-e.x,r=t.y-e.y;return _h(n==="h"?i:r)}function OL(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=wv(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function _w(e,t,n,i,r){function o(m,v,_){var S=m.index,k=m.point,O,N,P,D,j,ee;return S<=0||m.bendpoint?!1:(O=v[S-1],N=v[S],P=lf(O,N),D=ir(O,N),j=Math.abs(k.x-P.x),ee=Math.abs(k.y-P.y),D&&j<=_&&ee<=_)}function a(m,v){var _=m.waypoints,S,k,O,N;return v.index<=0||v.bendpoint||(S={start:_[v.index-1],end:_[v.index]},k=ir(S.start,S.end),!k)?null:(k==="h"?O=S.end.x-S.start.x:O=S.end.y-S.start.y,N=_h(O)/2,N)}function s(m,v){var _=v.waypoints,S=bh(t,_,m),k;if(S){k=a(v,S);var O;if(o(S,_,k)?O=r.start(m,v,S.index):O=i.start(m,v,S.index,!S.bendpoint),O!==!1)return!0}}function c(m,v,_){Ge.bind(m,v,function(S){n.triggerMouseEvent(v,S,_),S.stopPropagation()})}function l(m,v){var _=t.getLayer("overlays"),S=Et('.djs-bendpoints[data-element-id="'+Ds(m.id)+'"]',_);return!S&&v&&(S=Oe("g"),Se(S,{"data-element-id":m.id}),ct(S).add("djs-bendpoints"),We(_,S),c(S,"mousedown",m),c(S,"click",m),c(S,"dblclick",m)),S}function u(m,v){return Et('.djs-segment-dragger[data-segment-idx="'+m+'"]',v)}function p(m,v){v.waypoints.forEach(function(_,S){var k=xh(m);We(m,k),Cn(k,_.x,_.y)}),xh(m,"floating")}function f(m,v){for(var _=v.waypoints,S,k,O,N=1;N<_.length;N++)S=_[N-1],k=_[N],ir(S,k)&&(O=xw(m,S,k),Se(O,{"data-segment-idx":N}),c(O,"mousemove",v))}function d(m){z($c("."+vw,m),function(v){cn(v)})}function g(m){z($c("."+bw,m),function(v){cn(v)})}function h(m){var v=l(m);return v||(v=l(m,!0),p(v,m),f(v,m)),v}function y(m){var v=l(m);v&&(g(v),d(v),f(v,m),p(v,m))}function C(m,v){var _=Et(".floating",m),S=v.point;_&&(Cn(_,S.x,S.y),ct(_).add("positioned"))}function x(m,v,_){var S=u(v.index,m),k=_[v.index-1],O=_[v.index],N=v.point,P=lf(k,O),D=ir(k,O),j,ee;S&&(j=DL(S),ee={x:N.x-P.x,y:N.y-P.y},D==="v"&&(ee={x:ee.y,y:ee.x}),Cn(j,ee.x,ee.y))}e.on("connection.changed",function(m){y(m.element)}),e.on("connection.remove",function(m){var v=l(m.element);v&&cn(v)}),e.on("element.marker.update",function(m){var v=m.element,_;v.waypoints&&(_=h(v),m.add?ct(_).add(m.marker):ct(_).remove(m.marker))}),e.on("element.mousemove",function(m){var v=m.element,_=v.waypoints,S,k;if(_){if(S=l(v,!0),k=bh(t,_,m.originalEvent),!k)return;C(S,k),k.bendpoint||x(S,k,_)}}),e.on("element.mousedown",function(m){if(Ir(m)){var v=m.originalEvent,_=m.element;if(_.waypoints)return s(v,_)}}),e.on("selection.changed",function(m){var v=m.newSelection,_=v[0];_&&_.waypoints&&h(_)}),e.on("element.hover",function(m){var v=m.element;v.waypoints&&h(v)}),e.on("element.out",function(m){var v=m.element;if(v.waypoints){var _=l(v);if(_){var S=Et(".floating",_);S&&ct(S).remove("positioned")}}}),e.on("element.updateId",function(m){var v=m.element,_=m.newId;if(v.waypoints){var S=l(v);S&&Se(S,{"data-element-id":_})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}_w.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function DL(e){return Et(".djs-visual",e)}var ww=Math.round,So="reconnectStart",Ro="reconnectEnd",js="updateWaypoints";function wh(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=So:!l&&c===d.length-1?g=Ro:g=js;var h=g===js?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:p,target:f});if(y===!1&&(y=r.allowed(h,{connection:s,source:f,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===js?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===So?p:l,target:f===Ro?p:u}),d){s.source=f===So?p:l,s.target=f===Ro?p:u;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===Ro?p:u,target:f===So?p:l})),d&&(s.source=f===Ro?p:u,s.target=f===So?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!==js&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,y=s.hints||{},C={x:ww(a.x),y:ww(a.y)};if(!c)return!1;h===js?(p?f.splice(l,0,C):f[l]=C,y.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,jM(f),y)):(h===So?(y.docking="source",Su(s)&&(y.docking="target",y.newWaypoints=f.reverse())):h===Ro&&(y.docking="target",Su(s)&&(y.docking="source",y.newWaypoints=f.reverse())),o.reconnect(u,d,g,C,y))},this)}wh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],wh.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 Su(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===So)return t&&i&&t===i&&n!==i;if(r===Ro)return t&&n&&t===n&&n!==i}var LL="reconnectStart",IL="reconnectEnd",Ew="updateWaypoints",Hs="connect-ok",Ru="connect-not-ok",Sw="connect-hover",Rw="djs-updating",Cw="djs-dragging",Mw=1100;function Aw(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=xh(i.getLayer("overlays"));ct(f).add("djs-dragging"),i.addMarker(c,Cw),i.addMarker(c,Rw)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,Sw),l===Ew)return;s?(i.removeMarker(c,Ru),i.addMarker(c,Hs)):s===!1&&(i.removeMarker(c,Hs),i.addMarker(c,Ru))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Mw,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Sw),i.removeMarker(s,c?Hs:Ru))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),y={x:o.x,y:o.y},C=a.hints||{},x={};r&&(C.connectionStart&&(x.connectionStart=C.connectionStart),C.connectionEnd&&(x.connectionEnd=C.connectionEnd),p===LL?Su(a)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||d,x.target=g):p===IL?Su(a)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=d,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,h[c]=y),p===Ew&&(h=e.cropWaypoints(f,h)),x.waypoints=h,r.drawPreview(a,s,x)),Cn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Mw,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,cn(c),i.removeMarker(s,Rw),i.removeMarker(s,Cw),l&&(i.removeMarker(l,Hs),i.removeMarker(l,u?Hs:Ru)),r&&r.cleanUp(a)})}Aw.$inject=["bendpointMove","injector","eventBus","canvas"];var Pw="connect-hover",Tw="djs-updating";function kw(e,t,n){return Eh(e,t,e[t]+n)}function Eh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function BL(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return Eh(t,i,s)}function Ow(e){return e==="x"?"y":"x"}function Dw(e,t,n){var i,r;return e.original?e.original:(i=je(t),r=Ow(n),Eh(e,r,i[r]))}function Lw(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),y=d-1,C=d,x=f.waypoints,m=x[y],v=x[C],_=bh(n,x,p),S,k,O;if(S=ir(m,v),!!S)return k=S==="v"?"x":"y",y===0&&(m=Dw(m,f.source,k)),C===x.length-1&&(v=Dw(v,f.target,k)),_?O=_.point:O={x:(m.x+v.x)/2,y:(m.y+v.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:C,segmentStart:m,segmentEnd:v,axis:k,dragPosition:O},i.init(p,O,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){r.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,y=g[h],C=p.segmentEndIndex+f,x=g[C],m=Ow(p.axis),v=BL(d,y,x,m);Cn(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,y){return cf(p[y-1],p[y+1],h)?(d=y<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=xw(g,f.segmentStart,f.segmentEnd),ct(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Tw)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,y=f.segmentStart,C=f.segmentEnd,x=f.axis,m=f.originalWaypoints.slice(),v=kw(y,x,p["d"+x]),_=kw(C,x,p["d"+x]),S=m.length,k=0;m[g]=v,m[h]=_;var O,N;g<2&&(O=Rn(d.source,v),g===1?O==="intersect"&&(m.shift(),m[0]=v,k--):O!=="intersect"&&(m.unshift(y),k++)),h>S-3&&(N=Rn(d.target,_),h===S-2?N==="intersect"&&(m.pop(),m[m.length-1]=_):N!=="intersect"&&m.push(C)),f.newWaypoints=d.waypoints=s(d,m),l(f,k,p),f.newSegmentStartIndex=g+k,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Pw)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Pw)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&cn(f.draggerGfx),n.removeMarker(d,Tw)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(_){return{original:_.original,x:Math.round(_.x),y:Math.round(_.y)}});var y=u(g,h),C=y.waypoints,x=s(d,C),m=y.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+m}};o.updateWaypoints(d,x,v)})}Lw.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var NL=Math.abs,Iw=Math.round;function $L(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],NL(r-e)<=n)return r}function Bw(e){return{x:e.x,y:e.y}}function Nw(e){return{x:e.x+e.width,y:e.y+e.height}}function Ei(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Iw(e.x+e.width/2),y:Iw(e.y+e.height/2)}}function Pa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function rn(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function $w(e){return e.children||[]}var FL=Math.abs,Fw=Math.round,Sh=10;function jw(e){function t(o,a){if(Fe(o)){for(var s=o.length;s--;)if(FL(o[s]-a)<=Sh)return o[s]}else{o=+o;var c=a%o;if(c<Sh)return a-c;if(c>o-Sh)return a-c+o}return a}function n(o,a){if(o.waypoints)return TL(a,o);if(o.width)return{x:Fw(o.width/2+o.x),y:Fw(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;U(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&rn(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&rn(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!Rt(s)||!c||!c.x||!c.y||(rn(o,"x",c.x),rn(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,l=c&&n(c,o),u=o.x,p=o.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;U(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(u)!==-1)&&rn(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&rn(o,"y",d)}})}jw.$inject=["eventBus"];const jL={__depends__:[lr,Ui],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",_w],bendpointMove:["type",wh],bendpointMovePreview:["type",Aw],connectionSegmentMove:["type",Lw],bendpointSnapping:["type",jw]};function Hw(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!Bo(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Bo(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Rh(s)?u:l,connectionEnd:Rh(s)?l:u};fn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){fn(c)||(l=c,c=je(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}Hw.$inject=["eventBus","dragging","modeling","rules"];function Rh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var HL=1100,zL=900,zw="connect-ok",Gw="connect-not-ok";function Vw(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,l=o.start,u=o.startPosition,p=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},g=f,h=d;Rh(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",zL,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?zw:Gw)}),t.on(["connect.out","connect.cleanup"],HL,function(r){var o=r.hover;o&&(n.removeMarker(o,zw),n.removeMarker(o,Gw))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Vw.$inject=["injector","eventBus","canvas"];const Ch={__depends__:[xi,Ui,lr],__init__:["connectPreview"],connect:["type",Hw],connectPreview:["type",Vw]};var GL="djs-dragger";function gr(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)}gr.$inject=["injector","canvas","graphicsFactory","elementFactory"],gr.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Fc(i),r||(r=e.getConnection=VL(function(h,y,C){return g.getConnection(h,y,C)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?je(o):c,a?je(a):l]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},gr.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||je(n),o=t.connectionEnd||je(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);We(e,s)},gr.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&ts(o,s,!0)||e,t=i&&ts(a,s,!1)||t,[e,t]},gr.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&cn(e.connectionPreviewGfx)},gr.prototype.getConnection=function(e){var t=WL(e);return this._elementFactory.createConnection(t)},gr.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return Se(e,{pointerEvents:"none"}),ct(e).add(GL),We(this._canvas.getActiveLayer(),e),e},gr.prototype.createNoopConnection=function(e,t){return Za([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function VL(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function WL(e){return fn(e)?e:{}}const UL={__init__:["connectionPreview"],connectionPreview:["type",gr]},Cu="complex-preview";class Ww{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(Cu);n.filter(s=>!qL(s)).forEach(s=>{let c;Rt(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(fo(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(fo(c),s),Cn(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);Rt(s)?Cn(l,c.x,c.y):Cn(l,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape(fo(l),s,{width:c.width,height:c.height}),Cn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Fc(this._canvas.getLayer(Cu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Cu)}hide(){this._canvas.hideLayer(Cu)}}Ww.$inject=["canvas","graphicsFactory","previewSupport"];function qL(e){return e.hidden}const YL={__depends__:[va],__init__:["complexPreview"],complexPreview:["type",Ww]},Uw=Math.round;function Mu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Mu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=o.createShape(U({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;U(l,{x:u.x-Uw(l.width/2),y:u.y-Uw(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=r.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Bo(d))})},Mu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Mu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const KL={__depends__:[Ql,YL,Yd],__init__:["appendPreview"],appendPreview:["type",Mu]};var qw=Math.min,Yw=Math.max;function Mh(e){e.preventDefault()}function zs(e){e.stopPropagation()}function XL(e){return e.nodeType===Node.TEXT_NODE}function ZL(e){return[].slice.call(e)}function ki(e){this.container=e.container,this.parent=Lt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=zn(this.autoResize,this),this.handlePaste=zn(this.handlePaste,this)}ki.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Ai(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);U(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=Ai(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return U(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&U(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ge.bind(a,"keydown",this.keyHandler),Ge.bind(a,"mousedown",zs),Ge.bind(a,"paste",r.handlePaste),Ge.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ge.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ki.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},ki.prototype.insertText=function(e){e=QL(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ki.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=ZL(a.childNodes),c,l;if(XL(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&ji(g)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},ki.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},ki.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Lt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Mh(g),zs(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ge.bind(document,"mousemove",f),Ge.bind(document,"mouseup",d)},f=function(g){Mh(g),zs(g);var h=qw(Yw(l+g.clientX-s,i),o),y=qw(Yw(u+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Mh(g),zs(g),Ge.unbind(document,"mousemove",f,!1),Ge.unbind(document,"mouseup",d,!1)};Ge.bind(n,"mousedown",p)}U(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)},ki.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ge.unbind(t,"keydown",this.keyHandler),Ge.unbind(t,"mousedown",zs),Ge.unbind(t,"input",this.autoResize),Ge.unbind(t,"paste",this.handlePaste),Ge.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),ji(n)),ji(e)},ki.prototype.getValue=function(){return this.content.innerText.trim()},ki.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ki.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 QL(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function ni(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ki({container:t.getContainer(),keyHandler:zn(this._handleKey,this),resizeHandler:zn(this._handleResize,this),focusoutHandler:zn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ni.$inject=["eventBus","canvas"],ni.prototype.registerProvider=function(e){this._providers.push(e)},ni.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ni.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ni.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ni.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ni.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ni.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},ni.prototype.getValue=function(){return this._textbox.getValue()},ni.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()},ni.prototype._handleResize=function(e){this._fire("resize",e)},ni.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ni.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Tt(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 Kw={__depends__:[Al],__init__:["directEditing"],directEditing:["type",ni]};function JL(e){return function(t){var n=t.target,i=ue(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===st(e);return!o||!a||!s||!c}}const eI={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 ce(e,t={}){var n=eI[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var tI=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing"),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-start"),ce("timer-start"),ce("conditional-start"),ce("signal-start")],nI=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing"),ce("none-end-event",{actionName:"replace-with-none-end"})],iI=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-intermediate-catch"),ce("message-intermediate-throw"),ce("timer-intermediate-catch"),ce("escalation-intermediate-throw"),ce("conditional-intermediate-catch"),ce("link-intermediate-catch"),ce("link-intermediate-throw"),ce("compensation-intermediate-throw"),ce("signal-intermediate-catch"),ce("signal-intermediate-throw")],rI=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-end"),ce("escalation-end"),ce("error-end"),ce("cancel-end"),ce("compensation-end"),ce("signal-end"),ce("terminate-end")],oI=[ce("exclusive-gateway"),ce("parallel-gateway"),ce("inclusive-gateway"),ce("complex-gateway"),ce("event-based-gateway")],aI=[ce("transaction"),ce("event-subprocess"),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ce("collapsed-subprocess")],sI=[ce("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ce("transaction"),ce("event-subprocess"),ce("collapsed-ad-hoc-subprocess")],Xw=[ce("transaction"),ce("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ce("event-subprocess")],cI=Xw,Zw=[ce("task"),ce("user-task"),ce("service-task"),ce("send-task"),ce("receive-task"),ce("manual-task"),ce("rule-task"),ce("script-task"),ce("call-activity"),ce("collapsed-subprocess"),ce("expanded-subprocess"),ce("collapsed-ad-hoc-subprocess"),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],lI=[ce("data-store-reference")],uI=[ce("data-object-reference")],pI=[ce("message-boundary"),ce("timer-boundary"),ce("escalation-boundary"),ce("conditional-boundary"),ce("error-boundary"),ce("cancel-boundary"),ce("signal-boundary"),ce("compensation-boundary"),ce("non-interrupting-message-boundary"),ce("non-interrupting-timer-boundary"),ce("non-interrupting-escalation-boundary"),ce("non-interrupting-conditional-boundary"),ce("non-interrupting-signal-boundary")],fI=[ce("message-start"),ce("timer-start"),ce("conditional-start"),ce("signal-start"),ce("error-start"),ce("escalation-start"),ce("compensation-start"),ce("non-interrupting-message-start"),ce("non-interrupting-timer-start"),ce("non-interrupting-conditional-start"),ce("non-interrupting-signal-start"),ce("non-interrupting-escalation-start")],dI=[{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"}],hI=[ce("expanded-pool"),ce("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],mI={"bpmn:MessageEventDefinition":[ce("message-start"),ce("message-intermediate-catch"),ce("message-intermediate-throw"),ce("message-end")],"bpmn:TimerEventDefinition":[ce("timer-start"),ce("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ce("conditional-start"),ce("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ce("signal-start"),ce("signal-intermediate-catch"),ce("signal-intermediate-throw"),ce("signal-end")],"bpmn:ErrorEventDefinition":[ce("error-start"),ce("error-end")],"bpmn:EscalationEventDefinition":[ce("escalation-start"),ce("escalation-intermediate-throw"),ce("escalation-end")],"bpmn:CompensateEventDefinition":[ce("compensation-start"),ce("compensation-intermediate-throw"),ce("compensation-end")]};const Qw={"start-event-non-interrupting":`
|
|
317
317
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
318
318
|
<g transform="translate(0 995.64)">
|
|
319
319
|
<path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
325
325
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
326
326
|
</g>
|
|
327
|
-
</svg>`};function Si(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Si.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Si.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Si.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Fe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=qL(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,iI):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,rI):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=lI[r]||[],!Bn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=nt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(o=nt(KL.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Participant")?(o=nt(cI,function(c){return at(e)!==c.target.isExpanded}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&Bn(t.$parent)?(o=nt(aI.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&!Bn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(o=nt(XL.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:EndEvent")?(o=nt(QL.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):M(t,"bpmn:BoundaryEvent")?(o=nt(oI,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(o=nt(ZL.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Gateway")?(o=nt(JL,a),this._createEntries(e,o)):M(t,"bpmn:Transaction")?(o=nt(Ww,a),this._createEntries(e,o)):Bn(t)&&at(e)?(o=nt(nI,a),this._createEntries(e,o)):M(t,"bpmn:AdHocSubProcess")&&at(e)?(o=nt(tI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&at(e)?(o=nt(eI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&!at(e)?(o=nt(Uw,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,sI):M(t,"bpmn:FlowNode")?(o=nt(Uw,a),this._createEntries(e,o)):{})},Si.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!Bn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Ov(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Si.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Si.prototype._createSequenceFlowEntries=function(e,t){var n=ue(e),i={},r=this._modeling,o=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&M(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Si.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Si.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=ue(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Si.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Si.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Si.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ue(e),i=this,r=Dv(e),o=M(e,"bpmn:BoundaryEvent")?qw["intermediate-event-non-interrupting"]:qw["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const uI={__depends__:[fh,Jb,ql],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Si]};function Fs(e,t,n,i,r,o,a,s,c,l,u,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!us(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Fs.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Fs.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&U(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Fs.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Fe(t)?io(e,n=>t.includes(n)):t},Fs.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&U(u,g()),u;var p=e.businessObject;function f(m,v){r.start(m,v)}function d(m,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(m){var v=5,_=t.getPad(m).html,E=_.getBoundingClientRect(),T={x:E.left,y:E.bottom+v};return T}function y(m,v,_,E){function T(P,D){var F=i.createShape(U({type:m},E));o.start(P,F,{source:D})}var O=s?function(P,D){var F=i.createShape(U({type:m},E));s.append(D,F)}:T,N=s?function(P,D){return l.create(D,m,E),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:_,action:{dragstart:T,click:O,hover:N}}}function C(m){return function(v,_){n.splitLane(_,m),t.open(_,!0)}}if(tt(p,["bpmn:Lane","bpmn:Participant"])&&at(e)){var x=Dr(e);U(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(m,v){n.addLane(v,"top")}}}}),x.length<2&&((yn(e)?e.height>=120:e.width>=120)&&U(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:C(2)}}}),(yn(e)?e.height>=180:e.width>=180)&&U(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:C(3)}}})),U(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(m,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?U(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Yw(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?U(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!Yw(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Bn(p)&&U(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||U(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(m,v){var _=U(h(v),{cursor:{x:m.x,y:m.y}});a.open(v,"bpmn-replace",_,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),tt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),M(p,"bpmn:TextAnnotation")&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),tt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&U(u,g()),u};function Yw(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return z(o,function(a){a.$type===n&&(r=!0)}),i&&r}const pI={__depends__:[GL,Vw,E_,xi,xh,Rl,uI],__init__:["contextPadProvider"],contextPadProvider:["type",Fs]};var fI={horizontal:["x","width"],vertical:["y","height"]},Kw=5;function yr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Fe(i)?i:i?n:[]})}yr.$inject=["modeling","rules"],yr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},yr.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},yr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(z(t,function(o){r=o(r,n,i)}),r):e},yr.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=Bi(e,i);return z(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},yr.prototype._setOrientation=function(e){var t=fI[e];this._axis=t[0],this._dimension=t[1]},yr.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)},yr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Kw,max:t+n-Kw}};const dI={__init__:["distributeElements"],distributeElements:["type",yr]};function Eu(e){bi.call(this,e)}Eu.$inject=["eventBus"],Ee(Eu,bi),Eu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=nt(t,function(n){var i=tt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Nc(t),t.length<3?!1:t})};var Xw={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Si(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Si.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Si.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Si.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Fe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=JL(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,lI):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,uI):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=mI[r]||[],!In(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=it(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(o=it(tI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Participant")?(o=it(hI,function(c){return st(e)!==c.target.isExpanded}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&In(t.$parent)?(o=it(fI.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&!In(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(o=it(nI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:EndEvent")?(o=it(rI.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):M(t,"bpmn:BoundaryEvent")?(o=it(pI,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(o=it(iI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Gateway")?(o=it(oI,a),this._createEntries(e,o)):M(t,"bpmn:Transaction")?(o=it(Xw,a),this._createEntries(e,o)):In(t)&&st(e)?(o=it(cI,a),this._createEntries(e,o)):M(t,"bpmn:AdHocSubProcess")&&st(e)?(o=it(sI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&st(e)?(o=it(aI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&!st(e)?(o=it(Zw,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,dI):M(t,"bpmn:FlowNode")?(o=it(Zw,a),this._createEntries(e,o)):{})},Si.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!In(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Nv(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Si.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Si.prototype._createSequenceFlowEntries=function(e,t){var n=ue(e),i={},r=this._modeling,o=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&M(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Si.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Si.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=ue(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Si.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Si.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Si.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ue(e),i=this,r=$v(e),o=M(e,"bpmn:BoundaryEvent")?Qw["intermediate-event-non-interrupting"]:Qw["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const gI={__depends__:[vh,rx,Ql],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Si]};function Gs(e,t,n,i,r,o,a,s,c,l,u,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!hs(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Gs.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Gs.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&U(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Gs.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Fe(t)?io(e,n=>t.includes(n)):t},Gs.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&U(u,g()),u;var p=e.businessObject;function f(m,v){r.start(m,v)}function d(m,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(m){var v=5,_=t.getPad(m).html,S=_.getBoundingClientRect(),k={x:S.left,y:S.bottom+v};return k}function y(m,v,_,S){function k(P,D){var j=i.createShape(U({type:m},S));o.start(P,j,{source:D})}var O=s?function(P,D){var j=i.createShape(U({type:m},S));s.append(D,j)}:k,N=s?function(P,D){return l.create(D,m,S),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:_,action:{dragstart:k,click:O,hover:N}}}function C(m){return function(v,_){n.splitLane(_,m),t.open(_,!0)}}if(nt(p,["bpmn:Lane","bpmn:Participant"])&&st(e)){var x=Dr(e);U(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(m,v){n.addLane(v,"top")}}}}),x.length<2&&((gn(e)?e.height>=120:e.width>=120)&&U(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:C(2)}}}),(gn(e)?e.height>=180:e.width>=180)&&U(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:C(3)}}})),U(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(m,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?U(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Jw(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?U(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!Jw(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!In(p)&&U(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||U(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(m,v){var _=U(h(v),{cursor:{x:m.x,y:m.y}});a.open(v,"bpmn-replace",_,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),nt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),M(p,"bpmn:TextAnnotation")&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),nt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&U(u,g()),u};function Jw(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return z(o,function(a){a.$type===n&&(r=!0)}),i&&r}const yI={__depends__:[KL,Kw,A_,xi,Ch,Tl,gI],__init__:["contextPadProvider"],contextPadProvider:["type",Gs]};var vI={horizontal:["x","width"],vertical:["y","height"]},e0=5;function yr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Fe(i)?i:i?n:[]})}yr.$inject=["modeling","rules"],yr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},yr.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},yr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(z(t,function(o){r=o(r,n,i)}),r):e},yr.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=Li(e,i);return z(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},yr.prototype._setOrientation=function(e){var t=vI[e];this._axis=t[0],this._dimension=t[1]},yr.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)},yr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+e0,max:t+n-e0}};const bI={__init__:["distributeElements"],distributeElements:["type",yr]};function Au(e){bi.call(this,e)}Au.$inject=["eventBus"],Ee(Au,bi),Au.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=it(t,function(n){var i=nt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=zc(t),t.length<3?!1:t})};var t0={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
328
328
|
<polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
329
329
|
<rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
330
330
|
<rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
<polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
333
333
|
<rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
334
334
|
<rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
335
|
-
</svg>`},hI=900;function js(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",hI,this)}js.$inject=["popupMenu","distributeElements","translate","rules"],js.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},js.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},js.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Xw.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Xw.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const mI={__depends__:[fh,dI],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Eu],distributeElementsMenuProvider:["type",js]};var Zw="is not a registered action",gI="is already registered";function Ri(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ri.$inject=["eventBus","injector"],Ri.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=Fe(p)?p:u;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&(Fe(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ri.prototype.trigger=function(e,t){if(!this._actions[e])throw wh(e,Zw);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ri.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,r){n._registerAction(r,i)})},Ri.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw wh(e,gI);this._actions[e]=t},Ri.prototype.unregister=function(e){if(!this.isRegistered(e))throw wh(e,Zw);this._actions[e]=void 0},Ri.prototype.getActions=function(){return Object.keys(this._actions)},Ri.prototype.isRegistered=function(e){return!!this._actions[e]};function wh(e,t){return new Error(e+" "+t)}const yI={__init__:["editorActions"],editorActions:["type",Ri]};function Su(e){e.invoke(Ri,this)}Ee(Su,Ri),Su.$inject=["injector"],Su.prototype._registerDefaultActions=function(e){Ri.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(y){return y!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),y=g.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),y=[],C=g.type;h.length&&(y=nt(h,function(x){return!M(x,"bpmn:Lane")}),l.trigger(y,C))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;M(g,"bpmn:Collaboration")?y=n.filter(function(C){return M(C.parent,"bpmn:Collaboration")}):y=n.filter(function(C){return C!==g&&!M(C.parent,"bpmn:SubProcess")}),h=en(y),f.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const vI={__depends__:[yI],editorActions:["type",Su]};function Qw(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;tt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Qw.$inject=["eventBus"];function Co(e,t){le.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;qn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Co.$inject=["eventBus","gridSnapping","modeling"],Ee(Co,le),Co.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},Co.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},Co.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),U(e,o),e},Co.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),U(e,o),e};var bI=2e3;function Jw(e,t){e.on(["spaceTool.move","spaceTool.end"],bI,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}Jw.$inject=["eventBus","gridSnapping"];const xI={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Co],gridSnappingSpaceToolBehavior:["type",Jw]};var Ru=10;function Eh(e,t,n){return n||(n="round"),Math[n](e/t)*t}var _I=1200,wI=800;function Ur(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",wI,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],_I,function(o){var a=o.originalEvent;if(!(!r.active||a&&Jn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=SI(o,l,e);p&&(u.offset=p);var f=EI(o,l);f&&U(u,f),Ma(o,l)||r.snapEvent(o,l,u)})}})}Ur.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);on(e,t,i)},Ur.prototype.getGridSpacing=function(){return Ru},Ur.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Eh(e,Ru);var i,r;return t&&t.min&&(i=t.min,ze(i)&&(i=Eh(i+n,Ru,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ze(r)&&(r=Eh(r+n,Ru,"floor"),e=Math.min(e,r))),e-=n,e},Ur.prototype.isActive=function(){return this.active},Ur.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Ur.prototype.toggleActive=function(){this.setActive(!this.active)},Ur.$inject=["elementRegistry","eventBus","config.gridSnapping"];function EI(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Cu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,l=r.max;return c&&(Cu(t)?t0(s)?a.x.max=c.left:a.x.min=c.right:e0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Cu(t)?t0(s)?a.x.min=l.left:a.x.max=l.right:e0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function SI(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ze(s[t])||(s||(s=o.snapOffset={}),ze(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Cu(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function Cu(e){return e==="x"}function e0(e){return e.indexOf("n")!==-1}function t0(e){return e.indexOf("w")!==-1}const RI={__depends__:[xI],__init__:["gridSnapping"],gridSnapping:["type",Ur]};var CI=2e3;function n0(e,t,n){e.on("autoPlace",CI,function(i){var r=i.source,o=je(r),a=i.shape,s=Wx(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],M(a,"bpmn:TextAnnotation")&&(MI(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}n0.$inject=["eventBus","gridSnapping","elementRegistry"];function MI(e){return e==="x"}var AI=1750;function i0(e,t,n){t.on(["create.start","shape.move.start"],AI,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!M(o,"bpmn:Participant")||!M(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}i0.$inject=["canvas","eventBus","gridSnapping"];var PI=3e3;function Mu(e,t,n){le.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],PI,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||TI(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Mu.$inject=["eventBus","gridSnapping","modeling"],Ee(Mu,le),Mu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=DI(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function TI(e){return e.length>3}function kI(e){return e==="h"}function OI(e){return e==="v"}function DI(e,t,n){var i=ir(t,n),r={};return kI(i)&&(r.y=e.snapValue(t.y)),OI(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=U({},t,r),n=U({},n,r)),[t,n]}const LI={__depends__:[RI,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",n0],gridSnappingParticipantBehavior:["type",i0],gridSnappingLayoutConnectionBehavior:["type",Mu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Qw]};var II=30,r0=30;function Hs(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(M(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(M(r,"bpmn:Participant"))return at(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(M(r,"bpmn:SubProcess"))return at(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Hs.$inject=["eventBus","interactionEvents"],Hs.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Hs.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=yn(e)?{width:II,height:e.height}:{width:e.width,height:r0};return this._interactionEvents.createBoxHit(t,"all",n),!0},Hs.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:r0}),!0};const BI={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Hs]};function Au(e){e.invoke(xa,this)}Ee(Au,xa),Au.$inject=["injector"],Au.prototype.registerBindings=function(e,t){xa.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const NI={__depends__:[Zd],__init__:["keyboardBindings"],keyboardBindings:["type",Au]};var $I={moveSpeed:1,moveSpeedAccelerated:10},FI=1500,o0="left",a0="up",s0="right",c0="down",jI={ArrowLeft:o0,Left:o0,ArrowUp:a0,Up:a0,ArrowRight:s0,Right:s0,ArrowDown:c0,Down:c0},HI={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 l0(e,t,n,i,r){var o=this;this._config=U({},$I,e||{}),t.addListener(FI,function(a){var s=a.keyEvent,c=jI[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=HI[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}l0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const zI={__depends__:[Zd,xi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",l0]};var u0=10;function zs(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=AP(u,p,l),c.newBounds=TP(d,f),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Le(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=yy(p),!GI(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}zs.prototype.canResize=function(e){var t=this._rules,n=Pi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},zs.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=U({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,p0(t,o),"resize",{autoActivate:!0,cursor:VI(o),data:{shape:t,context:r}})},zs.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:u0,height:u0},r=rv(t,e.childrenBoxPadding),kP(n,t,i,r)},zs.$inject=["eventBus","rules","modeling","dragging"];function GI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function p0(e,t){var n=je(e),i=Le(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function VI(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 f0="djs-resizing",d0="resize-not-ok",WI=500;function h0(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,f0)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?st(c).remove(d0):st(c).add(d0)}function r(o){var a=o.shape,s=o.frame;s&&un(o.frame),t.removeMarker(a,f0)}e.on("resize.move",WI,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}h0.$inject=["eventBus","canvas","previewSupport"];var Pu=-6,Tu=8,ku=20,Gs="djs-resizer",UI=["n","w","s","e","nw","ne","se","sw"];function qr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&z(a,Gn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}qr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Ir(o)&&i.activate(o,e,n)}Ge.bind(t,"mousedown",r),Ge.bind(t,"touchstart",r)},qr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=qI(i),a=Oe("g");st(a).add(Gs),st(a).add(Gs+"-"+e.id),st(a).add(Gs+"-"+i),We(r,a);var s=Oe("rect");Se(s,{x:-Tu/2+o.x,y:-Tu/2+o.y,width:Tu,height:Tu}),st(s).add(Gs+"-visual"),We(a,s);var c=Oe("rect");return Se(c,{x:-ku/2+o.x,y:-ku/2+o.y,width:ku,height:ku}),st(c).add(Gs+"-hit"),We(a,c),Gc(a,t,n),a},qr.prototype.createResizer=function(e,t){var n=p0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},qr.prototype.addResizer=function(e){var t=this;Et(e)||z(UI,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},qr.prototype.removeResizers=function(){var e=this._getResizersParent();Lc(e)},qr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},qr.$inject=["eventBus","canvas","selection","resize"];function qI(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Pu:e.indexOf("w")!==-1&&(t.x=Pu),e.indexOf("s")!==-1?t.y=-Pu:e.indexOf("n")!==-1&&(t.y=Pu),t}const m0={__depends__:[Yi,lr,ga],__init__:["resize","resizePreview","resizeHandles"],resize:["type",zs],resizePreview:["type",h0],resizeHandles:["type",qr]};var YI=2e3;function Vs(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],YI,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||tt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Vs.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Vs.prototype.activate=function(e){var t=pi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);U(n,i);var r={},o=n.style||{};return U(o,{backgroundColor:null,border:null}),(tt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||g0(e))&&U(r,{centerVertically:!0}),kr(e)&&(U(r,{resizable:!0,autoResize:!0}),U(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(U(r,{resizable:!0,autoResize:!0}),U(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),U(n,{options:r,style:o}),n}},Vs.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||ZI(e)){var g=yn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};U(o,h),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(XI(e)){var y=yn(e),C=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};U(o,C),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(tt(e,["bpmn:Task","bpmn:CallActivity"])||g0(e))&&(U(o,{width:i.width,height:i.height}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),KI(e)&&(U(o,{width:i.width,x:i.x}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,m=i.width+2*x;if(n.labelTarget&&(U(o,{width:m,height:i.height+2*x,x:i.x-x,y:i.y-x}),U(d,{fontSize:l+"px",lineHeight:u})),kr(n)&&!Uc(n)&&!Je(n)){var v=sf(e),_=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),E=l,T=ho.width*a+2*x;U(o,{width:T,height:E+2*x,x:_.x-T/2,y:_.y-E/2-x}),U(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(U(o,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),U(d,{textAlign:"left",paddingTop:ia*a+"px",paddingBottom:ia*a+"px",paddingLeft:ia*a+"px",paddingRight:ia*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Vs.prototype.update=function(e,t,n,i){var r,o;M(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),QI(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function g0(e){return M(e,"bpmn:SubProcess")&&!at(e)}function KI(e){return M(e,"bpmn:SubProcess")&&at(e)}function XI(e){return M(e,"bpmn:Participant")&&!at(e)}function ZI(e){return M(e,"bpmn:Participant")&&at(e)}function QI(e){return!e||!e.trim()}var y0="djs-element-hidden",v0="djs-label-hidden";function b0(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,M(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Oe("path");Se(p,{d:u,strokeWidth:2,stroke:JI(o)}),We(s,p),We(r,s),Mn(s,o.x,o.y)}M(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,y0):(M(o,"bpmn:Task")||M(o,"bpmn:CallActivity")||M(o,"bpmn:SubProcess")||M(o,"bpmn:Participant")||M(o,"bpmn:Lane"))&&t.addMarker(o,v0)}),e.on("directEditing.resize",function(c){if(M(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(o.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});Se(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,y0),t.removeMarker(o,v0)),o=void 0,a=void 0,s&&(un(s),s=void 0)})}b0.$inject=["eventBus","canvas","pathMap"];function JI(e,t){var n=ct(e);return n.get("stroke")||t||"black"}const eB={__depends__:[Rd,m0,Vw],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Vs],labelEditingPreview:["type",b0]};var tB=500,nB=1e3;function Zi(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){TM(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){z(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],tB,function(o){var a=o.element,s=o.gfx,c=wt(".djs-outline",s);c&&i.updateOutline(a,c)})}Zi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=wt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),We(t,n),this.updateOutline(e,n)),n},Zi.prototype._createOutlineGfx=function(){var e=Oe("rect");return Se(e,U({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Zi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Zi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(r){n=n||r.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Zi.prototype.updateConnectionOutline=function(e,t){var n=en(t);Se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Zi.prototype.registerProvider=function(e,t){t||(t=e,e=nB),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Zi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Zi.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){mn(i.getOutline)&&(t=t||i.getOutline(e))}),t},Zi.$inject=["eventBus","styles","elementRegistry"];var Ou=6;function Sh(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Sh.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Lc(t);var n=e.length>1,i=this._canvas.getContainer();if(st(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=iB(en(e)),o=Oe("rect");Se(o,U({rx:3},r)),st(o).add("djs-selection-outline"),We(t,o)}},Sh.$inject=["eventBus","canvas","selection"];function iB(e){return{x:e.x-Ou,y:e.y-Ou,width:e.width+Ou*2,height:e.height+Ou*2}}const Rh={__depends__:[xi],__init__:["outline","multiSelectionOutline"],outline:["type",Zi],multiSelectionOutline:["type",Sh]},x0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],_0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},rB=15,Du=2;function w0(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>tt(g,x0));if(f.length===1){const g=f[0];Je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Je),h=f.find(y=>{var C;return(C=y.labels)==null?void 0:C.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!tt(p,x0)||!u(p)||(Je(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=qa([je(f),je(p)],_0),g=d.getAttribute("d"),y=r.isSelected(p)?c(p):l(p),C=Za(y,g);if(!C)return;const m=r.isSelected(f)?c(f):l(f),v=Za(m,g)||je(f);ss(v,C)<rB||(Qp(d,[v,C]),We(o,d))}function s(){Dc(`.${_0.class}`,o).forEach(un)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+Yr(f,"x")-Du,y:p.y+Yr(f,"y")-Du,width:Yr(f,"width")+Du*2,height:Yr(f,"height")+Du*2};return lf(d,Yr(f,"rx"))}if(f.cx){const d=Yr(f,"r"),g={x:p.x+Yr(f,"cx")-d,y:p.y+Yr(f,"cy")-d,width:d*2,height:d*2};return Hy(g)}}function l(p){return n.getShapePath(p)}function u(p){return r.isSelected(p)}}w0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Yr(e,t){return parseFloat(Se(e,t)||0)}const oB={__depends__:[xi,Rh],__init__:["labelLink"],labelLink:["type",w0]};var aB=new ma("tt");function sB(e){var t=Dt('<div class="djs-tooltip-container" />');return $n(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function cB(e,t,n){$n(e,{left:t+"px",top:n+"px"})}function Ch(e,t){e.style.display=t===!1?"none":""}var E0="djs-tooltip",Mh="."+E0;function Wn(e,t){this._eventBus=e,this._canvas=t,this._ids=aB,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=sB(t.getContainer());var n=this;Xn.bind(this._tooltipRoot,Mh,"mousedown",function(i){i.stopPropagation()}),Xn.bind(this._tooltipRoot,Mh,"mouseover",function(i){n.trigger("mouseover",i)}),Xn.bind(this._tooltipRoot,Mh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Wn.$inject=["eventBus","canvas"],Wn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=U({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Wn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Ln(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Wn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Wn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Wn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Wn.prototype.remove=function(e){var t=this.get(e);t&&(zi(t.html),zi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Wn.prototype.show=function(){Ch(this._tooltipRoot)},Wn.prototype.hide=function(){Ch(this._tooltipRoot,!1)},Wn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Wn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),qn(n)&&(n=Dt(n)),i=Dt('<div data-tooltip-id="'+t+'" class="'+E0+'">'),$n(i,{position:"absolute"}),i.appendChild(n),e.type&&$t(i).add("djs-tooltip-"+e.type),e.className&&$t(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Wn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;cB(n,t.x,t.y)},Wn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Ch(i,r))})},Wn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const lB={__init__:["tooltips"],tooltips:["type",Wn]};var uB="flow elements must be children of pools/participants",pB="Data object must be placed within a pool/participant.";function S0(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(r,n(uB)):M(a,"bpmn:DataObjectReference")&&i(r,n(pB)))})}S0.$inject=["eventBus","tooltips","translate"];const fB={__depends__:[lB],__init__:["modelingFeedback"],modelingFeedback:["type",S0]};var dB=500,hB=1250,mB=1500,Lu=Math.round;function gB(e){return{x:e.x+Lu(e.width/2),y:e.y+Lu(e.height/2)}}function R0(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",mB,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=yB(u),U(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",hB,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",dB,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Lu(l.x),l.y=Lu(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Ir(s)){var c=pa(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(hn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!st(s.target).has("djs-hit-no-move")){var p=gB(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}R0.$inject=["eventBus","dragging","modeling","selection","rules"];function yB(e){var t=Bo(e,"id");return nt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var C0=499,Ah="djs-dragging",M0="drop-ok",A0="drop-not-ok",P0="new-parent",T0="attach-ok";function k0(e,t,n,i){function r(c){var l=o(c),u=vB(l);return u}function o(c){var l=Ya(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[T0,M0,A0,P0].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,Ah),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",C0,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=r(u);if(!l.dragGroup){var d=Oe("g");Se(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();We(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Xu([p,o(u)]):p=o(u),z(p,function(h){t.addMarker(h,Ah)}),l.allDraggedElements=p,l.differentParents=bB(u)}),e.on("shape.move.move",C0,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,T0):l.canExecute&&f&&p.id!==f.id?a(p,P0):a(p,l.canExecute?M0:A0)),Mn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;z(u,function(f){t.removeMarker(f,Ah)}),p&&un(p)}),this.makeDraggable=s}k0.$inject=["eventBus","canvas","styles","previewSupport"];function vB(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=nt(e,function(i){return Et(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function bB(e){return n1(Bo(e,function(t){return t.parent&&t.parent.id}))!==1}const xB={__depends__:[El,xi,Rh,Yi,lr,ga],__init__:["move","movePreview"],move:["type",R0],movePreview:["type",k0]};var O0=".djs-palette-toggle",D0=".entry",_B=O0+", "+D0,Ph="djs-palette-",wB="shown",Th="open",L0="two-column",EB=1e3;function an(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}an.$inject=["eventBus","canvas"],an.prototype.registerProvider=function(e,t){t||(t=e,e=EB),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},an.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(RB,{})},an.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},an.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Dt(an.HTML_MARKUP);n.appendChild(i),$t(n).add(Ph+wB),Xn.bind(i,_B,"click",function(r){var o=r.delegateTarget;if(Gp(o,O0))return e.toggle();e.trigger("click",r)}),Ge.bind(i,"mousedown",function(r){r.stopPropagation()}),Xn.bind(i,D0,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},an.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},an.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=$t(n),a=$t(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(L0,r),a.toggle(Ph+L0,r),"open"in e&&(o.toggle(Th,e.open),a.toggle(Ph+Th,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},an.prototype._update=function(){var e=wt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();kc(e),z(t,function(n,i){var r=n.group||"default",o=wt("[data-group="+Ps(r)+"]",e);o||(o=Dt('<div class="group"></div>'),Ln(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Dt(a);if(o.appendChild(s),!n.separator&&(Ln(s,"data-action",i),n.title&&Ln(s,"title",n.title),n.className&&SB(s,n.className),n.imageUrl)){var c=Dt("<img>");Ln(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},an.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Ln(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},an.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(mn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},an.prototype._layoutChanged=function(){this._toggleState({})},an.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},an.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},an.prototype.open=function(){this._toggleState({open:!0})},an.prototype.toggle=function(){this.isOpen()?this.close():this.open()},an.prototype.isActiveTool=function(e){return e&&this._activeTool===e},an.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=wt(".djs-palette-entries",this._container),this._toolsContainer=wt("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=$t(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},an.prototype.isOpen=function(){return $t(this._container).has(Th)},an.prototype._getParentContainer=function(){return this._canvas.getContainer()},an.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function SB(e,t){var n=$t(e),i=Fe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function RB(e,t){var n=t.getPaletteEntries();return mn(n)?n(e):(z(n,function(i,r){e[r]=i}),e)}const CB={__init__:["palette"],palette:["type",an]};var I0="crosshair",B0="selected",MB="djs-dragging-active-lasso";function Kr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Oe("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),We(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Se(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const y of h)g.has(y)||t.removeMarker(y,B0);for(const y of g)h.has(y)||t.addMarker(y,B0)}},remove:function(p){this.update(p),p.frame&&un(p.frame),l(!1)}};function l(p){st(t.getContainer()).toggle(MB,p)}function u(p){var f=i.getAll();return new Set(Io(Qo(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=N0(p),f.add=gl(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=N0(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(gl(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:I0,data:{context:{}},keepSelection:!0})},Kr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:I0,data:{context:{}},keepSelection:!0})},Kr.prototype._select=function(e){this._selection.select(e)},Kr.prototype.select=function(e,t,n=[]){var i=Io(Qo(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 N0(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 AB={__depends__:[Ml,ds],__init__:["lassoTool"],lassoTool:["type",Kr]};var kh=1500,$0="grab";function Aa(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",kh,function(c){if(us(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(kh,function(c){if(!(!F0(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(kh,function(c){!F0(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!us(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Aa.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Aa.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:$0,data:{context:n||{}}})},Aa.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:$0,data:{context:{reactivate:n}}})},Aa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Aa.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function F0(e){return pn("Space",e)}const PB={__depends__:[Ml,ds],__init__:["handTool"],handTool:["type",Aa]};var j0="connect-ok",H0="connect-not-ok";function Pa(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?j0:H0))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?j0:H0)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}Pa.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Pa.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Pa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Pa.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Pa.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const TB={__depends__:[xh,Yi,lr,Ml,ds],globalConnect:["type",Pa]};function Oh(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Oh.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Oh.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function y(C){var x=n.createShape(U({type:p},h));t.start(C,x)}return{group:f,className:d,title:g,action:{dragstart:y,click:y}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return U(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const kB={__depends__:[CB,Rl,ox,AB,PB,TB,is],__init__:["paletteProvider"],paletteProvider:["type",Oh]};var OB=250;function Dh(e,t,n,i,r){le.call(this,e);function o(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);U(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=wt('[data-element-id="'+Ps(f.id)+'"]',s.dragGroup);g&&Se(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=wt('[data-element-id="'+Ps(u)+'"]',s.dragGroup);p&&Se(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",OB,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}Dh.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(Dh,le);const DB={__depends__:[ga],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Dh]};var LB=1250,Lh=40,IB=20,BB=10,z0=20,G0=["x","y"],NB=Math.abs;function V0(e){e.on(["connect.hover","connect.move","connect.end"],LB,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Jn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&$B(t,o,zB(o)),o&&HB(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ei(r),tt(o,["bpmn:Event","bpmn:Gateway"])&&W0(t,Ei(o)),tt(o,["bpmn:Task","bpmn:SubProcess"])&&FB(t,o),M(a,"bpmn:BoundaryEvent")&&s===a.host&&jB(t)):U0(i,"bpmn:MessageFlow")?(M(r,"bpmn:Event")&&(n.connectionStart=Ei(r)),M(o,"bpmn:Event")&&W0(t,Ei(o))):n.connectionStart=n.initialConnectionStart)})}V0.$inject=["eventBus"];function $B(e,t,n){G0.forEach(function(i){var r=q0(i,t);e[i]<t[i]+n?on(e,i,t[i]+n):e[i]>t[i]+r-n&&on(e,i,t[i]+r-n)})}function FB(e,t){var n=Ei(t);G0.forEach(function(i){GB(e,t,i)&&on(e,i,n[i])})}function jB(e){var t=e.context,n=t.source,i=t.target;if(!VB(t)){var r=Ei(n),o=Cn(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],l;NB(c-r[s])<Lh&&(c>r[s]?l=r[s]+Lh:l=r[s]-Lh,on(e,s,l))})}}function W0(e,t){on(e,"x",t.x),on(e,"y",t.y)}function U0(e,t){return e&&e.type===t}function HB(e,t){return br(t,function(n){return U0(e,n)})}function q0(e,t){return e==="x"?t.width:t.height}function zB(e){return M(e,"bpmn:Task")?BB:IB}function GB(e,t,n){return e[n]>t[n]+z0&&e[n]<t[n]+q0(n,t)-z0}function VB(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Xr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Xr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Xr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Xr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Xr.prototype.getSnapLocations=function(){return this._snapLocations},Xr.prototype.setSnapLocations=function(e){this._snapLocations=e},Xr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Iu,n.initDefaults(this._defaultSnaps)),n};function Iu(){this._snapValues={}}Iu.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)},Iu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&OL(e[n],r[n],i)},Iu.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(r){t.add(i,r)})})};var WB=1250;function Qi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],WB,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Jn(r.originalEvent))&&!(Ma(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Qi.$inject=["elementRegistry","eventBus","snapping"],Qi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Xr);var o;t.get(i.id)?o=Ei(i,e):o={x:e.x+Ei(i).x,y:e.y+Ei(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Je(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Qi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(r){if(Je(r)){Je(t)&&e.add("mid",Ei(r));return}if(Et(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);z(o,function(a){e.add("mid",a)});return}e.add("mid",Ei(r))}),!ze(t.x)||!ze(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ei(t)),e},Qi.prototype.getSnapTargets=function(e,t){return Dw(t).filter(function(n){return!UB(n)})};function UB(e){return!!e.hidden}var Y0=1500;function Ta(e,t){t.invoke(Qi,this),e.on(["create.move","create.end"],Y0,XB),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Y0,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Ma(n)&&qB(n,o)})}Ee(Ta,Qi),Ta.$inject=["eventBus","injector"],Ta.prototype.initSnap=function(e){var t=Qi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",X0(o,i,e))}),z(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",X0(o,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ta.prototype.addSnapTargetPoints=function(e,t,n){Qi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(o){(KB(o)||YB([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",kw(o)),e.add("bottom-right",Ow(o)))});var r=this._elementRegistry;return z(t.incoming,function(o){if(r.get(t.id)){K0(i,o.source)||e.add("mid",je(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),z(t.outgoing,function(o){if(r.get(t.id)){K0(i,o.target)||e.add("mid",je(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ta.prototype.getSnapTargets=function(e,t){return Qi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function qB(e,t){var n=Le(t),i=tb(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=je(o),/top/.test(i)?on(e,"y",n.top-a.y):/bottom/.test(i)&&on(e,"y",n.bottom-a.y),/left/.test(i)?on(e,"x",n.left-a.x):/right/.test(i)&&on(e,"x",n.right-a.x)}function YB(e,t){return e.every(function(n){return M(n,t)})}function KB(e){return M(e,"bpmn:SubProcess")&&at(e)?!0:M(e,"bpmn:Participant")}function XB(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&on(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&on(e,"y",e.y)}}function K0(e,t){return e.indexOf(t)!==-1}function X0(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var ZB=1250;function Ws(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],ZB,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Jn(i.originalEvent))&&!Ma(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),eN(s)&&on(i,"x",i.x),tN(s)&&on(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ws.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Xr);var o=Z0(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ws.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return z(r,function(o){e.add("corner",Ow(o)),e.add("corner",kw(o))}),e.add("corner",Z0(t,i)),e},Ws.$inject=["eventBus","snapping"],Ws.prototype.getSnapTargets=function(e,t){return Dw(t).filter(function(n){return!QB(n,e)&&!Et(n)&&!JB(n)&&!Je(n)})};function Z0(e,t){var n=je(e),i=Le(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function QB(e,t){return e.host===t}function JB(e){return!!e.hidden}function eN(e){return e==="n"||e==="s"}function tN(e){return e==="e"||e==="w"}var nN=7,iN=1e3;function Zr(e){this._canvas=e,this._asyncHide=Qu(Gn(this.hide,this),iN)}Zr.$inject=["canvas"],Zr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Ma(e,"x"),y:Ma(e,"y")};z(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,nN),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),z(["x","y"],function(a){var s=o[a];hn(s)&&on(e,a,s.originValue)})},Zr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return Se(n,{d:"M0,0 L0,0"}),st(n).add("djs-snap-line"),We(t,n),{update:function(i){ze(i)?e==="horizontal"?Se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Se(n,{display:"none"})}}},Zr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Zr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Zr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Zr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const rN={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Qi],resizeSnapping:["type",Ws],snapping:["type",Zr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",V0],createMoveSnapping:["type",Ta]};var Q0=300;function Ue(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=wt(Ue.INPUT_SELECTOR,this._container),this._resultsContainer=wt(Ue.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ue.$inject=["canvas","eventBus","selection","translate"],Ue.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Xn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ue.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ue.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ue.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ue.INPUT_SELECTOR,"keydown",function(n){pn("ArrowUp",n)&&n.preventDefault(),pn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ue.INPUT_SELECTOR,"keyup",function(n){if(pn("Escape",n))return e.close();if(pn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(pn("ArrowUp",n))return e._scrollToDirection(!0);if(pn("ArrowDown",n))return e._scrollToDirection();pn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ue.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Xn.unbind(e.el,e.type,e.listener)})},Ue.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=wt(Ue.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ue.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ue.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Ue.prototype._clearResults=function(){kc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ue.prototype._getCurrentResult=function(){return wt(Ue.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ue.prototype._createResultNode=function(e,t){var n=Dt(Ue.RESULT_HTML);return e.primaryTokens.length>0&&J0(n,e.primaryTokens,Ue.RESULT_PRIMARY_HTML),J0(n,e.secondaryTokens,Ue.RESULT_SECONDARY_HTML),Ln(n,Ue.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ue.prototype.registerProvider=function(e){this._searchProvider=e},Ue.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,$t(this._canvas.getContainer()).add("djs-search-open"),$t(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ue.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,$t(this._canvas.getContainer()).remove("djs-search-open"),$t(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ue.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ue.prototype.isOpen=function(){return this._open},Ue.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&$t(t).remove(Ue.RESULT_SELECTED_CLASS);var n=Ln(e,Ue.RESULT_ID_ATTRIBUTE),i=this._results[n].element;$t(e).add(Ue.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Q0}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ue.prototype._select=function(e){var t=Ln(e,Ue.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Q0}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ue.prototype._getBoxHtml=function(){const e=Dt(Ue.BOX_HTML),t=wt(Ue.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function J0(e,t,n){var i=oN(t),r=Dt(n);r.innerHTML=i,e.appendChild(r)}function oN(e){var t="";return e.forEach(function(n){var i=s_(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ue.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ue.CONTAINER_SELECTOR=".djs-search-container",Ue.INPUT_SELECTOR=".djs-search-input input",Ue.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ue.RESULT_SELECTOR=".djs-search-result",Ue.RESULT_SELECTED_CLASS="djs-search-result-selected",Ue.RESULT_SELECTED_SELECTOR="."+Ue.RESULT_SELECTED_CLASS,Ue.RESULT_ID_ATTRIBUTE="data-result-id",Ue.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ue.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},xI=900;function Vs(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",xI,this)}Vs.$inject=["popupMenu","distributeElements","translate","rules"],Vs.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Vs.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Vs.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:t0.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:t0.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const _I={__depends__:[vh,bI],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Au],distributeElementsMenuProvider:["type",Vs]};var n0="is not a registered action",wI="is already registered";function Ri(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ri.$inject=["eventBus","injector"],Ri.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=Fe(p)?p:u;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&(Fe(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ri.prototype.trigger=function(e,t){if(!this._actions[e])throw Ah(e,n0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ri.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,r){n._registerAction(r,i)})},Ri.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ah(e,wI);this._actions[e]=t},Ri.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ah(e,n0);this._actions[e]=void 0},Ri.prototype.getActions=function(){return Object.keys(this._actions)},Ri.prototype.isRegistered=function(e){return!!this._actions[e]};function Ah(e,t){return new Error(e+" "+t)}const EI={__init__:["editorActions"],editorActions:["type",Ri]};function Pu(e){e.invoke(Ri,this)}Ee(Pu,Ri),Pu.$inject=["injector"],Pu.prototype._registerDefaultActions=function(e){Ri.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(y){return y!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),y=g.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),y=[],C=g.type;h.length&&(y=it(h,function(x){return!M(x,"bpmn:Lane")}),l.trigger(y,C))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;M(g,"bpmn:Collaboration")?y=n.filter(function(C){return M(C.parent,"bpmn:Collaboration")}):y=n.filter(function(C){return C!==g&&!M(C.parent,"bpmn:SubProcess")}),h=Jt(y),f.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const SI={__depends__:[EI],editorActions:["type",Pu]};function i0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;nt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}i0.$inject=["eventBus"];function Co(e,t){le.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;Un(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Co.$inject=["eventBus","gridSnapping","modeling"],Ee(Co,le),Co.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},Co.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},Co.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),U(e,o),e},Co.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),U(e,o),e};var RI=2e3;function r0(e,t){e.on(["spaceTool.move","spaceTool.end"],RI,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}r0.$inject=["eventBus","gridSnapping"];const CI={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Co],gridSnappingSpaceToolBehavior:["type",r0]};var Tu=10;function Ph(e,t,n){return n||(n="round"),Math[n](e/t)*t}var MI=1200,AI=800;function Ur(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",AI,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],MI,function(o){var a=o.originalEvent;if(!(!r.active||a&&Qn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=TI(o,l,e);p&&(u.offset=p);var f=PI(o,l);f&&U(u,f),Pa(o,l)||r.snapEvent(o,l,u)})}})}Ur.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);rn(e,t,i)},Ur.prototype.getGridSpacing=function(){return Tu},Ur.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Ph(e,Tu);var i,r;return t&&t.min&&(i=t.min,ze(i)&&(i=Ph(i+n,Tu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ze(r)&&(r=Ph(r+n,Tu,"floor"),e=Math.min(e,r))),e-=n,e},Ur.prototype.isActive=function(){return this.active},Ur.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Ur.prototype.toggleActive=function(){this.setActive(!this.active)},Ur.$inject=["elementRegistry","eventBus","config.gridSnapping"];function PI(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(ku(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,l=r.max;return c&&(ku(t)?a0(s)?a.x.max=c.left:a.x.min=c.right:o0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(ku(t)?a0(s)?a.x.min=l.left:a.x.max=l.right:o0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function TI(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ze(s[t])||(s||(s=o.snapOffset={}),ze(s[t])||(s[t]=0),!r)||(n.get(r.id)||(ku(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function ku(e){return e==="x"}function o0(e){return e.indexOf("n")!==-1}function a0(e){return e.indexOf("w")!==-1}const kI={__depends__:[CI],__init__:["gridSnapping"],gridSnapping:["type",Ur]};var OI=2e3;function s0(e,t,n){e.on("autoPlace",OI,function(i){var r=i.source,o=je(r),a=i.shape,s=Xx(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],M(a,"bpmn:TextAnnotation")&&(DI(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}s0.$inject=["eventBus","gridSnapping","elementRegistry"];function DI(e){return e==="x"}var LI=1750;function c0(e,t,n){t.on(["create.start","shape.move.start"],LI,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!M(o,"bpmn:Participant")||!M(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}c0.$inject=["canvas","eventBus","gridSnapping"];var II=3e3;function Ou(e,t,n){le.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],II,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||BI(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Ou.$inject=["eventBus","gridSnapping","modeling"],Ee(Ou,le),Ou.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=FI(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function BI(e){return e.length>3}function NI(e){return e==="h"}function $I(e){return e==="v"}function FI(e,t,n){var i=ir(t,n),r={};return NI(i)&&(r.y=e.snapValue(t.y)),$I(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=U({},t,r),n=U({},n,r)),[t,n]}const jI={__depends__:[kI,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",s0],gridSnappingParticipantBehavior:["type",c0],gridSnappingLayoutConnectionBehavior:["type",Ou]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",i0]};var HI=30,l0=30;function Ws(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(M(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(M(r,"bpmn:Participant"))return st(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(M(r,"bpmn:SubProcess"))return st(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ws.$inject=["eventBus","interactionEvents"],Ws.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ws.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=gn(e)?{width:HI,height:e.height}:{width:e.width,height:l0};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ws.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:l0}),!0};const zI={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ws]};function Du(e){e.invoke(wa,this)}Ee(Du,wa),Du.$inject=["injector"],Du.prototype.registerBindings=function(e,t){wa.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const GI={__depends__:[ih],__init__:["keyboardBindings"],keyboardBindings:["type",Du]};var VI={moveSpeed:1,moveSpeedAccelerated:10},WI=1500,u0="left",p0="up",f0="right",d0="down",UI={ArrowLeft:u0,Left:u0,ArrowUp:p0,Up:p0,ArrowRight:f0,Right:f0,ArrowDown:d0,Down:d0},qI={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 h0(e,t,n,i,r){var o=this;this._config=U({},VI,e||{}),t.addListener(WI,function(a){var s=a.keyEvent,c=UI[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=qI[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}h0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const YI={__depends__:[ih,xi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",h0]};var m0=10;function Us(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=LP(u,p,l),c.newBounds=BP(d,f),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Be(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=wy(p),!KI(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}Us.prototype.canResize=function(e){var t=this._rules,n=Ai(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Us.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=U({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,g0(t,o),"resize",{autoActivate:!0,cursor:XI(o),data:{shape:t,context:r}})},Us.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:m0,height:m0},r=lv(t,e.childrenBoxPadding),NP(n,t,i,r)},Us.$inject=["eventBus","rules","modeling","dragging"];function KI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function g0(e,t){var n=je(e),i=Be(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function XI(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 y0="djs-resizing",v0="resize-not-ok",ZI=500;function b0(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,y0)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?ct(c).remove(v0):ct(c).add(v0)}function r(o){var a=o.shape,s=o.frame;s&&cn(o.frame),t.removeMarker(a,y0)}e.on("resize.move",ZI,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}b0.$inject=["eventBus","canvas","previewSupport"];var Lu=-6,Iu=8,Bu=20,qs="djs-resizer",QI=["n","w","s","e","nw","ne","se","sw"];function qr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&z(a,zn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}qr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Ir(o)&&i.activate(o,e,n)}Ge.bind(t,"mousedown",r),Ge.bind(t,"touchstart",r)},qr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=JI(i),a=Oe("g");ct(a).add(qs),ct(a).add(qs+"-"+e.id),ct(a).add(qs+"-"+i),We(r,a);var s=Oe("rect");Se(s,{x:-Iu/2+o.x,y:-Iu/2+o.y,width:Iu,height:Iu}),ct(s).add(qs+"-visual"),We(a,s);var c=Oe("rect");return Se(c,{x:-Bu/2+o.x,y:-Bu/2+o.y,width:Bu,height:Bu}),ct(c).add(qs+"-hit"),We(a,c),Yc(a,t,n),a},qr.prototype.createResizer=function(e,t){var n=g0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},qr.prototype.addResizer=function(e){var t=this;Rt(e)||z(QI,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},qr.prototype.removeResizers=function(){var e=this._getResizersParent();Fc(e)},qr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},qr.$inject=["eventBus","canvas","selection","resize"];function JI(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Lu:e.indexOf("w")!==-1&&(t.x=Lu),e.indexOf("s")!==-1?t.y=-Lu:e.indexOf("n")!==-1&&(t.y=Lu),t}const x0={__depends__:[Ui,lr,va],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Us],resizePreview:["type",b0],resizeHandles:["type",qr]};var eB=2e3;function Ys(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],eB,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||nt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ys.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ys.prototype.activate=function(e){var t=pi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);U(n,i);var r={},o=n.style||{};return U(o,{backgroundColor:null,border:null}),(nt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||_0(e))&&U(r,{centerVertically:!0}),kr(e)&&(U(r,{resizable:!0,autoResize:!0}),U(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(U(r,{resizable:!0,autoResize:!0}),U(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),U(n,{options:r,style:o}),n}},Ys.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||iB(e)){var g=gn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};U(o,h),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(nB(e)){var y=gn(e),C=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};U(o,C),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(nt(e,["bpmn:Task","bpmn:CallActivity"])||_0(e))&&(U(o,{width:i.width,height:i.height}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),tB(e)&&(U(o,{width:i.width,x:i.x}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,m=i.width+2*x;if(n.labelTarget&&(U(o,{width:m,height:i.height+2*x,x:i.x-x,y:i.y-x}),U(d,{fontSize:l+"px",lineHeight:u})),kr(n)&&!Zc(n)&&!et(n)){var v=df(e),_=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),S=l,k=ho.width*a+2*x;U(o,{width:k,height:S+2*x,x:_.x-k/2,y:_.y-S/2-x}),U(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(U(o,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),U(d,{textAlign:"left",paddingTop:oa*a+"px",paddingBottom:oa*a+"px",paddingLeft:oa*a+"px",paddingRight:oa*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ys.prototype.update=function(e,t,n,i){var r,o;M(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),rB(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function _0(e){return M(e,"bpmn:SubProcess")&&!st(e)}function tB(e){return M(e,"bpmn:SubProcess")&&st(e)}function nB(e){return M(e,"bpmn:Participant")&&!st(e)}function iB(e){return M(e,"bpmn:Participant")&&st(e)}function rB(e){return!e||!e.trim()}var w0="djs-element-hidden",E0="djs-label-hidden";function S0(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,M(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Oe("path");Se(p,{d:u,strokeWidth:2,stroke:oB(o)}),We(s,p),We(r,s),Cn(s,o.x,o.y)}M(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,w0):(M(o,"bpmn:Task")||M(o,"bpmn:CallActivity")||M(o,"bpmn:SubProcess")||M(o,"bpmn:Participant")||M(o,"bpmn:Lane"))&&t.addMarker(o,E0)}),e.on("directEditing.resize",function(c){if(M(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(o.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});Se(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,w0),t.removeMarker(o,E0)),o=void 0,a=void 0,s&&(cn(s),s=void 0)})}S0.$inject=["eventBus","canvas","pathMap"];function oB(e,t){var n=lt(e);return n.get("stroke")||t||"black"}const aB={__depends__:[kd,x0,Kw],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ys],labelEditingPreview:["type",S0]};var sB=500,cB=1e3;function Ki(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){BM(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){z(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],sB,function(o){var a=o.element,s=o.gfx,c=Et(".djs-outline",s);c&&i.updateOutline(a,c)})}Ki.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),We(t,n),this.updateOutline(e,n)),n},Ki.prototype._createOutlineGfx=function(){var e=Oe("rect");return Se(e,U({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Ki.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Ki.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(r){n=n||r.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Ki.prototype.updateConnectionOutline=function(e,t){var n=Jt(t);Se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Ki.prototype.registerProvider=function(e,t){t||(t=e,e=cB),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Ki.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ki.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){dn(i.getOutline)&&(t=t||i.getOutline(e))}),t},Ki.$inject=["eventBus","styles","elementRegistry"];var Nu=6;function Th(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Th.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Fc(t);var n=e.length>1,i=this._canvas.getContainer();if(ct(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=lB(Jt(e)),o=Oe("rect");Se(o,U({rx:3},r)),ct(o).add("djs-selection-outline"),We(t,o)}},Th.$inject=["eventBus","canvas","selection"];function lB(e){return{x:e.x-Nu,y:e.y-Nu,width:e.width+Nu*2,height:e.height+Nu*2}}const kh={__depends__:[xi],__init__:["outline","multiSelectionOutline"],outline:["type",Ki],multiSelectionOutline:["type",Th]},R0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],C0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},uB=15,$u=2;function M0(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>nt(g,R0));if(f.length===1){const g=f[0];et(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(et),h=f.find(y=>{var C;return(C=y.labels)==null?void 0:C.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!nt(p,R0)||!u(p)||(et(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Za([je(f),je(p)],C0),g=d.getAttribute("d"),y=r.isSelected(p)?c(p):l(p),C=ts(y,g);if(!C)return;const m=r.isSelected(f)?c(f):l(f),v=ts(m,g)||je(f);ps(v,C)<uB||(of(d,[v,C]),We(o,d))}function s(){$c(`.${C0.class}`,o).forEach(cn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+Yr(f,"x")-$u,y:p.y+Yr(f,"y")-$u,width:Yr(f,"width")+$u*2,height:Yr(f,"height")+$u*2};return mf(d,Yr(f,"rx"))}if(f.cx){const d=Yr(f,"r"),g={x:p.x+Yr(f,"cx")-d,y:p.y+Yr(f,"cy")-d,width:d*2,height:d*2};return Uy(g)}}function l(p){return n.getShapePath(p)}function u(p){return r.isSelected(p)}}M0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Yr(e,t){return parseFloat(Se(e,t)||0)}const pB={__depends__:[xi,kh],__init__:["labelLink"],labelLink:["type",M0]};var fB=new ya("tt");function dB(e){var t=Lt('<div class="djs-tooltip-container" />');return $n(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function hB(e,t,n){$n(e,{left:t+"px",top:n+"px"})}function Oh(e,t){e.style.display=t===!1?"none":""}var A0="djs-tooltip",Dh="."+A0;function Vn(e,t){this._eventBus=e,this._canvas=t,this._ids=fB,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=dB(t.getContainer());var n=this;Kn.bind(this._tooltipRoot,Dh,"mousedown",function(i){i.stopPropagation()}),Kn.bind(this._tooltipRoot,Dh,"mouseover",function(i){n.trigger("mouseover",i)}),Kn.bind(this._tooltipRoot,Dh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Vn.$inject=["eventBus","canvas"],Vn.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=U({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Vn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Dn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Vn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Vn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Vn.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)}},Vn.prototype.remove=function(e){var t=this.get(e);t&&(ji(t.html),ji(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Vn.prototype.show=function(){Oh(this._tooltipRoot)},Vn.prototype.hide=function(){Oh(this._tooltipRoot,!1)},Vn.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},Vn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Un(n)&&(n=Lt(n)),i=Lt('<div data-tooltip-id="'+t+'" class="'+A0+'">'),$n(i,{position:"absolute"}),i.appendChild(n),e.type&&$t(i).add("djs-tooltip-"+e.type),e.className&&$t(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Vn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;hB(n,t.x,t.y)},Vn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Oh(i,r))})},Vn.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 mB={__init__:["tooltips"],tooltips:["type",Vn]};var gB="flow elements must be children of pools/participants",yB="Data object must be placed within a pool/participant.";function P0(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(r,n(gB)):M(a,"bpmn:DataObjectReference")&&i(r,n(yB)))})}P0.$inject=["eventBus","tooltips","translate"];const vB={__depends__:[mB],__init__:["modelingFeedback"],modelingFeedback:["type",P0]};var bB=500,xB=1250,_B=1500,Fu=Math.round;function wB(e){return{x:e.x+Fu(e.width/2),y:e.y+Fu(e.height/2)}}function T0(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",_B,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=EB(u),U(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",xB,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",bB,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Fu(l.x),l.y=Fu(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Ir(s)){var c=da(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(fn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!ct(s.target).has("djs-hit-no-move")){var p=wB(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}T0.$inject=["eventBus","dragging","modeling","selection","rules"];function EB(e){var t=$o(e,"id");return it(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var k0=499,Lh="djs-dragging",O0="drop-ok",D0="drop-not-ok",L0="new-parent",I0="attach-ok";function B0(e,t,n,i){function r(c){var l=o(c),u=SB(l);return u}function o(c){var l=Qa(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[I0,O0,D0,L0].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,Lh),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",k0,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=r(u);if(!l.dragGroup){var d=Oe("g");Se(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();We(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=np([p,o(u)]):p=o(u),z(p,function(h){t.addMarker(h,Lh)}),l.allDraggedElements=p,l.differentParents=RB(u)}),e.on("shape.move.move",k0,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,I0):l.canExecute&&f&&p.id!==f.id?a(p,L0):a(p,l.canExecute?O0:D0)),Cn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;z(u,function(f){t.removeMarker(f,Lh)}),p&&cn(p)}),this.makeDraggable=s}B0.$inject=["eventBus","canvas","styles","previewSupport"];function SB(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=it(e,function(i){return Rt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function RB(e){return c1($o(e,function(t){return t.parent&&t.parent.id}))!==1}const CB={__depends__:[Al,xi,kh,Ui,lr,va],__init__:["move","movePreview"],move:["type",T0],movePreview:["type",B0]};var N0=".djs-palette-toggle",$0=".entry",MB=N0+", "+$0,Ih="djs-palette-",AB="shown",Bh="open",F0="two-column",PB=1e3;function on(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}on.$inject=["eventBus","canvas"],on.prototype.registerProvider=function(e,t){t||(t=e,e=PB),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},on.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(kB,{})},on.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},on.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Lt(on.HTML_MARKUP);n.appendChild(i),$t(n).add(Ih+AB),Kn.bind(i,MB,"click",function(r){var o=r.delegateTarget;if(Kp(o,N0))return e.toggle();e.trigger("click",r)}),Ge.bind(i,"mousedown",function(r){r.stopPropagation()}),Kn.bind(i,$0,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},on.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},on.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=$t(n),a=$t(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(F0,r),a.toggle(Ih+F0,r),"open"in e&&(o.toggle(Bh,e.open),a.toggle(Ih+Bh,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},on.prototype._update=function(){var e=Et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Bc(e),z(t,function(n,i){var r=n.group||"default",o=Et("[data-group="+Ds(r)+"]",e);o||(o=Lt('<div class="group"></div>'),Dn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Lt(a);if(o.appendChild(s),!n.separator&&(Dn(s,"data-action",i),n.title&&Dn(s,"title",n.title),n.className&&TB(s,n.className),n.imageUrl)){var c=Lt("<img>");Dn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},on.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Dn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},on.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(dn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},on.prototype._layoutChanged=function(){this._toggleState({})},on.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},on.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},on.prototype.open=function(){this._toggleState({open:!0})},on.prototype.toggle=function(){this.isOpen()?this.close():this.open()},on.prototype.isActiveTool=function(e){return e&&this._activeTool===e},on.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Et(".djs-palette-entries",this._container),this._toolsContainer=Et("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=$t(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},on.prototype.isOpen=function(){return $t(this._container).has(Bh)},on.prototype._getParentContainer=function(){return this._canvas.getContainer()},on.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function TB(e,t){var n=$t(e),i=Fe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function kB(e,t){var n=t.getPaletteEntries();return dn(n)?n(e):(z(n,function(i,r){e[r]=i}),e)}const OB={__init__:["palette"],palette:["type",on]};var j0="crosshair",H0="selected",DB="djs-dragging-active-lasso";function Kr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Oe("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),We(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Se(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const y of h)g.has(y)||t.removeMarker(y,H0);for(const y of g)h.has(y)||t.addMarker(y,H0)}},remove:function(p){this.update(p),p.frame&&cn(p.frame),l(!1)}};function l(p){ct(t.getContainer()).toggle(DB,p)}function u(p){var f=i.getAll();return new Set(No(ea(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=z0(p),f.add=_l(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=z0(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(_l(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:j0,data:{context:{}},keepSelection:!0})},Kr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:j0,data:{context:{}},keepSelection:!0})},Kr.prototype._select=function(e){this._selection.select(e)},Kr.prototype.select=function(e,t,n=[]){var i=No(ea(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 z0(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 LB={__depends__:[Ol,ys],__init__:["lassoTool"],lassoTool:["type",Kr]};var Nh=1500,G0="grab";function Ta(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Nh,function(c){if(hs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Nh,function(c){if(!(!V0(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Nh,function(c){!V0(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!hs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ta.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ta.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:G0,data:{context:n||{}}})},Ta.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:G0,data:{context:{reactivate:n}}})},Ta.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ta.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function V0(e){return ln("Space",e)}const IB={__depends__:[Ol,ys],__init__:["handTool"],handTool:["type",Ta]};var W0="connect-ok",U0="connect-not-ok";function ka(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?W0:U0))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?W0:U0)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}ka.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ka.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ka.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ka.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ka.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const BB={__depends__:[Ch,Ui,lr,Ol,ys],globalConnect:["type",ka]};function $h(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}$h.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],$h.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function y(C){var x=n.createShape(U({type:p},h));t.start(C,x)}return{group:f,className:d,title:g,action:{dragstart:y,click:y}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return U(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const NB={__depends__:[OB,Tl,ux,LB,IB,BB,ss],__init__:["paletteProvider"],paletteProvider:["type",$h]};var $B=250;function Fh(e,t,n,i,r){le.call(this,e);function o(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);U(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Et('[data-element-id="'+Ds(f.id)+'"]',s.dragGroup);g&&Se(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=Et('[data-element-id="'+Ds(u)+'"]',s.dragGroup);p&&Se(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",$B,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}Fh.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(Fh,le);const FB={__depends__:[va],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Fh]};var jB=1250,jh=40,HB=20,zB=10,q0=20,Y0=["x","y"],GB=Math.abs;function K0(e){e.on(["connect.hover","connect.move","connect.end"],jB,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Qn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&VB(t,o,YB(o)),o&&qB(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ei(r),nt(o,["bpmn:Event","bpmn:Gateway"])&&X0(t,Ei(o)),nt(o,["bpmn:Task","bpmn:SubProcess"])&&WB(t,o),M(a,"bpmn:BoundaryEvent")&&s===a.host&&UB(t)):Z0(i,"bpmn:MessageFlow")?(M(r,"bpmn:Event")&&(n.connectionStart=Ei(r)),M(o,"bpmn:Event")&&X0(t,Ei(o))):n.connectionStart=n.initialConnectionStart)})}K0.$inject=["eventBus"];function VB(e,t,n){Y0.forEach(function(i){var r=Q0(i,t);e[i]<t[i]+n?rn(e,i,t[i]+n):e[i]>t[i]+r-n&&rn(e,i,t[i]+r-n)})}function WB(e,t){var n=Ei(t);Y0.forEach(function(i){KB(e,t,i)&&rn(e,i,n[i])})}function UB(e){var t=e.context,n=t.source,i=t.target;if(!XB(t)){var r=Ei(n),o=Rn(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],l;GB(c-r[s])<jh&&(c>r[s]?l=r[s]+jh:l=r[s]-jh,rn(e,s,l))})}}function X0(e,t){rn(e,"x",t.x),rn(e,"y",t.y)}function Z0(e,t){return e&&e.type===t}function qB(e,t){return br(t,function(n){return Z0(e,n)})}function Q0(e,t){return e==="x"?t.width:t.height}function YB(e){return M(e,"bpmn:Task")?zB:HB}function KB(e,t,n){return e[n]>t[n]+q0&&e[n]<t[n]+Q0(n,t)-q0}function XB(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Xr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Xr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Xr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Xr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Xr.prototype.getSnapLocations=function(){return this._snapLocations},Xr.prototype.setSnapLocations=function(e){this._snapLocations=e},Xr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new ju,n.initDefaults(this._defaultSnaps)),n};function ju(){this._snapValues={}}ju.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)},ju.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&$L(e[n],r[n],i)},ju.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(r){t.add(i,r)})})};var ZB=1250;function Xi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],ZB,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Qn(r.originalEvent))&&!(Pa(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Xi.$inject=["elementRegistry","eventBus","snapping"],Xi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Xr);var o;t.get(i.id)?o=Ei(i,e):o={x:e.x+Ei(i).x,y:e.y+Ei(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),et(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Xi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(r){if(et(r)){et(t)&&e.add("mid",Ei(r));return}if(Rt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);z(o,function(a){e.add("mid",a)});return}e.add("mid",Ei(r))}),!ze(t.x)||!ze(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ei(t)),e},Xi.prototype.getSnapTargets=function(e,t){return $w(t).filter(function(n){return!QB(n)})};function QB(e){return!!e.hidden}var J0=1500;function Oa(e,t){t.invoke(Xi,this),e.on(["create.move","create.end"],J0,nN),e.on(["create.move","create.end","shape.move.move","shape.move.end"],J0,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Pa(n)&&JB(n,o)})}Ee(Oa,Xi),Oa.$inject=["eventBus","injector"],Oa.prototype.initSnap=function(e){var t=Xi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",tE(o,i,e))}),z(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",tE(o,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Oa.prototype.addSnapTargetPoints=function(e,t,n){Xi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(o){(tN(o)||eN([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Bw(o)),e.add("bottom-right",Nw(o)))});var r=this._elementRegistry;return z(t.incoming,function(o){if(r.get(t.id)){eE(i,o.source)||e.add("mid",je(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),z(t.outgoing,function(o){if(r.get(t.id)){eE(i,o.target)||e.add("mid",je(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Oa.prototype.getSnapTargets=function(e,t){return Xi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function JB(e,t){var n=Be(t),i=ab(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=je(o),/top/.test(i)?rn(e,"y",n.top-a.y):/bottom/.test(i)&&rn(e,"y",n.bottom-a.y),/left/.test(i)?rn(e,"x",n.left-a.x):/right/.test(i)&&rn(e,"x",n.right-a.x)}function eN(e,t){return e.every(function(n){return M(n,t)})}function tN(e){return M(e,"bpmn:SubProcess")&&st(e)?!0:M(e,"bpmn:Participant")}function nN(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&rn(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&rn(e,"y",e.y)}}function eE(e,t){return e.indexOf(t)!==-1}function tE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var iN=1250;function Ks(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],iN,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Qn(i.originalEvent))&&!Pa(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),aN(s)&&rn(i,"x",i.x),sN(s)&&rn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ks.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Xr);var o=nE(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ks.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return z(r,function(o){e.add("corner",Nw(o)),e.add("corner",Bw(o))}),e.add("corner",nE(t,i)),e},Ks.$inject=["eventBus","snapping"],Ks.prototype.getSnapTargets=function(e,t){return $w(t).filter(function(n){return!rN(n,e)&&!Rt(n)&&!oN(n)&&!et(n)})};function nE(e,t){var n=je(e),i=Be(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function rN(e,t){return e.host===t}function oN(e){return!!e.hidden}function aN(e){return e==="n"||e==="s"}function sN(e){return e==="e"||e==="w"}var cN=7,lN=1e3;function Zr(e){this._canvas=e,this._asyncHide=rp(zn(this.hide,this),lN)}Zr.$inject=["canvas"],Zr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Pa(e,"x"),y:Pa(e,"y")};z(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,cN),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),z(["x","y"],function(a){var s=o[a];fn(s)&&rn(e,a,s.originValue)})},Zr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return Se(n,{d:"M0,0 L0,0"}),ct(n).add("djs-snap-line"),We(t,n),{update:function(i){ze(i)?e==="horizontal"?Se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Se(n,{display:"none"})}}},Zr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Zr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Zr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Zr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const uN={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Xi],resizeSnapping:["type",Ks],snapping:["type",Zr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",K0],createMoveSnapping:["type",Oa]};var iE=300;function Ue(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Et(Ue.INPUT_SELECTOR,this._container),this._resultsContainer=Et(Ue.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ue.$inject=["canvas","eventBus","selection","translate"],Ue.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Kn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ue.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ue.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ue.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ue.INPUT_SELECTOR,"keydown",function(n){ln("ArrowUp",n)&&n.preventDefault(),ln("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ue.INPUT_SELECTOR,"keyup",function(n){if(ln("Escape",n))return e.close();if(ln("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(ln("ArrowUp",n))return e._scrollToDirection(!0);if(ln("ArrowDown",n))return e._scrollToDirection();ln(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ue.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Kn.unbind(e.el,e.type,e.listener)})},Ue.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=Et(Ue.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ue.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ue.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Ue.prototype._clearResults=function(){Bc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ue.prototype._getCurrentResult=function(){return Et(Ue.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ue.prototype._createResultNode=function(e,t){var n=Lt(Ue.RESULT_HTML);return e.primaryTokens.length>0&&rE(n,e.primaryTokens,Ue.RESULT_PRIMARY_HTML),rE(n,e.secondaryTokens,Ue.RESULT_SECONDARY_HTML),Dn(n,Ue.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ue.prototype.registerProvider=function(e){this._searchProvider=e},Ue.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,$t(this._canvas.getContainer()).add("djs-search-open"),$t(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ue.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,$t(this._canvas.getContainer()).remove("djs-search-open"),$t(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ue.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ue.prototype.isOpen=function(){return this._open},Ue.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&$t(t).remove(Ue.RESULT_SELECTED_CLASS);var n=Dn(e,Ue.RESULT_ID_ATTRIBUTE),i=this._results[n].element;$t(e).add(Ue.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:iE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ue.prototype._select=function(e){var t=Dn(e,Ue.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:iE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ue.prototype._getBoxHtml=function(){const e=Lt(Ue.BOX_HTML),t=Et(Ue.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function rE(e,t,n){var i=pN(t),r=Lt(n);r.innerHTML=i,e.appendChild(r)}function pN(e){var t="";return e.forEach(function(n){var i=f_(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ue.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ue.CONTAINER_SELECTOR=".djs-search-container",Ue.INPUT_SELECTOR=".djs-search-input input",Ue.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ue.RESULT_SELECTOR=".djs-search-result",Ue.RESULT_SELECTED_CLASS="djs-search-result-selected",Ue.RESULT_SELECTED_SELECTOR="."+Ue.RESULT_SELECTED_CLASS,Ue.RESULT_ID_ATTRIBUTE="data-result-id",Ue.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ue.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
336
336
|
<div class="djs-search-input">
|
|
337
337
|
<svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
338
338
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -340,4 +340,4 @@
|
|
|
340
340
|
<input type="text" spellcheck="false" />
|
|
341
341
|
</div>
|
|
342
342
|
<div class="djs-search-results" />
|
|
343
|
-
</div>`,Ue.RESULT_HTML='<div class="djs-search-result"></div>',Ue.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ue.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const aN={__depends__:[is,Zl,xi],searchPad:["type",Ue]};function Ih(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Ih.$inject=["elementRegistry","searchPad","canvas","search"],Ih.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:pi(i),id:i.id})),e,{keys:["label","id"]}).map(sN)};function sN(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const cN={__depends__:[aN,pw],__init__:["bpmnSearch"],bpmnSearch:["type",Ih]},lN="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",uN="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",pN={width:36,height:50},fN={width:50,height:50};function eE(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Ci=5;function Bu(e,t){this._styles=t,e.registerProvider(this)}Bu.$inject=["outline","styles"],Bu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(CA(e))return n=Oe("rect"),Se(n,U({x:-Ci,y:-Ci,rx:4,width:e.width+Ci*2,height:e.height+Ci*2},t)),n;if(!Je(e))return M(e,"bpmn:Gateway")?(n=Oe("rect"),U(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,U({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):tt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),Se(n,U({x:-Ci,y:-Ci,rx:14,width:e.width+Ci*2,height:e.height+Ci*2},t))):M(e,"bpmn:EndEvent")?(n=Oe("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+Ci+1},t))):M(e,"bpmn:Event")?(n=Oe("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+Ci},t))):M(e,"bpmn:DataObjectReference")&&tE(e,"bpmn:DataObjectReference")?n=eE(lN,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&tE(e,"bpmn:DataStoreReference")&&(n=eE(uN,{x:-6,y:-6},t)),n},Bu.prototype.updateOutline=function(e,t){if(!Je(e))return tt(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+Ci*2,height:e.height+Ci*2}),!0):!!tt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function tE(e,t){var n;return t==="bpmn:DataObjectReference"?n=pN:t==="bpmn:DataStoreReference"&&(n=fN),e.width===n.width&&e.height===n.height}const dN={__depends__:[Rh],__init__:["outlineProvider"],outlineProvider:["type",Bu]};var hN='<?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 Ji(e){ta.call(this,e)}Ee(Ji,ta),Ji.Viewer=Vr,Ji.NavigatedViewer=Ts,Ji.prototype.createDiagram=function(){return this.importXML(hN)},Ji.prototype._interactionModules=[h_,g_,b_],Ji.prototype._modelingModules=[gL,ql,_L,bL,LL,xh,jL,pI,Yb,Rl,mI,vI,LI,BI,NI,zI,eB,oB,zd,fB,xB,kB,DB,m0,rN,cN,dN],Ji.prototype._modules=[].concat(Vr.prototype._modules,Ji.prototype._interactionModules,Ji.prototype._modelingModules);const mN=he.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=he.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=bp(u);return r("imported",p),{warnings:p}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return he.onMounted(async()=>{a=new Ji({container:o.value,moddleExtensions:pc,additionalModules:[r_]}),i.xml&&await s(i.xml),r("ready")}),he.watch(()=>i.xml,l=>{l&&a&&s(l)}),he.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(he.openBlock(),he.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),Bh=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},gN=Bh(mN,[["__scopeId","data-v-07ee17c9"]]),yN=["title","aria-expanded"],vN=["title","onClick"],bN={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},xN={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},_N={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},wN={key:0,class:"bwl-validation__body"},EN={key:0,class:"bwl-validation__empty"},SN={key:1,class:"bwl-validation__empty"},RN={key:2,class:"bwl-validation__list"},CN=["onClick"],MN={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},AN={class:"bwl-validation__msg"},PN=["title"],TN=Bh(he.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=he.computed(()=>Qx(n.issues.value,n.describeElement)),r=he.computed(()=>Jx(i.value)),o=g=>ba(g,n.changeScope.value),a=he.computed(()=>Yd(i.value,n.changeScope.value)),s=he.ref({error:!0,warning:!0,info:!0}),c=he.computed(()=>e_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=he.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(he.openBlock(),he.createElementBlock("section",{class:he.normalizeClass(["bwl-validation",{"is-open":l.value}])},[he.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[he.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(he.openBlock(),he.createElementBlock("svg",{class:he.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[he.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=he.createElementVNode("span",null,"검증",-1))],8,yN),he.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=he.withModifiers(()=>{},["stop"]))},[(he.openBlock(),he.createElementBlock(he.Fragment,null,he.renderList(u,y=>he.createElementVNode("button",{key:y,type:"button",class:he.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:C=>f(y)},[(he.openBlock(),he.createElementBlock("svg",bN,[h[4]||(h[4]=he.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(he.openBlock(),he.createElementBlock("path",xN)):(he.openBlock(),he.createElementBlock("path",_N))])),he.createElementVNode("span",null,he.toDisplayString(r.value[y]),1)],10,vN)),64))])]),l.value?(he.openBlock(),he.createElementBlock("div",wN,[i.value.length===0?(he.openBlock(),he.createElementBlock("p",EN,"발견된 문제가 없습니다.")):c.value.length===0?(he.openBlock(),he.createElementBlock("p",SN," 선택한 심각도에 해당하는 항목이 없습니다. ")):(he.openBlock(),he.createElementBlock("ul",RN,[(he.openBlock(!0),he.createElementBlock(he.Fragment,null,he.renderList(c.value,y=>(he.openBlock(),he.createElementBlock("li",{key:y.key,class:he.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:C=>d(y)},[h[5]||(h[5]=he.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(he.openBlock(),he.createElementBlock("span",MN,"이번 변경")):he.createCommentVNode("",!0),he.createElementVNode("span",AN,he.toDisplayString(y.message),1),he.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},he.toDisplayString(y.category),9,PN)],10,CN))),128))]))])):he.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),kN={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},ON=["aria-checked","title","data-locale","onClick"],DN={class:"bwl-locale__label"},LN={key:0,class:"bwl-locale__badge"},IN=Bh(he.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(o){try{return new Intl.DisplayNames([o],{type:"language"}).of(o)??o}catch{return o}}const r=he.computed(()=>{const o=n.i18n.value;return o?o.locales.map(a=>{const s=o.counts[a]??{untranslated:0,reviewRequested:0},c=a===o.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===o.displayLocale,design:a===o.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(o,a)=>r.value.length?(he.openBlock(),he.createElementBlock("div",kN,[(he.openBlock(!0),he.createElementBlock(he.Fragment,null,he.renderList(r.value,s=>(he.openBlock(),he.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:he.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=>he.unref(n).setDisplayLocale(s.locale)},[he.createElementVNode("span",DN,he.toDisplayString(s.label),1),s.pending>0?(he.openBlock(),he.createElementBlock("span",LN,he.toDisplayString(s.pending),1)):he.createCommentVNode("",!0)],10,ON))),128))])):he.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);Z.ADDABLE_FLOW_NODE_TYPES=Qs,Z.APPLY_BPMN_OPS_SCHEMA=R1,Z.BPMN_EVENT_DEFINITION_TYPES=ec,Z.BPMN_MODDLE_EXTENSIONS=pc,Z.BWL_MODDLE_SCHEMA=Zh,Z.BWL_NS=Xh,Z.BWL_PREFIX=qu,Z.BWL_REVIEW_REQUEST_TYPE=nc,Z.BWL_SIDES=Yu,Z.BpmnDisplayLocaleSwitcher=IN,Z.BpmnModelerView=gN,Z.BpmnValidationPanel=TN,Z.EDITOR=xC,Z.FLOW_LABEL_INDENT=km,Z.GROUP_BORDER_MIN_RUN=xp,Z.GROUP_BORDER_NEAR=Wo,Z.HEADLESS_BPMN_MODULES=Yx,Z.HEADLESS_TEXT_METRICS=Go,Z.I18N_NS=s1,Z.I18N_PREFIX=nm,Z.I18N_REVIEW_REQUESTED_CLASS=n_,Z.I18N_TRANSLATION_TYPE=$o,Z.I18N_UNTRANSLATED_CLASS=t_,Z.I18nDisplay=Kd,Z.I18nDisplayModule=r_,Z.IR_EVENT_DEFINITIONS=Js,Z.IR_FLOW_NODE_TYPES=to,Z.IR_TEXT_LOCALES=tc,Z.LABEL_FORK_MARGIN=Ep,Z.LABEL_SHAPE_MIN_DEPTH=Gm,Z.SET_TRANSLATIONS_COMMAND=np,Z.SEVERITY_ORDER=qd,Z.SYMBOLIC_OP_KINDS=im,Z.SYMBOLIC_OP_SCHEMA=rm,Z.SetTranslationsHandler=ip,Z.TranslationCommands=op,Z.TranslationCommandsModule=ap,Z.UNDO_EPISODE_COMMAND=Ku,Z.UPDATE_TRANSLATION_COMMAND=oc,Z.UpdateTranslationHandler=tp,Z.applyBpmnOpBatch=Fg,Z.applyBpmnOps=kg,Z.applyLocaleBackfill=CC,Z.approximateTextWidth=Vo,Z.auditBpmnGeometry=Um,Z.auditBpmnGeometryXml=_R,Z.auditBpmnSemantics=Fp,Z.auditBpmnSemanticsXml=pC,Z.auditGeometry=dt,Z.auditTargetsOf=ci,Z.axisSegmentsOf=gn,Z.blackBoxNameRect=_p,Z.buildBpmnOpBatch=bC,Z.buildRegistryIndex=Ym,Z.containerBoundarySegments=Yo,Z.countBySeverity=Jx,Z.createBpmnEditorController=_C,Z.createBpmnModdle=Em,Z.createHeadlessBpmnModeler=UO,Z.crossedShapesOf=xn,Z.crossingCost=si,Z.describeProcess=Ig,Z.describeProcessXml=oC,Z.diffBpmnElements=$g,Z.diffBpmnElementsXml=yC,Z.documentLocalesOf=Ba,Z.edgeCrossCount=Ha,Z.edgeCrossingPairsOf=vc,Z.edgeCrossingStatsOf=$m,Z.executeAsUndoEpisode=Jh,Z.followMovedEdgeLabels=mg,Z.forwardThreePointCandidates=xc,Z.geometryFindingKey=lt,Z.inferScriptLocale=Hp,Z.installHeadlessBpmnDom=Rm,Z.irEventDefinitionOf=Uu,Z.isAddableFlowNodeType=Yh,Z.isChangeScopeMixed=Yd,Z.isEdgeOverlapFinding=wp,Z.isInChangeScope=ba,Z.isIrEventDefinition=Kh,Z.isIrFlowNodeType=qh,Z.isIrTextLocale=ZE,Z.labelRectsOf=co,Z.labelShapeDepth=Vm,Z.labelSlot=ro,Z.lineCrossesLabel=Fi,Z.lineThroughLabel=Dm,Z.lineThroughShapeLabel=zm,Z.loadBpmnXml=zo,Z.localeTextsOf=ep,Z.lowerOps=Pg,Z.oppositeOverlapCount=sR,Z.oppositeOverlapOf=Tm,Z.planBackEdgeBoundaryClearance=ig,Z.planCrossPoolRoute=eg,Z.planEdgeRepair=Mp,Z.planLabelLineClearance=Op,Z.planLabelPlacement=fg,Z.planLocaleBackfill=RC,Z.planMiddleSegmentShifts=Xm,Z.planOppositeOverlapRepair=og,Z.planSegmentDetours=bc,Z.planShapeLabelClearance=vg,Z.redockIntroducedDetachedEndpoints=xg,Z.repairIntroducedBoundaryHugging=rg,Z.repairIntroducedCrossings=Ap,Z.repairIntroducedEdgeCrossings=Qm,Z.repairIntroducedFakeMerges=sg,Z.repairIntroducedLabelLines=gg,Z.repairIntroducedOppositeOverlaps=pg,Z.repairIntroducedShapeLabelLines=bg,Z.repairIntroducedSharedSegmentLabels=yg,Z.rerouteIntroducedCrossPoolEdges=tg,Z.resolverServicesOf=Rg,Z.reviewRequestValuesOf=rp,Z.reviewRequestsOf=xr,Z.rootLangOf=Ju,Z.saveBpmnXml=KS,Z.sceneCrossingCost=Nm,Z.sceneFromDefinitions=Wm,Z.sceneFromRegistry=Ze,Z.segmentShapeClearance=yc,Z.shapesUnderLabel=za,Z.sharedSegmentUnderLabel=gc,Z.sharedSpansOf=mc,Z.sortPanelIssues=e_,Z.toPanelIssues=Qx,Z.touchedElements=vC,Z.translationLocale=On,Z.translationsOf=Fo,Z.unreadableOverlapCount=ai,Z.unreadableOverlapOf=Uo,Z.validateOps=Sg,Z.warningMessages=bp,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})}));
|
|
343
|
+
</div>`,Ue.RESULT_HTML='<div class="djs-search-result"></div>',Ue.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ue.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const fN={__depends__:[ss,nu,xi],searchPad:["type",Ue]};function Hh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Hh.$inject=["elementRegistry","searchPad","canvas","search"],Hh.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!et(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:pi(i),id:i.id})),e,{keys:["label","id"]}).map(dN)};function dN(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const hN={__depends__:[fN,gw],__init__:["bpmnSearch"],bpmnSearch:["type",Hh]},mN="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",gN="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",yN={width:36,height:50},vN={width:50,height:50};function oE(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Ci=5;function Hu(e,t){this._styles=t,e.registerProvider(this)}Hu.$inject=["outline","styles"],Hu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(OA(e))return n=Oe("rect"),Se(n,U({x:-Ci,y:-Ci,rx:4,width:e.width+Ci*2,height:e.height+Ci*2},t)),n;if(!et(e))return M(e,"bpmn:Gateway")?(n=Oe("rect"),U(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,U({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):nt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),Se(n,U({x:-Ci,y:-Ci,rx:14,width:e.width+Ci*2,height:e.height+Ci*2},t))):M(e,"bpmn:EndEvent")?(n=Oe("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+Ci+1},t))):M(e,"bpmn:Event")?(n=Oe("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+Ci},t))):M(e,"bpmn:DataObjectReference")&&aE(e,"bpmn:DataObjectReference")?n=oE(mN,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&aE(e,"bpmn:DataStoreReference")&&(n=oE(gN,{x:-6,y:-6},t)),n},Hu.prototype.updateOutline=function(e,t){if(!et(e))return nt(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+Ci*2,height:e.height+Ci*2}),!0):!!nt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function aE(e,t){var n;return t==="bpmn:DataObjectReference"?n=yN:t==="bpmn:DataStoreReference"&&(n=vN),e.width===n.width&&e.height===n.height}const bN={__depends__:[kh],__init__:["outlineProvider"],outlineProvider:["type",Hu]};var xN='<?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 Zi(e){ia.call(this,e)}Ee(Zi,ia),Zi.Viewer=Vr,Zi.NavigatedViewer=Ls,Zi.prototype.createDiagram=function(){return this.importXML(xN)},Zi.prototype._interactionModules=[b_,__,S_],Zi.prototype._modelingModules=[wL,Ql,ML,RL,jL,Ch,UL,yI,Jb,Tl,_I,SI,jI,zI,GI,YI,aB,pB,Yd,vB,CB,NB,FB,x0,uN,hN,bN],Zi.prototype._modules=[].concat(Vr.prototype._modules,Zi.prototype._interactionModules,Zi.prototype._modelingModules);const _N=he.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=he.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Rp(u);return r("imported",p),{warnings:p}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return he.onMounted(async()=>{a=new Zi({container:o.value,moddleExtensions:gc,additionalModules:[l_]}),i.xml&&await s(i.xml),r("ready")}),he.watch(()=>i.xml,l=>{l&&a&&s(l)}),he.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(he.openBlock(),he.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),zh=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},wN=zh(_N,[["__scopeId","data-v-07ee17c9"]]),EN=["title","aria-expanded"],SN=["title","onClick"],RN={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},CN={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},MN={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},AN={key:0,class:"bwl-validation__body"},PN={key:0,class:"bwl-validation__empty"},TN={key:1,class:"bwl-validation__empty"},kN={key:2,class:"bwl-validation__list"},ON=["onClick"],DN={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},LN={class:"bwl-validation__msg"},IN=["title"],BN=zh(he.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=he.computed(()=>i_(n.issues.value,n.describeElement)),r=he.computed(()=>r_(i.value)),o=g=>_a(g,n.changeScope.value),a=he.computed(()=>eh(i.value,n.changeScope.value)),s=he.ref({error:!0,warning:!0,info:!0}),c=he.computed(()=>o_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=he.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(he.openBlock(),he.createElementBlock("section",{class:he.normalizeClass(["bwl-validation",{"is-open":l.value}])},[he.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[he.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(he.openBlock(),he.createElementBlock("svg",{class:he.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[he.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=he.createElementVNode("span",null,"검증",-1))],8,EN),he.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=he.withModifiers(()=>{},["stop"]))},[(he.openBlock(),he.createElementBlock(he.Fragment,null,he.renderList(u,y=>he.createElementVNode("button",{key:y,type:"button",class:he.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:C=>f(y)},[(he.openBlock(),he.createElementBlock("svg",RN,[h[4]||(h[4]=he.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(he.openBlock(),he.createElementBlock("path",CN)):(he.openBlock(),he.createElementBlock("path",MN))])),he.createElementVNode("span",null,he.toDisplayString(r.value[y]),1)],10,SN)),64))])]),l.value?(he.openBlock(),he.createElementBlock("div",AN,[i.value.length===0?(he.openBlock(),he.createElementBlock("p",PN,"발견된 문제가 없습니다.")):c.value.length===0?(he.openBlock(),he.createElementBlock("p",TN," 선택한 심각도에 해당하는 항목이 없습니다. ")):(he.openBlock(),he.createElementBlock("ul",kN,[(he.openBlock(!0),he.createElementBlock(he.Fragment,null,he.renderList(c.value,y=>(he.openBlock(),he.createElementBlock("li",{key:y.key,class:he.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:C=>d(y)},[h[5]||(h[5]=he.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(he.openBlock(),he.createElementBlock("span",DN,"이번 변경")):he.createCommentVNode("",!0),he.createElementVNode("span",LN,he.toDisplayString(y.message),1),he.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},he.toDisplayString(y.category),9,IN)],10,ON))),128))]))])):he.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),NN={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},$N=["aria-checked","title","data-locale","onClick"],FN={class:"bwl-locale__label"},jN={key:0,class:"bwl-locale__badge"},HN=zh(he.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(o){try{return new Intl.DisplayNames([o],{type:"language"}).of(o)??o}catch{return o}}const r=he.computed(()=>{const o=n.i18n.value;return o?o.locales.map(a=>{const s=o.counts[a]??{untranslated:0,reviewRequested:0},c=a===o.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===o.displayLocale,design:a===o.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(o,a)=>r.value.length?(he.openBlock(),he.createElementBlock("div",NN,[(he.openBlock(!0),he.createElementBlock(he.Fragment,null,he.renderList(r.value,s=>(he.openBlock(),he.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:he.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=>he.unref(n).setDisplayLocale(s.locale)},[he.createElementVNode("span",FN,he.toDisplayString(s.label),1),s.pending>0?(he.openBlock(),he.createElementBlock("span",jN,he.toDisplayString(s.pending),1)):he.createCommentVNode("",!0)],10,$N))),128))])):he.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);Z.ADDABLE_FLOW_NODE_TYPES=ic,Z.APPLY_BPMN_OPS_SCHEMA=k1,Z.BPMN_EVENT_DEFINITION_TYPES=oc,Z.BPMN_MODDLE_EXTENSIONS=gc,Z.BWL_MODDLE_SCHEMA=nm,Z.BWL_NS=tm,Z.BWL_PREFIX=Ju,Z.BWL_REVIEW_REQUEST_TYPE=sc,Z.BWL_SIDES=ep,Z.BpmnDisplayLocaleSwitcher=HN,Z.BpmnModelerView=wN,Z.BpmnValidationPanel=BN,Z.EDITOR=CC,Z.FLOW_LABEL_INDENT=Bm,Z.GROUP_BORDER_MIN_RUN=Cp,Z.GROUP_BORDER_NEAR=qo,Z.HEADLESS_BPMN_MODULES=Jx,Z.HEADLESS_TEXT_METRICS=Wo,Z.I18N_NS=d1,Z.I18N_PREFIX=sm,Z.I18N_REVIEW_REQUESTED_CLASS=s_,Z.I18N_TRANSLATION_TYPE=jo,Z.I18N_UNTRANSLATED_CLASS=a_,Z.I18nDisplay=th,Z.I18nDisplayModule=l_,Z.IR_EVENT_DEFINITIONS=rc,Z.IR_FLOW_NODE_TYPES=to,Z.IR_TEXT_LOCALES=ac,Z.LABEL_FORK_MARGIN=Pp,Z.LABEL_SHAPE_MIN_DEPTH=Ym,Z.SET_TRANSLATIONS_COMMAND=cp,Z.SEVERITY_ORDER=Jd,Z.SYMBOLIC_OP_KINDS=cm,Z.SYMBOLIC_OP_SCHEMA=lm,Z.SetTranslationsHandler=lp,Z.TranslationCommands=pp,Z.TranslationCommandsModule=fp,Z.UNDO_EPISODE_COMMAND=tp,Z.UPDATE_TRANSLATION_COMMAND=uc,Z.UpdateTranslationHandler=sp,Z.applyBpmnOpBatch=Vg,Z.applyBpmnOps=Bg,Z.applyLocaleBackfill=OC,Z.approximateTextWidth=Uo,Z.auditBpmnGeometry=Zm,Z.auditBpmnGeometryXml=MR,Z.auditBpmnSemantics=Wp,Z.auditBpmnSemanticsXml=yC,Z.auditGeometry=dt,Z.auditTargetsOf=ci,Z.axisSegmentsOf=hn,Z.blackBoxNameRect=Mp,Z.buildBpmnOpBatch=RC,Z.buildRegistryIndex=Jm,Z.containerBoundarySegments=Xo,Z.countBySeverity=r_,Z.createBpmnEditorController=MC,Z.createBpmnModdle=Am,Z.createHeadlessBpmnModeler=QO,Z.crossedShapesOf=mn,Z.crossingCost=si,Z.describeProcess=jg,Z.describeProcessXml=pC,Z.diffBpmnElements=Gg,Z.diffBpmnElementsXml=EC,Z.documentLocalesOf=ja,Z.edgeCrossCount=Wa,Z.edgeCrossingPairsOf=Ec,Z.edgeCrossingStatsOf=Gm,Z.executeAsUndoEpisode=rm,Z.followMovedEdgeLabels=xg,Z.forwardThreePointCandidates=Rc,Z.geometryFindingKey=ut,Z.inferScriptLocale=qp,Z.installHeadlessBpmnDom=Tm,Z.irEventDefinitionOf=Qu,Z.isAddableFlowNodeType=Jh,Z.isChangeScopeMixed=eh,Z.isEdgeOverlapFinding=Ap,Z.isInChangeScope=_a,Z.isIrEventDefinition=em,Z.isIrFlowNodeType=Qh,Z.isIrTextLocale=i1,Z.labelRectsOf=co,Z.labelShapeDepth=Km,Z.labelSlot=ro,Z.lineCrossesLabel=Ni,Z.lineThroughLabel=$m,Z.lineThroughShapeLabel=qm,Z.loadBpmnXml=Vo,Z.localeTextsOf=ap,Z.lowerOps=Lg,Z.oppositeOverlapCount=dR,Z.oppositeOverlapOf=Im,Z.planBackEdgeBoundaryClearance=cg,Z.planCrossPoolRoute=og,Z.planEdgeRepair=Dp,Z.planLabelLineClearance=$p,Z.planLabelPlacement=yg,Z.planLocaleBackfill=kC,Z.planMiddleSegmentShifts=tg,Z.planOppositeOverlapRepair=ug,Z.planSegmentDetours=Sc,Z.planShapeLabelClearance=Eg,Z.redockIntroducedDetachedEndpoints=Rg,Z.repairIntroducedBoundaryHugging=lg,Z.repairIntroducedCrossings=Lp,Z.repairIntroducedEdgeCrossings=ig,Z.repairIntroducedFakeMerges=fg,Z.repairIntroducedLabelLines=_g,Z.repairIntroducedOppositeOverlaps=gg,Z.repairIntroducedShapeLabelLines=Sg,Z.repairIntroducedSharedSegmentLabels=wg,Z.rerouteIntroducedCrossPoolEdges=ag,Z.resolverServicesOf=Tg,Z.reviewRequestValuesOf=up,Z.reviewRequestsOf=xr,Z.rootLangOf=op,Z.saveBpmnXml=tR,Z.sceneCrossingCost=zm,Z.sceneFromDefinitions=Xm,Z.sceneFromRegistry=qe,Z.segmentShapeClearance=wc,Z.shapesUnderLabel=Ua,Z.sharedSegmentUnderLabel=_c,Z.sharedSpansOf=xc,Z.sortPanelIssues=o_,Z.toPanelIssues=i_,Z.touchedElements=SC,Z.translationLocale=kn,Z.translationsOf=Ho,Z.unreadableOverlapCount=ai,Z.unreadableOverlapOf=Yo,Z.validateOps=Pg,Z.warningMessages=Rp,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})}));
|