@g1cloud/bpmn-modeler-next 5.0.0-beta.29 → 5.0.0-beta.30
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 +1736 -1734
- package/dist/bpmn-modeler.umd.cjs +26 -26
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(ee,me){typeof exports=="object"&&typeof module<"u"?me(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],me):(ee=typeof globalThis<"u"?globalThis:ee||self,me(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,me){"use strict";var K5=Object.defineProperty;var X5=(ee,me,vr)=>me in ee?K5(ee,me,{enumerable:!0,configurable:!0,writable:!0,value:vr}):ee[me]=vr;var pi=(ee,me,vr)=>X5(ee,typeof me!="symbol"?me+"":me,vr);const vr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],_c=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Cg(e){return vr.includes(e)}function Mg(e){return _c.includes(e)}const wc=["timer"],Ec={timer:"bpmn:TimerEventDefinition"};function Ag(e){return typeof e=="string"&&wc.includes(e)}function mp(e){if(e.length===1)return wc.find(t=>Ec[t]===e[0])}const Sc=["ko","en","ja","zh"];function G1(e){return typeof e=="string"&&Sc.includes(e)}const Pg="http://g1project.net/spec/bpmn/bwl/1.0",yp="bwl",vp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Rc="bwl:ReviewRequest",Tg={name:"bwl-hints",uri:Pg,prefix:yp,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"}]}]},bp="bwl.undoEpisode",kg=new WeakSet;function V1(e){kg.has(e)||(e.register(bp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),kg.add(e))}function Og(e,t){V1(e);const n={run:t};if(e.execute(bp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function xp(e){return Array.prototype.concat.apply([],e)}const es=Object.prototype.toString,W1=Object.prototype.hasOwnProperty;function br(e){return e===void 0}function dn(e){return e!==void 0}function Qr(e){return e==null}function ze(e){return es.call(e)==="[object Array]"}function hn(e){return es.call(e)==="[object Object]"}function Ge(e){return es.call(e)==="[object Number]"}function bn(e){const t=es.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Qn(e){return es.call(e)==="[object String]"}function U1(e){if(!ze(e))throw new Error("must supply array")}function Jn(e,t){return!Qr(e)&&W1.call(e,t)}function Lt(e,t){const n=Mc(t);let i;return z(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Dg(e,t){const n=Mc(t);let i=ze(e)?-1:void 0;return z(e,function(o,r){if(n(o,r))return i=r,!1}),i}function rt(e,t){const n=Mc(t);let i=[];return z(e,function(o,r){n(o,r)&&i.push(o)}),i}function z(e,t){let n,i;if(br(e))return;const o=ze(e)?Z1:X1;for(let r in e)if(Jn(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function q1(e,t){if(br(e))return[];U1(e);const n=Mc(t);return e.filter(function(i,o){return!n(i,o)})}function ei(e,t,n){return z(e,function(i,o){n=t(n,i,o)}),n}function Oo(e,t){return!!ei(e,function(n,i,o){return n&&t(i,o)},!0)}function Do(e,t){return!!Lt(e,t)}function Bn(e,t){let n=[];return z(e,function(i,o){n.push(t(i,o))}),n}function Cc(e){return e&&Object.keys(e)||[]}function Y1(e){return Cc(e).length}function Jr(e){return Bn(e,t=>t)}function ea(e,t,n={}){return t=_p(t),z(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Lg(e,...t){e=_p(e);let n={};return z(t,o=>ea(o,e,n)),Bn(n,function(o,r){return o[0]})}const K1=Lg;function Vi(e,t){t=_p(t);let n=[];return z(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Bn(n,i=>i.v)}function ta(e){return function(t){return Oo(e,function(n,i){return t[i]===n})}}function _p(e){return bn(e)?e:t=>t[e]}function Mc(e){return bn(e)?e:t=>t===e}function X1(e){return e}function Z1(e){return Number(e)}function wp(e,t){let n,i,o,r;function a(p){let f=Date.now(),d=p?0:r+t-f;if(d>0)return s(d);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Kn(e,t){return e.bind(t)}function U(e,...t){return Object.assign(e,...t)}function Q1(e,t,n){let i=e;return z(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];dn(a)&&Qr(s)&&(s=i[o]=isNaN(+a)?{}:[]),br(a)?br(n)?delete i[o]:i[o]=n:i=s}),e}function Ii(e,t){let n={},i=Object(e);return z(t,function(o){o in i&&(n[o]=e[o])}),n}function Wi(e,t){let n={},i=Object(e);return z(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function M(e,t){var n=ge(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ot(e,t){return Do(t,function(n){return M(e,n)})}function ge(e){return e&&e.businessObject||e}function dt(e){return e&&e.di}const J1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Ig="i18n",na="i18n:Translation";function xr(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 ia(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,na)})}function Nn(e){return e.get("xml:lang")}function Lo(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,Rc)})}function ts(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Ep(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 Sp(e,t,n){const i=xr(e);if(!i)return{};const o=i.target[i.key]??"",r=ia(e).filter(u=>Nn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Nn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of ts(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Nn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Ac="bwl.updateTranslation";class Rp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:o,locales:r,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=xr(c),u=[];t.undo=u;const p=ia(c).filter(D=>Nn(D)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(D=>{if(!D)return[];const N=p.filter($=>$.body===D).map(Nn);return N.length?N:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,_=D=>{var N;return((N=p.find($=>Nn($)===D&&$.body))==null?void 0:N.body)??(h.includes(D)?f:"")},v=D=>Lo(c).some(N=>N.locale===D),y=_(m);if(y===i)return[];const b=!!y&&!v(m),E=b?r.filter(D=>D!==m&&_(D)&&!v(D)):[],w=()=>{let D=c.extensionElements;return D||(D=this.moddle.create("bpmn:ExtensionElements",{values:[]}),D.$parent=c,c.extensionElements=D,u.push(()=>delete c.extensionElements)),D.get("values")},P=(D,N)=>{const $=w();let H=$.find(Z=>{var J;return((J=Z.$instanceOf)==null?void 0:J.call(Z,na))&&Nn(Z)===D});if(H){const Z=H.body;H.body=N,u.push(()=>H.body=Z)}else H=this.moddle.create(na,{body:N}),H.set("xml:lang",D),H.$parent=c.extensionElements,$.push(H),u.push(()=>$.splice($.indexOf(H),1))},T=D=>{const N=w(),$=N.indexOf(D);N.splice($,1),u.push(()=>N.splice($,0,D))};if(s===void 0){if(m===o&&l){if(f&&!p.some(N=>N.body===f)){const N=a&&a!==o?a:void 0;N&&P(N,f)}const D=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{D?l.target[l.key]=f:delete l.target[l.key]})}P(m,i)}else(p.some(D=>Nn(D)===m)||!f&&m!==d)&&P(m,i);if(!b)for(const D of Lo(c).filter(N=>N.locale===m))T(D);for(const D of E){const N=w(),$=this.moddle.create(Rc,{locale:D,sourceLocale:m,previous:y});$.$parent=c.extensionElements,N.push($),u.push(()=>N.splice(N.indexOf($),1))}for(const D of Lo(c).filter(N=>N.sourceLocale===m&&(N.previous??"")===i))T(D);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}pi(Rp,"$inject",["moddle"]);const Cp="bwl.setTranslations",eS=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Mp{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:o=[],designLocale:r,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!xr(l))return[];const p=()=>{let _=l.extensionElements;return _||(_=this.moddle.create("bpmn:ExtensionElements",{values:[]}),_.$parent=l,l.extensionElements=_,u.push(()=>delete l.extensionElements)),_.get("values")},f=_=>{const v=p(),y=v.indexOf(_);y<0||(v.splice(y,1),u.push(()=>v.splice(y,0,_)))},d=_=>ia(l).find(v=>Nn(v)===_);if(i===null)for(const _ of a){const v=d(_);v&&f(v)}else if(i)for(const _ of a){const v=i[_];if(v===void 0)continue;const y=d(_);if(y){if(y.body===v)continue;const w=y.body;y.body=v,u.push(()=>y.body=w);continue}if(_===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(na,{body:v});E.set("xml:lang",_),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(_=>!o.includes(_.locale)&&!(i&&i[_.locale]!==void 0&&i[_.locale]!==c.texts[_.locale])&&!(i&&_.sourceLocale&&i[_.sourceLocale]===_.previous))];for(const _ of Lo(l)){const v=h.findIndex(y=>eS(_,y));v>=0?h.splice(v,1):f(_)}for(const _ of h){const v=p(),y=this.moddle.create(Rc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});y.$parent=l.extensionElements,v.push(y),u.push(()=>v.splice(v.indexOf(y),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}pi(Mp,"$inject",["moddle"]);function Ap(e){return Lo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Pp{constructor(t){t.registerHandler(Ac,Rp),t.registerHandler(Cp,Mp)}}pi(Pp,"$inject",["commandStack"]);const Tp={__init__:["translationCommands"],translationCommands:["type",Pp]},Bg=["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"],tS={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},nS={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Sc.map(e=>[e,{type:"string"}])),additionalProperties:!1},iS={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},oS={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},rS={type:"string",enum:[...wc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},aS={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[..._c]},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},sS={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},cS={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},lS={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},uS={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},pS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},fS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},dS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},hS={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},gS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...vp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function An(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const mS={"participant.add":An("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":An("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":An("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":An("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lane:{type:"string"},type:{type:"string",enum:[..._c]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":An("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":An("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":An("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":An("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":An("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":An("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":An("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":An("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":An("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":An("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":An("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":An("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":An("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Sc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":An("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Ng={anyOf:Bg.map(e=>mS[e])},yS={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:iS,irParticipant:oS,irNode:aS,irFlowCondition:sS,irSequenceFlow:cS,irMessageFlow:lS,irDataStore:uS,irDataAssociation:pS,irTextAnnotation:fS,irAssociation:dS,irGroup:hS,bwlPlacement:gS,eventDefinition:rS,localeTexts:nS,nullableString:tS,symbolicOp:Ng}};function kp(){}kp.prototype.get=function(e){return this.$model.properties.get(this,e)},kp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function $g(e,t){this.model=e,this.properties=t}$g.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(kp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),z(a,Kn(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var vS=U(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Fg=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 Op(e,t){var n=Fg[e];return n?n(t):t}function Dp(e){return!!vS[e]}function jg(e){return!!Fg[e]}function $n(e,t){var n=e.split(/:/),i,o;if(n.length===1)i=e,o=t;else if(n.length===2)i=n[1],o=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(o?o+":":"")+i,{name:e,prefix:o,localName:i}}function fi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}fi.prototype.build=function(){return Ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},fi.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)},fi.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=o.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");o.splice(s,1),this.addProperty(t,n?void 0:s,a),r[i.name]=r[i.localName]=t},fi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=$n(o[0],i),a=$n(o[1],r.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},fi.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},fi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},fi.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},fi.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},fi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},fi.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")},fi.prototype.hasProperty=function(e){return this.propertiesByName[e]},fi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(z(e.properties,Kn(function(r){r=U({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function Io(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Kn(this.registerPackage,this))}Io.prototype.getPackage=function(e){return this.packageMap[e]},Io.prototype.getPackages=function(){return this.packages},Io.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;Hg(t,e,"prefix"),Hg(t,e,"uri"),z(e.types,Kn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Io.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=$n(e.name,t.prefix),i=n.name,o=Object.create(null);z(e.properties,Kn(function(r){var a=$n(r.name,n.prefix),s=a.name;Dp(r.type)||(r.type=$n(r.type,a.prefix).name),U(r,{ns:a,name:s}),o[s]=r},this)),U(e,{ns:n,name:i,propertiesByName:o}),z(e.extends,Kn(function(r){var a=$n(r,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Io.prototype.mapTypes=function(e,t,n){var i=Dp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=$n(c,Dp(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},Io.prototype.getEffectiveDescriptor=function(e){var t=$n(e),n=new fi(t);this.mapTypes(t,function(o,r){n.addTrait(o,r)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Io.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Hg(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function _r(e){this.model=e}_r.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),o=i&&i.name;bS(n)?i?delete e[o]:delete e.$attrs[Lp(t)]:i?o in e?e[o]=n:zg(e,i,n):e.$attrs[Lp(t)]=n},_r.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Lp(t)];var i=n.name;return!e[i]&&n.isMany&&zg(e,n,[]),e[i]},_r.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)},_r.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},_r.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},_r.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(typeof o<"u"){const r=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw r;typeof console<"u"&&console.warn(r)}return null};function bS(e){return typeof e>"u"}function zg(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Lp(e){return e.replace(/^:/,"")}function vi(e,t={}){this.properties=new _r(this),this.factory=new $g(this,this.properties),this.registry=new Io(e,this.properties),this.typeCache=Object.create(null),this.config=t}vi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},vi.prototype.getType=function(e){var t=this.typeCache,n=Qn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},vi.prototype.createAny=function(e,t,n){var i=$n(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Q1(this,[a],s)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),z(n,function(a,s){hn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},vi.prototype.getPackage=function(e){return this.registry.getPackage(e)},vi.prototype.getPackages=function(){return this.registry.getPackages()},vi.prototype.getElementDescriptor=function(e){return e.$descriptor},vi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},vi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},vi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Gg=String.fromCharCode,xS=Object.prototype.hasOwnProperty,_S=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ns={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ns).forEach(function(e){ns[e.toUpperCase()]=ns[e]});function wS(e,t,n,i){return i?xS.call(ns,i)?ns[i]:"&"+i+";":Gg(t||parseInt(n,16))}function wr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(_S,wS):e}var Vg="non-whitespace outside of root node";function Bo(e){return new Error(e)}function ES(e){return"missing namespace for prefix <"+e+">"}function Pc(e){return{get:e,enumerable:!0}}function SS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Wg=Symbol("nameCache");function Ip(e){return e+"$uri"}function RS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Ip(i)]=n;return t}function Tc(){return{line:0,column:0}}function CS(e){throw e}function Ug(e){if(!this)return new Ug(e);var t=e&&e.proxy,n,i,o,r,a=CS,s,c,l,u,p=Tc,f=!1,d=!1,g="",h=!1,m=!1,_=null,v=!1,y,b,E,w;function P($){$ instanceof Error||($=Bo($)),_=$,a($,p)}function T($){s&&($ instanceof Error||($=Bo($)),s($,p))}this.on=function($,H){if(typeof H!="function")throw Bo("required args <name, cb>");switch($){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":o=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":r=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw Bo("unsupported event: "+$)}return this},this.ns=function($){if(typeof $>"u"&&($={}),typeof $!="object")throw Bo("required args <nsMap={}>");var H=Object.create(null),Z;for(Z in $)H[Z]=$[Z];return m=!0,w=H,this};function D(){y=m?[]:null,b=m?RS(w):null,E=[],p=Tc,v=!1,_=null,d=!1,g=""}this.parse=function($){if(typeof $!="string")throw Bo("required args <xml=string>");if(f)throw Bo("parse during stream; call end() first");return D(),N($),p=Tc,v=!1,_},this.write=function($){if(typeof $!="string")throw Bo("required args <xml=string>");return f||(D(),f=!0),_||(g=N(g+$,!0)||""),this},this.end=function(){return f||D(),f=!1,_||N(g),g="",p=Tc,v=!1,_},this.stop=function(){v=!0};function N($,H=!1){var Z=null,J=null,V,we=0,Ce=!1,ke=!1,Ee=0,q=0,ne,W,X,oe,he,De,B,C,R,G="",K=0,ie;function Pe(Ct,vn){var Rn=Ct.indexOf(":");if(Rn===-1)return Ct;var Un=b[Ct.substring(0,Rn)];return Un?vn===Un?Ct.substr(Rn+1):Un+Ct.substr(Rn):(T(ES(Ct.substring(0,Rn))),null)}function et(){if(ie!==null)return ie;var Ct,vn,Rn=m&&b.xmlns,Un=m&&h?[]:null,At=K,Qt=G,_n=Qt.length,qa,qn,Hi,li,nn,Gr={},Ya=new Set,Cn,gt,St;e:for(;At<_n;At++)if(Cn=!1,gt=Qt.charCodeAt(At),!(gt===32||gt<14&>>8)){for((gt<65||gt>122||gt>90&><97)&>!==95&>!==58&&(T("illegal first char attribute name"),Cn=!0),St=At+1;St<_n;St++)if(gt=Qt.charCodeAt(St),!(gt>96&><123||gt>64&><91||gt>47&><59||gt===46||gt===45||gt===95)){if(gt===32||gt<14&>>8){T("missing attribute value"),At=St;continue e}if(gt===61)break;T("illegal attribute name char"),Cn=!0}if(nn=Qt.substring(At,St),nn==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Cn=!0),gt=Qt.charCodeAt(St+1),gt===34)St=Qt.indexOf('"',At=St+2),St===-1&&(St=Qt.indexOf("'",At),St!==-1&&(T("attribute value quote missmatch"),Cn=!0));else if(gt===39)St=Qt.indexOf("'",At=St+2),St===-1&&(St=Qt.indexOf('"',At),St!==-1&&(T("attribute value quote missmatch"),Cn=!0));else for(T("missing attribute value quotes"),Cn=!0,St=St+1;St<_n&&(gt=Qt.charCodeAt(St+1),!(gt===32||gt<14&>>8));St++);for(St===-1&&(T("missing closing quotes"),St=_n,Cn=!0),Cn||(Hi=Qt.substring(At,St)),At=St;St+1<_n&&(gt=Qt.charCodeAt(St+1),!(gt===32||gt<14&>>8));St++)At===St&&(T("illegal character after attribute end"),Cn=!0);if(At=St+1,Cn)continue e;if(Ya.has(nn)){T("attribute <"+nn+"> already defined");continue}if(Ya.add(nn),!m){Gr[nn]=Hi;continue}if(h){if(qn=nn==="xmlns"?"xmlns":nn.charCodeAt(0)===120&&nn.substr(0,6)==="xmlns:"?nn.substr(6):null,qn!==null){if(Ct=wr(Hi),vn=Ip(qn),li=w[Ct],!li){if(qn==="xmlns"||vn in b&&b[vn]!==Ct)do li="ns"+we++;while(typeof b[li]<"u");else li=qn;w[Ct]=li}b[qn]!==li&&(qa||(b=SS(b),qa=!0),b[qn]=li,qn==="xmlns"&&(b[Ip(li)]=Ct,Rn=li),b[vn]=Ct),Gr[nn]=Hi;continue}Un.push(nn,Hi);continue}nn=Pe(nn,Rn),nn!==null&&(Gr[nn]=Hi)}if(h)for(At=0,_n=Un.length;At<_n;At++)nn=Pe(Un[At++],Rn),Hi=Un[At],nn!==null&&(Gr[nn]=Hi);return ie=Gr}function mt(){for(var Ct=/(\r\n|\r|\n)/g,vn=0,Rn=0,Un=0,At=q,Qt,_n;Ee>=Un&&(Qt=Ct.exec($),!(!Qt||(At=Qt[0].length+Qt.index,At>Ee)));)vn+=1,Un=At;return Ee==-1?(Rn=At,_n=$.substring(q)):q===0?_n=$.substring(q,Ee):(Rn=Ee-Un,_n=q==-1?$.substring(Ee):$.substring(Ee,q+1)),{data:_n,line:vn,column:Rn}}for(p=mt,t&&(R=Object.create({},{name:Pc(function(){return B}),originalName:Pc(function(){return C}),attrs:Pc(et),ns:Pc(function(){return b})}));q!==-1;){if($.charCodeAt(q)===60?Ee=q:Ee=$.indexOf("<",q),Ee===-1){if(H)return $.substring(q);if(E.length)return P("unexpected end of file");if(!d)return P("missing start tag");q<$.length&&$.substring(q).trim()&&T(Vg);return}if(d||(d=!0),q!==Ee){if(E.length){if(n&&(n($.substring(q,Ee),wr,p),v))return}else if($.substring(q,Ee).trim()&&(T(Vg),v))return}if(oe=$.charCodeAt(Ee+1),oe===33){if(X=$.charCodeAt(Ee+2),X===91&&$.substr(Ee+3,6)==="CDATA["){if(q=$.indexOf("]]>",Ee),q===-1)return H?$.substring(Ee):P("unclosed cdata");if(r&&(r($.substring(Ee+9,q),p),v))return;q+=3;continue}if(X===45&&$.charCodeAt(Ee+3)===45){if(q=$.indexOf("-->",Ee),q===-1)return H?$.substring(Ee):P("unclosed comment");if(c&&(c($.substring(Ee+4,q),wr,p),v))return;q+=3;continue}}if(oe===63){if(q=$.indexOf("?>",Ee),q===-1)return H?$.substring(Ee):P("unclosed question");if(l&&(l($.substring(Ee,q+2),p),v))return;q+=2;continue}for(ne=Ee+1;;ne++){if(he=$.charCodeAt(ne),isNaN(he))return H?$.substring(Ee):(q=-1,P("unclosed tag"));if(he===34)X=$.indexOf('"',ne+1),ne=X!==-1?X:ne;else if(he===39)X=$.indexOf("'",ne+1),ne=X!==-1?X:ne;else if(he===62){q=ne;break}}if(oe===33){if(u&&(u($.substring(Ee,q+1),wr,p),v))return;q+=1;continue}if(ie={},oe===47){if(Ce=!1,ke=!0,!E.length)return P("missing open tag");if(ne=B=E.pop(),X=Ee+2+ne.length,$.substring(Ee+2,X)!==ne)return P("closing tag mismatch");for(;X<q;X++)if(oe=$.charCodeAt(X),!(oe===32||oe>8&&oe<14))return P("close tag")}else{if($.charCodeAt(q-1)===47?(ne=B=$.substring(Ee+1,q-1),Ce=!0,ke=!0):(ne=B=$.substring(Ee+1,q),Ce=!0,ke=!1),!(oe>96&&oe<123||oe>64&&oe<91||oe===95||oe===58))return P("illegal first char nodeName");for(X=1,W=ne.length;X<W;X++)if(oe=ne.charCodeAt(X),!(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){B=ne.substring(0,X),ie=null;break}return P("invalid nodeName")}ke||E.push(B)}if(m){V=b,Ce&&(ke||y.push(V),ie===null&&(h=ne.indexOf("xmlns",X)!==-1)&&(K=X,G=ne,et(),h=!1)),C=B,J!==b&&(Z=b[Wg],Z===void 0&&(Z=b[Wg]=Object.create(null)),J=b);var qt=Z[B];if(qt!==void 0)B=qt;else{if(oe=B.indexOf(":"),oe!==-1){if(De=b[B.substring(0,oe)],!De)return P("missing namespace on <"+C+">");B=B.substr(oe+1)}else De=b.xmlns;De&&(B=De+":"+B),Z[C]=B}}if(Ce&&(K=X,G=ne,i&&(t?i(R,wr,ke,p):i(B,et,wr,ke,p),v)))return;if(ke){if(o&&(o(t?R:B,wr,Ce,p),v))return;m&&(Ce?b=V:b=y.pop())}q+=1}}}function qg(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Bp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Yg="property";function Kg(e){return e.xml&&e.xml.serialize}function MS(e){const t=Kg(e);return t!==Yg&&(t||null)}function AS(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xg(e,t){return qg(t)?e.prefix+":"+AS(e.localName):e.name}function PS(e,t){var n=e.name,i=e.localName,o=t&&t.xml&&t.xml.typePrefix;return o&&i.indexOf(o)===0?e.prefix+":"+i.slice(o.length):n}function TS(e,t,n){const i=$n(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=$n(o);var a=n.getPackage(r.prefix);return PS(r,a)}function No(e){return new Error(e)}function fo(e){return e.$descriptor}function kS(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 No("expected element");var n=this.elementsById,i=fo(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw No("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function is(){}is.prototype.handleEnd=function(){},is.prototype.handleText=function(){},is.prototype.handleNode=function(){};function Np(){}Np.prototype=Object.create(is.prototype),Np.prototype.handleNode=function(){return this};function oa(){}oa.prototype=Object.create(is.prototype),oa.prototype.handleText=function(e){this.body=(this.body||"")+e};function os(e,t){this.property=e,this.context=t}os.prototype=Object.create(oa.prototype),os.prototype.handleNode=function(e){if(this.element)throw No("expected no sub nodes");return this.element=this.createReference(e),this},os.prototype.handleEnd=function(){this.element.id=this.body},os.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function $p(e,t){this.element=t,this.propertyDesc=e}$p.prototype=Object.create(oa.prototype),$p.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Op(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function kc(){}kc.prototype=Object.create(oa.prototype),kc.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 zn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}zn.prototype=Object.create(kc.prototype),zn.prototype.addReference=function(e){this.context.addReference(e)},zn.prototype.handleText=function(e){var t=this.element,n=fo(t),i=n.bodyProperty;if(!i)throw No("unexpected body text <"+e+">");oa.prototype.handleText.call(this,e)},zn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=fo(t),i=n.bodyProperty;i&&e!==void 0&&(e=Op(i.type,e),t.set(i.name,e))},zn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=fo(n),o=this.context,r=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){o.addReference({element:r,property:u.ns.name,id:f})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Op(u.type,c):l==="xmlns"?l=":"+l:(s=$n(l,i.ns.prefix),a.getPackage(s.prefix)&&o.addWarning({message:"unknown attribute <"+l+">",element:r,property:l,value:c})),r.set(l,c))}),r},zn.prototype.getPropertyForNode=function(e){var t=e.name,n=$n(t),i=this.type,o=this.model,r=fo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=MS(s);if(l){const u=e.attributes[l];if(u){const p=TS(u,e.ns,o),f=o.getType(p);return U({},s,{effectiveType:fo(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Xg(n,c),u=o.getType(l);if(s=Lt(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return U({},s,{effectiveType:fo(u).name})}else if(s=Lt(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw No("unrecognized element <"+n.name+">")},zn.prototype.toString=function(){return"ElementDescriptor["+fo(this.type).name+"]"},zn.prototype.valueHandler=function(e,t){return new $p(e,t)},zn.prototype.referenceHandler=function(e){return new os(e,this.context)},zn.prototype.handler=function(e){return e==="Element"?new ra(this.model,e,this.context):new zn(this.model,e,this.context)},zn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,jg(n))return this.valueHandler(t,i);t.isReference?o=this.referenceHandler(t).handleNode(e):o=this.handler(n).handleNode(e);var r=o.element;return r!==void 0&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(U(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Fp(e,t,n){zn.call(this,e,t,n)}Fp.prototype=Object.create(zn.prototype),Fp.prototype.createElement=function(e){var t=e.name,n=$n(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Xg(n,r)||t;if(!o.hasType(a))throw No("unexpected element <"+e.originalName+">");return zn.prototype.createElement.call(this,e)};function ra(e,t,n){this.model=e,this.context=n}ra.prototype=Object.create(kc.prototype),ra.prototype.createElement=function(e){var t=e.name,n=$n(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ra.prototype.handleChild=function(e){var t=new ra(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,o;return i!==void 0&&(o=n.$children=n.$children||[],o.push(i),i.$parent=n),t},ra.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function jp(e){e instanceof vi&&(e={model:e}),U(this,{lax:!1},e)}jp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof zn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var o=this.model,r=this.lax,a=new kS(U({},t,{rootHandler:i})),s=new Ug({proxy:!0}),c=OS();i.context=a,c.push(i);function l(E,w,P){var T=w(),D=T.line,N=T.column,$=T.data;$.charAt(0)==="<"&&$.indexOf(" ")!==-1&&($=$.slice(0,$.indexOf(" "))+">");var H="unparsable content "+($?$+" ":"")+`detected
|
|
2
|
-
line: `+
|
|
1
|
+
(function(ee,me){typeof exports=="object"&&typeof module<"u"?me(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],me):(ee=typeof globalThis<"u"?globalThis:ee||self,me(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,me){"use strict";var K5=Object.defineProperty;var X5=(ee,me,vr)=>me in ee?K5(ee,me,{enumerable:!0,configurable:!0,writable:!0,value:vr}):ee[me]=vr;var pi=(ee,me,vr)=>X5(ee,typeof me!="symbol"?me+"":me,vr);const vr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],wc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Cg(e){return vr.includes(e)}function Mg(e){return wc.includes(e)}const Ec=["timer"],Sc={timer:"bpmn:TimerEventDefinition"};function Ag(e){return typeof e=="string"&&Ec.includes(e)}function mp(e){if(e.length===1)return Ec.find(t=>Sc[t]===e[0])}const Rc=["ko","en","ja","zh"];function G1(e){return typeof e=="string"&&Rc.includes(e)}const Pg="http://g1project.net/spec/bpmn/bwl/1.0",yp="bwl",vp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Cc="bwl:ReviewRequest",Tg={name:"bwl-hints",uri:Pg,prefix:yp,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"}]}]},bp="bwl.undoEpisode",kg=new WeakSet;function V1(e){kg.has(e)||(e.register(bp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),kg.add(e))}function Og(e,t){V1(e);const n={run:t};if(e.execute(bp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function xp(e){return Array.prototype.concat.apply([],e)}const ts=Object.prototype.toString,W1=Object.prototype.hasOwnProperty;function br(e){return e===void 0}function dn(e){return e!==void 0}function Qr(e){return e==null}function ze(e){return ts.call(e)==="[object Array]"}function hn(e){return ts.call(e)==="[object Object]"}function Ge(e){return ts.call(e)==="[object Number]"}function bn(e){const t=ts.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Qn(e){return ts.call(e)==="[object String]"}function U1(e){if(!ze(e))throw new Error("must supply array")}function Jn(e,t){return!Qr(e)&&W1.call(e,t)}function Lt(e,t){const n=Ac(t);let i;return z(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Dg(e,t){const n=Ac(t);let i=ze(e)?-1:void 0;return z(e,function(o,r){if(n(o,r))return i=r,!1}),i}function rt(e,t){const n=Ac(t);let i=[];return z(e,function(o,r){n(o,r)&&i.push(o)}),i}function z(e,t){let n,i;if(br(e))return;const o=ze(e)?Z1:X1;for(let r in e)if(Jn(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function q1(e,t){if(br(e))return[];U1(e);const n=Ac(t);return e.filter(function(i,o){return!n(i,o)})}function ei(e,t,n){return z(e,function(i,o){n=t(n,i,o)}),n}function Oo(e,t){return!!ei(e,function(n,i,o){return n&&t(i,o)},!0)}function Do(e,t){return!!Lt(e,t)}function Bn(e,t){let n=[];return z(e,function(i,o){n.push(t(i,o))}),n}function Mc(e){return e&&Object.keys(e)||[]}function Y1(e){return Mc(e).length}function Jr(e){return Bn(e,t=>t)}function ea(e,t,n={}){return t=_p(t),z(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Lg(e,...t){e=_p(e);let n={};return z(t,o=>ea(o,e,n)),Bn(n,function(o,r){return o[0]})}const K1=Lg;function Vi(e,t){t=_p(t);let n=[];return z(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Bn(n,i=>i.v)}function ta(e){return function(t){return Oo(e,function(n,i){return t[i]===n})}}function _p(e){return bn(e)?e:t=>t[e]}function Ac(e){return bn(e)?e:t=>t===e}function X1(e){return e}function Z1(e){return Number(e)}function wp(e,t){let n,i,o,r;function a(p){let f=Date.now(),d=p?0:r+t-f;if(d>0)return s(d);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Kn(e,t){return e.bind(t)}function U(e,...t){return Object.assign(e,...t)}function Q1(e,t,n){let i=e;return z(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];dn(a)&&Qr(s)&&(s=i[o]=isNaN(+a)?{}:[]),br(a)?br(n)?delete i[o]:i[o]=n:i=s}),e}function Ii(e,t){let n={},i=Object(e);return z(t,function(o){o in i&&(n[o]=e[o])}),n}function Wi(e,t){let n={},i=Object(e);return z(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function M(e,t){var n=ge(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ot(e,t){return Do(t,function(n){return M(e,n)})}function ge(e){return e&&e.businessObject||e}function dt(e){return e&&e.di}const J1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Ig="i18n",na="i18n:Translation";function xr(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 ia(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,na)})}function Nn(e){return e.get("xml:lang")}function Lo(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,Cc)})}function ns(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Ep(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 Sp(e,t,n){const i=xr(e);if(!i)return{};const o=i.target[i.key]??"",r=ia(e).filter(u=>Nn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Nn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of ns(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Nn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Pc="bwl.updateTranslation";class Rp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:o,locales:r,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=xr(c),u=[];t.undo=u;const p=ia(c).filter(O=>Nn(O)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(O=>{if(!O)return[];const N=p.filter($=>$.body===O).map(Nn);return N.length?N:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,_=O=>{var N;return((N=p.find($=>Nn($)===O&&$.body))==null?void 0:N.body)??(h.includes(O)?f:"")},v=O=>Lo(c).some(N=>N.locale===O),y=_(m);if(y===i)return[];const b=!!y&&!v(m),E=b?r.filter(O=>O!==m&&_(O)&&!v(O)):[],w=()=>{let O=c.extensionElements;return O||(O=this.moddle.create("bpmn:ExtensionElements",{values:[]}),O.$parent=c,c.extensionElements=O,u.push(()=>delete c.extensionElements)),O.get("values")},P=(O,N)=>{const $=w();let H=$.find(Q=>{var J;return((J=Q.$instanceOf)==null?void 0:J.call(Q,na))&&Nn(Q)===O});if(H){const Q=H.body;H.body=N,u.push(()=>H.body=Q)}else H=this.moddle.create(na,{body:N}),H.set("xml:lang",O),H.$parent=c.extensionElements,$.push(H),u.push(()=>$.splice($.indexOf(H),1))},T=O=>{const N=w(),$=N.indexOf(O);N.splice($,1),u.push(()=>N.splice($,0,O))};if(s===void 0){if(m===o&&l){if(f&&!p.some(N=>N.body===f)){const N=a&&a!==o?a:void 0;N&&P(N,f)}const O=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{O?l.target[l.key]=f:delete l.target[l.key]})}P(m,i)}else(p.some(O=>Nn(O)===m)||!f&&m!==d)&&P(m,i);if(!b)for(const O of Lo(c).filter(N=>N.locale===m))T(O);for(const O of E){const N=w(),$=this.moddle.create(Cc,{locale:O,sourceLocale:m,previous:y});$.$parent=c.extensionElements,N.push($),u.push(()=>N.splice(N.indexOf($),1))}for(const O of Lo(c).filter(N=>N.sourceLocale===m&&(N.previous??"")===i))T(O);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):[]}}pi(Rp,"$inject",["moddle"]);const Cp="bwl.setTranslations",eS=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Mp{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:o=[],designLocale:r,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!xr(l))return[];const p=()=>{let _=l.extensionElements;return _||(_=this.moddle.create("bpmn:ExtensionElements",{values:[]}),_.$parent=l,l.extensionElements=_,u.push(()=>delete l.extensionElements)),_.get("values")},f=_=>{const v=p(),y=v.indexOf(_);y<0||(v.splice(y,1),u.push(()=>v.splice(y,0,_)))},d=_=>ia(l).find(v=>Nn(v)===_);if(i===null)for(const _ of a){const v=d(_);v&&f(v)}else if(i)for(const _ of a){const v=i[_];if(v===void 0)continue;const y=d(_);if(y){if(y.body===v)continue;const w=y.body;y.body=v,u.push(()=>y.body=w);continue}if(_===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(na,{body:v});E.set("xml:lang",_),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(_=>!o.includes(_.locale)&&!(i&&i[_.locale]!==void 0&&i[_.locale]!==c.texts[_.locale])&&!(i&&_.sourceLocale&&i[_.sourceLocale]===_.previous))];for(const _ of Lo(l)){const v=h.findIndex(y=>eS(_,y));v>=0?h.splice(v,1):f(_)}for(const _ of h){const v=p(),y=this.moddle.create(Cc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});y.$parent=l.extensionElements,v.push(y),u.push(()=>v.splice(v.indexOf(y),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}pi(Mp,"$inject",["moddle"]);function Ap(e){return Lo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Pp{constructor(t){t.registerHandler(Pc,Rp),t.registerHandler(Cp,Mp)}}pi(Pp,"$inject",["commandStack"]);const Tp={__init__:["translationCommands"],translationCommands:["type",Pp]},Bg=["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"],tS={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},nS={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Rc.map(e=>[e,{type:"string"}])),additionalProperties:!1},iS={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},oS={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},rS={type:"string",enum:[...Ec],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},aS={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},sS={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},cS={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},lS={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},uS={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},pS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},fS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},dS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},hS={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},gS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...vp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function An(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const mS={"participant.add":An("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":An("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":An("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":An("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lane:{type:"string"},type:{type:"string",enum:[...wc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":An("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":An("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":An("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":An("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":An("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":An("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":An("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":An("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":An("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":An("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":An("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":An("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":An("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Rc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":An("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Ng={anyOf:Bg.map(e=>mS[e])},yS={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:iS,irParticipant:oS,irNode:aS,irFlowCondition:sS,irSequenceFlow:cS,irMessageFlow:lS,irDataStore:uS,irDataAssociation:pS,irTextAnnotation:fS,irAssociation:dS,irGroup:hS,bwlPlacement:gS,eventDefinition:rS,localeTexts:nS,nullableString:tS,symbolicOp:Ng}};function kp(){}kp.prototype.get=function(e){return this.$model.properties.get(this,e)},kp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function $g(e,t){this.model=e,this.properties=t}$g.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(kp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),z(a,Kn(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var vS=U(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Fg=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 Op(e,t){var n=Fg[e];return n?n(t):t}function Dp(e){return!!vS[e]}function jg(e){return!!Fg[e]}function $n(e,t){var n=e.split(/:/),i,o;if(n.length===1)i=e,o=t;else if(n.length===2)i=n[1],o=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(o?o+":":"")+i,{name:e,prefix:o,localName:i}}function fi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}fi.prototype.build=function(){return Ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},fi.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)},fi.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=o.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");o.splice(s,1),this.addProperty(t,n?void 0:s,a),r[i.name]=r[i.localName]=t},fi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=$n(o[0],i),a=$n(o[1],r.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},fi.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},fi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},fi.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},fi.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},fi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},fi.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")},fi.prototype.hasProperty=function(e){return this.propertiesByName[e]},fi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(z(e.properties,Kn(function(r){r=U({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function Io(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Kn(this.registerPackage,this))}Io.prototype.getPackage=function(e){return this.packageMap[e]},Io.prototype.getPackages=function(){return this.packages},Io.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;Hg(t,e,"prefix"),Hg(t,e,"uri"),z(e.types,Kn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Io.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=$n(e.name,t.prefix),i=n.name,o=Object.create(null);z(e.properties,Kn(function(r){var a=$n(r.name,n.prefix),s=a.name;Dp(r.type)||(r.type=$n(r.type,a.prefix).name),U(r,{ns:a,name:s}),o[s]=r},this)),U(e,{ns:n,name:i,propertiesByName:o}),z(e.extends,Kn(function(r){var a=$n(r,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Io.prototype.mapTypes=function(e,t,n){var i=Dp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=$n(c,Dp(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},Io.prototype.getEffectiveDescriptor=function(e){var t=$n(e),n=new fi(t);this.mapTypes(t,function(o,r){n.addTrait(o,r)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Io.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Hg(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function _r(e){this.model=e}_r.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),o=i&&i.name;bS(n)?i?delete e[o]:delete e.$attrs[Lp(t)]:i?o in e?e[o]=n:zg(e,i,n):e.$attrs[Lp(t)]=n},_r.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Lp(t)];var i=n.name;return!e[i]&&n.isMany&&zg(e,n,[]),e[i]},_r.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)},_r.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},_r.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},_r.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(typeof o<"u"){const r=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw r;typeof console<"u"&&console.warn(r)}return null};function bS(e){return typeof e>"u"}function zg(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Lp(e){return e.replace(/^:/,"")}function vi(e,t={}){this.properties=new _r(this),this.factory=new $g(this,this.properties),this.registry=new Io(e,this.properties),this.typeCache=Object.create(null),this.config=t}vi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},vi.prototype.getType=function(e){var t=this.typeCache,n=Qn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},vi.prototype.createAny=function(e,t,n){var i=$n(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Q1(this,[a],s)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),z(n,function(a,s){hn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},vi.prototype.getPackage=function(e){return this.registry.getPackage(e)},vi.prototype.getPackages=function(){return this.registry.getPackages()},vi.prototype.getElementDescriptor=function(e){return e.$descriptor},vi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},vi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},vi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Gg=String.fromCharCode,xS=Object.prototype.hasOwnProperty,_S=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,is={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(is).forEach(function(e){is[e.toUpperCase()]=is[e]});function wS(e,t,n,i){return i?xS.call(is,i)?is[i]:"&"+i+";":Gg(t||parseInt(n,16))}function wr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(_S,wS):e}var Vg="non-whitespace outside of root node";function Bo(e){return new Error(e)}function ES(e){return"missing namespace for prefix <"+e+">"}function Tc(e){return{get:e,enumerable:!0}}function SS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Wg=Symbol("nameCache");function Ip(e){return e+"$uri"}function RS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Ip(i)]=n;return t}function kc(){return{line:0,column:0}}function CS(e){throw e}function Ug(e){if(!this)return new Ug(e);var t=e&&e.proxy,n,i,o,r,a=CS,s,c,l,u,p=kc,f=!1,d=!1,g="",h=!1,m=!1,_=null,v=!1,y,b,E,w;function P($){$ instanceof Error||($=Bo($)),_=$,a($,p)}function T($){s&&($ instanceof Error||($=Bo($)),s($,p))}this.on=function($,H){if(typeof H!="function")throw Bo("required args <name, cb>");switch($){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":o=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":r=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw Bo("unsupported event: "+$)}return this},this.ns=function($){if(typeof $>"u"&&($={}),typeof $!="object")throw Bo("required args <nsMap={}>");var H=Object.create(null),Q;for(Q in $)H[Q]=$[Q];return m=!0,w=H,this};function O(){y=m?[]:null,b=m?RS(w):null,E=[],p=kc,v=!1,_=null,d=!1,g=""}this.parse=function($){if(typeof $!="string")throw Bo("required args <xml=string>");if(f)throw Bo("parse during stream; call end() first");return O(),N($),p=kc,v=!1,_},this.write=function($){if(typeof $!="string")throw Bo("required args <xml=string>");return f||(O(),f=!0),_||(g=N(g+$,!0)||""),this},this.end=function(){return f||O(),f=!1,_||N(g),g="",p=kc,v=!1,_},this.stop=function(){v=!0};function N($,H=!1){var Q=null,J=null,V,we=0,Ce=!1,ke=!1,Ee=0,Y=0,ne,W,Z,oe,he,De,B,C,R,G="",K=0,ie;function Pe(Ct,vn){var Rn=Ct.indexOf(":");if(Rn===-1)return Ct;var Un=b[Ct.substring(0,Rn)];return Un?vn===Un?Ct.substr(Rn+1):Un+Ct.substr(Rn):(T(ES(Ct.substring(0,Rn))),null)}function et(){if(ie!==null)return ie;var Ct,vn,Rn=m&&b.xmlns,Un=m&&h?[]:null,At=K,Qt=G,_n=Qt.length,qa,qn,Hi,li,nn,Gr={},Ya=new Set,Cn,gt,St;e:for(;At<_n;At++)if(Cn=!1,gt=Qt.charCodeAt(At),!(gt===32||gt<14&>>8)){for((gt<65||gt>122||gt>90&><97)&>!==95&>!==58&&(T("illegal first char attribute name"),Cn=!0),St=At+1;St<_n;St++)if(gt=Qt.charCodeAt(St),!(gt>96&><123||gt>64&><91||gt>47&><59||gt===46||gt===45||gt===95)){if(gt===32||gt<14&>>8){T("missing attribute value"),At=St;continue e}if(gt===61)break;T("illegal attribute name char"),Cn=!0}if(nn=Qt.substring(At,St),nn==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Cn=!0),gt=Qt.charCodeAt(St+1),gt===34)St=Qt.indexOf('"',At=St+2),St===-1&&(St=Qt.indexOf("'",At),St!==-1&&(T("attribute value quote missmatch"),Cn=!0));else if(gt===39)St=Qt.indexOf("'",At=St+2),St===-1&&(St=Qt.indexOf('"',At),St!==-1&&(T("attribute value quote missmatch"),Cn=!0));else for(T("missing attribute value quotes"),Cn=!0,St=St+1;St<_n&&(gt=Qt.charCodeAt(St+1),!(gt===32||gt<14&>>8));St++);for(St===-1&&(T("missing closing quotes"),St=_n,Cn=!0),Cn||(Hi=Qt.substring(At,St)),At=St;St+1<_n&&(gt=Qt.charCodeAt(St+1),!(gt===32||gt<14&>>8));St++)At===St&&(T("illegal character after attribute end"),Cn=!0);if(At=St+1,Cn)continue e;if(Ya.has(nn)){T("attribute <"+nn+"> already defined");continue}if(Ya.add(nn),!m){Gr[nn]=Hi;continue}if(h){if(qn=nn==="xmlns"?"xmlns":nn.charCodeAt(0)===120&&nn.substr(0,6)==="xmlns:"?nn.substr(6):null,qn!==null){if(Ct=wr(Hi),vn=Ip(qn),li=w[Ct],!li){if(qn==="xmlns"||vn in b&&b[vn]!==Ct)do li="ns"+we++;while(typeof b[li]<"u");else li=qn;w[Ct]=li}b[qn]!==li&&(qa||(b=SS(b),qa=!0),b[qn]=li,qn==="xmlns"&&(b[Ip(li)]=Ct,Rn=li),b[vn]=Ct),Gr[nn]=Hi;continue}Un.push(nn,Hi);continue}nn=Pe(nn,Rn),nn!==null&&(Gr[nn]=Hi)}if(h)for(At=0,_n=Un.length;At<_n;At++)nn=Pe(Un[At++],Rn),Hi=Un[At],nn!==null&&(Gr[nn]=Hi);return ie=Gr}function mt(){for(var Ct=/(\r\n|\r|\n)/g,vn=0,Rn=0,Un=0,At=Y,Qt,_n;Ee>=Un&&(Qt=Ct.exec($),!(!Qt||(At=Qt[0].length+Qt.index,At>Ee)));)vn+=1,Un=At;return Ee==-1?(Rn=At,_n=$.substring(Y)):Y===0?_n=$.substring(Y,Ee):(Rn=Ee-Un,_n=Y==-1?$.substring(Ee):$.substring(Ee,Y+1)),{data:_n,line:vn,column:Rn}}for(p=mt,t&&(R=Object.create({},{name:Tc(function(){return B}),originalName:Tc(function(){return C}),attrs:Tc(et),ns:Tc(function(){return b})}));Y!==-1;){if($.charCodeAt(Y)===60?Ee=Y:Ee=$.indexOf("<",Y),Ee===-1){if(H)return $.substring(Y);if(E.length)return P("unexpected end of file");if(!d)return P("missing start tag");Y<$.length&&$.substring(Y).trim()&&T(Vg);return}if(d||(d=!0),Y!==Ee){if(E.length){if(n&&(n($.substring(Y,Ee),wr,p),v))return}else if($.substring(Y,Ee).trim()&&(T(Vg),v))return}if(oe=$.charCodeAt(Ee+1),oe===33){if(Z=$.charCodeAt(Ee+2),Z===91&&$.substr(Ee+3,6)==="CDATA["){if(Y=$.indexOf("]]>",Ee),Y===-1)return H?$.substring(Ee):P("unclosed cdata");if(r&&(r($.substring(Ee+9,Y),p),v))return;Y+=3;continue}if(Z===45&&$.charCodeAt(Ee+3)===45){if(Y=$.indexOf("-->",Ee),Y===-1)return H?$.substring(Ee):P("unclosed comment");if(c&&(c($.substring(Ee+4,Y),wr,p),v))return;Y+=3;continue}}if(oe===63){if(Y=$.indexOf("?>",Ee),Y===-1)return H?$.substring(Ee):P("unclosed question");if(l&&(l($.substring(Ee,Y+2),p),v))return;Y+=2;continue}for(ne=Ee+1;;ne++){if(he=$.charCodeAt(ne),isNaN(he))return H?$.substring(Ee):(Y=-1,P("unclosed tag"));if(he===34)Z=$.indexOf('"',ne+1),ne=Z!==-1?Z:ne;else if(he===39)Z=$.indexOf("'",ne+1),ne=Z!==-1?Z:ne;else if(he===62){Y=ne;break}}if(oe===33){if(u&&(u($.substring(Ee,Y+1),wr,p),v))return;Y+=1;continue}if(ie={},oe===47){if(Ce=!1,ke=!0,!E.length)return P("missing open tag");if(ne=B=E.pop(),Z=Ee+2+ne.length,$.substring(Ee+2,Z)!==ne)return P("closing tag mismatch");for(;Z<Y;Z++)if(oe=$.charCodeAt(Z),!(oe===32||oe>8&&oe<14))return P("close tag")}else{if($.charCodeAt(Y-1)===47?(ne=B=$.substring(Ee+1,Y-1),Ce=!0,ke=!0):(ne=B=$.substring(Ee+1,Y),Ce=!0,ke=!1),!(oe>96&&oe<123||oe>64&&oe<91||oe===95||oe===58))return P("illegal first char nodeName");for(Z=1,W=ne.length;Z<W;Z++)if(oe=ne.charCodeAt(Z),!(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){B=ne.substring(0,Z),ie=null;break}return P("invalid nodeName")}ke||E.push(B)}if(m){V=b,Ce&&(ke||y.push(V),ie===null&&(h=ne.indexOf("xmlns",Z)!==-1)&&(K=Z,G=ne,et(),h=!1)),C=B,J!==b&&(Q=b[Wg],Q===void 0&&(Q=b[Wg]=Object.create(null)),J=b);var qt=Q[B];if(qt!==void 0)B=qt;else{if(oe=B.indexOf(":"),oe!==-1){if(De=b[B.substring(0,oe)],!De)return P("missing namespace on <"+C+">");B=B.substr(oe+1)}else De=b.xmlns;De&&(B=De+":"+B),Q[C]=B}}if(Ce&&(K=Z,G=ne,i&&(t?i(R,wr,ke,p):i(B,et,wr,ke,p),v)))return;if(ke){if(o&&(o(t?R:B,wr,Ce,p),v))return;m&&(Ce?b=V:b=y.pop())}Y+=1}}}function qg(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Bp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Yg="property";function Kg(e){return e.xml&&e.xml.serialize}function MS(e){const t=Kg(e);return t!==Yg&&(t||null)}function AS(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xg(e,t){return qg(t)?e.prefix+":"+AS(e.localName):e.name}function PS(e,t){var n=e.name,i=e.localName,o=t&&t.xml&&t.xml.typePrefix;return o&&i.indexOf(o)===0?e.prefix+":"+i.slice(o.length):n}function TS(e,t,n){const i=$n(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=$n(o);var a=n.getPackage(r.prefix);return PS(r,a)}function No(e){return new Error(e)}function fo(e){return e.$descriptor}function kS(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 No("expected element");var n=this.elementsById,i=fo(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw No("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function os(){}os.prototype.handleEnd=function(){},os.prototype.handleText=function(){},os.prototype.handleNode=function(){};function Np(){}Np.prototype=Object.create(os.prototype),Np.prototype.handleNode=function(){return this};function oa(){}oa.prototype=Object.create(os.prototype),oa.prototype.handleText=function(e){this.body=(this.body||"")+e};function rs(e,t){this.property=e,this.context=t}rs.prototype=Object.create(oa.prototype),rs.prototype.handleNode=function(e){if(this.element)throw No("expected no sub nodes");return this.element=this.createReference(e),this},rs.prototype.handleEnd=function(){this.element.id=this.body},rs.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function $p(e,t){this.element=t,this.propertyDesc=e}$p.prototype=Object.create(oa.prototype),$p.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Op(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Oc(){}Oc.prototype=Object.create(oa.prototype),Oc.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 zn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}zn.prototype=Object.create(Oc.prototype),zn.prototype.addReference=function(e){this.context.addReference(e)},zn.prototype.handleText=function(e){var t=this.element,n=fo(t),i=n.bodyProperty;if(!i)throw No("unexpected body text <"+e+">");oa.prototype.handleText.call(this,e)},zn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=fo(t),i=n.bodyProperty;i&&e!==void 0&&(e=Op(i.type,e),t.set(i.name,e))},zn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=fo(n),o=this.context,r=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){o.addReference({element:r,property:u.ns.name,id:f})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Op(u.type,c):l==="xmlns"?l=":"+l:(s=$n(l,i.ns.prefix),a.getPackage(s.prefix)&&o.addWarning({message:"unknown attribute <"+l+">",element:r,property:l,value:c})),r.set(l,c))}),r},zn.prototype.getPropertyForNode=function(e){var t=e.name,n=$n(t),i=this.type,o=this.model,r=fo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=MS(s);if(l){const u=e.attributes[l];if(u){const p=TS(u,e.ns,o),f=o.getType(p);return U({},s,{effectiveType:fo(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Xg(n,c),u=o.getType(l);if(s=Lt(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return U({},s,{effectiveType:fo(u).name})}else if(s=Lt(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw No("unrecognized element <"+n.name+">")},zn.prototype.toString=function(){return"ElementDescriptor["+fo(this.type).name+"]"},zn.prototype.valueHandler=function(e,t){return new $p(e,t)},zn.prototype.referenceHandler=function(e){return new rs(e,this.context)},zn.prototype.handler=function(e){return e==="Element"?new ra(this.model,e,this.context):new zn(this.model,e,this.context)},zn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,jg(n))return this.valueHandler(t,i);t.isReference?o=this.referenceHandler(t).handleNode(e):o=this.handler(n).handleNode(e);var r=o.element;return r!==void 0&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(U(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Fp(e,t,n){zn.call(this,e,t,n)}Fp.prototype=Object.create(zn.prototype),Fp.prototype.createElement=function(e){var t=e.name,n=$n(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Xg(n,r)||t;if(!o.hasType(a))throw No("unexpected element <"+e.originalName+">");return zn.prototype.createElement.call(this,e)};function ra(e,t,n){this.model=e,this.context=n}ra.prototype=Object.create(Oc.prototype),ra.prototype.createElement=function(e){var t=e.name,n=$n(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ra.prototype.handleChild=function(e){var t=new ra(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,o;return i!==void 0&&(o=n.$children=n.$children||[],o.push(i),i.$parent=n),t},ra.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function jp(e){e instanceof vi&&(e={model:e}),U(this,{lax:!1},e)}jp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof zn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var o=this.model,r=this.lax,a=new kS(U({},t,{rootHandler:i})),s=new Ug({proxy:!0}),c=OS();i.context=a,c.push(i);function l(E,w,P){var T=w(),O=T.line,N=T.column,$=T.data;$.charAt(0)==="<"&&$.indexOf(" ")!==-1&&($=$.slice(0,$.indexOf(" "))+">");var H="unparsable content "+($?$+" ":"")+`detected
|
|
2
|
+
line: `+O+`
|
|
3
3
|
column: `+N+`
|
|
4
|
-
nested error: `+E.message;if(P)return a.addWarning({message:H,error:E}),!0;throw No(H)}function u(E,w){return l(E,w,!0)}function p(){var E=a.elementsById,w=a.references,P,T;for(P=0;T=w[P];P++){var
|
|
5
|
-
`,LS=/<|>|'|"|&|\n\r|\n/g,Zg=/<|>|&/g;function Ui(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Ui.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Ui.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Ui.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Ui.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)},Ui.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Ui.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Ui.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Ui.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Ui.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 IS(e){return e.charAt(0).toLowerCase()+e.slice(1)}function BS(e,t){return qg(t)?IS(e):e}function Qg(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Jg(e){return Qn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function NS(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 $S(e,t){return t.isGeneric?U({localName:t.ns.localName},e):U({localName:BS(t.ns.localName,t.$pkg)},e)}function FS(e,t){return U({localName:t.ns.localName},e)}function jS(e){var t=e.$descriptor;return rt(t.properties,function(n){var i=n.name;if(n.isVirtual||!Jn(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var HS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},zS={"<":"lt",">":"gt","&":"amp"};function em(e,t,n){return e=Qn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function GS(e){return em(e,LS,HS)}function VS(e){return em(e,Zg,zS)}function WS(e){return rt(e,function(t){return t.isAttr})}function US(e){return rt(e,function(t){return!t.isAttr})}function Hp(e){this.tagName=e}Hp.prototype.build=function(e){return this.element=e,this},Hp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Er(){}Er.prototype.serializeValue=Er.prototype.serializeTo=function(e){e.append(this.escape?VS(this.value):this.value)},Er.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Zg)!==-1&&(this.escape=!0),this};function zp(e){this.tagName=e}Qg(zp,Er),zp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ht.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,o,r=t.isGeneric;return r?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),r?this.parseGenericContainments(e):(o=jS(e),this.parseAttributes(WS(o)),this.parseContainments(US(o))),this.parseGenericAttributes(e,i),this},Ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return $S(t,e)},Ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return FS(t,e)},Ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ht.prototype.nsAttributeName=function(e){var t;if(Qn(e)?t=$n(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:U({localName:t.localName},n)},Ht.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},Ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Er().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Ht(this).build(i))})},Ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=$n(t),r;if(o.prefix==="xmlns"&&(r={prefix:o.localName,uri:n}),!o.prefix&&o.localName==="xmlns"&&(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},Ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ht.prototype.parseGenericAttributes=function(e,t){var n=this;z(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(o){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,o)}})},Ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new Er().build(o,r[0]));else if(jg(o.type))z(r,function(l){n.push(new zp(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)z(r,function(l){n.push(new Hp(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Kg(o);z(r,function(l){var u;c?c===Yg?u=new Ht(t,o):u=new
|
|
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 KS(e){e=U({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new qS,r=new YS(o,e.format);e.preamble&&r.append(DS);var a=new Ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(XS(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function XS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Bp)n[i]=Bp[i];for(const i in t){const o=t[i];n[o]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Dc(e,t){vi.call(this,e,t)}Dc.prototype=Object.create(vi.prototype),Dc.prototype.fromXML=function(e,t,n){Qn(t)||(n=t,t="bpmn:Definitions");var i=new jp(U({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Dc.prototype.toXML=function(e,t){var n=new KS(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var ZS="BPMN20",QS="http://www.omg.org/spec/BPMN/20100524/MODEL",JS="bpmn",eR=[],tR=[{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"}]}],nR=[{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"}]}],iR={tagAlias:"lowerCase",typePrefix:"t"},oR={name:ZS,uri:QS,prefix:JS,associations:eR,types:tR,enumerations:nR,xml:iR},rR="BPMNDI",aR="http://www.omg.org/spec/BPMN/20100524/DI",sR="bpmndi",cR=[{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"]}],lR=[{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"}]}],uR=[],pR={name:rR,uri:aR,prefix:sR,types:cR,enumerations:lR,associations:uR},fR="DC",dR="http://www.omg.org/spec/DD/20100524/DC",hR="dc",gR=[{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}]}],mR=[],yR={name:fR,uri:dR,prefix:hR,types:gR,associations:mR},vR="DI",bR="http://www.omg.org/spec/DD/20100524/DI",xR="di",_R=[{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"}]}],wR=[],ER={tagAlias:"lowerCase"},SR={name:vR,uri:bR,prefix:xR,types:_R,associations:wR,xml:ER},RR="bpmn.io colors for BPMN",CR="http://bpmn.io/schema/bpmn/biocolor/1.0",MR="bioc",AR=[{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"}]}],PR=[],TR=[],kR={name:RR,uri:CR,prefix:MR,types:AR,enumerations:PR,associations:TR},OR="BPMN in Color",DR="http://www.omg.org/spec/BPMN/non-normative/color/1.0",LR="color",IR=[{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"}]}],BR=[],NR=[],$R={name:OR,uri:DR,prefix:LR,types:IR,enumerations:BR,associations:NR};const FR={bpmn:oR,bpmndi:pR,dc:yR,di:SR,bioc:kR,color:$R};function tm(e,t){const n=U({},FR,e);return new Dc(n,t)}const jR={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"}},Lc={[Ig]:jR,[yp]:Tg};function nm(){return tm(Lc)}const im=nm();async function aa(e){const{rootElement:t,warnings:n}=await im.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function HR(e){const{xml:t}=await im.toXML(e,{format:!0});return t}function Gp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const sa={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},zR=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function GR(e){const t=sa;return zR.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 ca(e,t){let n=0;for(const i of e)n+=t*GR(i);return n}function om(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&VR(e),WR(e),UR(e),qR(e)}function VR(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:ca(o,r),fontBoundingBoxAscent:r*sa.ascentEm,fontBoundingBoxDescent:r*sa.descentEm,actualBoundingBoxAscent:r*sa.ascentEm,actualBoundingBoxDescent:r*sa.descentEm}}};t.getContext=()=>n}function WR(e){if(e.SVGMatrix)return;class t{constructor(){pi(this,"a",1);pi(this,"b",0);pi(this,"c",0);pi(this,"d",1);pi(this,"e",0);pi(this,"f",0)}static of(i,o,r,a,s,c){return Object.assign(new t,{a:i,b:o,c:r,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,o){return this.multiply(t.of(1,0,0,1,i,o))}scale(i,o=i){return this.multiply(t.of(i,0,0,o,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function UR(e){var r;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(r=e.SVGSVGElement)==null?void 0:r.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const o=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(o,"transform")||Object.defineProperty(o,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function qR(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:ca(n,12),height:14}})}const Ic=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),YR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),KR=1,Bc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),XR=2;function ct(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const rm=20,Nc=5,am=3,ZR=8,la=15,Vp=50,sm=12,QR=sm*1.2;function Wp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>ca(r,sm))),o=n.length*QR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const cm=1;function on(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Sr(e,t){let n=null;const i=e.type!==t.type,r=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of on(e))for(const s of on(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>cm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":r?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=rm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Up(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function lm(e,t){const n=Sr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function JR(e,t){let n=0;for(const i of t)i.id!==e.id&&lm(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id!==e.id&&Sr(e,i)&&n++;return n}const um=15,pm=20;function eC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-pm||t.at>n[1]+pm)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],o=Math.max(i[0],t.lo),r=Math.min(i[1],t.hi);return r>o?[o,r]:null}const qp=20;function $c(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>cm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<rm||n.push([o-qp,r+qp])}return n}function Fc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of on(e)){const r=eC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of $c(o,on(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const tC=10,nC=1,iC=(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 oC(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(o-e.x,c)&&f(e.x-a,-c)&&f(r-e.y,l)&&f(e.y-s,-l)&&p>u}function Yp(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 rC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ua=1;function Bi(e,t){const n=e.x+ua,i=e.x+e.width-ua,o=e.y+ua,r=e.y+e.height-ua;return t.axis==="h"?t.at>o&&t.at<r&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<r&&t.hi>o}function pa(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 fm(e,t){const n=e.label;if(!n)return null;if(on(e).some(i=>Bi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(on(i).some(o=>Bi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(pa(i).some(o=>Bi(n,o)))return i.id;return null}function zt(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(oC(e.waypoints[r],e.waypoints[r+1],o,XR)){i.push(o);break}}return i}const rs=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},aC=(e,t,n,i)=>hm(e,t,n,i)?0:Math.min(rs(e,n,i),rs(t,n,i),rs(n,e,t),rs(i,e,t)),dm=(e,t)=>{let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const r=t[i],a=t[o];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n};function as(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,rs({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+a}];if(dm(e,s)||dm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,aC(e,t,s[l],s[(l+1)%s.length]));return c}function hm(e,t,n,i){const o=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.x),r=o(n,i,e),a=o(n,i,t),s=o(e,t,n),c=o(e,t,i);return r*a<0&&s*c<0}const Kp=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function gm(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(hm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ss(e,t){let n=0;for(const i of t)i.id===e.id||Kp(e,i)||gm(e,i)&&n++;return n}function hi(e,t){let n=0;for(const i of t)i.id===e.id||Kp(e,i)||ss(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function mm(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)ss(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function $o(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ss(n[i],[n[o]])>0){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function qi(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Kp(n[i],n[o])&&gm(n[i],n[o])){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function ym(e){const t=$o(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:sC(e)}}function sC(e){const t=e.shapes.filter(o=>o.type==="bpmn:Participant");if(t.length<3)return 0;const n=o=>{const r=e.shapes.find(a=>a.id===o);if(r)return t.find(a=>r.x>=a.x&&r.y>=a.y&&r.x+r.width<=a.x+a.width&&r.y+r.height<=a.y+a.height)};let i=0;for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.endpoints.length<2)continue;const r=n(o.endpoints[0]),a=n(o.endpoints[1]);if(!r||!a||r.id===a.id)continue;const s=Math.min(r.y,a.y),c=Math.max(r.y+r.height,a.y+a.height);t.some(l=>l.id!==r.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function vm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Bc.has(o.type)&&!i.has(o.id)&&o.x>=n.x&&o.y>=n.y&&o.x+o.width<=n.right&&o.y+o.height<=n.bottom).map(o=>o.id).sort()}function bm(e){var n;const t=(n=Ft(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ft(i);if((o==null?void 0:o.$type)!=="bwl:Members"||typeof o.refs!="string")continue;const r=o.refs.split(/\s+/).filter(Boolean);return r.length?r:void 0}}const xm=e=>e?{members:e}:{},Gn=e=>e.shapes.filter(t=>!t.container);function cC(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const o=i.endpoints.find(a=>a!==e.id),r=o?n.get(o):void 0;if(r&&r.type!=="bpmn:Group"){if(r.container)return r.id;if(r.parent)return r.parent}}}function lC(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const o=e.x+e.width/2,r=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&o>=a.x&&o<=a.x+a.width&&r>=a.y&&r<=a.y+a.height)}function _m(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((o,r)=>o.id.localeCompare(r.id)))if(on(i).some(o=>Bi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(pa(i).some(o=>Bi(n,o)))return i.id;return null}function Fo(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 wm=3;function Em(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const o=/Event$/.test(t.type);if(!o&&!/Gateway$/.test(t.type))return Math.min(n,i);const r=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(r,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(o)return Math.max(0,t.width/2-Math.hypot(s-r,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-r)/l+Math.abs(c-a)/u))*Math.min(l,u))}function cs(e,t){const n=[];for(const i of t.shapes){if(i.container||Bc.has(i.type))continue;const o=Em(e,i);o>=wm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function pt(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const b of zt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:b.id});const o=e.shapes.filter(y=>y.container&&YR.has(y.type));if(o.length){const y=(b,E)=>{const w=e.shapes.find(P=>P.id===E);return!!w&&w.x>=b.x&&w.y>=b.y&&w.x+w.width<=b.x+b.width&&w.y+w.height<=b.y+b.height};for(const b of e.edges)for(const E of zt(b,o))b.endpoints.includes(E.id)||b.endpoints.some(w=>y(E,w))||n.push({kind:"edge-crosses-subprocess",edge:b.id,subProcess:E.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const b=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[E,w]of b){if(!E)continue;const P=e.shapes.find($=>$.id===E);if(!P||P.container)continue;const T=Math.max(P.x-w.x,w.x-(P.x+P.width),0),D=Math.max(P.y-w.y,w.y-(P.y+P.height),0),N=Math.hypot(T,D);N>tC&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:E,distance:Math.round(N)})}}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let b=y+1;b<r.length;b++){const E=r[y],w=r[b];if(E.x+E.width<=w.x||w.x+w.width<=E.x||E.y+E.height<=w.y||w.y+w.height<=E.y)continue;const P=(T,D)=>T.x<=D.x&&T.y<=D.y&&T.x+T.width>=D.x+D.width&&T.y+T.height>=D.y+D.height;n.push({kind:"pool-overlap",pools:[E.id,w.id],contained:P(E,w)||P(w,E)})}const a=i.filter(y=>!y.attached);for(let y=0;y<a.length;y++)for(let b=y+1;b<a.length;b++){const E=a[y],w=a[b];if(!Yp(E,w,KR))continue;const P=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:"shape-overlap",shapes:P,identical:rC(E,w)})}const s=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<s.length;y++)for(let b=y+1;b<s.length;b++){const E=s[y],w=s[b],P=Math.min(E.x+E.width,w.x+w.width)-Math.max(E.x,w.x),T=Math.min(E.y+E.height,w.y+w.height)-Math.max(E.y,w.y);if(P<=Nc||T<=Nc)continue;const D=E.id<w.id?[E.id,w.id]:[w.id,E.id],N=new Set(w.members);if(E.members.some(H=>N.has(H))){const H=vm(e,s,{x:Math.max(E.x,w.x),y:Math.max(E.y,w.y),right:Math.min(E.x+E.width,w.x+w.width),bottom:Math.min(E.y+E.height,w.y+w.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:D,shapes:H});continue}const $=E.x<=w.x&&E.y<=w.y&&E.x+E.width>=w.x+w.width&&E.y+E.height>=w.y+w.height?E.id:w.x<=E.x&&w.y<=E.y&&w.x+w.width>=E.x+E.width&&w.y+w.height>=E.y+E.height?w.id:void 0;n.push({kind:"group-overlap-unintended",groups:D,...$?{container:$}:{}})}const c=new Set(s.flatMap(y=>[...y.members])),l=y=>e.shapes.filter(b=>!b.container&&!Bc.has(b.type)&&b.x>=y.x&&b.y>=y.y&&b.x+b.width<=y.x+y.width&&b.y+b.height<=y.y+y.height);for(const y of s){const b=l(y);if(!b.length)continue;const E=new Set(y.members),w=b.filter(P=>!E.has(P.id));w.some(P=>c.has(P.id))&&(w.length*2<b.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:w.map(P=>P.id).sort()}))}for(const y of s){const b=new Set(l(y).map(N=>N.id)),E=new Set(y.members),w=new Set([...b].filter(N=>!E.has(N)&&c.has(N)));if(!w.size)continue;let P=!1,T=!1,D=!1;for(const N of e.edges){if(N.type!=="bpmn:SequenceFlow"||!N.source||!N.target)continue;const $=w.has(N.source),H=w.has(N.target);!$&&H&&!b.has(N.source)?P=!0:$&&!H&&!b.has(N.target)?T=!0:$&&H&&(D=!0)}P&&T&&D&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...w].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let b=y+1;b<u.length;b++)for(let E=b+1;E<u.length;E++){const w=[u[y],u[b],u[E]],P={x:Math.max(...w.map(N=>N.x)),y:Math.max(...w.map(N=>N.y)),right:Math.min(...w.map(N=>N.x+N.width)),bottom:Math.min(...w.map(N=>N.y+N.height))};if(P.right-P.x<=Nc||P.bottom-P.y<=Nc)continue;const T=vm(e,[],P);if(!T.length)continue;const D=w.map(N=>N.id).sort();n.push({kind:"group-stack-unreadable",groups:D,shapes:T})}for(const y of e.shapes.filter(b=>b.type==="bpmn:Group"))for(const b of e.shapes){if(b.container||b.attached||Bc.has(b.type)||b.width<=0||b.height<=0)continue;const E=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[w,P,T,D,N]of E){const $=T==="h"?b.x:b.y,H=T==="h"?b.x+b.width:b.y+b.height;if(!($<N&&D<H))continue;const Z=T==="h"?b.y:b.x,J=T==="h"?b.y+b.height:b.x+b.width;if(!(Z<P&&P<J))continue;const V=Math.min(P-Z,J-P);V<ZR||n.push({kind:"group-cuts-shape",group:y.id,shape:b.id,side:w,depth:V})}}const p=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(p.length){const y=new Map(e.shapes.filter(b=>!b.container).map(b=>[b.id,{x:b.x+b.width/2,y:b.y+b.height/2}]));for(const b of e.edges){if(b.type!=="bpmn:SequenceFlow"&&b.type!=="bpmn:MessageFlow")continue;const E=on(b);if(E.length)for(const w of p){const P=w.x+w.width,T=w.y+w.height,D=b.endpoints.some($=>{const H=y.get($);return!!H&&w.x<H.x&&H.x<P&&w.y<H.y&&H.y<T});let N=null;for(const $ of E){const[H,Z,J]=$.axis==="v"?[w.y,T,[["left",w.x],["right",P]]]:[w.x,P,[["top",w.y],["bottom",T]]],V=Math.min($.hi,Z)-Math.max($.lo,H);if(V<Vp)continue;const we=$.axis==="v"?w.x<$.at&&$.at<P:w.y<$.at&&$.at<T;if(!(we&&D))for(const[Ce,ke]of J){const Ee=Math.abs($.at-ke);Ee<=la&&(!N||Ee<N.distance)&&(N={side:Ce,inside:we,distance:Ee,length:V})}}N&&n.push({kind:"edge-along-group-boundary",edge:b.id,group:w.id,side:N.side,inside:N.inside,distance:Math.round(N.distance),length:Math.round(N.length)})}}}const f=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(b=>b.type==="bpmn:Group"))for(const b of f){const E=y.x<b.x+b.width&&b.x<y.x+y.width,w=y.y<b.y+b.height&&b.y<y.y+y.height,P=[["top",y.y,b.y,E],["bottom",y.y+y.height,b.y+b.height,E],["left",y.x,b.x,w],["right",y.x+y.width,b.x+b.width,w]];for(const[T,D,N,$]of P)$&&Math.abs(D-N)<=am&&n.push({kind:"group-on-container-boundary",group:y.id,container:b.id,side:T})}const d=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<d.length;y++)for(let b=y+1;b<d.length;b++){const E=d[y],w=d[b],P=E.x<w.x+w.width&&w.x<E.x+E.width,T=E.y<w.y+w.height&&w.y<E.y+E.height,D=[["x",E.x+E.width,w.x,T],["x",w.x+w.width,E.x,T],["y",E.y+E.height,w.y,P],["y",w.y+w.height,E.y,P]];for(const[N,$,H,Z]of D)if(Z&&Math.abs($-H)<=am){n.push({kind:"group-on-group-boundary",groups:E.id<w.id?[E.id,w.id]:[w.id,E.id],axis:N});break}}for(let y=0;y<e.edges.length;y++)for(let b=y+1;b<e.edges.length;b++){const E=e.edges[y],w=e.edges[b],P=Sr(E,w);if(!P)continue;const T=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:P.axis,length:Math.round(P.length)})}for(const y of e.edges){if(!y.label)continue;const b=Fc(y,e.edges);b&&n.push({kind:"label-on-shared-segment",edge:y.id,other:b.other,axis:b.axis})}for(const y of e.edges){if(!y.label)continue;const b=fm(y,e);b&&n.push({kind:"label-over-line",edge:y.id,line:b})}if(t.includeObservationOnly){for(const y of e.edges)if(!(!y.label||y.type!=="bpmn:SequenceFlow"))for(const{shape:b,depth:E}of cs(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:b,depth:Math.round(E)})}const g=new Set(i.map(y=>y.id)),h=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...h.filter(b=>!g.has(b.id))]){if(!y.label)continue;const b=_m(y,e);b&&n.push({kind:"label-over-line",edge:y.id,line:b})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of h)for(const{owner:b,rect:E}of Fo(e))b===y.id||m.has(b)||Yp(y.label,E,ua)&&n.push({kind:"pool-name-over-label",pool:y.id,label:b});const _=Fo(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:b,rect:E}of _)b!==y.id&&Yp(y,E,ua)&&n.push({kind:"annotation-over-label",annotation:y.id,label:b});const v=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const b=y.parent??cC(y,e,v);if(!b)continue;const E=v.get(b);!E||!E.container||iC(E,y,nC)||y.type==="bpmn:TextAnnotation"&&!lC(y,E,e)||n.push({kind:"shape-outside-container",shape:y.id,container:E.id})}return n.sort((y,b)=>ct(y).localeCompare(ct(b)))}const Ft=e=>typeof e=="object"&&e!==null?e:void 0,Xt=e=>typeof e=="number"?e:0,ho=e=>{const t=Ft(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function uC(e){const t=Ft(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const o=t[i];for(const r of Array.isArray(o)?o:[o]){const a=ho(r);a&&n.push(a)}}return n}function pC(e){const t=Ft(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:ho(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:ho(t.targetRef);return n&&i?{source:n,target:i}:{}}function fC(e,t){const n=Ft(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=ho(n);return o?t.get(o):void 0}if(Ic.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return ho(n)}function Sm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ft(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ft(e))==null?void 0:s.rootElements)??[]){const f=Ft(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Ft(d),h=ho(g),m=ho(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=Ft((c=Ft(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Ft(g);if(!h)continue;const m=Ft(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const v=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",y=Ft(h.bounds);if(y){const E=h.isExpanded===!1&&v!=="bpmn:Participant",w=Ft((l=Ft(h.label))==null?void 0:l.bounds),P={id:_,type:v,x:Xt(y.x),y:Xt(y.y),width:Xt(y.width),height:Xt(y.height),container:Ic.has(v)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:fC(m,o)}:{},...w?{label:{x:Xt(w.x),y:Xt(w.y),width:Xt(w.width),height:Xt(w.height)}}:{},...v==="bpmn:Group"?xm(bm(m)):{}},T=h.isHorizontal!==!1,D=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(_)&&T&&D&&(P.label=Wp(P,D)),t.push(P);continue}const b=h.waypoint;if(Array.isArray(b)){const E=Ft((u=Ft(h.label))==null?void 0:u.bounds);n.push({id:_,type:v,waypoints:b.map(w=>{var P,T;return{x:Xt((P=Ft(w))==null?void 0:P.x),y:Xt((T=Ft(w))==null?void 0:T.y)}}),endpoints:uC(m),...pC(m),...E?{label:{x:Xt(E.x),y:Xt(E.y),width:Xt(E.width),height:Xt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Rm(e){return pt(Sm(e),{includeObservationOnly:!0})}async function dC(e){const{definitions:t,warnings:n}=await aa(e);return{findings:Rm(t),warnings:n}}function Ve(e){var i;const t=[],n=[];for(const o of e.getAll()){const r=o;if(r.type==="label"||r.labelTarget)continue;const a=typeof r.type=="string"?r.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=r.waypoints;if(s){const h=Ft(r.label),m=ho(r.source),_=ho(r.target);n.push({id:r.id,type:a,waypoints:s.map(v=>({x:Xt(v.x),y:Xt(v.y)})),endpoints:[m,_].filter(v=>!!v),...m&&_?{source:m,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Xt(h.y),width:Xt(h.width),height:Xt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ft(r.businessObject),l=Ft(r.label);let u=Ft(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Ft(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Ic.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:r.id,type:a,x:r.x,y:r.y,width:Xt(r.width),height:Xt(r.height),container:Ic.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Xt(l.y),width:Xt(l.width),height:Xt(l.height)}}:{},...a==="bpmn:Group"?xm(bm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Ft(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Wp(d,g)),t.push(d)}return{shapes:t,edges:n}}const hC={"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 gC(e,t){const n=hC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Cm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Mm(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 gC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Cm(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Cm(i):void 0},endpointsOf:n=>{var o,r;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(o=i.source)==null?void 0:o.id,target:(r=i.target)==null?void 0:r.id}},eventDefinitionOf:n=>{var r;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const o=(((r=i.businessObject)==null?void 0:r.eventDefinitions)??[]).map(a=>a.$type);return mp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Lo(i.businessObject).map(o=>o.locale)}}}const Xp=20,mC=4,Je=(e,t)=>Math.abs(e-t)<.5;function jc(e,t,n,i=Xp){if(Je(e.y,t.y)&&!Je(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x);if(!(o<n.x-i&&n.x+n.width+i<r))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Je(e.x,t.x)&&!Je(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y);if(!(o<n.y-i&&n.y+n.height+i<r))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Am(e,t,n,i=Xp){if(n.length<2)return null;if(Je(e.y,t.y)&&!Je(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(o<a&&s<r))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(Je(e.x,t.x)&&!Je(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(o<a&&s<r))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function Pm(e,t,n=Xp){if(e.length!==4)return null;const[i,o,r,a]=e;if(Je(i.y,o.y)&&Je(o.x,r.x)&&Je(r.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Je(i.x,o.x)&&Je(o.y,r.y)&&Je(r.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Hc(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(o>=i.y&&o<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=o>r,l=[{x:n.x+n.width,y:o},{x:a,y:o},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:r},{x:i.x,y:r}];return[l,u]}const zc=30,yC=[0,-25,25,-40,40];function vC(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+zc:s-zc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return yC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>zt({...e,endpoints:[],waypoints:f},[n]).length===0)}const Zp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],fa=(e,t,n)=>zt({...e,waypoints:t},n).length;function Qp(e,t,n,i){let o=[...e.waypoints],r=fa(e,o,t);if(r===0)return null;let a=!1;for(const p of Hc(e,t))if(fa(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(on),c=p=>on({...e,waypoints:p}).some(f=>$c(f,s).length>0),l=vC(e,t).filter(p=>fa(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&Je(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(Je(d[0].y,d[1].y)&&!Je(d[0].x,d[1].x)){const g=t.filter(v=>!e.endpoints.includes(v.id)&&zt({...e,waypoints:d},[v]).length>0),h=g.length>=2?Am(d[0],d[1],g):null,_=(h?h.map(v=>[d[0],...v,d[1]]):g.length===1?(jc(d[0],d[1],g[0])??[]).map(v=>[d[0],...v,d[1]]):g.length===0?[d]:[]).filter(v=>fa(e,v,t)===0&&v.length<=o.length).sort((v,y)=>Number(u(y))-Number(u(v)));if(_.length)return _.find(v=>!c(v))??_[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&zt({...e,waypoints:[f,d]},[_]).length>0);if(g.length<2)continue;const h=Am(f,d,g);if(!h)continue;const m=h.map(_=>Zp(o,p,_)).filter(_=>fa(e,_,t)===0).sort((_,v)=>Number(u(v))-Number(u(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let p=0;p<mC&&r>0;p++){let f=!1;for(let d=0;d+1<o.length&&!f;d++){const g=o[d],h=o[d+1];for(const m of t){if(e.endpoints.includes(m.id)||zt({...e,waypoints:[g,h]},[m]).length===0)continue;const _=jc(g,h,m),v=_?_.map(b=>Zp(o,d,b)):Pm(o,m)??[];if(!v.length)continue;const y=[...v].sort((b,E)=>Number(u(E))-Number(u(b)));for(const b of y){const E=fa(e,b,t);if(E<r){o=b,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function Jp(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=Gn(r),s=new Set,c=pt(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ct(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=r.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=zt(p,a);if(!n&&h.length&&h.every(b=>b.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=Qp(p,a,g,r.edges);if(!m){h.some(b=>b.type==="bpmn:TextAnnotation")&&s.add(u);continue}const _=r.edges.filter(b=>b.id!==u),v=di(p,_);di({...p,waypoints:m},_)>v||o.updateWaypoints(f,m)}return s}const bC=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,o.x)-1,y:Math.min(i.y,o.y)-1,width:Math.max(2,Math.abs(o.x-i.x)+2),height:Math.max(2,Math.abs(o.y-i.y)+2),container:!1,attached:!1})}return t};function ef(e){const t=e.parent;return t&&typeof t.x=="number"&&typeof t.width=="number"?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0}const tf=(e,t)=>!t||e.every(n=>n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height),nf=(e,t)=>ss(e,[t])>0;function Tm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=Gn(r);let s=r;const c=new Set(pt(r).map(ct));for(const[l,u]of $o(r))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(P=>P.id===p),g=s.edges.find(P=>P.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=ef(h),_=bC(g),v=[...Hc(d,a)??[]],y=Qp(d,[...a,..._],m,r.edges);y&&v.push(y);for(let P=0;P+1<d.waypoints.length;P++)for(const T of _)for(const D of jc(d.waypoints[P],d.waypoints[P+1],T)??[])v.push(Zp(d.waypoints,P,D));const b=s.edges.filter(P=>P.id!==p),E=P=>({...s,edges:s.edges.map(T=>T.id===p?{...T,waypoints:P}:T)}),w=v.find(P=>{const T={...d,waypoints:P};return nf(T,g)||!tf(P,m)||b.some(D=>D.id!==f&&!nf(d,D)&&nf(T,D))?!1:pt(E(P)).every(D=>c.has(ct(D)))});if(w){o.updateWaypoints(h,w),s=E(w);break}}}const xC=["top","bottom","left","right"],km={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},ls=20,_C=20;function wC(e,t){const n=e.x>=t.x-.5&&e.x<=t.x+t.width+.5,i=e.y>=t.y-.5&&e.y<=t.y+t.height+.5,o=[];return n&&Je(e.y,t.y)&&o.push("top"),n&&Je(e.y,t.y+t.height)&&o.push("bottom"),i&&Je(e.x,t.x)&&o.push("left"),i&&Je(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const EC=(e,t)=>t==="top"?{x:e.x+e.width/2,y:e.y}:t==="bottom"?{x:e.x+e.width/2,y:e.y+e.height}:t==="left"?{x:e.x,y:e.y+e.height/2}:{x:e.x+e.width,y:e.y+e.height/2};function Om(e,t,n,i){const o=km[t],r=km[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",f=a?"x":"y",d=o[p],g=r[p];if(Je(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=ls?[e,n]:null;let h;if(d===-g){const _=e[p]+d*ls,v=n[p]-d*ls;if(d*(v-_)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+zc:Math.min(e[p],n[p])-zc;const m=(_,v)=>a?{x:v,y:_}:{x:_,y:v};return[e,m(h,e[f]),m(h,n[f]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=ls&&u>=ls?[e,c,n]:null}function SC(e,t,n){const i=e.waypoints;if(i.length<2||!e.source||!e.target||e.source===e.target)return[];const o=e.source===t.id,r=n.get(o?e.target:e.source),a=o?i[i.length-1]:i[0],s=r?wC(a,r):null;if(!s)return[];const c=[];for(const l of xC){const u=EC(t,l),p=o?Om(u,l,a,s):Om(a,s,u,l);p&&c.push(p)}return c}const Dm=e=>e.slice(1).reduce((t,n,i)=>t+Math.abs(n.x-e[i].x)+Math.abs(n.y-e[i].y),0);function RC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(pt(r).map(ct));let c=r;for(const[l,u]of qi(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(D=>D.id===l),f=c.edges.find(D=>D.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!qi({edges:[p,f]}).length)continue;const d=p.endpoints.find(D=>f.endpoints.includes(D)),g=d?a.get(d):void 0;if(!g||g.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const _=D=>n.has(D.id)?[D.waypoints]:[D.waypoints,...SC(D,g,a)],v=D=>D.length-2,y=_(p).flatMap(D=>_(f).map(N=>({pa:D,pb:N}))).filter(({pa:D,pb:N})=>D!==p.waypoints||N!==f.waypoints).map(D=>({...D,cost:Dm(D.pa)+Dm(D.pb)+_C*(v(D.pa)+v(D.pb))})).sort((D,N)=>D.cost-N.cost),b=ef(h),E=ef(m),w=qi(c).length,P=new Set($o(c).map(([D,N])=>`${D}|${N}`)),T=y.find(({pa:D,pb:N})=>{const $={...p,waypoints:D},H={...f,waypoints:N};if(qi({edges:[$,H]}).length||Sr($,H)||!tf(D,b)||!tf(N,E))return!1;const Z={...c,edges:c.edges.map(J=>J.id===l?$:J.id===u?H:J)};return qi(Z).length>=w||$o(Z).some(([J,V])=>!P.has(`${J}|${V}`))?!1:pt(Z).every(J=>s.has(ct(J)))});T&&(T.pa!==p.waypoints&&o.updateWaypoints(h,T.pa),T.pb!==f.waypoints&&o.updateWaypoints(m,T.pb),c={...c,edges:c.edges.map(D=>D.id===l?{...p,waypoints:T.pa}:D.id===u?{...f,waypoints:T.pb}:D)})}}const CC=40,MC=20;function AC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ve(i),p=qi(u);return{keys:new Set(pt(u).map(ct)),crossings:$o(u).length,shared:p.length,mine:p.filter(([f,d])=>f===l||d===l).length}},a=(l,u)=>{const p=Ve(i),f=p.edges.find(d=>d.id===l);return f?new Set(zt({...f,waypoints:u},Gn(p)).map(d=>d.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,f=s(u)?u:s(p)?p:void 0;if(!f)continue;const d=f===u?p:u;if(!d||d.type==="bpmn:Participant")continue;const g=d.x+d.width/2;if(g>=f.x+10&&g<=f.x+f.width-10)continue;const h=g>f.x+f.width,m=f.y>d.y,_=m?d.y+d.height:d.y,v=m?f.y:f.y+f.height,y=Math.round((_+v)/2),b=N=>f===u?[...N].reverse():N,E=(l.waypoints??[]).map(N=>({x:N.x,y:N.y})),w=r(l.id),P=a(l.id,E)??new Set,T=h?f.x+f.width:f.x,D=f.x+f.width/2;for(let N=Math.min(CC,f.width/4);h?T-N>D:T+N<D;N+=MC){const $=Math.round(h?T-N:T+N),H=b([{x:g,y:_},{x:g,y},{x:$,y},{x:$,y:v}]),Z=a(l.id,H);if(!Z||[...Z].some(V=>!P.has(V)))continue;o.updateWaypoints(l,H);const J=r(l.id);if(J.crossings<=w.crossings&&J.shared<=w.shared&&J.mine<=w.mine&&[...J.keys].every(V=>w.keys.has(V)))break;o.updateWaypoints(l,E)}}}const PC=10;function Lm(e,t){if(e.parent){const o=t.find(r=>r.id===e.parent);if(o)return o}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(o=>n>=o.x&&n<=o.x+o.width&&i>=o.y&&i<=o.y+o.height)}function Im(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),o=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!o)return null;const r=Lm(i,n),a=Lm(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(H=>H.id!==r.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,Z)=>H.y-Z.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,m=s?g:d,_=e.waypoints[0],v=e.waypoints[e.waypoints.length-1],y=Gn(t),b=t.edges.filter(H=>H.id!==e.id),E=hi(e,b),w=zt(e,y).length;if(E===0&&w===0||w===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(H=>H.x)),T=Math.max(...u.map(H=>H.x+H.width)),D=(_.x+v.x)/2,N=H=>H.filter((Z,J)=>J===0||!(Je(Z.x,H[J-1].x)&&Je(Z.y,H[J-1].y)));let $;for(let H=P;H<=T;H+=PC){const Z=N([_,{x:_.x,y:h},{x:H,y:h},{x:H,y:m},{x:v.x,y:m},v]),J={...e,waypoints:Z};if(zt(J,y).length>0)continue;const V=hi(J,b),we=Math.abs(H-D);(!$||V<$.cross||V===$.cross&&we<$.detour)&&($={pts:Z,cross:V,detour:we})}return $&&(w>0?$.cross<=E:$.cross<E)?$.pts:null}const TC=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function kC(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ve(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Gn(a);for(const p of t.edges){if(!TC.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const f=i.get(p.id);if(!(f!=null&&f.waypoints)||((l=f.source)==null?void 0:l.id)!==p.source||((u=f.target)==null?void 0:u.id)!==p.target)continue;const d=r.get(p.source),g=r.get(p.target),h=s.get(p.source),m=s.get(p.target);if(!d||!g||!h||!m||!Je(d.width,h.width)||!Je(d.height,h.height)||!Je(g.width,m.width)||!Je(g.height,m.height))continue;const _=h.x-d.x,v=h.y-d.y;if(Je(_,0)&&Je(v,0)||!Je(m.x-g.x,_)||!Je(m.y-g.y,v))continue;const y=p.waypoints.map(w=>({x:w.x+_,y:w.y+v})),b=f.waypoints.map(w=>({x:w.x,y:w.y}));b.length===y.length&&b.every((w,P)=>Je(w.x,y[P].x)&&Je(w.y,y[P].y))||b.length===2&&(Je(b[0].x,b[1].x)||Je(b[0].y,b[1].y))&&zt({...p,waypoints:b},c).length===0||zt({...p,waypoints:y},c).length>0||o.updateWaypoints(f,y)}}function Bm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ve(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Im(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const of=20,Nm=10,Ni=10,rf=40,OC=6,DC=40,$m=50;function LC(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=OC})}function af(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(Je(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function IC(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function sf(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Nm;o<=n-t;o+=Nm)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function BC(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,f=t.x+t.width/2,d=(V,we)=>we>V.x+Ni&&we<V.x+V.width-Ni,g=(V,we)=>V.width<=2*rf?V.x+V.width/2:Math.min(Math.max(we,V.x+rf),V.x+V.width-rf),h=Math.max(e.x,t.x)+Ni,m=Math.min(e.x+e.width,t.x+t.width)-Ni;if(h<=m){const V=!a&&d(t,p)?p:!s&&d(e,f)?f:Math.round((h+m)/2);r.push([{x:V,y:l},{x:V,y:u}])}const _=s?g(t,p):f,v=a?g(e,f):p;if(!a&&!d(e,_)){const V=_<e.x?e.x:e.x+e.width;for(const we of sf(e.y+e.height/2,e.y+Ni,e.y+e.height-Ni))r.push([{x:V,y:we},{x:_,y:we},{x:_,y:u}])}if(!s&&!d(t,v)){const V=v<t.x?t.x:t.x+t.width;for(const we of sf(t.y+t.height/2,t.y+Ni,t.y+t.height-Ni))r.push([{x:v,y:l},{x:v,y:we},{x:V,y:we}])}const y=(V,we)=>{if(Math.abs(we-V)<2*Ni)return[];const Ce=Math.min(V,we)+Ni,ke=Math.max(V,we)-Ni;return sf(Math.round((V+we)/2),Ce,ke)};if(!a&&n)for(const V of y(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:V},{x:_,y:V},{x:_,y:u}]);if(!s&&i)for(const V of y(u,c?i.y:i.y+i.height))r.push([{x:v,y:l},{x:v,y:V},{x:f,y:V},{x:f,y:u}]);const b=Math.min(v,_),E=Math.max(v,_),w=[];for(const[V,we]of o.filter(Ce=>Ce.x<E&&Ce.x+Ce.width>b).map(Ce=>[Ce.y,Ce.y+Ce.height]).sort((Ce,ke)=>Ce[0]-ke[0])){const Ce=w[w.length-1];Ce&&V<=Ce[1]?Ce[1]=Math.max(Ce[1],we):w.push([V,we])}const P=[];for(let V=1;V<w.length;V++)w[V][0]-w[V-1][1]>=DC&&P.push(Math.round((w[V-1][1]+w[V][0])/2));w.length&&P.push(w[0][0]-$m,w[w.length-1][1]+$m);const T=(V,we)=>we<V.y?V.y:we>V.y+V.height?V.y+V.height:void 0,D=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(V=>!!V)),N=e.y+e.height/2,$=t.y+t.height/2,H=$>N?1:-1,Z=(V,we,Ce)=>o.some(ke=>!D.has(ke.id)&&ke.x<V&&V<ke.x+ke.width&&ke.y<Math.max(we,Ce)-1&&ke.y+ke.height>Math.min(we,Ce)+1),J=[];for(const V of P){const we=T(e,V),Ce=T(t,V);we===void 0||Ce===void 0||(V-N)*H<0&&Z(v,we,V)||(V-$)*H>0&&Z(_,Ce,V)||J.push({pts:[{x:v,y:we},{x:v,y:V},{x:_,y:V},{x:_,y:Ce}],len:Math.abs(V-we)+(E-b)+Math.abs(Ce-V)})}return{inPools:r,outside:J.sort((V,we)=>V.len-we.len).map(V=>V.pts)}}function NC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(d=>[d.id,d.waypoints])),a=n.shapes.filter(d=>d.type==="bpmn:Participant"),s=d=>{let g=d;for(;g&&g.type!=="bpmn:Participant";)g=g.parent;return g==null?void 0:g.id},c=()=>{const d=Ve(i);return{keys:new Set(pt(d).map(ct)),crossings:$o(d).length,shared:qi(d).length}},l=(d,g)=>d.length===g.length&&d.every((h,m)=>Je(h.x,g[m].x)&&Je(h.y,g[m].y)),u=d=>{const g=d.source,h=d.target;if(!g||!h)return"skip";const m=Ve(i),_=new Map(m.shapes.map(q=>[q.id,q])),v=s(g),y=s(h),b=new Set([v,y].filter(q=>!!q)),E=m.shapes.filter(q=>q.type==="bpmn:Participant"),w=(d.waypoints??[]).map(q=>({x:q.x,y:q.y})),P=af(w,b,E);if(P<of)return"skip";if(t.has(d.id)){const q=r.get(d.id);if(q&&l(q,w)||P-(q?af(q,b,a):0)<of)return"skip"}const T=_.get(g.id),D=_.get(h.id),N=m.edges.find(q=>q.id===d.id);if(!T||!D||!N)return"skip";const $=Gn(m),H=new Set(zt(N,$).map(q=>q.id)),Z=Fo(m).filter(q=>q.owner!==d.id&&q.owner!==T.id&&q.owner!==D.id),J=[...m.shapes.filter(q=>!q.container&&q.id!==T.id&&q.id!==D.id),...Z.map(q=>q.rect)],V=q=>on({...N,waypoints:q}).some(ne=>LC(ne,J)),we=BC(T,D,v?_.get(v):void 0,y?_.get(y):void 0,E),Ce=q=>q.map((ne,W)=>({pts:ne,i:W,key:ne.length*2+(V(ne)?1:0)})).sort((ne,W)=>ne.key-W.key||ne.i-W.i).map(ne=>ne.pts),ke=[...Ce(we.inPools),...Ce(we.outside)],Ee=c();for(const q of ke){if(af(q,b,E)>=of)continue;const ne={...N,waypoints:q};if(zt(ne,$).some(oe=>!H.has(oe.id))||on(ne).some(oe=>IC(oe,m.shapes)||Z.some(he=>Bi(he.rect,oe))))continue;o.updateWaypoints(d,q);const X=c();if(X.crossings<=Ee.crossings&&X.shared<=Ee.shared&&[...X.keys].every(oe=>Ee.keys.has(oe)))return"fixed";o.updateWaypoints(d,w)}return"stuck"},p=i.getAll().filter(d=>d.type==="bpmn:MessageFlow"),f=[];for(const d of p)u(d)==="stuck"&&f.push(d);for(const d of f)u(d)}const Yi=[25,-25,40,-40],da=35;function $C(e,t,n=[]){const i=e.x+e.width/2,o=t.x+t.width/2,r=[],a=n.filter(s=>!s.container&&s.id!==e.id&&s.id!==t.id&&s.label).map(s=>({...s.label,id:`${s.id}:label`,type:"label",container:!1,attached:!1}));for(const s of[!0,!1]){const c=s?e.y:e.y+e.height,l=s?t.y:t.y+t.height,u=s?Math.min(e.y,t.y)-da:Math.max(e.y+e.height,t.y+t.height)+da,p=jC(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,FC]];for(const[d,g]of f)for(const h of[0,...Yi])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...Yi]){if(Math.abs(m)>=t.width/2-5)continue;const _=i+h,v=o+m,y=[{x:_,y:c},{x:_,y:d},{x:v,y:d},{x:v,y:l}];g&&zt({endpoints:[],waypoints:y},a).length||r.push({pts:y,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const FC=45,Gc=20;function jC(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,_)=>m.width*m.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),f=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!f.length)return null;const d=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...f.map(v=>v.y));for(let v=!0;v;){v=!1;for(const y of d)y.y<m&&y.y<l&&y.y+y.height>m-Gc&&(m=y.y,v=!0)}const _=Math.max(u.y,...d.filter(v=>v.y+v.height<=m).map(v=>v.y+v.height));return m-_>=Gc?Math.round((m+_)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const _ of d)_.y+_.height>g&&_.y+_.height>l&&_.y<g+Gc&&(g=_.y+_.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=Gc?Math.round((g+h)/2):null}function Vc(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const o=n.y+n.height/2;if(o>=i.y&&o<=i.y+i.height)return $C(n,i,[...t.values()]);const r=i.x+i.width/2,a=n.x+n.width/2,s=o<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-da:n.y+n.height+da,p=[];for(const v of[0,...Yi]){if(Math.abs(v)>=i.width/2-5)continue;const y=r+v;p.push({pts:[{x:n.x,y:o},{x:y,y:o},{x:y,y:c}],cost:Math.abs(v)});for(const b of[0,...Yi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:y,y:u},{x:y,y:c}],cost:Math.abs(v)+Math.abs(b)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const v of[0,...Yi]){if(Math.abs(v)>=n.width/2-5)continue;const y=a+v;p.push({pts:[{x:y,y:g},{x:y,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(v)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+da:i.y-da;for(const v of[0,...Yi]){if(Math.abs(v)>=i.width/2-5)continue;const y=r+v;for(const b of[0,...Yi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:g},{x:E,y:_},{x:y,y:_},{x:y,y:m}],cost:h+Math.abs(v)+Math.abs(b)})}}return p}const Wc=30;function Fm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=Je(i.y,o.y)&&!Je(i.x,o.x),a=Je(i.x,o.x)&&!Je(i.y,o.y);if(!(!r&&!a))for(const s of t)if(r){const c=Math.min(i.x,o.x);if(Math.max(i.x,o.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Wc||Math.abs(i.y-(s.y+s.height))<Wc)return!0}else{const c=Math.min(i.y,o.y);if(Math.max(i.y,o.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Wc||Math.abs(i.x-(s.x+s.width))<Wc)return!0}}return!1}const Uc=40;function HC(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-Uc,a=o.x+o.width+Uc,s=o.y-Uc,c=o.y+o.height+Uc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>r&&f.y<c&&d.y>s){i++;break}}}return i}function jm(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),o=Gn(t),r=t.edges.filter(w=>w.id!==e.id),a=di(e,r),s=hi(e,r),c=w=>HC(w,t.shapes,e.endpoints)+(Fm(w,n)?1:0),l=c(e.waypoints),u=w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.find(D=>D.type==="bpmn:Lane"&&P>=D.x&&P<=D.x+D.width&&T>=D.y&&T<=D.y+D.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=w=>{if(!d||!f)return!1;for(let P=1;P<w.length-2;P++){const T=w[P],D=w[P+1];if(Je(T.y,D.y)&&!Je(T.x,D.x)&&T.y>f.y&&T.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),_=(w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.filter(D=>D.type==="bpmn:Participant"&&P>=D.x&&P<=D.x+D.width&&T>=D.y&&T<=D.y+D.height).sort((D,N)=>D.width*D.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),v=w=>{if(!_)return 0;let P=0;for(let T=1;T<w.length-1;T++){const D=w[T];(D.x<_.x||D.x>_.x+_.width||D.y<_.y||D.y>_.y+_.height)&&P++}return P},y=v(e.waypoints);if(!Fm(e.waypoints,n)&&!(d&&!h)&&y===0)return null;const b=w=>w.reduce((P,T,D)=>D?P+Math.abs(T.x-w[D-1].x)+Math.abs(T.y-w[D-1].y):0,0);let E;for(const{pts:w,cost:P}of Vc(e,i)){const T={...e,waypoints:w};if(zt(T,o).length>0)continue;const D=di(T,r);if(D>a)continue;const N=v(w);if(N>y)continue;const $=N<y&&D===0;if(!$&&hi(T,r)>s)continue;const H=c(w),Z=g(w);if(!$&&!(Z&&!h)&&H>=l)continue;const V=Z?0:1,we=b(w);(!E||N<E.out||N===E.out&&(V<E.lane||V===E.lane&&(D<E.opp||D===E.opp&&(H<E.sc||H===E.sc&&(P<E.cost||P===E.cost&&we<E.len)))))&&(E={pts:w,out:N,sc:H,lane:V,opp:D,cost:P,len:we})}return(E==null?void 0:E.pts)??null}function zC(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,o=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),r=o.filter(p=>p.endpoints[1]===i),a=o.filter(p=>p.endpoints[0]===i);if(r.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function GC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=Ve(i),c=s.edges.find(m=>m.id===a);if(!c||c.waypoints.length<4)continue;const l=Gn(s),u=s.edges.filter(m=>m.id!==a),p=zt(c,l).length,f=di(c,u),d=hi(c,u),g=n.has(a)?new Set(pt(s).map(ct)):null,h=Hc(c,s.shapes);h.length===2&&zC(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const _={...c,waypoints:m};if(zt(_,l).length>p||di(_,u)>f||hi(_,u)>d)continue;if(g){const y=new Set(pt({...s,edges:s.edges.map(w=>w.id===a?_:w)}).map(ct)),b=[...y].filter(w=>!g.has(w)).length,E=[...g].filter(w=>!y.has(w)).length;if(b>E)continue}const v=i.get(a);v&&o.updateWaypoints(v,m);break}}}function Hm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ve(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=jm(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function cf(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],o=t.get(e.endpoints[0]??""),r=t.get(e.endpoints[1]??""),a=Je(n[0].x,n[1].x)&&!Je(n[0].y,n[1].y),s=Je(n[n.length-1].x,n[n.length-2].x)&&!Je(n[n.length-1].y,n[n.length-2].y);for(const c of Yi){if(a&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function VC(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const _ of[0,...Yi])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+_,y:l},{x:u+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+_},{x:g,y:p+_}],cost:Math.abs(_)});return m}function lf(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const o=Math.max(n.x,i.x),r=Math.min(n.x+n.width,i.x+i.width);if(r-o<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(o+r)/2,p=[];for(const f of[0,...Yi]){const d=u+f;d<=o||d>=r||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function zm(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Gn(t),o=t.edges.filter(d=>d.id!==e.id),r=di(e,o);if(r===0)return null;const a=hi(e,o);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=l?1:0},p=u(e.waypoints),f=[...Vc(e,n),...lf(e,n),...cf(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(zt(h,i).length>0)continue;const m=di(h,o),_=hi(h,o),v=r-m+(p-u(d));if(m>=r||_-a>v)continue;const y=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&y<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:y})}return(s==null?void 0:s.pts)??null}function Gm(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Sr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function WC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Gn(t),o=t.edges.filter(f=>f.id!==e.id),r=Gm(e,o);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Vc(e,n),...lf(e,n),...VC(e,n),...cf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(zt(g,i).length>0)continue;const h=Gm(g,o);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const v=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&v<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:_,cost:d,length:v})}return(u==null?void 0:u.pts)??null}function Vm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=pt(Ve(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ct(s)));if(!r.length)return;const a=new Set;for(const s of r)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=Ve(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=WC(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Wm(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 Um(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Sr(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,o]=e.endpoints,[r,a]=t.endpoints,s=[i,o].filter(u=>u&&(u===r||u===a)).length;return!(!!o&&o===r||!!a&&a===i)||s!==1?!1:Wm(e,n)&&Wm(t,n)}function qm(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Um(e,o,n)&&i++;return i}function UC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Gn(t),o=t.edges.filter(f=>f.id!==e.id),r=qm(e,o,n);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Vc(e,n),...lf(e,n),...cf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(zt(g,i).length>0)continue;const h=qm(g,o,n);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const v=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&v<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:_,cost:d,length:v})}return(u==null?void 0:u.pts)??null}function qC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=pt(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ct(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!Um(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ve(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=UC(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function Ym(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=pt(r).filter(u=>Up(u)&&!t.has(ct(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Up(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=r.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ve(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=zm(f,p);if(!d)continue;const g=i.get(u);g&&o.updateWaypoints(g,d)}}const YC=10,KC=(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 Km(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Fc(e,i))return null;const o=Gn(t),r=i.flatMap(on);for(const a of on(e)){let s=[[a.lo,a.hi]];for(const[d,g]of $c(a,r))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([v,y])=>y>v)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+YC*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-um}:{x:a.at+Pn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Fc({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&KC(f,d)))return f}return null}const Pn=8;function uf(e,t){const n=e.label;if(!n)return null;const i=on(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=f=>{const d=f.axis==="h"?o:r,g=f.axis==="h"?r-f.at:o-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(on),...t.shapes.filter(f=>f.container).flatMap(pa)],l=f=>!c.some(d=>Bi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Pn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Pn,s.at-Pn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-Pn-n.height,s.at+Pn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const Xm=30,XC=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const o=t[i],r=t[i+1],a=r.x-o.x,s=r.y-o.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-o.x)*a+(e.y-o.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(o.x+l*a),e.y-(o.y+l*s)))}return n},Zm=(e,t)=>XC({x:e.x+e.width/2,y:e.y+e.height/2},t);function ZC(e,t){const n=e.label;if(!n)return null;const i=on(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(on),...t.shapes.filter(c=>c.container).flatMap(pa)],r=Fo(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!o.some(l=>Bi(c,l))&&!cs(c,t).length&&!r.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+Pn,c.at-Pn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Pn,c.at-Pn-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function Qm(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(pt(o).map(ct));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((w,P)=>w.x-u[P].x===d&&w.y-u[P].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const w=o.edges.find($=>$.id===c);if(!(w!=null&&w.label)||!cs(w.label,o).length)continue;let P={...w.label,x:l.label.x,y:l.label.y};if((cs(P,o).length||Zm(P,w.waypoints)>Xm)&&(P=null),!P&&Zm(w.label,w.waypoints)>Xm&&(P=ZC(w,o)),!P)continue;const T=P,D={...o,edges:o.edges.map($=>$.id===c?{...$,label:T}:$)},N=pt(D);if(N.some($=>!r.has(ct($))))continue;i.moveElements([f],{x:T.x-f.x,y:T.y-f.y}),o=D,r=new Set(N.map(ct));continue}const m=l.label.x+d-f.x,_=l.label.y+g-f.y;if(m===0&&_===0)continue;const v=o.edges.find(w=>w.id===c);if(!(v!=null&&v.label))continue;const y={...v.label,x:v.label.x+m,y:v.label.y+_},b={...o,edges:o.edges.map(w=>w.id===c?{...w,label:y}:w)},E=pt(b);E.some(w=>!r.has(ct(w)))||(i.moveElements([f],{x:m,y:_}),o=b,r=new Set(E.map(ct)))}}function Jm(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=uf(a,r);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&o.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function ey(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=pt(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ct(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=Km(c,r);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&o.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function ty(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(on),...t.shapes.filter(f=>f.container).flatMap(pa)],o=i.filter(f=>Bi(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Fo(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=>Bi(f,d))&&!r.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of o)f.axis==="h"?l.push({...n,y:f.at-Pn-n.height},{...n,y:f.at+Pn}):l.push({...n,x:f.at-Pn-n.width},{...n,x:f.at+Pn});const u=e.x+e.width/2,p=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+Pn},{...n,x:u-n.width/2,y:e.y-Pn-n.height},{...n,x:e.x+e.width+Pn,y:p-n.height/2},{...n,x:e.x-Pn-n.width,y:p-n.height/2}),l.find(c)??null}function ny(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=ty(r,Ve(n));if(!a)continue;const s=n.get(r.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function QC(e,t){const n=e.x,i=e.x+e.width,o=e.y,r=e.y+e.height;if(t.x<n||t.x>i||t.y<o||t.y>r)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,o),r))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-o,{x:t.x,y:o}],[r-t.y,{x:t.x,y:r}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function iy(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(pt(o).map(ct));const a=[...new Set(pt(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,m]of u){const _=h?o.shapes.find(y=>y.id===h):void 0;if(!_)continue;const v=QC(_,l[m]);v.x===l[m].x&&v.y===l[m].y||(l[m]=v,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=pt(f);if(d.some(h=>!r.has(ct(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(ct)))}}const pf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function oy(e,t){const n=(o,r,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>r?`${r}.${u}`:u;return{id:o,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((o,r)=>n(o.id,`participant.lanes[${r}]`,o))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((o,r)=>({...n(o.id,`lanes[${r}]`,o),omittedMeansRemove:(t==null?void 0:t.categoryOf(o.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function JC(e,t,n){const i=[],o=n?ts(n):[];return e.forEach((r,a)=>{if(r.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:r.id,field:"locale"});return}if(!o.includes(r.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:r.id,field:"locale",locale:r.locale,locales:o});return}t.categoryOf(r.id)!==void 0&&!t.reviewRequestLocalesOf(r.id).includes(r.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:r.id,locale:r.locale});return}for(const s of oy(r,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:o});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:o});continue}if(!l)continue;if(!pf(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):o.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:o}),p=!1);if(!p)continue;const f=o.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function bi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function eM(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:o}=n,r=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(pf(c.map)){const l=c.map;return r(c.id).texts={...l},l[o]}if(c.plain===null||c.condition===null&&c.plain===void 0){r(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(r(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=r(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=oy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=bi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=bi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:bi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:bi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:bi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:bi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(bi(c,"text",a(l[0])));break;default:s.push(pf(l[0].map)?bi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const tM=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,ry=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),ay={"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}]},us=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),qc=e=>typeof e=="string"&&e!=="";function nM(e){const t=[];function n(i,o,r,a){if(a===null){qc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!us(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)qc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!us(i)||!qc(i.kind)||!(i.kind in ay)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of ay[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(!us(f))break;f=f[g]}if(!us(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(o,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}d.forEach((g,h)=>n(o,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;us(c)&&!qc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Mg(l)){t.push({kind:"node-type-unsupported",opIndex:o,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!Ag(p)){t.push({kind:"payload-invalid",opIndex:o,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:o,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function sy(e,t,n={}){const i=nM(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,_){if(!tM.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{..._,opIndex:h})}e.forEach((h,m)=>{var _;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(v=>v.id)});for(const v of h.participant.lanes??[])s(m,v.id,{category:"lane"});break;case"node.add":s(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(m,h.dataStore.id,{category:"dataStore"});for(const v of h.associations??[])v.id&&s(m,v.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(_=h.association)!=null&&_.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(v=>v.id));for(const v of h.lanes)t.categoryOf(v.id)===void 0&&s(m,v.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,_,v){const y=c(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:_});return}if(v&&!v.includes(y)){o.push({kind:"ref-category",opIndex:h,ref:m,role:_,expected:v.join("|"),actual:y});return}return y}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,m)=>{var _;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:y}=h.node;if(v===void 0){(p||y!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,v,"participant",["participant"])===void 0)break;y!==void 0&&((((_=r.get(v))==null?void 0:_.lanes)??a.get(v)??t.lanesOf(v)).includes(y)||o.push({kind:"lane-unknown",opIndex:m,lane:y,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:y,target:b,name:E,condition:w}=h.flow,P=u(m,y,"source",["flowNode"]),T=u(m,b,"target",["flowNode"]);P&&T&&l(y)!==l(b)&&o.push({kind:"flow-cross-pool",opIndex:m,id:v}),E!==void 0&&w!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:v});break}case"messageFlow.add":{const{id:v,source:y,target:b}=h.flow,E=u(m,y,"source",["flowNode","participant"]),w=u(m,b,"target",["flowNode","participant"]);if(E&&w){const P=l(y),T=l(b);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:m,id:v})}for(const P of[y,b])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:v,ref:P});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(E=>E===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:v.source,target:v.target});continue}const b=v.source===h.dataStore.id?v.target:v.source;u(m,b,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:y}=h.association,b=u(m,v,"source"),E=u(m,y,"target");if(b&&E){const w=new Set([b,E]);w.has("dataStore")&&w.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:v,target:y})}break}case"association.add":{const{id:v,source:y,target:b}=h.association,E=u(m,y,"source"),w=u(m,b,"target");E&&w&&E!=="annotation"&&w!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:v??`${y}->${b}`});break}case"annotation.add":{if(h.association){const{source:v,target:y}=h.association;if(v!==h.annotation.id&&y!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const b=v===h.annotation.id?y:v;u(m,b,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const y=u(m,v,"member");y&&ry.has(y)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),y=h.lanes.map(E=>E.id);for(const E of v)y.includes(E)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:E});for(const E of y)t.categoryOf(E)!==void 0&&!v.includes(E)&&o.push({kind:"id-duplicate",opIndex:m,id:E});const b=y.filter(E=>v.includes(E));b.length===v.length&&b.some((E,w)=>E!==v[w])&&o.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(g(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(g(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,y=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,b=t.endpointsOf(h.id),E=h.source??(b==null?void 0:b.source),w=h.target??(b==null?void 0:b.target);v&&y&&E!==void 0&&w!==void 0&&new Set([l(E),l(w),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":g(m,h.id,"messageFlow");break;case"dataStore.update":g(m,h.id,"dataStore");break;case"annotation.update":{if(g(m,h.id,"annotation")===void 0)break;h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.update":{if(g(m,h.id,"group")===void 0)break;for(const v of h.members??[]){const y=u(m,v,"member");y&&ry.has(y)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:y})}break}case"translation.confirm":g(m,h.id);break;case"element.remove":{g(m,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...JC(e,t,n.i18n)),o;function g(h,m,_){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const v=t.categoryOf(m);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(_&&v!==_){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:_,actual:v});return}return v}}function cy(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 Yc(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]},Tn=10,iM=300,oM=160,ly=20,ff=100,uy=40,rM=10,aM=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function py(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,o=t.y+t.height/2;let r;for(const a of e.getAll()){if(a.type!=="bpmn:Lane")continue;const s=a;typeof s.x!="number"||typeof s.width!="number"||i>=s.x&&i<=s.x+s.width&&o>=s.y&&o<=s.y+s.height&&(!r||s.width*s.height<r.width*r.height)&&(r=s)}return r?{x:n.x,width:n.width,y:r.y,height:r.height}:void 0}const Xc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function Zc(e,t,n,i,o){const r=n,a=py(e,t,i),s=a??i,c=(Z,J,V=s)=>{const[we,Ce]=Kc[Z];let ke={x:t.x+t.width/2+we*(t.width/2+r.width/2+J),y:t.y+t.height/2+Ce*(t.height/2+r.height/2+J)};const Ee=V.x+Tn+r.width/2,q=V.x+V.width-Tn-r.width/2,ne=V.y+Tn+r.height/2,W=V.y+V.height-Tn-r.height/2,X={x:Math.min(q,Math.max(Ee,ke.x)),y:Math.min(W,Math.max(ne,ke.y))};return(X.x!==ke.x||X.y!==ke.y)&&(ke=Math.abs(X.x-(t.x+t.width/2))<(t.width+r.width)/2+Tn&&Math.abs(X.y-(t.y+t.height/2))<(t.height+r.height)/2+Tn?{x:t.x+t.width+Tn+r.width/2,y:X.y}:X),ke},l=(i.children??[]).filter(Z=>!("waypoints"in Z&&Z.waypoints)&&Z.type!=="bpmn:Lane"&&Z.type!=="label"&&typeof Z.x=="number"&&Z.id!==o.selfId),u=Ve(e),p=Z=>{var V,we;if(!o.selfId)return!1;const J=e.get(Z);return!!J&&(((V=J.source)==null?void 0:V.id)===o.selfId||((we=J.target)==null?void 0:we.id)===o.selfId)},f=u.edges.filter(Z=>!p(Z.id)).flatMap(on),d=Fo(u).filter(Z=>Z.owner!==o.selfId).map(Z=>Z.rect),g=Z=>({x0:Z.x-r.width/2-Tn,x1:Z.x+r.width/2+Tn,y0:Z.y-r.height/2-Tn,y1:Z.y+r.height/2+Tn}),h=Z=>{const J=g(Z);return l.some(V=>J.x0<V.x+V.width&&J.x1>V.x&&J.y0<V.y+V.height&&J.y1>V.y)},m=Z=>{const J=g(Z);return f.some(V=>V.axis==="h"?V.at>J.y0&&V.at<J.y1&&V.lo<J.x1&&V.hi>J.x0:V.at>J.x0&&V.at<J.x1&&V.lo<J.y1&&V.hi>J.y0)},_=Z=>{const J=g(Z);return d.some(V=>J.x0<V.x+V.width&&J.x1>V.x&&J.y0<V.y+V.height&&J.y1>V.y)},v=u.shapes.filter(Z=>Z.type==="bpmn:Group").flatMap(Z=>[{axis:"h",at:Z.y,lo:Z.x,hi:Z.x+Z.width},{axis:"h",at:Z.y+Z.height,lo:Z.x,hi:Z.x+Z.width},{axis:"v",at:Z.x,lo:Z.y,hi:Z.y+Z.height},{axis:"v",at:Z.x+Z.width,lo:Z.y,hi:Z.y+Z.height}]),y=Z=>{const J=g(Z);return v.some(V=>V.axis==="h"?V.at>J.y0&&V.at<J.y1&&V.lo<J.x1&&V.hi>J.x0:V.at>J.x0&&V.at<J.x1&&V.lo<J.y1&&V.hi>J.y0)},b=Z=>h(Z)||m(Z)||_(Z)||y(Z),E=Z=>Z.x-r.width/2>=i.x&&Z.x+r.width/2<=i.x+i.width&&Z.y-r.height/2>=i.y&&Z.y+r.height/2<=i.y+i.height,w=Z=>E(Z)&&(!a||Xc(Z,r,a));if(o.placement){const Z=Ee=>Ee.startsWith("top")?Ee.replace(/^top/,"bottom"):Ee.replace(/^bottom/,"top"),J=Ee=>Ee.endsWith("left")?Ee.replace(/left$/,"right"):Ee.replace(/right$/,"left"),V=o.placement.side,we=[V,Z(V),J(V),Z(J(V)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Ce=o.placement.offset??50;let ke=c(V,Ce);if(b(ke)||a&&!Xc(ke,r,a)){const Ee=(q,ne)=>{const W=new Set;for(const X of we){if(W.has(X))continue;W.add(X);const oe=c(X,Ce,q);if(ne(oe)&&!b(oe))return ke=oe,!0}return!1};!Ee(s,w)&&a&&Ee(i,E)}return ke}const P=o.from,T=s.x+Tn+r.width/2,D=s.x+s.width-Tn-r.width/2,N=s.y+Tn+r.height/2,$=s.y+s.height-Tn-r.height/2;let H={x:Math.min(D,Math.max(T,P.x)),y:Math.min($,Math.max(N,P.y))};if(b(H)){const Z=(t.width+r.width)/2+Tn,V=[{x:H.x+Z,y:H.y},{x:H.x-Z,y:H.y},{x:H.x,y:H.y-r.height-Tn},{x:H.x,y:H.y+r.height+Tn}].filter(w).find(we=>!b(we));V&&(H=V)}return H}function en(e,t){return e.filter(n=>n.kind===t)}class fy extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function dy(e,t){var x1,_1,w1,E1,S1,R1,C1,M1,A1,P1,T1,k1,O1,D1,L1,I1,B1,N1,$1,F1,j1,H1,z1;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=x=>r.get(x),f=x=>{const S=p(x);if(!S)throw new Error(`하강 참조 해소 실패: ${x}`);return S},d=x=>{let S=x.parent;for(;S;){if(S.type==="bpmn:Participant")return S;S=S.parent}},g=new Map;for(const x of r.filter(S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number"))g.set(x.id,{x:x.x,y:x.y});const h=en(e,"participant.add"),m=en(e,"node.add"),_=en(e,"sequenceFlow.add"),v=en(e,"messageFlow.add"),y=en(e,"dataStore.add"),b=en(e,"dataAssociation.add"),E=en(e,"annotation.add"),w=en(e,"group.add"),P=new Map(m.map(x=>[x.node.id,x])),T=(x,S,A)=>{var F;const k=x.businessObject,L=(((F=k.extensionElements)==null?void 0:F.values)??[]).filter(I=>I.$type!==S),O=A?[...L,i.create(S,A)]:L;if(!O.length){k.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:O});O.forEach(I=>{I.$parent=j}),n.updateProperties(x,{extensionElements:j})},D=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of en(e,"element.remove")){const S=p(x.id);S&&n.removeElements([S])}const N=x=>r.filter(S=>{var A;return S.type==="bpmn:Lane"&&((A=d(S))==null?void 0:A.id)===x}).sort((S,A)=>S.y-A.y);for(const x of en(e,"participant.update")){const S=f(x.id);if(x.name!==void 0&&n.updateProperties(S,{name:x.name??void 0}),!x.lanes)continue;const A=N(x.id);if(!A.length){n.splitLane(S,x.lanes.length),N(x.id).forEach((L,O)=>{const j=x.lanes[O];j&&n.updateProperties(L,{id:j.id,name:j.name})});continue}const k=new Set(A.map(L=>L.id));x.lanes.forEach((L,O)=>{if(k.has(L.id)){n.updateProperties(f(L.id),{name:L.name});return}const j=O===0?n.addLane(N(x.id)[0],"top"):n.addLane(f(x.lanes[O-1].id),"bottom");n.updateProperties(j,{id:L.id,name:L.name})})}const $=150,H=130,Z=80,J=90,V=180,we=30,Ce=30,ke=(x,S,A,k,L)=>{const O=A-S.width/2,j=k-S.height/2;return(x.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(L!=null&&L.has(F.id))&&typeof F.x=="number"&&O<F.x+F.width+Ce&&O+S.width+Ce>F.x&&j<F.y+F.height&&j+S.height>F.y)},Ee=new Set;for(const x of h){Ee.add(`pool:${x.participant.id}`);for(const S of x.participant.lanes??[])Ee.add(S.id)}const q=new Map;for(const x of m){const S=x.node.lane??`pool:${x.node.participant??""}`;let A=q.get(S);A||q.set(S,A=new Set([0])),x.band!==void 0&&A.add(x.band)}const ne=new Map;for(const[x,S]of q){if(!Ee.has(x))continue;const A=[...S].sort((O,j)=>O-j),k=A.map((O,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),L=Math.min(...k);ne.set(x,new Map(A.map((O,j)=>[O,k[j]-L])))}{const x=new Map;for(const S of h)(S.participant.lanes??[]).forEach((A,k)=>x.set(A.id,k));for(const[S,A]of ne){if(!x.has(S)||A.size<2)continue;const k=x.get(S),L=A.get(0)??0,O=new Set;for(const ce of m){if(ce.node.lane!==S||(ce.band??0)!==0||!ce.node.type.endsWith("Gateway"))continue;const re={in:new Set,out:new Set,cross:new Set};for(const fe of _){const ye=fe.flow.source===ce.node.id;if(!ye&&fe.flow.target!==ce.node.id)continue;const Ze=P.get(ye?fe.flow.target:fe.flow.source);if(!Ze||Ze.node.participant!==ce.node.participant||!Ze.node.lane)continue;let Be,te=!1;if(Ze.node.lane!==S){const ae=x.get(Ze.node.lane);if(ae===void 0)continue;Be=ae>k?"down":"up",te=!0}else{const ae=A.get(Ze.band??0)??L;Be=ae>L?"down":ae<L?"up":void 0}Be&&(re[ye?"out":"in"].add(Be),te&&re.cross.add(Be))}for(const fe of["up","down"])re.in.has(fe)&&re.out.has(fe)&&re.cross.has(fe)&&O.add(fe)}if(O.size!==1)continue;const[j]=O,F=Math.max(...A.values()),I=j==="down"?F:0;if(L===I)continue;const Y=[...A.entries()].filter(([ce])=>ce!==0).sort((ce,re)=>ce[1]-re[1]),Q=[...Array(F+1).keys()].filter(ce=>ce!==I),se=new Map([[0,I]]);Y.forEach(([ce],re)=>se.set(ce,Q[re])),ne.set(S,se)}}const W=x=>{var S;return(((S=q.get(x))==null?void 0:S.size)??0)>1},X=x=>x.band??(x.node.lane||!W(`pool:${x.node.participant??""}`)?void 0:0),oe=new Map,he=x=>oe.get(x.node.id)??X(x),De=new Set,B=new Set;{const x=new Map;for(const k of _)x.set(k.flow.target,(x.get(k.flow.target)??0)+1);const S=k=>{const L=[],O=new Set([k]),j=[k];for(;j.length;){const F=j.shift();L.push(F);for(const I of _)I.flow.source!==F||O.has(I.flow.target)||(x.get(I.flow.target)??0)!==1||(O.add(I.flow.target),j.push(I.flow.target))}return L},A=(k,L)=>{var O;return((O=ne.get(k))==null?void 0:O.get(L))??L};for(const k of m){if(!k.node.type.endsWith("Gateway"))continue;const L=k.node.lane??`pool:${k.node.participant??""}`,O=ne.get(L);if(!O||O.size<2)continue;const j=he(k);if(j===void 0||A(L,j)!==A(L,0))continue;const F=A(L,j),I=_.filter(fe=>fe.flow.source===k.node.id).map(fe=>P.get(fe.flow.target)).filter(fe=>!!fe&&(fe.node.lane??`pool:${fe.node.participant??""}`)===L),Y=I.filter(fe=>{const ye=he(fe);return ye!==void 0&&A(L,ye)===F&&(x.get(fe.node.id)??0)===1}),Q=I.some(fe=>{const ye=he(fe);return ye!==void 0&&A(L,ye)>F});if(Y.length!==1||!Q)continue;const se=new Set(I.flatMap(fe=>S(fe.node.id)));if(!_.some(fe=>fe.flow.target===k.node.id&&se.has(fe.flow.source)))continue;const re=new Map;for(const[fe,ye]of O)re.set(fe,ye+1);re.set(-1,0),ne.set(L,re);for(const fe of S(Y[0].node.id))P.has(fe)&&(oe.set(fe,-1),B.add(fe));De.add(k.node.id)}}const C=(x,S)=>{var A;return((A=ne.get(x))==null?void 0:A.get(S))??S},R=(x,S,A,k)=>{const L=x?p(x):S?p(S):void 0;if(!L)return!1;const O=x?L.y+Math.min(L.height/2,J):L.y+Z;return Math.abs(O+C(x??`pool:${S??""}`,A)*$-k)<=$/2},G=new Map;for(const[x,S]of q){let A=0;for(const k of S)A=Math.max(A,C(x,k));G.set(x,A)}const K=x=>V+$*x,ie=(x,S,A)=>{const k=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==S&&typeof L.y=="number"&&L.y>=x);k.length&&n.moveElements(k,{x:0,y:A})},Pe=(x,S,A)=>{const k=x.type==="bpmn:Participant"?x:void 0;if(!k||k.children.some(F=>F.type==="bpmn:Lane"))return;const L=A+S.height/2+we-k.y;if(k.height>=L)return;const O=L-k.height,j=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:L}),ie(j,k.id,O)},et=(x,S)=>{const A=S-x.height;if(A<=0)return;const k=d(x)??x,L=[],O=I=>{L.push(I);for(const Y of I.children??[])O(Y)};O(k);const j=x.y+x.height-10,F=l.calculateAdjustments(L,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},mt=(x,S,A)=>{if(x){const j=f(x),F=K(S);if(j.height>=F)return;const I=F-j.height,Y=d(j),Q=Y?Y.y+Y.height:j.y+j.height;et(j,F),ie(Q,Y==null?void 0:Y.id,I);return}if(!A)return;const k=$*(S+1);if(A.height>=k)return;const L=k-A.height,O=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:k}),ie(O,A.id,L)},qt=new Map;for(const x of _)qt.set(x.flow.target,(qt.get(x.flow.target)??0)+1);const Ct=x=>(qt.get(x)??0)<=1,vn=new Set(m.map(x=>x.node.id).filter(x=>en(e,"sequenceFlow.update").filter(S=>S.target===x).length===1&&!_.some(S=>S.flow.target===x||S.flow.source===x&&P.has(S.flow.target)))),Rn=new Map,Un=(x,S)=>{if(!x)return;const A=p(x);if(!A||A.height>=K(S))return;const k=A.y+A.height-10,L=d(A);if(L)return new Set((L.children??[]).filter(O=>O.type!=="bpmn:Lane"&&typeof O.y=="number"&&O.y>k).map(O=>O.id))},At=(x,S,A)=>{if(!x)return!0;const k=p(x);return k?A-S.height/2>=k.y&&A+S.height/2<=k.y+k.height:!0},Qt=h.map((x,S)=>({op:x,declared:S}));Qt.sort((x,S)=>{const A=x.op.order??Number.POSITIVE_INFINITY,k=S.op.order??Number.POSITIVE_INFINITY;return A!==k?A-k:x.declared-S.declared});let _n=80;for(const x of r.getAll())x.parent===u()&&"height"in x&&typeof x.y=="number"&&(_n=Math.max(_n,x.y+x.height+60));for(const{op:x}of Qt){const S=x.participant,A=m.filter(ce=>ce.node.participant===S.id).length,k=((x1=S.lanes)==null?void 0:x1.length)??0,L=Math.max(1200,A*160+300),O=(S.lanes??[]).map(ce=>K(G.get(ce.id)??0)),j=O.reduce((ce,re)=>ce+re,0);k&&j<300&&(O[k-1]+=300-j);const F=Math.max(300,$*((G.get(`pool:${S.id}`)??0)+1)),I=S.blackBox||A+k===0?120:k?Math.max(300,j):F,Y=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:S.id,name:S.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...S.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:L,height:I,isExpanded:!0}),Q=n.createShape(Y,{x:100+L/2,y:_n+I/2},u()),se=S.lanes??[];if(se.length&&n.splitLane(Q,se.length),se.length){const ce=r.filter(re=>{var fe;return re.type==="bpmn:Lane"&&((fe=d(re))==null?void 0:fe.id)===S.id}).sort((re,fe)=>re.y-fe.y);if(ce.forEach((re,fe)=>{const ye=se[fe];ye&&n.updateProperties(re,{id:ye.id,name:ye.name})}),O.some(re=>re!==Q.height/k)){let re=Q.y;ce.forEach((fe,ye)=>{const Ze=O[ye];n.resizeShape(fe,{x:fe.x,y:re,width:fe.width,height:Ze}),re+=Ze})}}_n=Q.y+Q.height+60}const qa=x=>{var k;const S=P.get(x);if(S)return S.node.participant??"";const A=p(x);return A?A.type==="bpmn:Participant"?A.id:((k=d(A))==null?void 0:k.id)??"":""},qn=new Map,Hi=x=>{let S=qn.get(x);return S||qn.set(x,S={nodes:[],flows:[]}),S};for(const x of m)Hi(x.node.participant??"").nodes.push(x);for(const x of _)Hi(qa(x.flow.source)).flows.push(x);const li=x=>{var S;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((S=x.condition)==null?void 0:S.label)})},nn=(x,S,A)=>o.createShape({type:Yc(x.type),...x.eventDefinition?{eventDefinitionType:Ec[x.eventDefinition]}:{},businessObject:i.create(Yc(x.type),{id:x.id,name:x.name,...S!==void 0?{"bwl:band":S}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Gr=[...Qt.map(({op:x})=>x.participant.id).filter(x=>qn.has(x)),...[...qn.keys()].filter(x=>!h.some(S=>S.participant.id===x))],Ya=x=>x.endsWith("Gateway");for(const x of Gr){const S=qn.get(x),A=x?f(x):void 0,k=A?A.x+150:250;let L=A?A.y+80:120;const O=(te,ae,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,J)+C(te,ae??0)*$}return ae!==void 0&&A?A.y+Z+C(`pool:${x}`,ae)*$:le},j=(te,ae,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,J)+ae*$}return A?A.y+Z+ae*$:le},F=te=>te.participant?f(te.participant):u(),I=(te,ae,le,be,tt,nt,It,jt)=>{const xe=le!==void 0||be!==void 0,ve=Ne=>{const Me=()=>mt(le,Ne,A);jt?jt(Me):Me()},ue=C(le??`pool:${x}`,be??0);if((be===void 0||R(le,x,be,It??Number.NaN))&&It!==void 0&&At(le,ae,It)&&!ke(te,ae,tt,It))return{x:tt,y:It};if(xe)for(let Ne=0;Ne<4;Ne++){const Me=j(le,ue+Ne,nt);if(!ke(te,ae,tt,Me,Un(le,ue+Ne)))return ve(ue+Ne),{x:tt,y:Me}}const _e=O(le,be,nt);xe?ve(ue):jt?jt(()=>Pe(te,ae,ae.y+ae.height/2)):Pe(te,ae,_e);let He=tt;for(let Ne=0;Ne<64;Ne++){const Me=ke(te,ae,He,_e);if(!Me)break;He=Me.x+Me.width+H+ae.width/2}return{x:He,y:_e}},Y=new Set(S.flows.map(te=>te.flow.target)),Q=new Map,se=te=>{if(te===void 0)return;const ae=r.get(te);if(!(!ae||typeof ae.x!="number"||typeof ae.width!="number"))return ae.x+ae.width+H};for(const te of S.nodes){if(Y.has(te.node.id))continue;const ae=nn(te.node,te.band,te.afterColumn),le=X(te),be=te.node.lane?`${te.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",tt=F(te.node),nt=Q.get(be)??k,It=se(te.afterColumn),jt=It===void 0?nt:Math.max(nt,It);let xe;const ve=I(tt,ae,te.node.lane,le,jt,L,void 0,vn.has(te.node.id)&&te.node.participant!==void 0?ue=>xe=ue:void 0);if(xe?n.createShape(ae,ve,tt,{autoResize:!1}):n.createShape(ae,ve,tt),xe){const ue=te.node.lane?f(te.node.lane):tt;Rn.set(te.node.id,{container:ue,relCy:ve.y-ue.y,grow:xe})}Q.set(be,ve.x+ae.width+H),!te.node.lane&&le===void 0&&(L+=160)}const ce=new Set,re=new Map,fe=new Map,ye=new Map;if(x&&Ee.has(`pool:${x}`)){const te=new Map;for(const xe of S.flows)te.set(xe.flow.target,(te.get(xe.flow.target)??0)+1);const ae=xe=>O(xe.node.lane,he(xe),Number.NaN),le=new Set,be=xe=>{var _e;const ve=(_e=P.get(xe))==null?void 0:_e.node.participant;if(ve)return p(ve);const ue=p(xe);if(ue)return ue.type==="bpmn:Participant"?ue:d(ue)},tt=xe=>{const ve=[],ue=new Set([xe]),_e=[xe];for(;_e.length;){const He=_e.shift(),Ne=P.get(He);Ne&&ve.push(Ne);for(const Me of S.flows)Me.flow.source!==He||ue.has(Me.flow.target)||(te.get(Me.flow.target)??0)!==1||(ue.add(Me.flow.target),_e.push(Me.flow.target))}return ve},nt=xe=>{if(!A)return;const ve=new Set(xe.map(He=>He.node.id));let ue=!1,_e=!1;for(const He of v){if(!ve.has(He.flow.source))continue;const Ne=be(He.flow.target);!Ne||Ne.id===A.id||(Ne.y<A.y?ue=!0:_e=!0)}return ue&&!_e?"up":_e&&!ue?"down":void 0};for(const xe of S.nodes){if(!Ya(xe.node.type))continue;const ve=O(xe.node.lane,X(xe),Number.NaN);if(Number.isNaN(ve))continue;const ue=[];for(const Me of S.flows){if(Me.flow.source!==xe.node.id)continue;const st=P.get(Me.flow.target);if(!st||st.node.lane!==xe.node.lane||(te.get(st.node.id)??0)!==1)continue;const ft=X(st);if(ft===void 0)continue;const Jt=O(st.node.lane,ft,Number.NaN);if(Number.isNaN(Jt))continue;const Mn=tt(st.node.id),yt=nt(Mn);yt&&ue.push({subtree:Mn,band:ft,row:Jt,dir:yt})}if(!ue.some(Me=>Me.dir==="up")||!ue.some(Me=>Me.dir==="down")||!ue.some(Me=>Me.dir==="up"&&ue.some(st=>st.dir==="down"&&st.row<Me.row)))continue;const He=[...ue].sort((Me,st)=>Me.row-st.row);[...ue.filter(Me=>Me.dir==="up"),...ue.filter(Me=>Me.dir==="down")].sort((Me,st)=>Me.dir===st.dir?Me.row-st.row:Me.dir==="up"?-1:1).forEach((Me,st)=>{const ft=He[st].band;if(ft!==Me.band){le.add(xe.node.id);for(const Jt of Me.subtree)X(Jt)===Me.band&&oe.set(Jt.node.id,ft)}})}const It=xe=>{if(!A)return;const ve=new Set(xe.map(He=>He.node.id));let ue=!1,_e=!1;for(const He of v){if(!ve.has(He.flow.target))continue;const Ne=be(He.flow.source);!Ne||Ne.id===A.id||(Ne.y<A.y?ue=!0:_e=!0)}return ue&&!_e?"up":_e&&!ue?"down":void 0};for(const xe of S.nodes){if(!Ya(xe.node.type))continue;const ve=xe.node.lane??`pool:${x}`,ue=ne.get(ve);if(!ue||ue.size<2)continue;const _e=ue.get(0);if(_e===void 0)continue;const He=Math.max(...ue.values()),Ne=_e===He&&_e!==0?"down":void 0;if(!Ne)continue;const Me=[];for(const yt of S.flows){if(yt.flow.source!==xe.node.id)continue;const Hn=P.get(yt.flow.target);if(!Hn||Hn.node.lane!==xe.node.lane||(te.get(Hn.node.id)??0)!==1)continue;const Za=he(Hn);Za!==void 0&&Me.push({t:Hn,subtree:tt(Hn.node.id),band:Za})}const st=Me.find(yt=>(ue.get(yt.band)??yt.band)===_e);if(!st||It(st.subtree)===Ne||nt(st.subtree)===Ne)continue;const ft=Me.find(yt=>yt!==st&&It(yt.subtree)===Ne);if(!ft)continue;const Jt=st.band,Mn=ft.band;for(const yt of st.subtree)he(yt)===Jt&&oe.set(yt.node.id,Mn);for(const yt of ft.subtree)he(yt)===Mn&&oe.set(yt.node.id,Jt);le.add(xe.node.id)}for(const xe of S.nodes){if(!Ya(xe.node.type))continue;const ve=ae(xe);if(Number.isNaN(ve)||E.some(Me=>{var st,ft;return(((st=Me.placement)==null?void 0:st.anchor)??(Me.association?Me.association.source===Me.annotation.id?Me.association.target:Me.association.source:void 0))===xe.node.id&&((ft=Me.placement)==null?void 0:ft.side.startsWith("bottom"))}))continue;let _e,He=!1,Ne;for(const Me of S.flows){if(Me.flow.source!==xe.node.id)continue;const st=P.get(Me.flow.target);if(!st||!st.node.lane&&X(st)===void 0)continue;const ft=ae(st);Number.isNaN(ft)||(Math.abs(ft-ve)<.5&&(He=!0),ft>ve?!_e||ft>_e.row?_e={id:st.node.id,row:ft,count:1}:ft===_e.row&&_e.count++:ft<ve&&st.node.lane===xe.node.lane&&(!Ne||ft>Ne.row?Ne={op:st,row:ft,count:1}:ft===Ne.row&&Ne.count++))}_e&&_e.count===1&&(te.get(_e.id)??0)===1&&!le.has(xe.node.id)&&ce.add(_e.id),!He&&Ne&&Ne.count===1&&(te.get(Ne.op.node.id)??0)===1&&!De.has(xe.node.id)&&re.set(Ne.op.node.id,{lane:xe.node.lane,band:he(xe)})}const jt=new Map;for(const xe of v)jt.set(xe.flow.target,[...jt.get(xe.flow.target)??[],xe]);for(const xe of S.nodes){const ve=jt.get(xe.node.id);if(!ve||ve.length!==1||!te.get(xe.node.id)||!xe.node.lane&&X(xe)===void 0||B.has(xe.node.id))continue;const ue=(_1=P.get(ve[0].flow.source))==null?void 0:_1.node.participant,_e=ue?p(ue):void 0;if(!_e||!A||_e.id===A.id)continue;const He=xe.node.lane??`pool:${x}`,Ne=ne.get(He);if(!Ne)continue;const Me=Ne.get(0)??0,st=(Ne.get(he(xe)??0)??Me)-Me;if(st===0)continue;const ft=_e.y<A.y;if(ft&&st<0||!ft&&st>0)continue;let Jt;for(const[Mn,yt]of Ne){const Hn=yt-Me;(ft&&Hn<0&&(!Jt||Hn<Jt.row)||!ft&&Hn>0&&(!Jt||Hn>Jt.row))&&(Jt={band:Mn,row:Hn})}Jt&&fe.set(xe.node.id,{lane:xe.node.lane,band:Jt.band})}}const Ze=new Set;let Be=0;for(;Be++<S.nodes.length+2;){for(let le=0;le<S.nodes.length+S.flows.length+2;le++){let be=!1;for(const tt of S.flows){const nt=tt.flow;if(Ze.has(nt.id))continue;const It=p(nt.source);if(!It)continue;const jt=p(nt.target),xe=P.get(nt.target);if(!jt&&xe){const ve=nn(xe.node,xe.band),ue=he(xe);if(xe.node.lane||ue!==void 0){const _e=F(xe.node),He=It,Ne=He.x+(ye.get(nt.source)??0)+He.width+H,Me=re.get(nt.target)??fe.get(nt.target),st=I(_e,ve,Me?Me.lane:xe.node.lane,Me?Me.band:ue,ce.has(nt.target)?He.x+He.width/2:Ne,Number.NaN,Me||!Ct(nt.target)?void 0:He.y+He.height/2),ft=n.createShape(ve,st,_e);ce.has(nt.target)&&ye.set(nt.target,Ne-(ft.x+ft.width/2)),n.connect(It,ft,{type:"bpmn:SequenceFlow",businessObject:li(nt)})}else s.append(It,ve,{connection:{type:"bpmn:SequenceFlow",businessObject:li(nt)}})}else if(jt)n.connect(It,jt,{type:"bpmn:SequenceFlow",businessObject:li(nt)});else continue;Ze.add(nt.id),be=!0}if(!be)break}const te=S.nodes.filter(le=>!p(le.node.id));if(!te.length)break;const ae=te[0];{const le=nn(ae.node,ae.band),be=F(ae.node),tt=X(ae);n.createShape(le,I(be,le,ae.node.lane,tt,k,L),be),!ae.node.lane&&tt===void 0&&(L+=160)}}}const Cn=40,gt=x=>{const S=Q=>Q.kind==="label-over-line"||Q.kind==="label-over-shape"||Q.kind==="label-on-shared-segment"?Q.edge===x.id:Q.kind==="annotation-over-label"||Q.kind==="pool-name-over-label"?Q.label===x.id:!1,A=()=>new Set(pt(Ve(r)).filter(Q=>!S(Q)).map(Q=>ct(Q))),k=A(),L=x.waypoints.map(Q=>({x:Q.x,y:Q.y})),O=x.label,j=O&&{x:O.x,y:O.y};n.layoutConnection(x,{waypoints:[]});const F=A(),I=[...F].filter(Q=>!k.has(Q)).length,Y=[...k].filter(Q=>!F.has(Q)).length;I<=Y||(n.updateWaypoints(x,L),O&&j&&(O.x!==j.x||O.y!==j.y)&&n.moveElements([O],{x:j.x-O.x,y:j.y-O.y}))},St=5,Oi=10,qE=200,gc=new Set([..._.map(x=>x.flow.id),...v.map(x=>x.flow.id),...en(e,"sequenceFlow.update").map(x=>x.id),...en(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),b5=(x,S,A,k,L,O)=>{const j=new Set(x.map(te=>te.id)),F=Math.min(...x.map(te=>te.x))+S-Oi,I=Math.max(...x.map(te=>te.x+te.width))+S+qE+Oi,Y=Math.min(...x.map(te=>te.y+Math.min(0,...A)))-Oi,Q=Math.max(...x.map(te=>te.y+te.height+Math.max(0,...A)))+Oi,se=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const ae=te;return gc.has(ae.id)||!ae.waypoints||ae.waypoints.length<2||[ae.source,ae.target].some(be=>!be||j.has(be.id)||be.x>=k)?!1:ae.waypoints.some((be,tt)=>{const nt=ae.waypoints[tt+1];return!!nt&&Math.max(be.x,nt.x)>=F&&Math.min(be.x,nt.x)<=I&&Math.max(be.y,nt.y)>=Y&&Math.min(be.y,nt.y)<=Q})});if(!se.length)return 0;const ce=te=>{const ae=new Map;for(const le of x)for(const be of A){const tt={id:le.id,type:le.type,x:le.x+S+te,y:le.y+be,width:le.width,height:le.height};for(const nt of se){let It=1/0;for(let xe=0;xe+1<nt.waypoints.length;xe++)It=Math.min(It,as(nt.waypoints[xe],nt.waypoints[xe+1],tt));const jt=`${nt.id}|${le.id}`;ae.set(jt,Math.min(ae.get(jt)??1/0,It))}}return ae},re=[...ce(0)].filter(([,te])=>te<=St).map(([te])=>te);if(!re.length)return 0;let fe=0;for(let te=1;te<=qE;te++){const ae=ce(te);if([...ae.values()].every(le=>le>St)&&re.every(le=>(ae.get(le)??1/0)>=Oi)){fe=te;break}}if(!fe)return 0;const ye=Math.min(...x.map(te=>te.x))+S+fe,Ze=new Set(re.map(te=>te.slice(0,te.indexOf("|"))));return se.some(te=>te.type==="bpmn:SequenceFlow"&&Ze.has(te.id)&&te.waypoints.some((ae,le)=>{const be=te.waypoints[le+1];if(!be||Math.min(ae.y,be.y)>O||Math.max(ae.y,be.y)<O||ae.y===be.y)return!1;const tt=ae.x+(O-ae.y)*(be.x-ae.x)/(be.y-ae.y);return tt>L&&tt<ye}))?0:fe},Vr=(x,S=()=>!0)=>{const A=p(x);if(!A)return[];const k=[A],L=new Set([x]);for(let O=0;O<k.length;O++){const j=k[O].id;for(const F of _){const I=F.flow.target;if(F.flow.source!==j||L.has(I)||!P.has(I))continue;L.add(I);const Y=p(I);Y&&S(Y)&&k.push(Y)}}return k},x5=(x,S=()=>!0)=>{const A=p(x);if(!A)return[];const k=[A],L=new Set([x]);for(let O=0;O<k.length;O++){const j=k[O].id;for(const F of _){const I=F.flow.source;if(F.flow.target!==j||L.has(I)||!P.has(I))continue;L.add(I);const Y=p(I);Y&&S(Y)&&k.push(Y)}}return k},Di=30,Li=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",cp=(x,S)=>hf(n,x,S),mc=(x,S,A=!1)=>{const k=new Set(x.flatMap(I=>I.subtree.map(Y=>Y.id)));for(const I of x){const Y=(I.pool.children??[]).filter(Li).filter(se=>!k.has(se.id));if(I.subtree.some(se=>Y.some(ce=>se.x+S<ce.x+ce.width+Di&&se.x+S+se.width+Di>ce.x&&se.y<ce.y+ce.height&&se.y+se.height>ce.y)))return null}const L=x.map(I=>I.pool.width),O=A?r.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(Y=>({x:Y.x,y:Y.y}))})):[],j=r.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(x.flatMap(I=>I.subtree),{x:S,y:0});const F=x.map(I=>{const Q=Math.max(...I.subtree.map(se=>se.x+se.width))+hy-(I.pool.x+I.pool.width);return Q>0&&cp(I.pool,I.pool.width+Q),Q});return()=>{n.moveElements(x.flatMap(I=>I.subtree),{x:-S,y:0}),x.forEach((I,Y)=>{F[Y]>0&&cp(I.pool,L[Y])});for(const{c:I,wps:Y}of O){const Q=I.waypoints??[];Q.length===Y.length&&Q.every((ce,re)=>Math.abs(ce.x-Y[re].x)<=.5&&Math.abs(ce.y-Y[re].y)<=.5)||n.updateWaypoints(I,Y.map(ce=>({x:ce.x,y:ce.y})))}for(let I=0;I<3;I++){let Y=0;for(const Q of j){const se=Q.x-Q.label.x,ce=Q.y-Q.label.y;Math.abs(se)<=.5&&Math.abs(ce)<=.5||(n.moveElements([Q.label],{x:se,y:ce}),Y++)}if(!Y)break}}},yg=x=>{var L,O;const S=new Map,A=new Map;for(const j of r.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(S.set(F.id,F),A.set(F.id,[]))}for(const j of r.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,I=(L=F.source)==null?void 0:L.id,Y=(O=F.target)==null?void 0:O.id;I&&Y&&A.has(I)&&A.get(I).push(Y),I&&Y&&A.has(Y)&&A.get(Y).push(I)}const k=[];for(const[j,F]of A)F.length&&F.every(I=>x.has(I))&&k.push(S.get(j));return k},YE=(x,S)=>{if(!x.length)return null;const A=new Set(x.map(Q=>Q.id)),k=r.getAll().filter(Q=>Q.type==="bpmn:Participant"&&!A.has(Q.id)),L=Math.min(...k.filter(Q=>(Q.children??[]).length>0).map(Q=>Q.x)),O=new Set(x.filter(Q=>Math.abs(Q.x-L)<=2).map(Q=>Q.id));if(x.some(Q=>{const se=O.has(Q.id)?Q.x:Q.x+S,ce=O.has(Q.id)?Q.width+S:Q.width;return k.some(re=>se<re.x+re.width+Di&&se+ce+Di>re.x&&Q.y<re.y+re.height&&Q.y+Q.height>re.y)}))return null;const F=r.filter(Q=>Q.type==="label").map(Q=>({label:Q,x:Q.x,y:Q.y})),I=x.filter(Q=>!O.has(Q.id)),Y=x.filter(Q=>O.has(Q.id)).map(Q=>({pool:Q,was:{x:Q.x,y:Q.y,width:Q.width,height:Q.height}}));I.length&&n.moveElements(I,{x:S,y:0});for(const{pool:Q,was:se}of Y)n.resizeShape(Q,{...se,width:se.width+S});return()=>{for(const{pool:Q,was:se}of Y)n.resizeShape(Q,se);I.length&&n.moveElements(I,{x:-S,y:0});for(let Q=0;Q<3;Q++){let se=0;for(const ce of F){const re=ce.x-ce.label.x,fe=ce.y-ce.label.y;Math.abs(re)<=.5&&Math.abs(fe)<=.5||(n.moveElements([ce.label],{x:re,y:fe}),se++)}if(!se)break}}},KE=(x,S,A)=>{const k=A.x+A.width/2,L=S.y>A.y,O=L?A.y+A.height:A.y,j=L?S.y:S.y+S.height,F=x.source===S?[{x:k,y:j},{x:k,y:O}]:[{x:k,y:O},{x:k,y:j}],I=Ve(r),Y={...I.edges.find(Q=>Q.id===x.id),waypoints:F};return zt(Y,Gn(I)).length?!1:(n.updateWaypoints(x,F),!0)},_5=()=>{const x=r.filter(L=>L.type==="bpmn:Participant"),S=Math.min(...x.filter(L=>(L.children??[]).length>0).map(L=>L.x)),A=L=>!!L&&L.type==="bpmn:Participant"&&!(L.children??[]).length&&Math.abs(L.x-S)<=2&&!h.some(O=>O.participant.id===L.id),k=new Set;for(const L of r.getAll()){if(L.type!=="bpmn:MessageFlow")continue;const O=L;if((O.waypoints??[]).length!==2)continue;const j=[O.source,O.target].find(I=>A(I)),F=j===O.source?O.target:O.source;j&&F&&F.type!=="bpmn:Participant"&&k.add(O.id)}return k},w5=x=>{var A;const S=new Map;for(const k of x){const L=r.get(k);if(!L||(L.waypoints??[]).length===2)continue;const O=((A=L.source)==null?void 0:A.type)==="bpmn:Participant"?L.source:L.target,j=O===L.source?L.target:L.source;if(j.x+j.width/2<=O.x+O.width)continue;const F=S.get(O.id)??{pool:O,msgs:[]};F.msgs.push({conn:L,other:j}),S.set(O.id,F)}for(const{pool:k,msgs:L}of S.values()){const O=Math.max(...L.map(({other:fe})=>fe.x+fe.width/2))+ff;if(r.getAll().some(fe=>{if(fe.type!=="bpmn:Participant"||fe.id===k.id)return!1;const ye=fe;return k.x<ye.x+ye.width+Di&&O+Di>ye.x&&k.y<ye.y+ye.height&&k.y+k.height>ye.y}))continue;const F={x:k.x,y:k.y,width:k.width,height:k.height},I=[...k.incoming??[],...k.outgoing??[]],Y=I.map(fe=>({c:fe,wps:(fe.waypoints??[]).map(ye=>({x:ye.x,y:ye.y}))})),Q=I.flatMap(fe=>{const ye=fe.label;return ye?[{label:ye,x:ye.x,y:ye.y}]:[]}),se=gr();n.resizeShape(k,{...F,width:O-k.x});const ce=L.filter(({conn:fe,other:ye})=>KE(fe,k,ye)).length,re=gr();if(!(ce>0&&re.messages>se.messages&&re.lines>=se.lines)){n.resizeShape(k,F);for(const{c:fe,wps:ye}of Y){const Ze=fe.waypoints??[];Ze.length===ye.length&&Ze.every((te,ae)=>Math.abs(te.x-ye[ae].x)<=.5&&Math.abs(te.y-ye[ae].y)<=.5)||n.updateWaypoints(fe,ye.map(te=>({x:te.x,y:te.y})))}for(let fe=0;fe<3;fe++){let ye=0;for(const Ze of Q){const Be=Ze.x-Ze.label.x,te=Ze.y-Ze.label.y;Math.abs(Be)<=.5&&Math.abs(te)<=.5||(n.moveElements([Ze.label],{x:Be,y:te}),ye++)}if(!ye)break}}}},XE=()=>{let x=0;for(const S of r.getAll()){if(S.type!=="bpmn:DataInputAssociation"&&S.type!=="bpmn:DataOutputAssociation")continue;const A=S.waypoints??[];for(let k=1;k<A.length;k++)x+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return x},ZE=()=>{let x=0;for(const S of r.getAll()){if(S.type!=="bpmn:Association")continue;const A=S.waypoints??[];for(let k=1;k<A.length;k++)x+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return x},E5=x=>{const S=[];for(const A of r.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const k=A;if(x.has(k.id))continue;const O=[...k.incoming??[],...k.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===k?I.target:I.source);if(!O.length||O.some(I=>I===void 0))continue;const j=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const Y=I,Q=[Y.source,Y.target];return Q.some(se=>!se)?[]:Q.map(se=>se.id)},F=O.flatMap(I=>j(I));F.length&&F.every(I=>x.has(I))&&S.push(k)}return S},QE=()=>pt(Ve(r)).filter(x=>x.kind==="edge-crosses-shape").length,JE=x=>{const S=(x.children??[]).filter(Li);let A=0;for(let k=0;k<S.length;k++)for(let L=k+1;L<S.length;L++){const O=S[k],j=S[L];O.x<j.x+j.width&&O.x+O.width>j.x&&O.y<j.y+j.height&&O.y+O.height>j.y&&A++}return A},gr=()=>{const x=Ve(r),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:x.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:x.edges.filter(A=>S(A.waypoints)).length}},e1=x=>{const S=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const L=k;if(!L.waypoints||L.waypoints.length!==2)continue;const O=L.source,j=L.target;if(!O||!j)continue;const F=x.has(O.id);if(F===x.has(j.id))continue;const I=F?j:O,Y=d(I);if(!Y||x.has(I.id))continue;const Q=S.get(Y.id);Q?I.x<Q.minX&&(Q.minX=I.x):S.set(Y.id,{pool:Y,minX:I.x})}const A=[];for(const{pool:k,minX:L}of S.values()){const O=(k.children??[]).filter(j=>Li(j)&&!x.has(j.id)&&j.x>=L);O.length&&A.push({subtree:O,pool:k})}return A},S5=(x,S,A)=>{const k=new Map(S.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),L=new Set(x);for(const j of S)for(const F of j.subtree)L.add(F.id);let O=!1;for(;;){let j=0;for(const F of e1(L)){if(F.pool===A)continue;const I=k.get(F.pool.id);I?I.subtree.push(...F.subtree):k.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const Y of F.subtree)L.add(Y.id);j+=F.subtree.length}if(!j)break;O=!0}return O?[...k.values()]:null},R5=(x,S)=>{const A=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const O=L,j=O.waypoints;if(!j||j.length<2||!j.every(re=>Math.abs(re.x-j[0].x)<1))continue;const F=O.source,I=O.target;if(!F||!I)continue;const Y=x.has(F.id);if(Y===x.has(I.id))continue;const Q=Y?I:F,se=d(Q);if(!se||se===S||se===d(Y?F:I))continue;const ce=A.get(se.id);ce?Q.x<ce.minX&&(ce.minX=Q.x):A.set(se.id,{pool:se,minX:Q.x})}const k=[];for(const{pool:L,minX:O}of A.values()){const j=(L.children??[]).filter(F=>Li(F)&&!x.has(F.id)&&F.x>=O);j.length&&k.push({subtree:j,pool:L})}return k},t1=x=>{const S=Ve(r),A=S.shapes.filter(L=>x.has(L.id)),k=new Set;for(const L of S.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const O of zt(L,A))k.add(`${L.id}|${O.id}`);return k},n1=new Map;for(const x of en(e,"sequenceFlow.update")){if(x.target===void 0)continue;const S=P.get(x.target);if(!S)continue;const A=p(x.target),k=p(x.id);if(!A||!k)continue;const L=x.source!==void 0?p(x.source):k.source,O=k.target;if(!L||!O||O.id===A.id)continue;const j=k.waypoints&&k.waypoints.length>=3&&Math.abs(k.waypoints[0].x-k.waypoints[1].x)<1&&Math.abs(k.waypoints[0].y-k.waypoints[1].y)>1?{x:k.waypoints[0].x,y:k.waypoints[0].y}:void 0,F=j?k.waypoints[1].y:void 0,I=j&&k.label?{x:k.label.x,y:k.label.y}:void 0,Y=I&&k.label&&Math.abs(I.y+k.label.height/2-F)<=$/5&&I.x+k.label.width>j.x?I.x+k.label.width+6:void 0,Q=(L.outgoing??[]).filter(Te=>Te.type==="bpmn:SequenceFlow"&&Te.id!==k.id&&Te.target&&!gc.has(Te.id)),se=new Set(Q.map(Te=>Te.target.id)),ce=Te=>{const Pt={type:"bpmn:Task",x:Te.x+2,y:Te.y+2,width:Te.width-4,height:Te.height-4};return Q.find(_t=>(_t.waypoints??[]).some((fn,Oe)=>!!_t.waypoints[Oe+1]&&as(fn,_t.waypoints[Oe+1],Pt)===0))},re=Vr(x.target),fe=new Set(re.map(Te=>Te.id)),ye=Rn.has(x.target)?{autoResize:!1}:void 0,Ze=Math.min(...re.map(Te=>Te.x)),Be=Math.max(...re.map(Te=>Te.x+Te.width)),te=L.x+L.width,ae=O.x+O.width<=L.x,le=(()=>{if(!ae)return;const Te=d(A),Pt=((Te==null?void 0:Te.children)??[]).filter(Ie=>Li(Ie)&&!fe.has(Ie.id)&&Ie.type!=="bpmn:Group"&&Ie.type!=="bpmn:Participant"),_t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],fn=r.getAll().filter(Ie=>{if(!_t.includes(Ie.type))return!1;const Bt=Ie;return Bt.id===k.id||gc.has(Bt.id)||!Bt.waypoints||Bt.waypoints.length<2?!1:![Bt.source,Bt.target].some(Tt=>!Tt||fe.has(Tt.id))}),Oe=(Ie,Bt)=>re.every(Tt=>{var Yr;const bt={id:Tt.id,type:Tt.type,x:Tt.x+Ie,y:Tt.y+Bt,width:Tt.width,height:Tt.height};return Te&&(bt.x<Te.x||bt.x+bt.width>Te.x+Te.width||bt.y<Te.y||bt.y+bt.height>Te.y+Te.height)||!At((Yr=P.get(Tt.id))==null?void 0:Yr.node.lane,Tt,Tt.y+Bt+Tt.height/2)||Pt.some(Yn=>bt.x<Yn.x+Yn.width+Oi&&bt.x+bt.width+Oi>Yn.x&&bt.y<Yn.y+Yn.height+Oi&&bt.y+bt.height+Oi>Yn.y)?!1:fn.every(Yn=>{for(let uo=0;uo+1<Yn.waypoints.length;uo++)if(as(Yn.waypoints[uo],Yn.waypoints[uo+1],bt)<Oi)return!1;return!0})}),Ye=L.x+L.width/2,wt=L.y+L.height/2,Ke=k.waypoints??[],Mt=Ke.length>=2&&Math.abs(Ke[0].y-Ke[1].y)<1&&Ke[1].x<Ke[0].x;return[...F!==void 0?[{cx:Ye,cy:F}]:[],...Mt?[{cx:L.x-Cn-A.width/2,cy:Ke[0].y}]:[],{cx:Ye,cy:wt+$},{cx:Ye,cy:wt-$}].find(Ie=>Oe(Ie.cx-(A.x+A.width/2),Ie.cy-(A.y+A.height/2)))})(),be=ae&&!le?te:O.x,tt=A.y+A.height/2,nt=b5(re,te+Cn-Ze,[0,L.y+L.height/2-tt,O.y+O.height/2-tt],be,te,L.y+L.height/2),It=te+Cn+nt,jt=(()=>{if(Y===void 0)return 0;const Te=te+Cn,Pt=L.y+L.height/2-A.height/2,_t={x:Te,y:Pt,width:Be-Ze,height:A.height},fn=d(L);return((fn==null?void 0:fn.children)??[]).some(Ye=>Li(Ye)&&!fe.has(Ye.id)&&Ye.id!==L.id&&Ye.id!==O.id&&Ye.type!=="bpmn:Group"&&Ye.type!=="bpmn:Participant"&&Ye.x<_t.x+_t.width&&Ye.x+Ye.width>_t.x&&Ye.y<_t.y+_t.height&&Ye.y+Ye.height>_t.y)||ce(_t)?Math.max(0,Y-Te):0})(),xe=le?0:Be-Ze+Cn*2+nt+jt-(ae?0:O.x-te);let ve=[];if(xe>0){const Te=d(A),Pt=(Te==null?void 0:Te.children)??[],_t=Ke=>Ke.type==="bpmn:Lane";ve=(()=>{const Ke=new Set;for(const Fe of Pt)Li(Fe)&&!fe.has(Fe.id)&&Fe.id!==L.id&&Fe.x>=be&&Ke.add(Fe.id);const Mt=[];for(const Fe of Pt){if(Fe.type!=="bpmn:DataStoreReference"&&Fe.type!=="bpmn:DataObjectReference")continue;const Ie=Fe,Tt=[...Ie.incoming??[],...Ie.outgoing??[]].filter(bt=>bt.type==="bpmn:DataInputAssociation"||bt.type==="bpmn:DataOutputAssociation").map(bt=>bt.source===Ie?bt.target:bt.source);Tt.length&&Tt.every(bt=>bt!==void 0&&Ke.has(bt.id))&&Mt.push(Ie)}return Mt})();const Oe=Pt.filter(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&!_t(Ke)&&Ke.type!=="label"&&!fe.has(Ke.id)&&Ke.id!==L.id&&Ke.x>=be),Ye=Oe.flatMap(Ke=>Ke.labels??[]),wt=Te?[Te,...Pt.filter(Ke=>_t(Ke))]:[];if(Oe.length){const Ke=new Set(Oe.map(Qe=>Qe.id)),Mt=e1(Ke),Fe=Mt.length?S5(Ke,Mt,Te):null,Ie=Qe=>{const xt=new Set(Ke);for(const Nt of Qe)for(const ko of Nt.subtree)xt.add(ko.id);return E5(xt)},Bt=Ie(Mt),Tt=Fe?Ie(Fe):Bt,bt=yg(Ke),Yr=new Set(Ke);for(const Qe of Mt)for(const xt of Qe.subtree)Yr.add(xt.id);const Yn=Mt.length?yg(Yr):bt,uo=(()=>{if(!Fe)return[];const Qe=new Set(Ke);for(const xt of Fe)for(const Nt of xt.subtree)Qe.add(Nt.id);return yg(Qe)})(),Qa=Fe??Mt,Kr=(()=>{const Qe=new Set(Ke);for(const xt of Qa)for(const Nt of xt.subtree)Qe.add(Nt.id);return R5(Qe,Te)})(),Rg=Kr.length?Ie([...Qa,...Kr]):Bt,Gi=new Set([...Oe,...wt].map(Qe=>Qe.id)),vt=Pt.filter(Qe=>{const xt=Qe.labelTarget;return Qe.type==="label"&&!!xt&&"waypoints"in xt&&!!xt.source&&!!xt.target&&Gi.has(xt.source.id)&&Gi.has(xt.target.id)}),wn=_5();n.createSpace([...Oe,...Ye,...vt],wt,{x:xe,y:0},"e",be-1);const Yt=(Qe,xt,Nt)=>{const ko=gr(),dp=Nt?t1(Nt):null,hp=mc(Qe,xe,!!Nt);if(!hp)return!1;const bc=xt.length?YE(xt,xe):null,gp=gr(),Kt=!!Nt&&!!dp&&[...t1(Nt)].some(Zr=>!dp.has(Zr));return gp.messages>ko.messages&&gp.lines>=ko.lines&&!Kt?!0:(bc==null||bc(),hp(),!1)},ui=Kr.length>0&&Yt([...Qa,...Kr],Fe?uo:Yn,new Set(Kr.flatMap(Qe=>Qe.subtree.map(xt=>xt.id)))),Xr=!ui&&Fe?Yt(Fe,uo):!1;let po=ui||Xr;!po&&Mt.length&&(po=Yt(Mt,Yn));const Ja=ui?Rg:Xr?Tt:Bt;if(!po){for(const Qe of Mt){const xt=gr(),Nt=mc([Qe],xe);if(!Nt)continue;const ko=gr();(ko.messages<=xt.messages||ko.lines<xt.lines)&&Nt()}if(bt.length){const Qe=gr(),xt=YE(bt,xe);if(xt){const Nt=gr();(Nt.messages<=Qe.messages||Nt.lines<Qe.lines)&&xt()}}}if(w5(wn),Ja.length){const Qe=()=>new Set(pt(Ve(r)).map(Nt=>ct(Nt))),xt=Nt=>{const ko=ZE(),dp=Qe(),hp=Nt.map(Kt=>({a:Kt,x:Kt.x,y:Kt.y})),bc=r.filter(Kt=>Kt.type==="label").map(Kt=>({label:Kt,x:Kt.x,y:Kt.y}));n.moveElements(Nt,{x:xe,y:0});const gp=[...Qe()].filter(Kt=>!dp.has(Kt));if(ZE()<ko&&gp.length===0)return!0;for(const{a:Kt,x:Zr,y:xc}of hp)(Kt.x!==Zr||Kt.y!==xc)&&n.moveElements([Kt],{x:Zr-Kt.x,y:xc-Kt.y});for(const Kt of bc){const Zr=Kt.x-Kt.label.x,xc=Kt.y-Kt.label.y;(Zr!==0||xc!==0)&&n.moveElements([Kt.label],{x:Zr,y:xc})}return!1};if(!xt(Ja)&&Ja.length>1)for(const Nt of Ja)xt([Nt])}}}const ue=S.node.lane!==void 0?p(S.node.lane):S.node.participant!==void 0?p(S.node.participant):void 0,_e=Te=>{if(!ue)return!0;const Pt=Te.y+Te.height/2;return Pt>=ue.y&&Pt<=ue.y+ue.height},He=!_e(L)&&_e(O),Ne=Te=>Te.y+Te.height/2,Me=()=>{const Te=L.x+L.width,Pt=O.x,_t=Ne(O)-A.height/2,fn=Ne(O)+A.height/2;return!r.getAll().some(Oe=>Li(Oe)&&Oe.type!=="bpmn:Participant"&&Oe.type!=="bpmn:Group"&&Oe.type!=="bpmn:TextAnnotation"&&Oe.id!==L.id&&Oe.id!==O.id&&Oe.id!==A.id&&Oe.x<Pt&&Oe.x+Oe.width>Te&&Oe.y<fn&&Oe.y+Oe.height>_t)},st=!He&&S.band!==void 0&&_e(O)&&!R(S.node.lane,S.node.participant,S.band,Ne(L))&&R(S.node.lane,S.node.participant,S.band,Ne(O))&&O.x>=L.x+L.width&&Me(),ft=He||st?O:L,Jt=ft.y+ft.height/2,Mn=Jt-(A.y+A.height/2),yt=S.band!==void 0,Hn=yt?[A]:re,Za=(S.band===void 0||R(S.node.lane,S.node.participant,S.band,Jt))&&Ct(x.target)&&Hn.every(Te=>{var Pt;return At((Pt=P.get(Te.id))==null?void 0:Pt.node.lane,Te,Te.y+Te.height/2+Mn)}),Y5=Te=>Math.abs(Te.y+Te.height/2-(A.y+A.height/2))<=$/2;if(Za&&yt){const Te=Math.abs(Mn)<=$/2?re.filter(Oe=>Oe.id!==A.id&&Y5(Oe)):[],Pt=A.y+A.height/2,fn=S.band!==void 0&&!R(S.node.lane,S.node.participant,S.band,Pt)?re.filter(Oe=>{var Ye,wt;return Oe.id!==A.id&&!Te.includes(Oe)&&((Ye=P.get(Oe.id))==null?void 0:Ye.band)===S.band&&((wt=P.get(Oe.id))==null?void 0:wt.node.lane)===S.node.lane&&(Math.abs(Oe.y+Oe.height/2-Pt)<=$/2||R(S.node.lane,S.node.participant,S.band,Oe.y+Oe.height/2))}).map(Oe=>({t:Oe,dy:Jt-(Oe.y+Oe.height/2)})).filter(({dy:Oe})=>Oe!==0):[];if(n.moveElements(re,{x:It-Ze,y:0},void 0,ye),n.moveElements([A],{x:0,y:Mn},void 0,ye),Te.length){const Oe=()=>new Set(pt(Ve(r)).map(Ie=>ct(Ie))),Ye=Oe(),wt=r.filter(Ie=>Ie.type==="label").map(Ie=>({label:Ie,x:Ie.x,y:Ie.y}));n.moveElements(Te,{x:0,y:Mn});const Ke=Oe(),Mt=[...Ke].filter(Ie=>!Ye.has(Ie)).length,Fe=[...Ye].filter(Ie=>!Ke.has(Ie)).length;if(Mt>Fe){n.moveElements(Te,{x:0,y:-Mn});for(const Ie of wt){const Bt=Ie.x-Ie.label.x,Tt=Ie.y-Ie.label.y;(Bt!==0||Tt!==0)&&n.moveElements([Ie.label],{x:Bt,y:Tt})}}}if(fn.length){const Oe=new Set(re.map(Ye=>Ye.id));for(const{t:Ye,dy:wt}of fn)ke(Ye.parent,Ye,Ye.x+Ye.width/2,Ye.y+Ye.height/2+wt,Oe)||n.moveElements([Ye],{x:0,y:wt})}}else n.moveElements(re,{x:It-Ze,y:Za?Mn:0},void 0,ye);const zi=d(A);if(!Za&&S.node.lane===void 0&&S.band!==void 0&&zi){const Te=zi.y+Z+C(`pool:${S.node.participant??""}`,S.band)*$,Pt=Te-(A.y+A.height/2);Pt!==0&&!ke(zi,A,A.x+A.width/2,Te,fe)&&n.moveElements([A],{x:0,y:Pt},void 0,ye)}if(le)n.moveElements(re,{x:le.cx-(A.x+A.width/2),y:le.cy-(A.y+A.height/2)},void 0,ye);else if(zi){const Te=(zi.children??[]).filter(Oe=>Li(Oe)&&!fe.has(Oe.id)&&Oe.type!=="bpmn:Group"&&Oe.type!=="bpmn:Participant"),Pt=(Oe,Ye,wt,Ke,Mt)=>Oe.x+Ye<Mt.x+Mt.width+Ke&&Oe.x+Ye+Oe.width+Ke>Mt.x&&Oe.y+wt<Mt.y+Mt.height+Ke&&Oe.y+wt+Oe.height+Ke>Mt.y,_t=Te.find(Oe=>Pt(A,0,0,0,Oe)),fn=_t?void 0:ce(A);if(_t||fn){const Oe=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Ye=r.getAll().filter(vt=>{if(!Oe.includes(vt.type))return!1;const wn=vt;return gc.has(wn.id)||!wn.waypoints||wn.waypoints.length<2?!1:![wn.source,wn.target].some(Yt=>!Yt||fe.has(Yt.id))}),wt=(vt,wn,Yt)=>{var ui;return At((ui=P.get(vt.id))==null?void 0:ui.node.lane,vt,vt.y+Yt+vt.height/2)&&vt.x+wn>=zi.x&&vt.x+wn+vt.width<=zi.x+zi.width&&vt.y+Yt>=zi.y&&vt.y+Yt+vt.height<=zi.y+zi.height},Ke=(vt,wn)=>re.every(Yt=>wt(Yt,vt,wn)&&!Te.some(ui=>Pt(Yt,vt,wn,Oi,ui))&&Ye.every(ui=>{const Xr={id:Yt.id,type:Yt.type,x:Yt.x+vt,y:Yt.y+wn,width:Yt.width,height:Yt.height};for(let po=0;po+1<ui.waypoints.length;po++)if(as(ui.waypoints[po],ui.waypoints[po+1],Xr)<Oi)return!1;return!0})),Mt=A.y+A.height/2,Fe=[F,O.y+O.height/2].filter(vt=>vt!==void 0&&Math.abs(vt-Mt)>=1),Ie=_t&&se.has(_t.id)?_t:fn==null?void 0:fn.target,Bt=Ie?Ie.x-A.x:0,Tt=Math.max(...re.map(vt=>vt.x+vt.width)),bt=[...Bt!==0?[Bt]:[],...nt!==0?[-nt]:[],0],Yr=Y===void 0?[]:bt.map(vt=>Math.max(vt,Y-A.x)),Yn=vt=>Tt+vt+Cn<=O.x,uo=[...new Set([...Yr,...bt])].filter(Yn),Qa=_t&&se.has(_t.id)?[_t.x+_t.width+Cn-A.x]:[],Kr=Y===void 0?[]:Qa.map(vt=>Math.max(vt,Y-A.x)),Rg=[...new Set([...Kr,...Qa])].filter(vt=>Yn(vt)&&!uo.includes(vt));let Gi;for(const vt of[uo,Rg]){for(const wn of Fe){for(const Yt of vt)if(Ke(Yt,wn-Mt)){Gi={dx:Yt,dy:wn-Mt};break}if(Gi)break}if(Gi)break}if(Gi){const vt=Qe=>{const xt=Qe;return[xt.edge,xt.other,...Array.isArray(xt.edges)?xt.edges:[]].some(Nt=>typeof Nt=="string"&&gc.has(Nt))},wn=()=>new Set(pt(Ve(r)).filter(Qe=>!vt(Qe)).map(Qe=>ct(Qe))),Yt=wn(),ui=r.filter(Qe=>Qe.type==="label").map(Qe=>({label:Qe,x:Qe.x,y:Qe.y}));n.moveElements(re,{x:Gi.dx,y:Gi.dy},void 0,ye);const Xr=wn(),po=[...Xr].filter(Qe=>!Yt.has(Qe)).length,Ja=[...Yt].filter(Qe=>!Xr.has(Qe)).length;if(po>Ja){n.moveElements(re,{x:-Gi.dx,y:-Gi.dy},void 0,ye);for(const Qe of ui){const xt=Qe.x-Qe.label.x,Nt=Qe.y-Qe.label.y;(xt!==0||Nt!==0)&&n.moveElements([Qe.label],{x:xt,y:Nt})}}else j&&n1.set(k.id,{exit:j,channelY:F,label:I})}}}{const Te=new Set(re.map(Ye=>Ye.id)),Pt=new Set(_.map(Ye=>Ye.flow.id)),_t=20,fn=Ye=>{const wt=Ye.source,Ke=Ye.target,Mt=Math.min(wt.x,Ke.x)-_t,Fe=Math.max(wt.x+wt.width,Ke.x+Ke.width)+_t,Ie=Math.min(wt.y,Ke.y)-_t,Bt=Math.max(wt.y+wt.height,Ke.y+Ke.height)+_t;return Ye.waypoints.some(Tt=>Tt.x<Mt||Tt.x>Fe||Tt.y<Ie||Tt.y>Bt)},Oe=new Map;for(const Ye of re)for(const wt of[...Ye.incoming??[],...Ye.outgoing??[]])wt.id!==x.id&&Pt.has(wt.id)&&!(Te.has(wt.source.id)&&Te.has(wt.target.id))&&Oe.set(wt.id,wt);for(const Ye of Oe.values())fn(Ye)&>(Ye)}const lo=ve.length?d(ve[0]):void 0;if(lo){const Te={assoc:XE(),overlaps:JE(lo),crosses:QE()},Pt=ve.map(Fe=>({st:Fe,x:Fe.x})),_t=r.filter(Fe=>Fe.type==="label").map(Fe=>({label:Fe,x:Fe.x,y:Fe.y})),fn=Math.min(...ve.flatMap(Fe=>[...Fe.incoming??[],...Fe.outgoing??[]].filter(Ie=>Ie.type==="bpmn:DataInputAssociation"||Ie.type==="bpmn:DataOutputAssociation").map(Ie=>(Ie.source===Fe?Ie.target:Ie.source).x))),Oe=new Set(ve.map(Fe=>Fe.id)),Ye=(lo.children??[]).filter(Li).filter(Fe=>!Oe.has(Fe.id));let wt=fn;for(const Fe of[...ve].sort((Ie,Bt)=>Ie.x-Bt.x)){let Ie=wt;for(let Bt=0;Bt<100;Bt++){const Tt=Ye.find(bt=>Ie<bt.x+bt.width+Di&&Ie+Fe.width+Di>bt.x&&Fe.y<bt.y+bt.height&&Fe.y+Fe.height>bt.y);if(!Tt)break;Ie=Tt.x+Tt.width+Di}Ie!==Fe.x&&n.moveElements([Fe],{x:Ie-Fe.x,y:0}),wt=Ie+Fe.width+Di}const Ke=wt+150-(lo.x+lo.width);Ke>0&&cp(lo,lo.width+Ke);const Mt={assoc:XE(),overlaps:JE(lo),crosses:QE()};if(Mt.assoc>=Te.assoc||Mt.overlaps>Te.overlaps||Mt.crosses>Te.crosses){for(const{st:Fe,x:Ie}of Pt)Fe.x!==Ie&&n.moveElements([Fe],{x:Ie-Fe.x,y:0});Ke>0&&cp(lo,lo.width-Ke);for(const Fe of _t){const Ie=Fe.x-Fe.label.x,Bt=Fe.y-Fe.label.y;(Ie!==0||Bt!==0)&&n.moveElements([Fe.label],{x:Ie,y:Bt})}}}}for(const[x,S]of Rn){const A=p(x);if(!A)continue;const k=S.container,L=Math.abs(A.y+A.height/2-k.y-S.relCy)>=.5,O=A.label,j=Math.min(A.y,O&&!O.hidden?O.y:A.y),F=Math.max(A.y+A.height,O&&!O.hidden?O.y+O.height:0);if(L&&j>=k.y&&F<=k.y+k.height)continue;const I=A.y;S.grow(),A.y!==I&&n.moveElements([A],{x:0,y:I-A.y},void 0,{autoResize:!1})}const i1=(x,S)=>{const A=S.target===x,k=f(S.source),L=f(S.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,L,S.id?{type:O,businessObject:i.create(O,{id:S.id})}:{type:O})},o1=x=>{for(const S of h){if(!S.participant.blackBox)continue;const A=p(S.participant.id);if(!A)continue;const k=[];for(const O of v){const j=O.flow.source===S.participant.id?O.flow.target:O.flow.target===S.participant.id?O.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&k.push(F)}if(!k.length)continue;if(!x&&S.order===void 0){const O=(()=>{var F;const j=new Map;for(const I of k){const Y=d(I);if(!Y)continue;const Q=j.get(Y.id);Q?Q.n+=1:j.set(Y.id,{shape:Y,n:1})}return(F=[...j.values()].sort((I,Y)=>Y.n-I.n)[0])==null?void 0:F.shape})();if(O){const j=Y=>Y.reduce((Q,se)=>Q+se,0)/Y.length,F=j(k.map(Y=>Y.y+Y.height/2))<O.y+O.height/2,I=r.filter(Y=>Y.type==="bpmn:Participant"&&Y.id!==S.participant.id&&Y.id!==O.id).filter(Y=>F?Y.y+Y.height<=O.y+5:Y.y>=O.y+O.height-5);if(I.length){const Y=[...I.reduce((le,be)=>le.set(be.y,(le.get(be.y)??0)+1),new Map)].sort((le,be)=>be[1]-le[1]||(F?be[0]-le[0]:le[0]-be[0]))[0][0],Q=Math.min(A.width,iM),se=oM,ce=k.map(le=>le.x+le.width/2),re=Math.round(j(ce)-Q/2),fe=Math.max(...ce)+ff,ye=le=>({x:le,width:Math.max(Q,fe-le)}),Ze=I.filter(le=>Math.min(le.y+le.height,Y+se)-Math.max(le.y,Y)>0),Be=le=>{const be=ye(le);return Ze.some(tt=>tt.x<be.x+be.width&&be.x<tt.x+tt.width)},te=le=>{const be=ye(le);return ce.filter(tt=>tt>=be.x+10&&tt<=be.x+be.width-10).length},ae=(()=>{if(!Be(re))return re;const le=te(re);return Ze.flatMap(be=>[be.x+be.width+ly,be.x-ly-Q]).map(be=>Math.round(be)).filter(be=>!Be(be)&&te(be)>=le).sort((be,tt)=>Math.abs(be-re)-Math.abs(tt-re))[0]??re})();if(ae!==A.x||Y!==A.y||Q!==A.width||se!==A.height){const le=()=>new Set(pt(Ve(r)).map(xe=>ct(xe))),be=le(),tt={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:ae,y:Y,width:Q,height:se});const nt=le(),It=[...nt].filter(xe=>!be.has(xe)).length,jt=[...be].filter(xe=>!nt.has(xe)).length;It>jt&&n.resizeShape(A,tt)}}}}const L=Math.max(...k.map(O=>O.x+O.width/2))+ff;if(L>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:L-A.x,height:A.height}),!!x)for(const O of v){const j=p(O.flow.id),F=O.flow.source===S.participant.id?O.flow.target:O.flow.target===S.participant.id?O.flow.source:void 0,I=F?p(F):void 0;if(!j||!I||I.type==="bpmn:Participant")continue;const Y=I.x+I.width/2;Y<A.x+10||Y>A.x+A.width-10||KE(j,A,I)}}};o1(!1);for(const x of v){const S=x.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([..._.map(I=>I.flow.id),...v.map(I=>I.flow.id)].filter(I=>!!I)),k=r.filter(I=>!!I.waypoints),L=(I,Y)=>Math.abs(Y.x-I.x)<2?"L":Math.abs(Y.x-(I.x+I.width))<2?"R":Math.abs(Y.y-I.y)<2?"T":Math.abs(Y.y-(I.y+I.height))<2?"B":void 0,O=new Map,j=(I,Y,Q)=>{if(!I||!Y||typeof I.x!="number")return;const se=L(I,Y);if(!se)return;let ce=O.get(I.id);ce||O.set(I.id,ce=new Map),ce.set(se,[...ce.get(se)??[],Q])};for(const I of k){const Y=I.waypoints;!Y||Y.length<2||(j(I.source,Y[0],{id:I.id,dir:"out"}),j(I.target,Y[Y.length-1],{id:I.id,dir:"in"}))}const F=new Set;for(const[I,Y]of O){const Q=p(I);if(!Q||typeof Q.x!="number")continue;const se=te=>{var le;const ae=(le=p(te.id))==null?void 0:le.source;return!!ae&&typeof ae.x=="number"&&ae.x+ae.width/2>Q.x+Q.width/2};if(![...Y.values()].some(te=>te.length>=3&&te.some(ae=>ae.dir==="out")&&te.some(ae=>ae.dir==="in"&&A.has(ae.id)&&se(ae))))continue;const re=d(Q);if(!re||F.has(re.id)||(re.children??[]).some(te=>te.type==="bpmn:Lane"))continue;const fe=(w1=Y.get("T"))!=null&&w1.length?(E1=Y.get("B"))!=null&&E1.length?void 0:"B":"T";if(!fe||(fe==="T"?Q.y-re.y:re.y+re.height-(Q.y+Q.height))>=$)continue;const Ze=(re.children??[]).filter(te=>!("waypoints"in te&&te.waypoints)&&te.type!=="label"&&typeof te.x=="number"),Be=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+$}),ie(Be,re.id,$),fe==="T"&&Ze.length&&n.moveElements(Ze,{x:0,y:$}),F.add(re.id)}}const vg=20,r1=4,C5=3,M5=2,A5=[10,30,80],mr=()=>{const x=Ve(r);return{bad:pt(x).filter(S=>S.kind==="edge-crosses-shape"||S.kind==="edge-overlap-opposite"||S.kind==="edge-overlap-mixed").length,crossings:mm(x),straight:x.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length}},Ka=x=>{const S=Ve(r),A=S.edges.find(k=>k.id===x);return A?zt(A,Gn(S)).length:0},lp=x=>Ka(x)>0,up=x=>Ve(r).edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.id!==x&&S.waypoints.length===2).length,P5=(x,S,A)=>mc([{subtree:x,pool:S}],A),a1=(x,S)=>S.bad>x.bad||S.crossings>x.crossings&&S.straight<=x.straight&&S.bad>=x.bad,Xa=(x,S)=>a1(x,S)||S.straight<x.straight,Wr=(x,S,A=()=>!0,k=a1,L=!1)=>{const O=mr(),j=mc(x,S,L);if(!j)return!1;const F=mr();return k(O,F)||!A()?(j(),!1):!0},T5=(x,S,A,k=()=>!0)=>Wr([{subtree:x,pool:S}],A,k),Ur=x=>{var S;return!!((S=P.get(x))!=null&&S.node.participant)},yc=new Map;for(const x of v){if(!Ur(x.flow.target))continue;const S=yc.get(x.flow.target)??[];S.push(x),yc.set(x.flow.target,S)}const pp=[...yc.keys()],bg=new Set(_.map(x=>x.flow.target)),s1=x=>Qt.findIndex(({op:S})=>S.participant.id===x);pp.sort((x,S)=>{var L,O;const A=bg.has(x)?1:0,k=bg.has(S)?1:0;return A!==k?A-k:s1((L=P.get(x))==null?void 0:L.node.participant)-s1((O=P.get(S))==null?void 0:O.node.participant)});const yr=x=>x.x+x.width/2,k5=x=>{const S=new Map;for(const L of r.getAll()){const O=L;if(!O.waypoints||!O.source||!O.target)continue;(S.get(O.source.id)??S.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([x]),k=[x];for(let L=0;L<k.length;L++)for(const O of S.get(k[L])??[])A.has(O)||(A.add(O),k.push(O));return A},O5=(x,S)=>{const A=k5(S);let k;for(const L of r.getAll()){const O=L;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==x||A.has(O.source.id))continue;const j=O.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=yr(j);(k===void 0||F>k)&&(k=F)}return k},xg=(x,S)=>{const A=p(x.flow.source);if(A)return A.type==="bpmn:Participant"?O5(A.id,S):yr(A)},c1=x=>{let S;for(const A of yc.get(x)??[]){const k=xg(A,x);k!==void 0&&(!S||k>S.cx)&&(S={op:A,cx:k})}return S==null?void 0:S.op},D5=x=>{const S=c1(x),A=p(x),k=S?xg(S,x):void 0;return A&&k!==void 0?k-yr(A):void 0},L5=x=>{const S=D5(x);return S!==void 0&&Math.abs(S)<vg},_g=(x,S,A,k,L)=>{var O;for(let j=!0;j;){j=!1;for(const F of v){if(F.flow.id===A)continue;const I=S.has(F.flow.source),Y=S.has(F.flow.target);if(I===Y||k(I?F.flow.source:F.flow.target))continue;const Q=I?F.flow.target:F.flow.source;if(L(Q)||!Ur(Q))continue;const se=p(F.flow.id);if(!(se!=null&&se.waypoints)||se.waypoints.length!==2)continue;const ce=p(Q),re=(O=P.get(Q))==null?void 0:O.node.participant;if(!ce||!re)continue;const fe=Vr(Q,ye=>ye.x>=ce.x).filter(ye=>!S.has(ye.id));if(!(!fe.length||fe.some(ye=>L(ye.id)))){for(const ye of fe)S.add(ye.id);x.set(re,[...x.get(re)??[],...fe]),j=!0}}}return[...x].map(([j,F])=>({subtree:F,pool:f(j)}))},l1=(x,S,A,k,L)=>_g(new Map([[S,[...x]]]),new Set(x.map(O=>O.id)),k,O=>O===A,O=>O===L),wg=x=>{const S=c1(x);if(!S)return null;const A=p(x),k=p(S.flow.source),L=xg(S,x);if(!A||!k||L===void 0)return null;const O=L-yr(A);if(O>=vg){const j=P.get(x).node.participant,F=Vr(x,I=>I.x>=A.x);return{groups:l1(F,j,x,S.flow.id,S.flow.source),dx:O}}if(-O>=vg&&Ur(S.flow.source)){const j=P.get(S.flow.source).node.participant,F=Vr(S.flow.source,I=>I.x>=k.x&&!L5(I.id));return{groups:l1(F,j,S.flow.source,S.flow.id,x),dx:-O}}return null},u1=()=>pp.map(x=>({id:x,plan:wg(x)})).filter(x=>!!x.plan).sort((x,S)=>Math.min(...x.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))-Math.min(...S.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))).map(x=>x.id);for(let x=0;x<3;x++){const S=mr(),A=[];for(const L of u1()){const O=wg(L);if(!O)continue;const j=mc(O.groups,O.dx);j&&A.push(j)}if(!A.length)break;if(!Xa(S,mr()))continue;for(const L of A.reverse())L();let k=!1;for(const L of u1()){const O=wg(L);O&&Wr(O.groups,O.dx,()=>!0,Xa)&&(k=!0)}if(!k)break}for(const x of pp){if(bg.has(x))continue;const S=P.get(x);if(!S||S.node.lane!==void 0)continue;const A=X(S);if(A===void 0)continue;const k=p(x),L=k?d(k):void 0;if(!k||!L)continue;const O=L.y+Z+C(`pool:${S.node.participant??""}`,A)*$,j=O-(k.y+k.height/2);j!==0&&!ke(L,k,k.x+k.width/2,O)&&n.moveElements([k],{x:0,y:j})}const p1=new Set;for(let x=0,S=!0;S&&x<C5;x++){S=!1;for(const A of pp.flatMap(k=>yc.get(k)??[])){if(p1.has(A.flow.id)||!lp(A.flow.id))continue;const k=p(A.flow.target);if(!k)continue;const L=f(P.get(A.flow.target).node.participant),O=Vr(A.flow.target,Y=>Y.x>=k.x),j=k.width+H,F=Ka(A.flow.id),I=up(A.flow.id);for(let Y=1;Y<=r1;Y++){const Q=()=>Ka(A.flow.id)<F&&up(A.flow.id)>=I;if(T5(O,L,j*Y,Q)){p1.add(A.flow.id),S=!0;break}}}}const Eg=v.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),f1=new Set(Eg.map(x=>x.id));for(const x of r.filter(S=>S.type==="bpmn:MessageFlow"))f1.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&Eg.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of Eg){if(!lp(x.id))continue;const S=p(x.source),A=p(x.target);if(!S||!A)continue;let k,L,O;if(x.preexisting){const[F,I]=S.type==="bpmn:Participant"?[A,S]:[S,A];if(k=yr(F),k<I.x||k>I.x+I.width)continue;[L,O]=F.y<I.y?[F.y+F.height,I.y]:[I.y+I.height,F.y]}else{if(S.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(k=S.x+S.width/2,Math.abs(k-(A.x+A.width/2))>15))continue;[L,O]=S.y<A.y?[S.y+S.height,A.y]:[A.y+A.height,S.y]}const j=[...P.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==S.id&&F.id!==A.id).filter(F=>F.x<=k&&k<=F.x+F.width&&F.y+F.height>L&&F.y<O).sort((F,I)=>F.x-I.x);for(const F of j){const I=(S1=P.get(F.id))==null?void 0:S1.node.participant,Y=I?p(I):void 0;if(!I||!Y)continue;const Q=[...P.values()].filter(ae=>ae.node.participant===I).map(ae=>ae.node.id),se=ae=>ae.map(le=>p(le)).filter(le=>!!le),re=[x5(F.id,ae=>{var le;return((le=P.get(ae.id))==null?void 0:le.node.participant)===I}),se(Q)].filter(ae=>ae.length).map(ae=>[{subtree:ae,pool:Y}]);if(x.preexisting){const ae=se(Q);ae.length&&re.push(_g(new Map([[I,[...ae]]]),new Set(ae.map(le=>le.id)),x.id,()=>!1,le=>le===S.id||le===A.id))}const fe=F.width+H,ye=Ka(x.id),Ze=up(x.id),Be=()=>Ka(x.id)<ye&&up(x.id)>=Ze;let te=!1;for(const ae of re){for(let le=1;le<=r1;le++)if(Wr(ae,fe*le,Be)){te=!0;break}if(te)break}if(!lp(x.id))break}}const fp=()=>{var S;const x=new Set;for(const A of pt(Ve(r)))A.kind!=="edge-crosses-shape"||f1.has(A.edge)||((S=p(A.edge))==null?void 0:S.type)==="bpmn:MessageFlow"&&x.add(`${A.edge}>${A.shape}`);return x},I5=(x,S)=>mr().bad>=x&&[...fp()].some(A=>!S.has(A)),d1=x=>{var S,A;return Ka(x)===0&&((A=(S=p(x))==null?void 0:S.waypoints)==null?void 0:A.length)===2},B5=(x,S,A)=>{const k=new Set(x.flatMap(O=>O.subtree.map(j=>j.id))),L=[...fp()].filter(O=>!A.has(O)).map(O=>O.split(">")[1]);return[...new Set(L)].filter(O=>k.has(O)&&O!==S.source&&O!==S.target)},N5=(x,S,A,k,L)=>{const O=x.map(Y=>({...Y,subtree:Y.subtree.filter(Q=>!L.includes(Q.id))})).filter(Y=>Y.subtree.length),j=new Set(O.flatMap(Y=>Y.subtree.map(Q=>Q.id))),F=()=>L.every(Y=>{const Q=p(Y);return!!Q&&_.filter(se=>se.flow.target===Y&&j.has(se.flow.source)).every(se=>{const ce=p(se.flow.source);return!!ce&&ce.x+ce.width<=Q.x})});return Wr(O,S,()=>d1(A.id)&&[...fp()].every(Y=>k.has(Y))&&F(),Xa,!0)};for(const x of v){if(!lp(x.flow.id))continue;const S=p(x.flow.id);if(((R1=S==null?void 0:S.waypoints)==null?void 0:R1.length)!==2)continue;const A=p(x.flow.source),k=p(x.flow.target);if(!A||!k||A.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!Ur(x.flow.source)||!Ur(x.flow.target)||Math.abs(yr(A)-yr(k))>M5)continue;const L=yr(A),O=S.waypoints.map(ye=>ye.y),[j,F]=[Math.min(...O),Math.max(...O)],I=Gn(Ve(r)).filter(ye=>ye.id!==A.id&&ye.id!==k.id&&ye.x<L&&L<ye.x+ye.width&&j<ye.y+ye.height&&ye.y<F);if(!I.length)continue;const Y=(C1=P.get(x.flow.source))==null?void 0:C1.node.participant,Q=(M1=P.get(x.flow.target))==null?void 0:M1.node.participant;if(!Y||!Q)continue;const se=new Map;for(const[ye,Ze,Be]of[[x.flow.source,A,Y],[x.flow.target,k,Q]]){const te=se.get(Be)??[],ae=Vr(ye,le=>le.x>=Ze.x).filter(le=>!te.some(be=>be.id===le.id));se.set(Be,[...te,...ae])}const ce=new Set([...se.values()].flat().map(ye=>ye.id)),re=_g(se,ce,x.flow.id,ye=>ye===x.flow.source||ye===x.flow.target,()=>!1),fe=Math.max(...I.map(ye=>ye.x+ye.width));for(const ye of A5){const Ze=fe+ye-L;if(Ze<=0)continue;const Be=mr().bad,te=fp();let ae=[],le=!0;const be=()=>!d1(x.flow.id)||le&&(ae=B5(re,x.flow,te),ae.length)?!1:!I5(Be,te);if(Wr(re,Ze,be,Xa))break;if(ae.length&&(N5(re,Ze,x.flow,te,ae)||(le=!1,Wr(re,Ze,be,Xa))))break}}{const x=A=>A.y+A.height/2,S=[];for(const A of P.keys()){if(!Ur(A))continue;const k=_.filter(j=>j.flow.target===A);if(k.length!==1)continue;const L=p(k[0].flow.source),O=p(A);!L||!O||!P.has(L.id)||Math.abs(x(L)-x(O))>1||O.x-(L.x+L.width)<=H+1||S.push({id:A,pred:L,node:O})}S.sort((A,k)=>A.node.x-k.node.x);for(const{id:A}of S){const k=P.get(A),L=p(A),O=p(_.find(ce=>ce.flow.target===A).flow.source);if(!L||!O)continue;const j=L.x-(O.x+O.width);if(j<=H+1)continue;const F=f(k.node.participant),I=Vr(A,ce=>ce.x>=L.x),Y=mr(),Q=P5(I,F,-(j-H));if(!Q)continue;const se=mr();(se.bad>Y.bad||se.crossings>=Y.crossings||se.straight<Y.straight)&&Q()}}o1(!0);const $5=10,F5=400,j5=x=>[...x.incoming??[],...x.outgoing??[]].filter(S=>S.type==="bpmn:DataInputAssociation"||S.type==="bpmn:DataOutputAssociation").map(S=>S.source===x?S.target:S.source).filter(S=>!!S&&typeof S.y=="number"),H5=r.filter(x=>x.type==="bpmn:DataStoreReference"&&g.has(x.id)),z5=(x,S)=>{const A=x.x+x.width/2,k=x.y+x.height/2;let L;for(const O of H5){if((d(O)??u())!==S||O.y<x.y+x.height)continue;const j=Math.abs(O.x+O.width/2-A);j>F5||j<O.width||!j5(O).some(I=>I.height===x.height&&Math.abs(I.y+I.height/2-k)<=$5&&O.y>=I.y+I.height)||(!L||j<L.dx||j===L.dx&&O.id<L.id)&&(L={dx:j,id:O.id,cy:O.y+O.height/2})}return L==null?void 0:L.cy};for(const x of y){const S=x.associations??[],A=S.map(O=>O.source===x.dataStore.id?O.target:O.source).map(p).find(Boolean),k=A?d(A)??u():u(),L=A?{x:A.x+A.width/2,y:z5(A,k)??A.y+A.height+110}:{x:200,y:_n+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},L,k);for(const O of S)i1(x.dataStore.id,O)}for(const x of b){const A=f(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;i1(A,x.association)}let h1=0;const qr=10,g1=40,G5=(x,S)=>{const A=S.map(I=>d(I)).filter(I=>!!I);for(const I of A){const Y=qr,Q=I.y,se=I.y+I.height,ce=I.x,re=I.x+I.width;if(Math.abs(x.y-Q)<Y){const fe=Q+Y-x.y;x.y+=fe,x.height-=fe}if(Math.abs(x.y+x.height-se)<Y&&(x.height=se-Y-x.y),Math.abs(x.x-ce)<Y){const fe=ce+Y-x.x;x.x+=fe,x.width-=fe}Math.abs(x.x+x.width-re)<Y&&(x.width=re-Y-x.x)}if(!A.length)return;const k=Math.min(...A.map(I=>I.y)),L=Math.max(...A.map(I=>I.y+I.height)),O=k-x.y,j=x.y+x.height-L,F=g1-qr;if(O>0!=j>0)if(O>0&&O<F){const I=O+qr;x.y+=I,x.height-=I}else j>0&&j<F&&(x.height-=j+qr)},V5=(x,S)=>{const A=qr,k=30,L=r.filter(O=>O.type==="bpmn:Group"&&O.id!==S);for(const O of L){const j=O.x,F=O.x+O.width,I=O.y,Y=O.y+O.height,Q=x.y<Y&&I<x.y+x.height,se=x.x<F&&j<x.x+x.width;if(Q){if(Math.abs(x.x-F)<A){const ce=Math.min(F+A-x.x,k);ce>0&&x.width-ce>0&&(x.x+=ce,x.width-=ce)}if(Math.abs(x.x+x.width-j)<A){const ce=Math.min(x.x+x.width-(j-A),k);ce>0&&x.width-ce>0&&(x.width-=ce)}}if(se){if(Math.abs(x.y-Y)<A){const ce=Math.min(Y+A-x.y,k);ce>0&&x.height-ce>0&&(x.y+=ce,x.height-=ce)}if(Math.abs(x.y+x.height-I)<A){const ce=Math.min(x.y+x.height-(I-A),k);ce>0&&x.height-ce>0&&(x.height-=ce)}}}},Sg=(x,S)=>{const A=g1,k=Math.min(...x.map(I=>I.x))-A,L=Math.min(...x.map(I=>I.y))-A,O=Math.max(...x.map(I=>I.x+I.width))+A,j=Math.max(...x.map(I=>I.y+I.height))+A,F={x:k,y:L,width:O-k,height:j-L};return G5(F,x),V5(F,S),F};for(const x of w){const S=(x.group.members??[]).map(p).filter(L=>!!L);let A;S.length?A=Sg(S,x.group.id):(A={x:300+h1*350,y:40,width:300,height:200},h1++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());x.group.name&&n.updateLabel(k,x.group.name),(A1=x.group.members)!=null&&A1.length&&T(k,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(L=>!!L.waypoints),S=new Map,A=(L,O)=>{!L||!O||(S.has(L)||S.set(L,new Set),S.get(L).add(O))};for(const L of x){const O=(P1=L.source)==null?void 0:P1.id,j=(T1=L.target)==null?void 0:T1.id;A(O,j),((k1=L.type)!=null&&k1.includes("DataOutputAssociation")||(O1=L.type)!=null&&O1.includes("DataInputAssociation")||L.type==="bpmn:Association")&&A(j,O)}const k=r.filter(L=>L.type==="bpmn:Group");for(const L of k){const j=(((D1=L.businessObject.extensionElements)==null?void 0:D1.values)??[]).find(Be=>Be.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const I=new Set(F),Y=[...F];for(;Y.length;){const Be=Y.shift();for(const te of S.get(Be)??[])I.has(te)||(I.add(te),Y.push(te))}const Q=L.x,se=L.x+L.width,ce=L.y,re=L.y+L.height,fe=Be=>_.filter(te=>te.flow.target===Be).length,ye=Be=>{var ae;const te=((ae=p(Be))==null?void 0:ae.type)??"";if(te==="bpmn:StartEvent"&&fe(Be)===0)return!1;if(te.endsWith("Gateway")){const le=_.filter(be=>be.flow.target===Be).map(be=>be.flow.source);if(le.length&&le.every(be=>{var tt;return((tt=p(be))==null?void 0:tt.type)==="bpmn:StartEvent"&&fe(be)===0}))return!1}return!0},Ze=r.filter(Be=>Li(Be)).filter(Be=>Be.type!=="bpmn:Group"&&Be.type!=="bpmn:Participant"&&Be.type!=="bpmn:TextAnnotation"&&!I.has(Be.id)&&Ur(Be.id)&&ye(Be.id)&&Be.x<se&&Be.x+Be.width>Q&&Be.y<re&&Be.y+Be.height>ce);if(Ze.length)for(const Be of[-1,1]){const te=Ze.filter(ve=>(ve.x+ve.width-Q<=se-ve.x?-1:1)===Be);if(!te.length)continue;const ae=[];for(const ve of te){const ue=ae.find(_e=>_e.some(He=>ve.y<He.y+He.height&&ve.y+ve.height>He.y));ue?ue.push(ve):ae.push([ve])}const le=new Map;for(const ve of ae){let ue=Be<0?Q-qr:se+qr;for(const _e of[...ve].sort((He,Ne)=>Be<0?Ne.x-He.x:He.x-Ne.x)){const He=Be<0?Math.min(_e.x,ue-_e.width):Math.max(_e.x,ue);ue=Be<0?He-Di:He+_e.width+Di,He!==_e.x&&Math.sign(He-_e.x)===Be&&le.set(_e.id,He-_e.x)}}const be=new Map,tt=ve=>be.get(ve)===ve||!be.get(ve)?ve:tt(be.get(ve));for(const ve of te)be.set(ve.id,ve.id);for(const ve of v){const ue=le.has(ve.flow.source)?ve.flow.source:void 0,_e=le.has(ve.flow.target)?ve.flow.target:void 0;if(!ue||!_e)continue;const He=p(ve.flow.id);((L1=He==null?void 0:He.waypoints)==null?void 0:L1.length)===2&&be.set(tt(ue),tt(_e))}const nt=new Map;for(const ve of te){if(!le.has(ve.id))continue;const ue=tt(ve.id);nt.set(ue,[...nt.get(ue)??[],ve])}const It=[...nt.values()].sort((ve,ue)=>Be<0?Math.min(...ve.map(_e=>_e.x))-Math.min(...ue.map(_e=>_e.x)):Math.max(...ue.map(_e=>_e.x))-Math.max(...ve.map(_e=>_e.x))),jt=[];let xe=!0;for(const ve of It){const ue=ve.map(Ne=>le.get(Ne.id)??0).reduce((Ne,Me)=>Math.abs(Me)>Math.abs(Ne)?Me:Ne,0),_e=new Map;let He=!0;for(const Ne of ve){const Me=d(Ne);if(!Me){He=!1;break}_e.has(Me.id)||_e.set(Me.id,{subtree:[],pool:Me}),_e.get(Me.id).subtree.push(Ne)}He&&Wr([..._e.values()],ue,()=>!0,Xa)?jt.push({shapes:ve,dx:ue}):xe=!1}if(!xe)for(const ve of jt.reverse())n.moveElements(ve.shapes,{x:-ve.dx,y:0})}}}{const x=new Set([...w.map(S=>S.group.id),...en(e,"group.update").map(S=>S.id)]);for(const S of r.filter(A=>A.type==="bpmn:Group")){if(x.has(S.id))continue;const k=(((I1=S.businessObject.extensionElements)==null?void 0:I1.values)??[]).find(F=>F.$type==="bwl:Members"),L=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!L.length||!L.some(F=>{const I=g.get(F.id);return!I||I.x!==F.x||I.y!==F.y})||!L.some(F=>F.x<S.x||F.y<S.y||F.x+F.width>S.x+S.width||F.y+F.height>S.y+S.height)||n.resizeShape(S,Sg(L,S.id))}}{const S=new Map(Fo(Ve(r)).map(F=>[F.owner,F.rect])),A=r.filter(F=>!!F.waypoints),k=new Map,L=(F,I)=>{!F||!I||(k.has(F)||k.set(F,new Set),k.get(F).add(I))};for(const F of A){const I=(B1=F.source)==null?void 0:B1.id,Y=(N1=F.target)==null?void 0:N1.id;L(I,Y),(($1=F.type)!=null&&$1.includes("DataOutputAssociation")||(F1=F.type)!=null&&F1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&L(Y,I)}const O=F=>_.filter(I=>I.flow.target===F).length,j=F=>{var Y;const I=((Y=p(F))==null?void 0:Y.type)??"";if(I==="bpmn:StartEvent"&&O(F)===0)return!1;if(I.endsWith("Gateway")){const Q=_.filter(se=>se.flow.target===F).map(se=>se.flow.source);if(Q.length&&Q.every(se=>{var ce;return((ce=p(se))==null?void 0:ce.type)==="bpmn:StartEvent"&&O(se)===0}))return!1}return!0};for(const F of r.filter(I=>I.type==="bpmn:Group")){const Y=(((j1=F.businessObject.extensionElements)==null?void 0:j1.values)??[]).find(ue=>ue.$type==="bwl:Members"),Q=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!Q.length)continue;const se=Q.map(p).filter(ue=>!!ue);if(!se.length||!(w.some(ue=>ue.group.id===F.id)||en(e,"group.update").some(ue=>ue.id===F.id)||se.some(ue=>{const _e=g.get(ue.id);return!_e||_e.x!==ue.x||_e.y!==ue.y})))continue;const re=new Set(Q),fe=[...Q];for(;fe.length;){const ue=fe.shift();for(const _e of k.get(ue)??[])re.has(_e)||(re.add(_e),fe.push(_e))}const ye=F.x,Ze=F.x+F.width,Be=F.y,te=F.y+F.height,ae=ue=>{const _e=S.get(ue.id),He={x:ue.x,y:ue.y,width:ue.width,height:ue.height};return _e?[He,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[He]},le=se.flatMap(ae),be=Math.min(...le.map(ue=>ue.x)),tt=Math.max(...le.map(ue=>ue.x+ue.width)),nt=Math.min(...le.map(ue=>ue.y)),It=Math.max(...le.map(ue=>ue.y+ue.height)),jt={L:be-ye,R:Ze-tt,T:nt-Be,B:te-It},xe=r.filter(ue=>Li(ue)).filter(ue=>ue.type!=="bpmn:Group"&&ue.type!=="bpmn:Participant"&&ue.type!=="bpmn:TextAnnotation"&&!re.has(ue.id)&&j(ue.id)&&ue.x<Ze&&ue.x+ue.width>ye&&ue.y<te&&ue.y+ue.height>Be);if(!xe.length)continue;const ve={L:0,R:0,T:0,B:0};for(const ue of xe){const _e=ae(ue),He=Math.min(..._e.map(yt=>yt.x)),Ne=Math.max(..._e.map(yt=>yt.x+yt.width)),Me=Math.min(..._e.map(yt=>yt.y)),st=Math.max(..._e.map(yt=>yt.y+yt.height)),ft={L:Ne-ye,R:Ze-He,T:st-Be,B:te-Me},Jt=["L","R","T","B"].filter(yt=>ft[yt]<=jt[yt]+.001);if(!Jt.length)continue;const Mn=Jt.reduce((yt,Hn)=>ft[Hn]<ft[yt]?Hn:yt,Jt[0]);ve[Mn]=Math.max(ve[Mn],Math.min(ft[Mn]+10,jt[Mn]))}!ve.L&&!ve.R&&!ve.T&&!ve.B||n.resizeShape(F,{x:F.x+ve.L,y:F.y+ve.T,width:F.width-ve.L-ve.R,height:F.height-ve.T-ve.B})}}const m1=x=>{const S=x.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=x;return{x:A.x,y:A.y,width:A.width,height:A.height}};let vc=0;const y1=12,v1=14,W5=15,U5=300,q5=x=>{const S=x.split(`
|
|
7
|
-
`),A=Math.max(...S.map(O=>ca(O,y1))),k=Math.max(100,Math.min(U5,Math.ceil(A)+v1)),L=S.reduce((O,j)=>O+Math.max(1,Math.ceil((ca(j,y1)+v1)/k)),0);return{width:k,height:Math.max(30,L*W5+10)}};for(const x of E){const S=x.association,A=((H1=x.placement)==null?void 0:H1.anchor)??(S?S.source===x.annotation.id?S.target:S.source:void 0),k=A?p(A):void 0,L=k?m1(k):void 0,O=q5(x.annotation.text??"");let j;if(L&&x.placement){const[Q,se]=Kc[x.placement.side],ce=x.placement.offset??50;j={x:L.x+L.width/2+Q*(L.width/2+O.width/2+ce),y:L.y+L.height/2+se*(L.height/2+O.height/2+ce)}}else L?(j={x:L.x+L.width/2+180+vc%3*260,y:L.y-110-vc%2*95},vc++):(j={x:300+vc*260,y:60},vc++);const F=k?d(k)??u():u(),I=F;L&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(j=Zc(r,L,O,I,x.placement?{placement:x.placement}:{from:j}));const Y=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},j,F);if(S){const Q=se=>se===x.annotation.id?Y:f(se);n.connect(Q(S.source),Q(S.target),S.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:S.id})}:{type:"bpmn:Association"})}x.placement&&T(Y,"bwl:Placement",D(x.placement))}for(const x of en(e,"association.add")){const S=x.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 b1=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of en(e,"node.update")){let S=f(x.id);if(x.type&&Yc(x.type)!==S.type){const A=S.x+S.width/2,k=S.y+S.height/2,L=b1();S=c.replaceElement(S,{type:Yc(x.type),...x.eventDefinition?{eventDefinitionType:Ec[x.eventDefinition]}:{}});const O=b1(),j=[...L].filter(Y=>Y!==x.id&&!O.has(Y));if(j.length)throw new fy({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:j});const F=Math.round(A-(S.x+S.width/2)),I=Math.round(k-(S.y+S.height/2));if(F!==0||I!==0){n.moveShape(S,{x:F,y:I});for(const Y of[...S.incoming??[],...S.outgoing??[]])gt(Y)}}if(x.name!==void 0&&n.updateProperties(S,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(S,{"bwl:band":x.band});const A=S.y+S.height/2,k=d(S),L=x.lane?f(x.lane):((k==null?void 0:k.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);x.band!==void 0&&mt(L==null?void 0:L.id,x.band,k);const O=L?L.y+(x.band===void 0?L.height/2:Math.min(L.height/2,J)+C(L.id,x.band)*$):x.band!==void 0&&k?k.y+Z+C(`pool:${k.id}`,x.band)*$:void 0;if(O!==void 0){const j=O-A;j!==0&&n.moveElements([S],{x:0,y:j})}}}for(const x of en(e,"sequenceFlow.update")){const S=f(x.id);if(x.source!==void 0||x.target!==void 0){const A=S,k=x.source!==void 0?f(x.source):A.source,L=x.target!==void 0?f(x.target):A.target,O=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(A,k,L,[O(k),O(L)]);const j=n1.get(A.id),F=L.y+L.height/2;if(j&&L.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:L.x,y:F}]);const I=A.label;if(I&&j.label){const Q=Math.abs(j.label.y+I.height/2-j.channelY)<=$/5&&j.label.x+I.width>j.exit.x,se=j.exit.x+6,ce=L.x-6-I.width,re=Q?ce>=se?{x:Math.max(se,Math.min(j.label.x,ce)),y:j.label.y+(F-j.channelY)}:void 0:j.label;re&&(re.x!==I.x||re.y!==I.y)&&n.moveElements([I],{x:re.x-I.x,y:re.y-I.y})}}else Math.abs(F-(k.y+k.height/2))>1&>(A)}x.name!==void 0&&n.updateProperties(S,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(S,{name:((z1=x.condition)==null?void 0:z1.label)??void 0})}for(const x of en(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(f(x.id),{name:x.name??void 0});for(const x of en(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(f(x.id),{name:x.name??void 0});for(const x of en(e,"annotation.update")){const S=f(x.id);if(x.text!==void 0&&n.updateProperties(S,{text:x.text}),x.placement===null)T(S,"bwl:Placement",null);else if(x.placement){const A=f(x.placement.anchor),k=m1(A),L=d(A)??u(),O=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[j,F]=Kc[x.placement.side],I=x.placement.offset??50,Y={x:k.x+k.width/2+j*(k.width/2+S.width/2+I),y:k.y+k.height/2+F*(k.height/2+S.height/2+I)},Q=O?Zc(r,k,{width:S.width,height:S.height},L,{placement:x.placement,selfId:x.id}):Y;n.moveElements([S],{x:Q.x-(S.x+S.width/2),y:Q.y-(S.y+S.height/2)}),T(S,"bwl:Placement",D(x.placement))}}for(const x of en(e,"group.update")){const S=f(x.id);if(x.name!==void 0&&n.updateLabel(S,x.name??""),x.members){const A=x.members.map(p).filter(k=>!!k);A.length&&n.resizeShape(S,Sg(A,x.id)),T(S,"bwl:Members",{refs:x.members.join(" ")})}}}function df(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 sM(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>pt(f).filter(d=>!t.has(ct(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ve(i),c=r(s),l=[...new Set(c.flatMap(df))].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 V=d.x+d.width/2,we=d.y+d.height/2;h=i.getAll().find(Ce=>{if(Ce.type!=="bpmn:Participant")return!1;const ke=Ce;return typeof ke.x=="number"&&typeof ke.width=="number"&&V>=ke.x&&V<=ke.x+ke.width&&we>=ke.y&&we<=ke.y+ke.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(V=>V.$type==="bwl:Placement"),v=[...d.incoming??[],...d.outgoing??[]].find(V=>V.type==="bpmn:Association"),y=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(v?((p=v.source)==null?void 0:p.id)===f?v.target:v.source:void 0);if(!y)continue;const b=y.waypoints,E=b!=null&&b.length?{x:b[Math.floor((b.length-1)/2)].x,y:b[Math.floor((b.length-1)/2)].y,width:0,height:0}:{x:y.x,y:y.y,width:y.width,height:y.height},w={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},T=_==null?void 0:_.side,D=py(i,E,h),N=[];if(T&&T in Kc&&N.push(Zc(i,E,w,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:f})),D&&!Xc(P,w,D))for(const V of aM)N.push(Zc(i,E,w,h,{placement:{side:V,offset:null},selfId:f}));for(const[V,we]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Ce=1;Ce<=rM;Ce++)N.push({x:P.x+V*uy*Ce,y:P.y+we*uy*Ce});const $={...s,edges:s.edges.filter(V=>V.id!==(v==null?void 0:v.id))},H=r($),Z=H.filter(V=>df(V).includes(f)).length;if(!Z)continue;let J;for(const V of N){const we=V.x-P.x,Ce=V.y-P.y;if(!we&&!Ce||V.x-w.width/2<h.x||V.x+w.width/2>h.x+h.width||V.y-w.height/2<h.y||V.y+w.height/2>h.y+h.height||D&&!Xc(V,w,D))continue;const ke={...$,shapes:$.shapes.map(W=>W.id===f?{...W,x:W.x+we,y:W.y+Ce}:W)},Ee=r(ke),q=Ee.filter(W=>df(W).includes(f)).length;if(q>=Z||Ee.length>H.length)continue;const ne=Math.abs(we)+Math.abs(Ce);if((!J||q<J.mine||q===J.mine&&(Ee.length<J.all||Ee.length===J.all&&ne<J.dist))&&(J={x:V.x,y:V.y,mine:q,all:Ee.length,dist:ne}),J.mine===0&&J.all<H.length)break}J&&o.moveElements([d],{x:J.x-P.x,y:J.y-P.y})}}const cM=60;function hf(e,t,n,i){const o=t.x+t.width,r=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(r.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of r)Math.abs(c.x+c.width-o)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function lM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=u=>pt(u).filter(p=>!t.has(ct(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let m=!1;for(const _ of n.shapes)_.type!=="bpmn:Group"||f.has(_.id)||[...d].some(v=>{const y=s.get(v);return y&&c(_,y)})&&(f.add(_.id),m=!0);for(const _ of n.shapes)_.type!=="bpmn:Participant"||d.has(_.id)||[...f].some(v=>{const y=s.get(v);return y&&c(y,_)})&&(d.add(_.id),m=!0);if(!m)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(m=>{const _=s.get(m);return _&&c(_,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Ve(i),f=r(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(b=>[b.id,b]));let h=null;for(const b of d){if(b.kind!=="pool-overlap")continue;const[E,w]=b.pools,P=g.get(E),T=g.get(w);if(!P||!T)continue;const[D,N]=P.x<=T.x?[P,T]:[T,P];if(b.contained)continue;const $=s.get(D.id),H=s.get(N.id),Z=$&&H?Math.max(H.x-($.x+$.width),0):cM,J=D.x+D.width+Z-N.x;if(J<=0)continue;const V=l(N.id).filter(we=>i.get(we));V.length&&(!h||J>h.dx)&&(h={movers:V,dx:J})}if(!h)return;const m=h.movers.map(b=>i.get(b)).filter(b=>!!b&&typeof b.x=="number");if(!m.length)return;const _=f.length,v=d.length;o.moveElements(m,{x:h.dx,y:0});const y=r(Ve(i));if(!(a(y).length<v&&y.length<=_)){o.moveElements(m,{x:-h.dx,y:0});return}}}const ps=.5,hy=150;function uM(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of pM(n))i.length<n.length&&i.some(r=>fM(e.elementRegistry.get(r.id)))||dM(e,i)}function pM(e){const t=[...e].sort((i,o)=>i.x+i.width-(o.x+o.width)),n=[];for(const i of t){const o=n[n.length-1],r=o==null?void 0:o[o.length-1];o&&r&&i.x+i.width-(r.x+r.width)<=ps?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function fM(e){var i,o,r;const t=(i=e==null?void 0:e.businessObject)==null?void 0:i.processRef;if(!t)return!0;const n=(t.laneSets??[]).reduce((a,s)=>{var c;return a+(((c=s.lanes)==null?void 0:c.length)??0)},0);return(((o=t.flowElements)==null?void 0:o.length)??0)+n+(((r=t.artifacts)==null?void 0:r.length)??0)===0}function dM(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(v=>v.x+v.width),r=Math.max(...o);if(r-Math.min(...o)>ps)return;const a=t.map(v=>n.get(v.id)).filter(v=>!!v&&typeof v.x=="number");if(a.length<2)return;const s=new Map(t.map(v=>[v.id,v.x]));if(a.some(v=>Math.abs(v.x-s.get(v.id))>ps))return;const c=a.map(v=>v.x+v.width);if(Math.max(...c)-Math.min(...c)<=ps)return;const l=v=>v.x+v.width,u=v=>!!v&&typeof v.width=="number",p=v=>{const y={shapes:[],edges:[],lanes:[]},b=E=>{for(const w of E.children??[]){if("waypoints"in w&&w.waypoints){y.edges.push(w);continue}w.type!=="label"&&(w.type==="bpmn:Lane"?y.lanes.push(w):y.shapes.push(w),b(w))}};return b(v),y},f=new Map(a.map(v=>[v.id,p(v)]));let d=r;for(const v of a){const{shapes:y}=f.get(v.id),b=y.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(d=Math.max(d,Math.max(...b)+hy))}const g=a.filter(v=>Math.abs(l(v)-d)>ps);if(!g.length)return;for(const v of g){const y=l(v),{shapes:b,edges:E,lanes:w}=f.get(v.id);if([...b.flatMap(D=>[l(D),...u(D.label)?[l(D.label)]:[]]),...E.flatMap(D=>[...D.waypoints.map(N=>N.x),...u(D.label)?[l(D.label)]:[]])].some(D=>D>d)||[...(v.incoming??[]).map(D=>D.waypoints[D.waypoints.length-1]),...(v.outgoing??[]).map(D=>D.waypoints[0])].some(D=>!D||D.x>d||Math.abs(D.x-y)<1))return;if(d>y){const D={x:y,y:v.y,width:d-y,height:v.height},N=new Set([v.id,...b.map(H=>H.id),...E.map(H=>H.id),...w.map(H=>H.id)]);if(n.getAll().some(H=>{var V;if("waypoints"in H&&H.waypoints||H.type==="bpmn:Group"||!u(H))return!1;const Z=H.type==="label"?(V=H.labelTarget)==null?void 0:V.id:H.id;if(!Z||N.has(Z)||N.has(H.id))return!1;const J=H;return J.x<D.x+D.width&&J.x+J.width>D.x&&J.y<D.y+D.height&&J.y+J.height>D.y}))return}}const h=()=>new Set(pt(Ve(n)).map(ct)),m=h(),_=g.map(v=>v.width);for(const v of g)hf(i,v,d-v.x,{layout:!1});[...h()].every(v=>m.has(v))||g.forEach((v,y)=>hf(i,v,_[y],{layout:!1}))}function hM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>pt(l).filter(u=>!t.has(ct(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(w=>w.id!==l.id&&w.type!=="bpmn:Group"&&a(l,w));if(!p.length)continue;const f=p.map(w=>i.get(w.id)).filter(w=>!!w&&typeof w.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),m=g.t+(l.y-d.t),_=g.r+(l.x+l.width-d.r),v=g.b+(l.y+l.height-d.b),y={x:h,y:m,width:_-h,height:v-m};if(y.width<=0||y.height<=0||Math.abs(y.x-u.x)<1&&Math.abs(y.y-u.y)<1&&Math.abs(y.width-u.width)<1&&Math.abs(y.height-u.height)<1)continue;const b=r(Ve(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,y),r(Ve(i)).length>b&&o.resizeShape(u,E)}}const Qc=20,Jc=10;function gM(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(pt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ct)),s=Ve(o),c=pt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(ct(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(De=>De.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const m=l.get(d);if(!(!m||Math.abs(m.x-h.x)>=.5||Math.abs(m.y-h.y)>=.5||Math.abs(m.width-h.width)>=.5||Math.abs(m.height-h.height)>=.5))continue;const v=h.members.map(De=>o.get(De)).filter(De=>!!De&&typeof De.x=="number");if(!v.length)continue;const y=Math.min(...v.map(De=>De.x)),b=Math.min(...v.map(De=>De.y)),E=Math.max(...v.map(De=>De.x+De.width)),w=Math.max(...v.map(De=>De.y+De.height)),P=h.x,T=h.y,D=h.x+h.width,N=h.y+h.height;let $=P,H=T,Z=D,J=N;for(const De of g){const B=s.edges.find(R=>R.id===De.edge);if(!B)continue;const C=B.endpoints.some(R=>{const G=s.shapes.find(Pe=>Pe.id===R);if(!G||G.container)return!1;const K=G.x+G.width/2,ie=G.y+G.height/2;return P<K&&K<D&&T<ie&&ie<N});for(const R of on(B)){const G=R.axis==="v"?[T,N]:[P,D];Math.min(R.hi,G[1])-Math.max(R.lo,G[0])<Vp||(R.axis==="v"?P<R.at&&R.at<D:T<R.at&&R.at<N)&&C||(R.axis==="v"?(Math.abs(R.at-P)<=la&&($=Math.max($,R.at+Qc)),Math.abs(R.at-D)<=la&&(Z=Math.min(Z,R.at-Qc))):(Math.abs(R.at-T)<=la&&(H=Math.max(H,R.at+Qc)),Math.abs(R.at-N)<=la&&(J=Math.min(J,R.at-Qc))))}}if($>y-Jc&&($=P),H>b-Jc&&(H=T),Z<E+Jc&&(Z=D),J<w+Jc&&(J=N),$===P&&H===T&&Z===D&&J===N)continue;const V=o.get(d),we={x:V.x,y:V.y,width:V.width,height:V.height},Ce=Ve(o),ke=new Set(pt(Ce).map(ct)),Ee=a(Ce);r.resizeShape(V,{x:$,y:H,width:Z-$,height:J-H});let q=Ve(o),ne=pt(q).filter(De=>!ke.has(ct(De)));const W=[];if(ne.length>0&&ne.every(De=>De.kind==="label-over-line"&&!i.has(De.edge)&&q.edges.some(B=>B.id===De.edge))){for(const De of ne){if(De.kind!=="label-over-line")continue;const B=q.edges.find(ie=>ie.id===De.edge),C=B&&uf(B,q),R=(f=o.get(De.edge))==null?void 0:f.label;if(!C||!R)continue;const G=C.x-R.x,K=C.y-R.y;r.moveElements([R],{x:G,y:K}),W.push({label:R,dx:G,dy:K})}q=Ve(o),ne=pt(q).filter(De=>!ke.has(ct(De)))}const oe=a(q),he=[...oe].some(De=>!Ee.has(De));if(ne.length||he||oe.size>=Ee.size){for(const De of W.reverse())r.moveElements([De.label],{x:-De.dx,y:-De.dy});r.resizeShape(V,we)}}}function mM(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Ep((o==null?void 0:o.$parent)??o),a=ts(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:Sp(u,i,r),requests:Ap(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...r?{rootLang:r}:{},before:s.get(l)}]:[]})}}function gy(e,t,n={}){var H,Z;const{i18n:i,lower:o=dy}=n,r=cy(e),a=Mm(r.elementRegistry),s=sy(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0},sharedEndpointCrossings:{before:0,after:0,pairs:[]}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=eM(t,a,i),u=i&&l.writes.size?mM(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ve(r.elementRegistry),f=new Set(pt(p).map(ct)),d=new Set(pt(p,{includeObservationOnly:!0}).map(ct)),g=new Set(p.edges.map(J=>J.id)),h=new Set(t.flatMap(J=>J.kind==="sequenceFlow.update"&&(J.source!==void 0||J.target!==void 0)?[J.id]:[])),m=new Set(p.shapes.map(J=>J.id)),_=$o(p),v=_.length,y=new Set(_.map(([J,V])=>`${J}|${V}`)),b=qi(p),E=new Set(b.map(([J,V])=>`${J}|${V}`)),w=new Map;for(const J of r.elementRegistry.filter(V=>"waypoints"in V&&!!V.waypoints))J.label&&w.set(J.id,{wps:J.waypoints.map(V=>({x:V.x,y:V.y})),label:{x:J.label.x,y:J.label.y},source:(H=J.source)==null?void 0:H.id,target:(Z=J.target)==null?void 0:Z.id});const P=e.get("commandStack");try{Og(P,()=>{o(l.ops,r);for(const V of(u==null?void 0:u.contexts())??[])P.execute(Cp,V);lM(r,f,p),uM(r,p),hM(r,f,p),kC(r,p,h),AC(r,g,m),Bm(r,g);const J=Jp(r,f);Tm(r,y,g),Ym(r,f,g),Hm(r,g),GC(r,g,h),Vm(r,f,g),qC(r,f,g),RC(r,E,g),NC(r,g,p),ey(r,f,g),Jm(r,g,h),ny(r,m),sM(r,f,m),Jp(r,f,J),gM(r,d,p,g),iy(r,f),Qm(r,w)})}catch(J){return{ok:!1,issues:[J instanceof fy?J.issue:{kind:"lower-failed",message:J instanceof Error?J.message:String(J)}],findings:[],stats:c}}const T=Ve(r.elementRegistry),D=pt(T,{includeObservationOnly:!0}).filter(J=>!d.has(ct(J))),N=ym(T),$=qi(T);return{ok:!0,issues:[],findings:D,stats:{edgeCrossings:{before:v,after:N.pairs.length,pairs:N.pairs,solidPairs:N.solidPairs,dashedPairs:N.dashedPairs,mixedPairs:N.mixedPairs,crossPoolMessages:N.crossPoolMessages},sharedEndpointCrossings:{before:b.length,after:$.length,pairs:$}}}}function yM(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function my(e,t){return typeof e.get=="function"?e.get(t):e[t]}function yy(e,t){const n=my(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function vy(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function vM(e){return typeof e=="string"&&vp.includes(e)}function $i(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function by(e,t={}){const n=e.rootElements??[],i=n.find(q=>q.$type==="bpmn:Collaboration"),o=new Map(n.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],_=[],v=[],y=new Map,b=new Set,E=new Set,w=q=>{q&&b.add(q)},P=q=>{b.add(q),E.add(q)},T=q=>{const ne=vy(q,"bwl:Placement");if(!ne)return;const W=typeof ne.anchor=="string"?ne.anchor:void 0;if(!W||!vM(ne.side))return;const X=typeof ne.offset=="number"?ne.offset:void 0;m.push({owner:q.id,anchor:W,side:ne.side,...X!==void 0?{offset:X}:{}})},D=q=>{const ne=vy(q,"bwl:Members"),W=typeof(ne==null?void 0:ne.refs)=="string"?ne.refs.split(/\s+/).filter(Boolean):[];W.length&&v.push({owner:q.id,refs:W})},N=q=>{var ne;for(const W of q)switch(w(W.id),W.$type){case"bpmn:TextAnnotation":P(W.id),y.set(W.id,W),c.push({id:W.id,text:typeof W.text=="string"?W.text:""}),T(W);break;case"bpmn:Association":g.push({id:W.id,type:W.$type,source:$i(W.sourceRef),target:$i(W.targetRef)});break;case"bpmn:Group":{P(W.id),y.set(W.id,W);const X=(ne=W.categoryValueRef)==null?void 0:ne.value;l.push({id:W.id,...typeof X=="string"&&X?{name:X}:{}}),D(W);break}default:u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"})}},$=q=>{for(const ne of q.flowElements??[])w(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"}),(ne.flowElements??[]).length&&$(ne);for(const ne of q.artifacts??[])w(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"})},H=(q,ne)=>{const W=q.flowElements??[],X=(q.laneSets??[]).flatMap(he=>he.lanes??[]),oe=new Map;for(const he of X){w(he.id),y.set(he.id,he);for(const De of he.flowNodeRef??[]){const B=$i(De);B&&oe.set(B,he.id)}}for(const he of W){if(w(he.id),y.set(he.id,he),he.$type==="bpmn:SequenceFlow"){f.push({id:he.id,source:$i(he.sourceRef),target:$i(he.targetRef),...typeof he.name=="string"&&he.name?{name:he.name}:{}});continue}if(he.$type==="bpmn:DataStoreReference"){P(he.id),s.push({id:he.id,...he.name?{name:he.name}:{}});continue}const De=yM(he.$type),B=De==="intermediateCatchEvent"?mp((he.eventDefinitions??[]).map(K=>K.$type)):void 0;if(!Cg(De)||De==="intermediateCatchEvent"&&!B){u.push({id:he.id,type:he.$type,reason:"type-outside-mvp"});continue}P(he.id);const C=De==="boundaryEvent"?$i(he.attachedToRef):void 0;a.push({id:he.id,type:De,...he.name?{name:he.name}:{},...ne?{participant:ne}:{},...oe.has(he.id)?{lane:oe.get(he.id)}:{},...C?{attachedTo:C}:{},...B?{eventDefinition:B}:{}}),De==="subProcess"&&$(he);const R=yy(he,"bwl:band");R!==void 0&&(p.bands[he.id]=R);const G=my(he,"bwl:afterColumn");typeof G=="string"&&G!==""&&_.push([he.id,G]);for(const K of he.dataOutputAssociations??[])w(K.id),h.push({id:K.id,type:K.$type,source:he.id,target:$i(K.targetRef)});for(const K of he.dataInputAssociations??[])w(K.id),h.push({id:K.id,type:K.$type,source:$i((K.sourceRef??[])[0]),target:he.id})}N(q.artifacts??[])};if(i){const q=new Set;for(const ne of i.participants??[]){P(ne.id),y.set(ne.id,ne);const W=$i(ne.processRef);W&&q.add(W);const X=W?o.get(W):void 0,oe=((X==null?void 0:X.laneSets)??[]).flatMap(C=>C.lanes??[]),he=oe.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of he)P(C.id);const De=!X||(X.flowElements??[]).length===0&&oe.length===0&&(X.artifacts??[]).length===0;r.push({id:ne.id,...ne.name?{name:ne.name}:{},...De?{blackBox:!0}:{},...he.length?{lanes:he}:{}});const B=yy(ne,"bwl:poolOrder");B!==void 0&&(p.poolOrders[ne.id]=B),X&&H(X,ne.id)}for(const ne of i.messageFlows??[])w(ne.id),y.set(ne.id,ne),d.push({id:ne.id,source:$i(ne.sourceRef),target:$i(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});N(i.artifacts??[]);for(const[ne,W]of o)!q.has(ne)&&(W.flowElements??[]).length>0&&u.push({id:ne,type:W.$type,reason:"unreachable-process"})}else for(const q of o.values())H(q);const Z=[],J=[],V=[],we=[],Ce=(q,ne)=>!!q&&!!ne&&E.has(q)&&E.has(ne);for(const q of f){if(!Ce(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Z.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of d){if(!Ce(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}J.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of h){if(!Ce(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}we.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&E.add(q.id)}for(const q of g){if(!Ce(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}V.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const ke=new Map(l.map(q=>[q.id,q]));for(const{owner:q,refs:ne}of v){const W=ne.filter(oe=>b.has(oe)),X=ke.get(q);X&&W.length&&(X.members=W)}for(const q of m)b.has(q.anchor)&&(p.placements[q.owner]={anchor:q.anchor,side:q.side,...q.offset!==void 0?{offset:q.offset}:{}});for(const[q,ne]of _)b.has(ne)&&(p.afterColumns[q]=ne);const Ee={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Z,...J.length?{messageFlows:J}:{},...s.length?{dataStores:s}:{},...we.length?{dataAssociations:we}:{},...c.length?{annotations:c}:{},...V.length?{associations:V}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Ee,hints:p,omitted:u,i18n:bM(Ee,y,e,t.i18n)}:{definition:Ee,hints:p,omitted:u}}function bM(e,t,n,i){const o=Ep(n),r=ts(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Sp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Ap(u))r.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:r.slice(1),reviewRequests:a}}async function xM(e,t={}){const{definitions:n,warnings:i}=await aa(e);return{...by(n,t),warnings:i}}const _M=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function gf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function wM(e){return gf(e.processRef)!==void 0}function EM(e){const t=new Set,n=o=>{const r=gf(o);r&&t.add(r)},i=o=>{for(const r of o.flowElements??[]){n(r.sourceRef),n(r.targetRef),r.attachedToRef&&(n(r.attachedToRef),t.add(r.id));for(const a of r.dataOutputAssociations??[])t.add(r.id),n(a.targetRef);for(const a of r.dataInputAssociations??[]){t.add(r.id);for(const s of a.sourceRef??[])n(s)}(r.flowElements??[]).length&&i(r)}for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)};for(const o of e.rootElements??[])if(o.$type==="bpmn:Process")i(o);else if(o.$type==="bpmn:Collaboration"){for(const r of o.messageFlows??[])n(r.sourceRef),n(r.targetRef);for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)}return t}function SM(e){const t=[],n=i=>{for(const o of i.flowElements??[])_M.has(o.$type)&&t.push(o),(o.flowElements??[]).length&&n(o)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function RM(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 mf(e){const t=[],n=e.rootElements??[],i=EM(e);for(const r of SM(e))i.has(r.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[r.id],params:{type:r.$type}});const o=n.find(r=>r.$type==="bpmn:Collaboration");if(o){const r=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of o.participants??[])wM(s)&&RM(r.get(gf(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 CM(e){const{definitions:t,warnings:n}=await aa(e);return{issues:mf(t),warnings:n}}const MM=.5,AM=8,PM=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),ha=e=>typeof e=="number"?e:Number(e??NaN),el=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function TM(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${el(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${el(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(el).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function kM(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},o=a=>{const s=a;return s?[ha(s.x),ha(s.y),ha(s.width),ha(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=el(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[ha(f.x),ha(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function xy(e){const t=kM(e),n=new Map,i=new Set,o=r=>{if(Array.isArray(r))return r.forEach(o);if(!r||typeof r!="object"||i.has(r))return;i.add(r);const a=r,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!PM.has(s)&&n.set(c,{type:s,props:TM(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&o(l)};return o(e),n}function _y(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),o=t===""?[]:t.split(",").map(Number);return i.length!==o.length?!0:i.some((r,a)=>Math.abs(r-o[a])>n)}function wy(e,t,n={}){const i=n.moveTolerance??MM,o=xy(e),r=xy(t),a=[],s=[],c=[];for(const[l,u]of r){const p=o.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||_y(p.geometry,u.geometry,i)||_y(p.label,u.label,n.labelTolerance??AM))&&c.push(l)}for(const l of o.keys())r.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function OM(e,t,n={}){const[i,o]=await Promise.all([aa(e),aa(t)]);return{...wy(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function DM(e){return new Set([...e.added,...e.modified])}function LM(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Ey(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=gy(e,t.ops,{i18n:i});if(!o.ok)return{status:"rejected",issues:o.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:o.findings,stats:o.stats}}const IM=new Set(["lasso","lasso.selection","hand","hand.move"]),Sy=1e4,BM="bwl-edit-locked",Ry=new WeakMap;function NM(e){const t=Ry.get(e);if(t)return t;const n=e.get("eventBus"),i=e.get("dragging",!1);let o=!1,r=!1;n.on("drag.init",Sy,()=>{var s;if(o)return IM.has((s=i==null?void 0:i.context())==null?void 0:s.prefix)?void 0:!1}),n.on(["contextPad.open.allowed","contextPad.trigger","palette.trigger","element.dblclick"],Sy,()=>o?!1:void 0);const a={get locked(){return o},set(s){var l,u,p;if(s===o)return;o=s,e.get("canvas").getContainer().classList.toggle(BM,s);const c=e.get("keyboard",!1);s?(i==null||i.cancel(),(l=e.get("contextPad",!1))==null||l.close(),(u=e.get("popupMenu",!1))==null||u.close(),(p=e.get("directEditing",!1))==null||p.complete(),r=!!(c!=null&&c.getBinding()),c==null||c.unbind()):r&&(c.bind(),r=!1)}};return Ry.set(e,a),a}const $M=Symbol("bpmn-editor"),yf={geometry:[],semantic:[]};function FM(){const e=me.ref(!1),t=me.ref(!0),n=me.ref(!1),i=me.shallowRef(yf),o=me.shallowRef(void 0),r=me.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=yf;return}const _=pt(Ve(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:_,semantic:v?mf(v):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const _=u();if(!_||!a){r.value=void 0;return}const v=_.locales(),y={};for(const b of v)y[b]={untranslated:_.untranslatedCount(b),reviewRequested:_.reviewRequestedCount(b)};r.value={designLocale:a.designLocale,locales:v,displayLocale:_.getDisplayLocale()??a.designLocale,counts:y}}function f(){const _=u();_&&(_.configure(a),a&&s&&(s=_.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(_,v){NM(_).set(!v)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function m(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:o,i18n:r,configureI18n(_){a=_,f(),p()},setDisplayLocale(_){var y;s=_;const v=(y=u())==null?void 0:y.setDisplayLocale(_);v&&(s=v),p()},setChangeScope(_){o.value=_===void 0?void 0:new Set(_)},requestFocus(_){if(!c)return;const v=c.get("elementRegistry").get(_);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(_){const v=c==null?void 0:c.get("elementRegistry").get(_),y=v==null?void 0:v.businessObject;if(!y)return;const b=typeof y.name=="string"&&y.name.trim()!==""?y.name:y.text;return{name:typeof b=="string"&&b.trim()!==""?b.trim():void 0,type:typeof y.$type=="string"?y.$type:""}},attach(_){c&&this.detach(),c=_,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=yf,o.value=void 0,r.value=void 0},setEditable(_){t.value=_,c&&g(c,_)},async applyAgentBatch(_,v){const y=h();n.value=!0;try{const b=await Ey(y,_,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return b.status==="applied"&&(e.value=!1),b}finally{n.value=!1}},async importXml(_){const{warnings:v}=await h().importXML(_);return e.value=!1,o.value=void 0,l(),{warnings:Gp(v)}},async saveXml(){const{xml:_}=await h().saveXML({format:!0});return e.value=!1,_??""},undo:()=>{var _;return(_=m())==null?void 0:_.undo()},redo:()=>{var _;return(_=m())==null?void 0:_.redo()},canUndo:()=>{var _;return((_=m())==null?void 0:_.canUndo())??!1},canRedo:()=>{var _;return((_=m())==null?void 0:_.canRedo())??!1}}}const jM=new RegExp("\\p{Script=Hangul}","u"),HM=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,zM=new RegExp("\\p{Script=Han}","u");function vf(e){const t=jM.test(e),n=HM.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:zM.test(e)?"han":"other"}}function Cy(e){var t,n;return((t=e==null?void 0:e.get)==null?void 0:t.call(e,"xml:lang"))??((n=e==null?void 0:e.$attrs)==null?void 0:n["xml:lang"])}function My(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=xr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:ia(a).filter(l=>Nn(l))})}return n}const fs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function GM(e){const t=Cy(e),n=My(e);let i;const o={},r=[],a=[],s=[];for(const g of n){const h=g.trs.filter(m=>(m.body??"")===g.name).map(Nn);if(h.length){const m=[...h].sort().join("+");o[m]=(o[m]??0)+1,i=i?new Set([...i].filter(_=>h.includes(_))):new Set(h)}else g.trs.some(m=>m.body)?r.push(fs(g)):s.push({e:g,inference:vf(g.name)});for(const m of g.trs){const _=Nn(m),v=m.body??"",y=vf(v);y.locale&&y.locale!==_?a.push({...fs(g),locale:_,script:y.script}):_==="ko"&&y.script==="han"&&g.trs.some(b=>b!==m&&b.body===v)&&a.push({...fs(g),locale:_,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...fs(g),locale:h.locale}):d.push({...fs(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function VM(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Cy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(My(e).map(r=>[r.bo.id,r]));for(const{id:r,name:a,locale:s}of t.additions){const c=o.get(r);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>Nn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(na,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ae(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function WM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bf={exports:{}},Ay;function UM(){if(Ay)return bf.exports;Ay=1;var e=bf.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,t/o))/Math.log(n)*o;for(var r=i-Math.floor(i),a="",o=0;o<Math.floor(i);o++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(r){var c=Math.pow(n,r),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var o=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(r,c));return r[c]=a,c},r=o.hats={};return o.get=function(a){return o.hats[a]},o.set=function(a,s){return o.hats[a]=s,o},o.bits=t||128,o.base=n||16,o},bf.exports}var qM=UM(),YM=WM(qM);function Ki(e){if(!(this instanceof Ki))return new Ki(e);e=e||[128,36,1],this._seed=e.length?YM.rack(e[0],e[1],e[2]):e}Ki.prototype.next=function(e){return this._seed(e||!0)},Ki.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Ki.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Ki.prototype.assigned=function(e){return this._seed.get(e)||!1},Ki.prototype.unclaim=function(e){delete this._seed.hats[e]},Ki.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const gn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};gn.td=gn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],gn.option=gn.optgroup=[1,'<select multiple="multiple">',"</select>"],gn.thead=gn.tbody=gn.colgroup=gn.caption=gn.tfoot=[1,"<table>","</table>"],gn.polyline=gn.ellipse=gn.polygon=gn.circle=gn.text=gn.line=gn.path=gn.rect=gn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function $t(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(gn,i)?gn[i]:gn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function KM(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function Vn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(o,r){n[r]=o})}),e}function En(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const XM=Object.prototype.toString;function Rt(e){return new jo(e)}function jo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}jo.prototype.add=function(e){return this.list.add(e),this},jo.prototype.remove=function(e){return XM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},jo.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},jo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},jo.prototype.array=function(){return Array.from(this.list)},jo.prototype.has=jo.prototype.contains=function(e){return this.list.contains(e)};function tl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Rr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function ZM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nl={},Py;function QM(){if(Py)return nl;Py=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return nl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},nl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},nl}var Ty=QM(),JM=ZM(Ty),$e=KM({__proto__:null,default:JM},[Ty]),ky=["focus","blur"];function eA(e,t,n,i,o){return ky.indexOf(n)!==-1&&(o=!0),$e.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Rr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function tA(e,t,n,i){return ky.indexOf(t)!==-1&&(i=!0),$e.unbind(e,t,n,i)}var ti={bind:eA,unbind:tA};function xf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Et(e,t){return t=t||document,t.querySelector(e)}function ds(e,t){return t=t||document,t.querySelectorAll(e)}function Xi(e){e.parentNode&&e.parentNode.removeChild(e)}function nA(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function iA(e,t){return t.appendChild(nA(e,t))}function qe(e,t){return iA(t,e),e}var _f=2,Oy={"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":_f,"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":_f,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function oA(e,t){return Oy[t]?e.style[t]:e.getAttributeNS(null,t)}function Dy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Oy[i];o?(o===_f&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function rA(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Dy(e,o,t[o])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)Dy(e,t,n);else return oA(e,t);else rA(e,t);return e}const aA=Object.prototype.toString;function lt(e){return new Ho(e)}function Ho(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ho.prototype.add=function(e){return this.list.add(e),this},Ho.prototype.remove=function(e){return aA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ho.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},Ho.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ho.prototype.array=function(){return Array.from(this.list)},Ho.prototype.has=Ho.prototype.contains=function(e){return this.list.contains(e)};function hs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function wf(e){return e.cloneNode(!0)}var Ef={svg:"http://www.w3.org/2000/svg"},Ly='<svg xmlns="'+Ef.svg+'"';function sA(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Ef.svg)===-1&&(e=Ly+e.substring(4)):(e=Ly+">"+e+"</svg>",t=!0);var n=cA(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function cA(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Le(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=sA(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ef.svg,e),t&&Se(n,t),n}var Sf=null;function Iy(){return Sf===null&&(Sf=Le("svg")),Sf}function By(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function lA(e,t,n,i,o,r){var a=Iy().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return By(a,e);case 6:return By(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function gs(e){return Iy().createSVGTransform()}var Ny=/([&<>]{1})/g,uA=/([&<>\n\r"]{1})/g,pA={"&":"&","<":"<",">":">",'"':"'"};function Rf(e,t){function n(i,o){return pA[o]||o}return e.replace(t,n)}function $y(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Rf(e.textContent,Ny));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(o=e.attributes,n=0,i=o.length;n<i;++n)r=o.item(n),t.push(" ",r.name,'="',Rf(r.value,uA),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)$y(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Rf(e.nodeValue,Ny),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function fA(e){for(var t=e.firstChild,n=[];t;)$y(t,n),t=t.nextSibling;return n.join("")}function Fy(e,t){return fA(e)}function rn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function dA(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function hA(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(dA(e,i))}function ms(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),hA(n,t)),n.consolidate()}const gA=/^class[ {]/;function mA(e){return gA.test(e.toString())}function Cf(e){return Array.isArray(e)}function Mf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function il(...e){e.length===1&&Cf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const yA=/constructor\s*[^(]*\(\s*([^)]*)\)/m,vA=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,bA=/\/\*([^*]*)\*\//m;function xA(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(mA(e)?yA:vA);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(bA);return(o&&o[1]||i).trim()})||[]}function jy(e,t){const n=t||{get:function(y,b){if(i.push(y),b===!1)return null;throw s(`No provider for "${y}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(y){const b=i.join(" -> ");return i.length=0,new Error(b?`${y} (Resolving: ${b})`:y)};function c(y,b){if(!o[y]&&y.includes(".")){const E=y.split(".");let w=c(E.shift());for(;E.length;)w=w[E.shift()];return w}if(Mf(r,y))return r[y];if(Mf(o,y)){if(i.indexOf(y)!==-1)throw i.push(y),s("Cannot resolve circular dependency!");return i.push(y),r[y]=o[y][0](o[y][1]),i.pop(),r[y]}return n.get(y,b)}function l(y,b){if(typeof b>"u"&&(b={}),typeof y!="function")if(Cf(y))y=il(y.slice());else throw s(`Cannot invoke "${y}". Expected a function!`);const w=(y.$inject||xA(y)).map(P=>Mf(b,P)?b[P]:c(P));return{fn:y,dependencies:w}}function u(y){const{fn:b,dependencies:E}=l(y),w=Function.prototype.bind.call(b,null,...E);return new w}function p(y,b,E){const{fn:w,dependencies:P}=l(y,E);return w.apply(b,P)}function f(y){return il(b=>y.get(b))}function d(y,b){if(b&&b.length){const E=Object.create(null),w=Object.create(null),P=[],T=[],D=[];let N,$,H,Z;for(let J in o)N=o[J],b.indexOf(J)!==-1&&(N[2]==="private"?($=P.indexOf(N[3]),$===-1?(H=N[3].createChild([],b),Z=f(H),P.push(N[3]),T.push(H),D.push(Z),E[J]=[Z,J,"private",H]):E[J]=[D[$],J,"private",T[$]]):E[J]=[N[2],N[1]],w[J]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&b.forEach(V=>{N[1].$scope.indexOf(V)!==-1&&(E[J]=[N[2],N[1]],w[V]=!0)});b.forEach(J=>{if(!w[J])throw new Error('No provider for "'+J+'". Cannot use provider from the parent!')}),y.unshift(E)}return new jy(y,a)}const g={factory:p,type:u,value:function(y){return y}};function h(y,b){const E=y.__init__||[];return function(){E.forEach(w=>{typeof w=="string"?b.get(w):b.invoke(w)})}}function m(y){const b=y.__exports__;if(b){const E=y.__modules__,w=Object.keys(y).reduce(($,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&($[H]=y[H]),$),Object.create(null)),P=(E||[]).concat(w),T=d(P),D=il(function($){return T.get($)});b.forEach(function($){o[$]=[D,$,"private",T]});const N=(y.__init__||[]).slice();return N.unshift(function(){T.init()}),y=Object.assign({},y,{__init__:N}),h(y,T)}return Object.keys(y).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const w=y[E];if(w[2]==="private"){o[E]=w;return}const P=w[0],T=w[1];o[E]=[g[P],_A(P,T),P]}),h(y,a)}function _(y,b){return y.indexOf(b)!==-1||(y=(b.__depends__||[]).reduce(_,y),y.indexOf(b)!==-1)?y:y.concat(b)}function v(y){const b=y.reduce(_,[]).map(m);let E=!1;return function(){E||(E=!0,b.forEach(w=>w()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=v(e)}function _A(e,t){return e!=="value"&&Cf(t)&&(t=il(t.slice())),t}var wA=1e3;function go(e,t){var n=this;t=t||wA,e.on(["render.shape","render.connection"],t,function(i,o){var r=i.type,a=o.element,s=o.gfx,c=o.attrs;if(n.canRender(a))return r==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,o){if(n.canRender(o))return i.type==="render.getShapePath"?n.getShapePath(o):n.getConnectionPath(o)})}go.prototype.canRender=function(e){},go.prototype.drawShape=function(e,t){},go.prototype.drawConnection=function(e,t){},go.prototype.getShapePath=function(e){},go.prototype.getConnectionPath=function(e){};function Cr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function EA(e){return["M",e.x,e.y]}function Af(e){return["L",e.x,e.y]}function SA(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function RA(e,t){const n=e.length,i=[EA(e[0])];for(let o=1;o<n;o++){const r=e[o-1],a=e[o],s=e[o+1];if(!s||!t){i.push(Af(a));continue}const c=Math.min(t,Pf(a.x-r.x,a.y-r.y),Pf(s.x-a.x,s.y-a.y));if(!c){i.push(Af(a));continue}const l=ol(a,r,c),u=ol(a,r,c*.5),p=ol(a,s,c),f=ol(a,s,c*.5);i.push(Af(l)),i.push(SA(u,f,p))}return i}function ol(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Pf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Pf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ys(e,t,n){Ge(t)&&(n=t,t=null),t||(t={});const i=Le("path",t);return Ge(n)&&(i.dataset.cornerRadius=String(n)),Tf(i,e)}function Tf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:Cr(RA(t,n))}),e}function rl(e){var t=new Set(e);return rt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Mr(e,t,n){n=n||0,ze(e)||(e=[e]),z(e,function(i,o){var r=t(i,o,n);ze(r)&&r.length&&Mr(r,t,n+1)})}function kf(e,t,n){var i=new Set,o=new Set;return Mr(e,function(r,a,s){i.add(r);var c=r.children;if(c&&!o.has(c))return o.add(c),c}),Array.from(i)}function vs(e,t){return kf(e)}function CA(e,t,n){br(t)&&(t=!0),hn(t)&&(n=t,t=!0),n=n||{};var i=bs(n.allShapes),o=bs(n.allConnections),r=bs(n.enclosedElements),a=bs(n.enclosedConnections),s=bs(n.topLevel,t&&ea(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,z(u.incoming,c),z(u.outgoing,c),u.children}return Mr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function an(e,t){t=!!t,ze(e)||(e=[e]);var n,i,o,r;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=an(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function ga(e,t){var n={};return z(e,function(i){var o=i;o.waypoints&&(o=an(o)),!Ge(t.y)&&o.x>t.x&&(n[i.id]=i),!Ge(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Ge(t.width)&&Ge(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Ge(t.width)||!Ge(t.height))&&(n[i.id]=i)}),n}function Hy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function zy(e){return!!(e&&e.isFrame)}function bs(e,t){return U({},e||{},t||{})}var MA=1;function zo(e,t){go.call(this,e,MA),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})}Ae(zo,go),zo.prototype.canRender=function(){return!0},zo.prototype.drawShape=function(t,n,i){var o=Le("rect");return Se(o,{x:0,y:0,width:n.width||0,height:n.height||0}),zy(n)?Se(o,U({},this.FRAME_STYLE,i||{})):Se(o,U({},this.SHAPE_STYLE,i||{})),qe(t,o),o},zo.prototype.drawConnection=function(t,n,i){var o=ys(n.waypoints,U({},this.CONNECTION_STYLE,i||{}));return qe(t,o),o},zo.prototype.getShapePath=function(t){var n=t.x,i=t.y,o=t.width,r=t.height,a=[["M",n,i],["l",o,0],["l",0,r],["l",-o,0],["z"]];return Cr(a)},zo.prototype.getConnectionPath=function(t){var n=t.waypoints,i,o,r=[];for(i=0;o=n[i];i++)o=o.original||o,r.push([i===0?"M":"L",o.x,o.y]);return Cr(r)},zo.$inject=["eventBus","styles"];function AA(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,o){var r=this.style(i,o);return U(r,{class:n})},this.style=function(n,i){!ze(n)&&!i&&(i=n,n=[]);var o=ei(n,function(r,a){return U(r,e[a]||{})},{});return i?U(o,i):o},this.computeStyle=function(n,i,o){return ze(i)||(o=i,i=[]),t.style(i||[],U({},o,n||{}))}}const PA={__init__:["defaultRenderer"],defaultRenderer:["type",zo],styles:["type",AA]};function Zt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function tn(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Of(e,t){return!e||!t?-1:e.indexOf(t)}function xs(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Df(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=xs(e,t);return Math.abs(o/r)<=i}var TA=2;function mo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(kA(o,n))return r;return!1}function kA(e,t){const n=t[0];return Oo(t,function(i){return Math.abs(n[e]-i[e])<=TA})}function Gy(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 OA=/,?([a-z]),?/gi,Vy=parseFloat,sn=Math,Go=sn.PI,Zi=sn.min,Qi=sn.max,Wy=sn.pow,Vo=sn.abs,DA=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,LA=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Uy=Array.isArray||function(e){return e instanceof Array};function IA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function BA(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 NA(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),o=t.cache=t.cache||{},r=t.count=t.count||[];return IA(o,i)?(BA(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function $A(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(DA,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(LA,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([o,...a.splice(0,2)]),s="l",o=o=="m"?"l":"L");a.length>=t[s]&&(n.push([o,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Bf,n}function FA(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 jA(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 If(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 Bf(){return this.join(",").replace(OA,"$1")}function HA(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var o=e[n],r=t[n]=new Array(o.length),a=0,s=o.length;a<s;a++)r[a]=o[a];return t.toString=Bf,t}function qy(e,t,n,i,o,r,a,s,c){var l=1-c,u=Wy(l,3),p=Wy(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*o+d*a,h=u*t+p*3*c*i+l*3*c*c*r+d*s;return{x:al(g),y:al(h)}}function Yy(e){var t=qA(...e);return If(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Wo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function zA(e,t){return e=If(e),t=If(t),Wo(t,e.x,e.y)||Wo(t,e.x2,e.y)||Wo(t,e.x,e.y2)||Wo(t,e.x2,e.y2)||Wo(e,t.x,t.y)||Wo(e,t.x2,t.y)||Wo(e,t.x,t.y2)||Wo(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 Ky(e,t,n,i,o){var r=-3*t+9*n-9*i+3*o,a=e*r+6*t-12*n+6*i;return e*a-3*t+3*n}function Xy(e,t,n,i,o,r,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<u;g++){var h=l*p[g]+l,m=Ky(h,e,n,o,a),_=Ky(h,t,i,r,s),v=m*m+_*_;d+=f[g]*sn.sqrt(v)}return l*d}function GA(e,t,n,i,o,r,a,s){if(!(Qi(e,n)<Zi(o,a)||Zi(e,n)>Qi(o,a)||Qi(t,i)<Zi(r,s)||Zi(t,i)>Qi(r,s))){var c=(e*i-t*n)*(o-a)-(e-n)*(o*s-r*a),l=(e*i-t*n)*(r-s)-(t-i)*(o*s-r*a),u=(e-n)*(r-s)-(t-i)*(o-a);if(u){var p=al(c/u),f=al(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Zi(e,n).toFixed(2)||d>+Qi(e,n).toFixed(2)||d<+Zi(o,a).toFixed(2)||d>+Qi(o,a).toFixed(2)||g<+Zi(t,i).toFixed(2)||g>+Qi(t,i).toFixed(2)||g<+Zi(r,s).toFixed(2)||g>+Qi(r,s).toFixed(2)))return{x:p,y:f}}}}function al(e){return Math.round(e*1e11)/1e11}function VA(e,t,n){var i=Yy(e),o=Yy(t);if(!zA(i,o))return[];var r=Xy(...e),a=Xy(...t),s=Qy(e)?1:~~(r/5)||1,c=Qy(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=qy(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=qy(...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 m=l[d],_=l[d+1],v=u[g],y=u[g+1],b=Vo(_.x-m.x)<.01?"y":"x",E=Vo(y.x-v.x)<.01?"y":"x",w=GA(m.x,m.y,_.x,_.y,v.x,v.y,y.x,y.y),P;if(w){if(P=w.x.toFixed(9)+"#"+w.y.toFixed(9),p[P])continue;p[P]=!0;var T=m.t+Vo((w[b]-m[b])/(_[b]-m[b]))*(_.t-m.t),D=v.t+Vo((w[E]-v[E])/(y[E]-v[E]))*(y.t-v.t);T>=0&&T<=1&&D>=0&&D<=1&&f.push({x:w.x,y:w.y,t1:T,t2:D})}}return f}function Zy(e,t,n){e=tv(e),t=tv(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,v=t.length;_<v;_++){var y=t[_];if(y[0]=="M")r=l=y[1],a=u=y[2];else{y[0]=="C"?(f=[r,a,...y.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var b=VA(p,f);{for(var E=0,w=b.length;E<w;E++)b[E].segment1=g,b[E].segment2=_,b[E].bez1=p,b[E].bez2=f;d=d.concat(b)}}}}}return d}function WA(e){return Uy(e)&&Uy(e[0])}function UA(e){if(FA(e))return e;var t=new Array(e.length),n=0,i=0,o=0,r=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],o=n,r=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":o=+l[1]+n,r=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Bf,t}function Qy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function sl(e,t,n,i){return[e,t,n,i,n,i]}function Jy(e,t,n,i,o,r){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*o+s*n,a*r+s*i,o,r]}function ev(e,t,n,i,o,r,a,s,c,l){var u=Go*120/180,p=Go/180*(+o||0),f=[],d,g=NA(function(B,C,R){var G=B*sn.cos(R)-C*sn.sin(R),K=B*sn.sin(R)+C*sn.cos(R);return{x:G,y:K}});if(l)P=l[0],T=l[1],E=l[2],w=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,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=sn.sqrt(_),n=_*n,i=_*i);var v=n*n,y=i*i,b=(r==a?-1:1)*sn.sqrt(Vo((v*y-v*m*m-y*h*h)/(v*m*m+y*h*h))),E=b*n*m/i+(e+s)/2,w=b*-i*h/n+(t+c)/2,P=sn.asin(((t-w)/i).toFixed(9)),T=sn.asin(((c-w)/i).toFixed(9));P=e<E?Go-P:P,T=s<E?Go-T:T,P<0&&(P=Go*2+P),T<0&&(T=Go*2+T),a&&P>T&&(P=P-Go*2),!a&&T>P&&(T=T-Go*2)}var D=T-P;if(Vo(D)>u){var N=T,$=s,H=c;T=P+u*(a&&T>P?1:-1),s=E+n*sn.cos(T),c=w+i*sn.sin(T),f=ev(s,c,n,i,o,0,a,$,H,[T,N,E,w])}D=T-P;var Z=sn.cos(P),J=sn.sin(P),V=sn.cos(T),we=sn.sin(T),Ce=sn.tan(D/4),ke=4/3*n*Ce,Ee=4/3*i*Ce,q=[e,t],ne=[e+ke*J,t-Ee*Z],W=[s+ke*we,c-Ee*V],X=[s,c];if(ne[0]=2*q[0]-ne[0],ne[1]=2*q[1]-ne[1],l)return[ne,W,X].concat(f);f=[ne,W,X].concat(f).join().split(",");for(var oe=[],he=0,De=f.length;he<De;he++)oe[he]=he%2?g(f[he-1],f[he],p).y:g(f[he],f[he+1],p).x;return oe}function qA(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,_,v=0;v<2;++v){if(v==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,f=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,f=3*i-3*t),Vo(u)<1e-12){if(Vo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,_=sn.sqrt(m),!(m<0)&&(g=(-p+_)/(2*u),0<g&&g<1&&c.push(g),h=(-p-_)/(2*u),0<h&&h<1&&c.push(h))}for(var y=c.length,b=y,E;y--;)d=c[y],E=1-d,l[0][y]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][y]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:Zi(...l[0]),y0:Zi(...l[1]),x1:Qi(...l[0]),y1:Qi(...l[1])}}function tv(e){if(WA(e)||(e=$A(e)),jA(e))return e;for(var t=HA(UA(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,m;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",...ev(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),f=["C",h,m,...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",...Jy(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",...Jy(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...sl(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...sl(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...sl(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...sl(d.x,d.y,d.X,d.Y)];break}return f},o=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)r[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),l=t.length}},r=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(r[c]=a,c&&(s=r[c-1])),t[c]=i(t[c],n,s),r[c]!="A"&&a=="C"&&(r[c]="C"),o(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Vy(u[p-4])||n.x,n.by=Vy(u[p-3])||n.y}return t}function kt(e){return hn(e)&&Jn(e,"waypoints")}function it(e){return hn(e)&&Jn(e,"labelTarget")}function YA(e){return hn(e)&&Qr(e.parent)}function nv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function yo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function je(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function cl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function KA(e){return yo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function XA(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=JA(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),o=i/2,r=0,a=n[r];a.endLength<o;)a=n[++r];var s=(o-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function We(e){return kt(e)?XA(e):KA(e)}function kn(e,t,n){n=n||0,hn(n)||(n={x:n,y:n});var i=je(e),o=je(t),r=i.bottom+n.y<=o.top,a=i.left-n.x>=o.right,s=i.top-n.y>=o.bottom,c=i.right+n.x<=o.left,l=r?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function _s(e,t,n){var i=ZA(e,t);return i.length===1||i.length===2&&xs(i[0],i[1])<1?yo(i[0]):i.length>1?(i=Vi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),yo(i[n?0:i.length-1])):null}function ZA(e,t){return Zy(e,t)}function QA(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],xs(n,o)===0||Df(i,o,n)?e.splice(t,1):t++;return e}function JA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ll(e,t){return Math.round(e*t)/t}function iv(e){return Ge(e)?e+"px":e}function eP(e){for(;e.parent;)e=e.parent;return e}function tP(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"),Vn(n,{position:"relative",overflow:"hidden",width:iv(e.width),height:iv(e.height)}),t.appendChild(n),n}function ov(e,t,n){const i=Le("g");lt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const nP="base",rv=0,iP=1,oP={shape:["x","y","width","height"],connection:["waypoints"]};function Ue(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||{})}Ue.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ue.prototype._init=function(e){const t=this._eventBus,n=this._container=tP(e),i=this._svg=Le("svg");Se(i,{width:"100%",height:"100%"}),En(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),qe(n,i);const o=this._viewport=ov(i,"viewport");e.deferUpdate&&(this._viewboxChanged=wp(this._viewboxChanged,300)),this._restoreFocus=wp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:o})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ue.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},Ue.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ue.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Hy(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ue.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ue.prototype.restoreFocus=function(){this._restoreFocus()},Ue.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ue.prototype.isFocused=function(){return this._focused},Ue.prototype.getDefaultLayer=function(){return this.getLayer(nP,rv)},Ue.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},Ue.prototype._getChildIndex=function(e){return ei(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ue.prototype._createLayer=function(e,t){typeof t>"u"&&(t=iP);const n=this._getChildIndex(t);return{group:ov(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ue.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,o=t.index;if(t.visible)return i;const r=this._getChildIndex(o);return n.insertBefore(i,n.childNodes[r]||null),t.visible=!0,i},Ue.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(rn(n),t.visible=!1),n},Ue.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],rn(t.group))},Ue.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ue.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(eP(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},Ue.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ue.prototype._findPlaneForRoot=function(e){return Lt(this._planes,function(t){return t.rootElement===e})},Ue.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ue.prototype._resolveElements=function(e){return ze(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ue.prototype.getContainer=function(){return this._container},Ue.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),lt(o).add(t)):(e.markers.delete(t),lt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ue.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ue.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ue.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ue.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ue.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ue.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,rv);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ue.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},Ue.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},Ue.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)},Ue.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})},Ue.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})},Ue.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=oP[e];if(!Oo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ue.prototype._setParent=function(e,t,n){tn(t.children,e,n),e.parent=t},Ue.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const o=this._eventBus,r=this._graphicsFactory;this._ensureValid(e,t),o.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=r.create(e,t,i);return this._elementRegistry.add(t,a),r.update(e,t,a),o.fire(e+".added",{element:t,gfx:a}),t},Ue.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ue.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ue.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e),!!e)return o.fire(t+".remove",{element:e}),i.remove(e),Zt(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},Ue.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ue.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ue.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ue.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ue.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ue.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,o,r,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ms(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=ms(t),o=a?a.matrix:lA(),s=ll(o.a,1e3),c=ll(-o.e||0,1e3),l=ll(-o.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Ue.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),av(t,n)}),{x:n.e,y:n.f}},Ue.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const o=this.findRoot(i);if(!o)return;o!==this.getRootElement()&&this.setRootElement(o);const r=i.filter(g=>g!=o);if(!r.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=an(r),s=je(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=je(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),m=Math.max(0,s.bottom-f.bottom),_=Math.min(0,s.top-f.top);u=g||h,p=m||_}this.scroll({dx:-u*l,dy:-p*l})},Ue.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),ll(i.a,1e3)};function av(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ue.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let o,r;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?r={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(o=Math.min(1,n.width/i.width,n.height/i.height),r={x:i.x+(e?i.width/2-n.width/o/2:0),y:i.y+(e?i.height/2-n.height/o/2:0),width:n.width/o,height:n.height/o}),this.viewbox(r),this.viewbox(!1).scale},Ue.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=U(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),av(this._viewport,u),u},Ue.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ue.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale,r=n.width*t.scale,a=n.height*t.scale;return{x:i,y:o,width:r,height:a}},Ue.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ma="data-element-id";function gi(e){this._elements={},this._eventBus=e}gi.$inject=["eventBus"],gi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,ma,i),n&&Se(n,ma,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},gi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,ma,""),i.secondaryGfx&&Se(i.secondaryGfx,ma,""),delete t[n])},gi.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},gi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Se(t,ma,i),t},gi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,ma);var n=this._elements[t];return n&&n.element},gi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},gi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},gi.prototype.getAll=function(){return this.filter(function(e){return e})},gi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},gi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},gi.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function rP(e,t,n,i){var o=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var a=this.indexOf(r);return a!==-1&&(this.splice(a,1),t.unset(r,o,i)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,a){var s=this.indexOf(r);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,r),s===-1&&t.set(r,o,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function aP(e){return e.__refs_collection===!0}function sP(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function sv(e,t,n){var i=rP(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(o){e.set(o,t.inverse,n)})}function cP(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(r){if(r!==o){var a=o;o=null,a&&e.unset(a,i,n),o=r,e.set(o,i,n)}}})}function xi(e,t){if(!(this instanceof xi))return new xi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}xi.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?sv(this,t,e):cP(this,t,e)},xi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return aP(n)||sv(this,t,e),n},xi.prototype.ensureBound=function(e,t){sP(e,t)||this.bind(e,t)},xi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},xi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Nf=new xi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),cv=new xi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),lv=new xi({name:"attachers",collection:!0},{name:"host"}),uv=new xi({name:"outgoing",collection:!0},{name:"source"}),pv=new xi({name:"incoming",collection:!0},{name:"target"});function ya(){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)}}),Nf.bind(this,"parent"),cv.bind(this,"labels"),uv.bind(this,"outgoing"),pv.bind(this,"incoming")}function ws(){ya.call(this),Nf.bind(this,"children"),lv.bind(this,"host"),lv.bind(this,"attachers")}Ae(ws,ya);function fv(){ya.call(this),Nf.bind(this,"children")}Ae(fv,ws);function dv(){ws.call(this),cv.bind(this,"labelTarget")}Ae(dv,ws);function hv(){ya.call(this),uv.bind(this,"source"),pv.bind(this,"target")}Ae(hv,ya);var lP={connection:hv,shape:ws,label:dv,root:fv};function uP(e,t){var n=lP[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}function pP(e){return e instanceof ya}function vo(){this._uid=12}vo.prototype.createRoot=function(e){return this.create("root",e)},vo.prototype.createLabel=function(e){return this.create("label",e)},vo.prototype.createShape=function(e){return this.create("shape",e)},vo.prototype.createConnection=function(e){return this.create("connection",e)},vo.prototype.create=function(e,t){return t=U({},t||{}),t.id||(t.id=e+"_"+this._uid++),uP(e,t)};var ul="__fn",gv=1e3,fP=Array.prototype.slice;function ni(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ni.prototype.on=function(e,t,n,i){if(e=ze(e)?e:[e],bn(t)&&(i=n,n=t,t=gv),!Ge(t))throw new Error("priority must be a number");var o=n;i&&(o=Kn(n,i),o[ul]=n[ul]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ni.prototype.once=function(e,t,n,i){var o=this;if(bn(t)&&(i=n,n=t,t=gv),!Ge(t))throw new Error("priority must be a number");function r(){r.__isTomb=!0;var a=n.apply(i,arguments);return o.off(e,r),a}r[ul]=n,this.on(e,t,r)},ni.prototype.off=function(e,t){e=ze(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ni.prototype.createEvent=function(e){var t=new Es;return t.init(e),t},ni.prototype.fire=function(e,t){var n,i,o,r;if(r=fP.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 Es?n=t:n=this.createEvent(t),r[0]=n;var a=n.type;e!==a&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==a&&(n.type=a)}return o===void 0&&n.defaultPrevented&&(o=!1),o}},ni.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ni.prototype._destroy=function(){this._listeners={}},ni.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ni.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=dP(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(o){if(!this.handleError(o))throw console.error("unhandled error in event listener",o),o}return i},ni.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},ni.prototype._getListeners=function(e){return this._listeners[e]},ni.prototype._setListeners=function(e,t){this._listeners[e]=t},ni.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,o,r;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,r=n.callback,(r===t||r[ul]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Es(){}Es.prototype.stopPropagation=function(){this.cancelBubble=!0},Es.prototype.preventDefault=function(){this.defaultPrevented=!0},Es.prototype.init=function(e){U(this,e||{})};function dP(e,t){return e.apply(null,t)}function Uo(e){return e.childNodes[0]}function hP(e){return e.parentNode.childNodes[1]}function pl(e,t,n,i,o){var r=gs();r.setTranslate(t,n);var a=gs();a.setRotate(i||0,0,0);var s=gs();s.setScale(1,1),ms(e,[r,a,s])}function On(e,t,n){var i=gs();i.setTranslate(t,n),ms(e,i)}function mv(e,t){var n=gs();n.setRotate(t,0,0),ms(e,n)}function mi(e,t){this._eventBus=e,this._elementRegistry=t}mi.$inject=["eventBus","elementRegistry"],mi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=hP(t),n||(n=Le("g"),lt(n).add("djs-children"),qe(t.parentNode,n))):n=t,n},mi.prototype._clear=function(e){var t=Uo(e);return tl(t),t},mi.prototype._createContainer=function(e,t,n,i){var o=Le("g");lt(o).add("djs-group"),typeof n<"u"?gP(o,t,t.childNodes[n]):qe(t,o);var r=Le("g");lt(r).add("djs-element"),lt(r).add("djs-"+e),i&<(r).add("djs-frame"),qe(o,r);var a=Le("g");return lt(a).add("djs-visual"),qe(r,a),r},mi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,zy(t))},mi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ei(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),z(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;z(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},mi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},mi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},mi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},mi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},mi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),On(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},mi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);rn(t.parentNode)};function gP(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const mP={__depends__:[PA],__init__:["canvas"],canvas:["type",Ue],elementRegistry:["type",gi],elementFactory:["type",vo],eventBus:["type",ni],graphicsFactory:["type",mi]};function yP(e){var t=new jy(e);return t.init(),t}function vP(e){e=e||{};var t={config:["value",e]},n=[t,mP].concat(e.modules||[]);return yP(n)}function qo(e,t){this._injector=t||vP(e),this.get("eventBus").fire("diagram.init")}qo.prototype.get=function(e,t){return this._injector.get(e,t)},qo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},qo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},qo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Fn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Xn(e,t){return e.$instanceOf(t)}function bP(e){return Lt(e.rootElements,function(t){return Xn(t,"bpmn:Process")||Xn(t,"bpmn:Collaboration")})}function xP(e){var t={},n=[],i={};function o(W,X){return function(oe){W(oe,X)}}function r(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,X){var oe=W.gfx;if(oe)throw new Error(`already rendered ${Fn(W)}`);return e.element(W,i[W.id],X)}function c(W,X){return e.root(W,i[W.id],X)}function l(W,X){try{var oe=i[W.id]&&s(W,X);return r(W),oe}catch(he){u(he.message,{element:W,error:he}),console.error(`failed to import ${Fn(W)}`,he)}}function u(W,X){e.error(W,X)}var p=this.registerDi=function(X){var oe=X.bpmnElement;oe?i[oe.id]?u(`multiple DI elements defined for ${Fn(oe)}`,{element:oe}):i[oe.id]=X:u(`no bpmnElement referenced in ${Fn(X)}`,{element:X})};function f(W){d(W.plane)}function d(W){p(W),z(W.planeElement,g)}function g(W){p(W)}this.handleDefinitions=function(X,oe){var he=X.diagrams;if(oe&&he.indexOf(oe)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!oe&&he&&he.length&&(oe=he[0]),!oe)throw new Error("no diagram to display");i={},f(oe);var De=oe.plane;if(!De)throw new Error(`no plane for ${Fn(oe)}`);var B=De.bpmnElement;if(!B)if(B=bP(X),B)u(`correcting missing bpmnElement on ${Fn(De)} to ${Fn(B)}`),De.bpmnElement=B,p(De);else throw new Error("no process or collaboration to display");var C=c(B,De);if(Xn(B,"bpmn:Process")||Xn(B,"bpmn:SubProcess"))m(B,C);else if(Xn(B,"bpmn:Collaboration"))q(B,C),_(X.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Fn(De)}: ${Fn(B)}`);h(n)};var h=this.handleDeferred=function(){for(var X;n.length;)X=n.shift(),X()};function m(W,X){Ce(W,X),D(W.ioSpecification,X),T(W.artifacts,X),r(W)}function _(W,X){var oe=rt(W,function(he){return!a(he)&&Xn(he,"bpmn:Process")&&he.laneSets});oe.forEach(o(m,X))}function v(W,X){l(W,X)}function y(W,X){z(W,o(v,X))}function b(W,X){l(W,X)}function E(W,X){l(W,X)}function w(W,X){l(W,X)}function P(W,X){l(W,X)}function T(W,X){z(W,function(oe){Xn(oe,"bpmn:Association")?n.push(function(){P(oe,X)}):P(oe,X)})}function D(W,X){W&&(z(W.dataInputs,o(E,X)),z(W.dataOutputs,o(w,X)))}var N=this.handleSubProcess=function(X,oe){Ce(X,oe),T(X.artifacts,oe)};function $(W,X){var oe=l(W,X);Xn(W,"bpmn:SubProcess")&&N(W,oe||X),Xn(W,"bpmn:Activity")&&D(W.ioSpecification,X),n.push(function(){z(W.dataInputAssociations,o(b,X)),z(W.dataOutputAssociations,o(b,X))})}function H(W,X){l(W,X)}function Z(W,X){l(W,X)}function J(W,X){n.push(function(){var oe=l(W,X);W.childLaneSet&&V(W.childLaneSet,oe||X),ne(W)})}function V(W,X){z(W.lanes,o(J,X))}function we(W,X){z(W,o(V,X))}function Ce(W,X){ke(W.flowElements,X),W.laneSets&&we(W.laneSets,X)}function ke(W,X){z(W,function(oe){Xn(oe,"bpmn:SequenceFlow")?n.push(function(){H(oe,X)}):Xn(oe,"bpmn:BoundaryEvent")?n.unshift(function(){$(oe,X)}):Xn(oe,"bpmn:FlowNode")?$(oe,X):Xn(oe,"bpmn:DataObject")||(Xn(oe,"bpmn:DataStoreReference")||Xn(oe,"bpmn:DataObjectReference")?Z(oe,X):u(`unrecognized flowElement ${Fn(oe)} in context ${Fn(X&&X.businessObject)}`,{element:oe,context:X}))})}function Ee(W,X){var oe=l(W,X),he=W.processRef;he&&m(he,oe||X)}function q(W,X){z(W.participants,o(Ee,X)),n.push(function(){y(W.messageFlows,X)}),T(W.artifacts,X)}function ne(W){z(W.flowNodeRef,function(X){var oe=X.get("lanes");oe&&oe.push(W)})}}function _P(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},f=new xP(p);u=u||l.diagrams&&l.diagrams[0];var d=wP(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(g+"_plane")||r.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),o=e.get("eventBus"),r=e.get("canvas"),o.fire("import.render.start",{definitions:t}),c(t,n),o.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function wP(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=EP(n));var o;M(i,"bpmn:Collaboration")?o=i:o=Lt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Lt(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Bn(o.participants,function(l){return l.processRef}),r.push(o));var a=yv(r),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function yv(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(yv(n.flowElements)))}),t}function EP(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var SP='<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>',vv=SP,bv={verticalAlign:"middle"},xv={color:"#404040"},RP={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},CP={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},MP={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"},AP='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+vv+'</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>',Ji;function PP(){Ji=$t(AP),Vn(Ji,RP),Vn(Et("svg",Ji),bv),Vn(Et(".backdrop",Ji),CP),Vn(Et(".notice",Ji),MP),Vn(Et(".link",Ji),xv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function TP(){Ji||(PP(),ti.bind(Ji,".backdrop","click",function(e){document.body.removeChild(Ji)})),document.body.appendChild(Ji)}const fl=5,_v="djs-outline-hidden";function Gt(e){e=U({},OP,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),LP(this._container)}Ae(Gt,qo),Gt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),dl(s,r),s=kP(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw dl(r,[]),r}if(typeof t=="string"&&(i=DP(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw dl(r,[]),r}try{this.clear()}catch(r){throw dl(r,[]),r}const{warnings:o}=await _P(this,n,i);return{warnings:o}},Gt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Et(":scope > defs",i._svg),a=Fy(o),s=r?"<defs>"+Fy(r)+"</defs>":"",c=i.getContainer();Rt(c).add(_v);let l;try{l=o.getBBox()}finally{Rt(c).remove(_v)}const u=l.x-fl,p=l.y-fl,f=l.width+fl*2,d=l.height+fl*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+E.message;if(P)return a.addWarning({message:H,error:E}),!0;throw No(H)}function u(E,w){return l(E,w,!0)}function p(){var E=a.elementsById,w=a.references,P,T;for(P=0;T=w[P];P++){var O=T.element,N=E[T.id],$=fo(O).propertiesByName[T.property];if(N||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),$.isMany){var H=O.get($.name),Q=H.indexOf(T);Q===-1&&(Q=H.length),N?H[Q]=N:H.splice(Q,1)}else O.set($.name,N)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(E){if(d.test(E)){var w=g.exec(E),P=w&&w[1];!P||h.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function _(E,w){var P=c.peek();try{c.push(P.handleNode(E))}catch(T){l(T,w,r)&&c.push(new Np)}}function v(E,w){try{c.peek().handleText(E)}catch(P){u(P,w)}}function y(E,w){E.trim()&&v(E,w)}var b=o.getPackages().reduce(function(E,w){return E[w.uri]=w.prefix,E},Object.entries(Bp).reduce(function(E,[w,P]){return E[P]=w,E},o.config&&o.config.nsMap||{}));return s.ns(b).on("openTag",function(E,w,P,T){var O=E.attrs||{},N=Object.keys(O).reduce(function(H,Q){var J=w(O[Q]);return H[Q]=J,H},{}),$={name:E.name,originalName:E.originalName,attributes:N,ns:E.ns};_($,T)}).on("question",m).on("closeTag",f).on("cdata",v).on("text",function(E,w,P){y(w(E),P)}).on("error",l).on("warn",u),new Promise(function(E,w){var P;try{s.parse(e),p()}catch(H){P=H}var T=i.element;!P&&!T&&(P=No("failed to parse document as <"+i.type.$descriptor.name+">"));var O=a.warnings,N=a.references,$=a.elementsById;return P?(P.warnings=O,w(P)):E({rootElement:T,elementsById:$,references:N,warnings:O})})},jp.prototype.handler=function(e){return new Fp(this.model,e)};function OS(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var DS=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,LS=/<|>|'|"|&|\n\r|\n/g,Zg=/<|>|&/g;function Ui(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Ui.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Ui.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Ui.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Ui.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)},Ui.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Ui.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Ui.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Ui.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Ui.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 IS(e){return e.charAt(0).toLowerCase()+e.slice(1)}function BS(e,t){return qg(t)?IS(e):e}function Qg(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Jg(e){return Qn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function NS(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 $S(e,t){return t.isGeneric?U({localName:t.ns.localName},e):U({localName:BS(t.ns.localName,t.$pkg)},e)}function FS(e,t){return U({localName:t.ns.localName},e)}function jS(e){var t=e.$descriptor;return rt(t.properties,function(n){var i=n.name;if(n.isVirtual||!Jn(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var HS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},zS={"<":"lt",">":"gt","&":"amp"};function em(e,t,n){return e=Qn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function GS(e){return em(e,LS,HS)}function VS(e){return em(e,Zg,zS)}function WS(e){return rt(e,function(t){return t.isAttr})}function US(e){return rt(e,function(t){return!t.isAttr})}function Hp(e){this.tagName=e}Hp.prototype.build=function(e){return this.element=e,this},Hp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Er(){}Er.prototype.serializeValue=Er.prototype.serializeTo=function(e){e.append(this.escape?VS(this.value):this.value)},Er.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Zg)!==-1&&(this.escape=!0),this};function zp(e){this.tagName=e}Qg(zp,Er),zp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ht.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,o,r=t.isGeneric;return r?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),r?this.parseGenericContainments(e):(o=jS(e),this.parseAttributes(WS(o)),this.parseContainments(US(o))),this.parseGenericAttributes(e,i),this},Ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return $S(t,e)},Ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return FS(t,e)},Ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ht.prototype.nsAttributeName=function(e){var t;if(Qn(e)?t=$n(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:U({localName:t.localName},n)},Ht.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},Ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Er().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Ht(this).build(i))})},Ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=$n(t),r;if(o.prefix==="xmlns"&&(r={prefix:o.localName,uri:n}),!o.prefix&&o.localName==="xmlns"&&(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},Ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ht.prototype.parseGenericAttributes=function(e,t){var n=this;z(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(o){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,o)}})},Ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new Er().build(o,r[0]));else if(jg(o.type))z(r,function(l){n.push(new zp(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)z(r,function(l){n.push(new Hp(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Kg(o);z(r,function(l){var u;c?c===Yg?u=new Ht(t,o):u=new Dc(t,o,c):u=new Ht(t),n.push(u.build(l))})}})},Ht.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Ui(i):t=i),t},Ht.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix,a=i.byUri(o);return(!a||n)&&i.add(e,t),i.mapPrefix(r,o),e},Ht.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,o=e.uri,r,a,s;if(!i&&!o)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),o=o||s||n.uriByPrefix(i),!o)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(o),!e&&!i&&(e=this.logNamespace({uri:o},s===o,!0)),!e){for(r=i,a=1;n.uriByPrefix(r);)r=i+"_"+a++;e=this.logNamespace({prefix:r,uri:o},s===o)}return i&&n.mapPrefix(i,o),e},Ht.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];z(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Ht.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Jg(e)},Ht.prototype.addAttribute=function(e,t){var n=this.attrs;Qn(t)&&(t=GS(t));var i=Dg(n,function(r){return r.name.localName===e.localName&&r.name.uri===e.uri&&r.name.prefix===e.prefix}),o={name:e,value:t};i!==-1?n.splice(i,1,o):n.push(o)},Ht.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=NS(n).concat(t)),z(t,function(i){e.append(" ").append(Jg(i.name)).append('="').append(i.value).append('"')})},Ht.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Er;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 Dc(e,t,n){Ht.call(this,e,t),this.serialization=n}Qg(Dc,Ht),Dc.prototype.parseNsAttributes=function(e){var t=Ht.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},Dc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function qS(){this.value="",this.write=function(e){this.value+=e}}function YS(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 KS(e){e=U({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new qS,r=new YS(o,e.format);e.preamble&&r.append(DS);var a=new Ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(XS(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function XS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Bp)n[i]=Bp[i];for(const i in t){const o=t[i];n[o]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Lc(e,t){vi.call(this,e,t)}Lc.prototype=Object.create(vi.prototype),Lc.prototype.fromXML=function(e,t,n){Qn(t)||(n=t,t="bpmn:Definitions");var i=new jp(U({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Lc.prototype.toXML=function(e,t){var n=new KS(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var ZS="BPMN20",QS="http://www.omg.org/spec/BPMN/20100524/MODEL",JS="bpmn",eR=[],tR=[{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"}]}],nR=[{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"}]}],iR={tagAlias:"lowerCase",typePrefix:"t"},oR={name:ZS,uri:QS,prefix:JS,associations:eR,types:tR,enumerations:nR,xml:iR},rR="BPMNDI",aR="http://www.omg.org/spec/BPMN/20100524/DI",sR="bpmndi",cR=[{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"]}],lR=[{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"}]}],uR=[],pR={name:rR,uri:aR,prefix:sR,types:cR,enumerations:lR,associations:uR},fR="DC",dR="http://www.omg.org/spec/DD/20100524/DC",hR="dc",gR=[{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}]}],mR=[],yR={name:fR,uri:dR,prefix:hR,types:gR,associations:mR},vR="DI",bR="http://www.omg.org/spec/DD/20100524/DI",xR="di",_R=[{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"}]}],wR=[],ER={tagAlias:"lowerCase"},SR={name:vR,uri:bR,prefix:xR,types:_R,associations:wR,xml:ER},RR="bpmn.io colors for BPMN",CR="http://bpmn.io/schema/bpmn/biocolor/1.0",MR="bioc",AR=[{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"}]}],PR=[],TR=[],kR={name:RR,uri:CR,prefix:MR,types:AR,enumerations:PR,associations:TR},OR="BPMN in Color",DR="http://www.omg.org/spec/BPMN/non-normative/color/1.0",LR="color",IR=[{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"}]}],BR=[],NR=[],$R={name:OR,uri:DR,prefix:LR,types:IR,enumerations:BR,associations:NR};const FR={bpmn:oR,bpmndi:pR,dc:yR,di:SR,bioc:kR,color:$R};function tm(e,t){const n=U({},FR,e);return new Lc(n,t)}const jR={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"}},Ic={[Ig]:jR,[yp]:Tg};function nm(){return tm(Ic)}const im=nm();async function aa(e){const{rootElement:t,warnings:n}=await im.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function HR(e){const{xml:t}=await im.toXML(e,{format:!0});return t}function Gp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const sa={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},zR=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function GR(e){const t=sa;return zR.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 ca(e,t){let n=0;for(const i of e)n+=t*GR(i);return n}function om(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&VR(e),WR(e),UR(e),qR(e)}function VR(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:ca(o,r),fontBoundingBoxAscent:r*sa.ascentEm,fontBoundingBoxDescent:r*sa.descentEm,actualBoundingBoxAscent:r*sa.ascentEm,actualBoundingBoxDescent:r*sa.descentEm}}};t.getContext=()=>n}function WR(e){if(e.SVGMatrix)return;class t{constructor(){pi(this,"a",1);pi(this,"b",0);pi(this,"c",0);pi(this,"d",1);pi(this,"e",0);pi(this,"f",0)}static of(i,o,r,a,s,c){return Object.assign(new t,{a:i,b:o,c:r,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,o){return this.multiply(t.of(1,0,0,1,i,o))}scale(i,o=i){return this.multiply(t.of(i,0,0,o,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function UR(e){var r;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(r=e.SVGSVGElement)==null?void 0:r.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const o=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(o,"transform")||Object.defineProperty(o,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function qR(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:ca(n,12),height:14}})}const Bc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),YR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),KR=1,Nc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),XR=2;function ct(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const rm=20,$c=5,am=3,ZR=8,la=15,Vp=50,sm=12,QR=sm*1.2;function Wp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>ca(r,sm))),o=n.length*QR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const cm=1;function on(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Sr(e,t){let n=null;const i=e.type!==t.type,r=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of on(e))for(const s of on(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>cm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":r?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=rm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Up(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function lm(e,t){const n=Sr(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function JR(e,t){let n=0;for(const i of t)i.id!==e.id&&lm(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id!==e.id&&Sr(e,i)&&n++;return n}const um=15,pm=20;function eC(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-pm||t.at>n[1]+pm)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],o=Math.max(i[0],t.lo),r=Math.min(i[1],t.hi);return r>o?[o,r]:null}const qp=20;function Fc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>cm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<rm||n.push([o-qp,r+qp])}return n}function jc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of on(e)){const r=eC(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Fc(o,on(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const tC=10,nC=1,iC=(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 oC(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(o-e.x,c)&&f(e.x-a,-c)&&f(r-e.y,l)&&f(e.y-s,-l)&&p>u}function Yp(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 rC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ua=1;function Bi(e,t){const n=e.x+ua,i=e.x+e.width-ua,o=e.y+ua,r=e.y+e.height-ua;return t.axis==="h"?t.at>o&&t.at<r&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<r&&t.hi>o}function pa(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 fm(e,t){const n=e.label;if(!n)return null;if(on(e).some(i=>Bi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(on(i).some(o=>Bi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(pa(i).some(o=>Bi(n,o)))return i.id;return null}function zt(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(oC(e.waypoints[r],e.waypoints[r+1],o,XR)){i.push(o);break}}return i}const as=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},aC=(e,t,n,i)=>hm(e,t,n,i)?0:Math.min(as(e,n,i),as(t,n,i),as(n,e,t),as(i,e,t)),dm=(e,t)=>{let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const r=t[i],a=t[o];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n};function ss(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,as({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+a}];if(dm(e,s)||dm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,aC(e,t,s[l],s[(l+1)%s.length]));return c}function hm(e,t,n,i){const o=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.x),r=o(n,i,e),a=o(n,i,t),s=o(e,t,n),c=o(e,t,i);return r*a<0&&s*c<0}const Kp=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function gm(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(hm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function cs(e,t){let n=0;for(const i of t)i.id===e.id||Kp(e,i)||gm(e,i)&&n++;return n}function hi(e,t){let n=0;for(const i of t)i.id===e.id||Kp(e,i)||cs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function mm(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)cs(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function $o(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(cs(n[i],[n[o]])>0){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function qi(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Kp(n[i],n[o])&&gm(n[i],n[o])){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function ym(e){const t=$o(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:sC(e)}}function sC(e){const t=e.shapes.filter(o=>o.type==="bpmn:Participant");if(t.length<3)return 0;const n=o=>{const r=e.shapes.find(a=>a.id===o);if(r)return t.find(a=>r.x>=a.x&&r.y>=a.y&&r.x+r.width<=a.x+a.width&&r.y+r.height<=a.y+a.height)};let i=0;for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.endpoints.length<2)continue;const r=n(o.endpoints[0]),a=n(o.endpoints[1]);if(!r||!a||r.id===a.id)continue;const s=Math.min(r.y,a.y),c=Math.max(r.y+r.height,a.y+a.height);t.some(l=>l.id!==r.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function vm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Nc.has(o.type)&&!i.has(o.id)&&o.x>=n.x&&o.y>=n.y&&o.x+o.width<=n.right&&o.y+o.height<=n.bottom).map(o=>o.id).sort()}function bm(e){var n;const t=(n=Ft(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ft(i);if((o==null?void 0:o.$type)!=="bwl:Members"||typeof o.refs!="string")continue;const r=o.refs.split(/\s+/).filter(Boolean);return r.length?r:void 0}}const xm=e=>e?{members:e}:{},Gn=e=>e.shapes.filter(t=>!t.container);function cC(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const o=i.endpoints.find(a=>a!==e.id),r=o?n.get(o):void 0;if(r&&r.type!=="bpmn:Group"){if(r.container)return r.id;if(r.parent)return r.parent}}}function lC(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const o=e.x+e.width/2,r=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&o>=a.x&&o<=a.x+a.width&&r>=a.y&&r<=a.y+a.height)}function _m(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((o,r)=>o.id.localeCompare(r.id)))if(on(i).some(o=>Bi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(pa(i).some(o=>Bi(n,o)))return i.id;return null}function Fo(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 wm=3;function Em(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const o=/Event$/.test(t.type);if(!o&&!/Gateway$/.test(t.type))return Math.min(n,i);const r=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(r,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(o)return Math.max(0,t.width/2-Math.hypot(s-r,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-r)/l+Math.abs(c-a)/u))*Math.min(l,u))}function ls(e,t){const n=[];for(const i of t.shapes){if(i.container||Nc.has(i.type))continue;const o=Em(e,i);o>=wm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function pt(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const b of zt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:b.id});const o=e.shapes.filter(y=>y.container&&YR.has(y.type));if(o.length){const y=(b,E)=>{const w=e.shapes.find(P=>P.id===E);return!!w&&w.x>=b.x&&w.y>=b.y&&w.x+w.width<=b.x+b.width&&w.y+w.height<=b.y+b.height};for(const b of e.edges)for(const E of zt(b,o))b.endpoints.includes(E.id)||b.endpoints.some(w=>y(E,w))||n.push({kind:"edge-crosses-subprocess",edge:b.id,subProcess:E.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const b=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[E,w]of b){if(!E)continue;const P=e.shapes.find($=>$.id===E);if(!P||P.container)continue;const T=Math.max(P.x-w.x,w.x-(P.x+P.width),0),O=Math.max(P.y-w.y,w.y-(P.y+P.height),0),N=Math.hypot(T,O);N>tC&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:E,distance:Math.round(N)})}}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let b=y+1;b<r.length;b++){const E=r[y],w=r[b];if(E.x+E.width<=w.x||w.x+w.width<=E.x||E.y+E.height<=w.y||w.y+w.height<=E.y)continue;const P=(T,O)=>T.x<=O.x&&T.y<=O.y&&T.x+T.width>=O.x+O.width&&T.y+T.height>=O.y+O.height;n.push({kind:"pool-overlap",pools:[E.id,w.id],contained:P(E,w)||P(w,E)})}const a=i.filter(y=>!y.attached);for(let y=0;y<a.length;y++)for(let b=y+1;b<a.length;b++){const E=a[y],w=a[b];if(!Yp(E,w,KR))continue;const P=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:"shape-overlap",shapes:P,identical:rC(E,w)})}const s=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<s.length;y++)for(let b=y+1;b<s.length;b++){const E=s[y],w=s[b],P=Math.min(E.x+E.width,w.x+w.width)-Math.max(E.x,w.x),T=Math.min(E.y+E.height,w.y+w.height)-Math.max(E.y,w.y);if(P<=$c||T<=$c)continue;const O=E.id<w.id?[E.id,w.id]:[w.id,E.id],N=new Set(w.members);if(E.members.some(H=>N.has(H))){const H=vm(e,s,{x:Math.max(E.x,w.x),y:Math.max(E.y,w.y),right:Math.min(E.x+E.width,w.x+w.width),bottom:Math.min(E.y+E.height,w.y+w.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:O,shapes:H});continue}const $=E.x<=w.x&&E.y<=w.y&&E.x+E.width>=w.x+w.width&&E.y+E.height>=w.y+w.height?E.id:w.x<=E.x&&w.y<=E.y&&w.x+w.width>=E.x+E.width&&w.y+w.height>=E.y+E.height?w.id:void 0;n.push({kind:"group-overlap-unintended",groups:O,...$?{container:$}:{}})}const c=new Set(s.flatMap(y=>[...y.members])),l=y=>e.shapes.filter(b=>!b.container&&!Nc.has(b.type)&&b.x>=y.x&&b.y>=y.y&&b.x+b.width<=y.x+y.width&&b.y+b.height<=y.y+y.height);for(const y of s){const b=l(y);if(!b.length)continue;const E=new Set(y.members),w=b.filter(P=>!E.has(P.id));w.some(P=>c.has(P.id))&&(w.length*2<b.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:w.map(P=>P.id).sort()}))}for(const y of s){const b=new Set(l(y).map(N=>N.id)),E=new Set(y.members),w=new Set([...b].filter(N=>!E.has(N)&&c.has(N)));if(!w.size)continue;let P=!1,T=!1,O=!1;for(const N of e.edges){if(N.type!=="bpmn:SequenceFlow"||!N.source||!N.target)continue;const $=w.has(N.source),H=w.has(N.target);!$&&H&&!b.has(N.source)?P=!0:$&&!H&&!b.has(N.target)?T=!0:$&&H&&(O=!0)}P&&T&&O&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...w].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let b=y+1;b<u.length;b++)for(let E=b+1;E<u.length;E++){const w=[u[y],u[b],u[E]],P={x:Math.max(...w.map(N=>N.x)),y:Math.max(...w.map(N=>N.y)),right:Math.min(...w.map(N=>N.x+N.width)),bottom:Math.min(...w.map(N=>N.y+N.height))};if(P.right-P.x<=$c||P.bottom-P.y<=$c)continue;const T=vm(e,[],P);if(!T.length)continue;const O=w.map(N=>N.id).sort();n.push({kind:"group-stack-unreadable",groups:O,shapes:T})}for(const y of e.shapes.filter(b=>b.type==="bpmn:Group"))for(const b of e.shapes){if(b.container||b.attached||Nc.has(b.type)||b.width<=0||b.height<=0)continue;const E=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[w,P,T,O,N]of E){const $=T==="h"?b.x:b.y,H=T==="h"?b.x+b.width:b.y+b.height;if(!($<N&&O<H))continue;const Q=T==="h"?b.y:b.x,J=T==="h"?b.y+b.height:b.x+b.width;if(!(Q<P&&P<J))continue;const V=Math.min(P-Q,J-P);V<ZR||n.push({kind:"group-cuts-shape",group:y.id,shape:b.id,side:w,depth:V})}}const p=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(p.length){const y=new Map(e.shapes.filter(b=>!b.container).map(b=>[b.id,{x:b.x+b.width/2,y:b.y+b.height/2}]));for(const b of e.edges){if(b.type!=="bpmn:SequenceFlow"&&b.type!=="bpmn:MessageFlow")continue;const E=on(b);if(E.length)for(const w of p){const P=w.x+w.width,T=w.y+w.height,O=b.endpoints.some($=>{const H=y.get($);return!!H&&w.x<H.x&&H.x<P&&w.y<H.y&&H.y<T});let N=null;for(const $ of E){const[H,Q,J]=$.axis==="v"?[w.y,T,[["left",w.x],["right",P]]]:[w.x,P,[["top",w.y],["bottom",T]]],V=Math.min($.hi,Q)-Math.max($.lo,H);if(V<Vp)continue;const we=$.axis==="v"?w.x<$.at&&$.at<P:w.y<$.at&&$.at<T;if(!(we&&O))for(const[Ce,ke]of J){const Ee=Math.abs($.at-ke);Ee<=la&&(!N||Ee<N.distance)&&(N={side:Ce,inside:we,distance:Ee,length:V})}}N&&n.push({kind:"edge-along-group-boundary",edge:b.id,group:w.id,side:N.side,inside:N.inside,distance:Math.round(N.distance),length:Math.round(N.length)})}}}const f=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(b=>b.type==="bpmn:Group"))for(const b of f){const E=y.x<b.x+b.width&&b.x<y.x+y.width,w=y.y<b.y+b.height&&b.y<y.y+y.height,P=[["top",y.y,b.y,E],["bottom",y.y+y.height,b.y+b.height,E],["left",y.x,b.x,w],["right",y.x+y.width,b.x+b.width,w]];for(const[T,O,N,$]of P)$&&Math.abs(O-N)<=am&&n.push({kind:"group-on-container-boundary",group:y.id,container:b.id,side:T})}const d=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<d.length;y++)for(let b=y+1;b<d.length;b++){const E=d[y],w=d[b],P=E.x<w.x+w.width&&w.x<E.x+E.width,T=E.y<w.y+w.height&&w.y<E.y+E.height,O=[["x",E.x+E.width,w.x,T],["x",w.x+w.width,E.x,T],["y",E.y+E.height,w.y,P],["y",w.y+w.height,E.y,P]];for(const[N,$,H,Q]of O)if(Q&&Math.abs($-H)<=am){n.push({kind:"group-on-group-boundary",groups:E.id<w.id?[E.id,w.id]:[w.id,E.id],axis:N});break}}for(let y=0;y<e.edges.length;y++)for(let b=y+1;b<e.edges.length;b++){const E=e.edges[y],w=e.edges[b],P=Sr(E,w);if(!P)continue;const T=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:P.axis,length:Math.round(P.length)})}for(const y of e.edges){if(!y.label)continue;const b=jc(y,e.edges);b&&n.push({kind:"label-on-shared-segment",edge:y.id,other:b.other,axis:b.axis})}for(const y of e.edges){if(!y.label)continue;const b=fm(y,e);b&&n.push({kind:"label-over-line",edge:y.id,line:b})}if(t.includeObservationOnly){for(const y of e.edges)if(!(!y.label||y.type!=="bpmn:SequenceFlow"))for(const{shape:b,depth:E}of ls(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:b,depth:Math.round(E)})}const g=new Set(i.map(y=>y.id)),h=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...h.filter(b=>!g.has(b.id))]){if(!y.label)continue;const b=_m(y,e);b&&n.push({kind:"label-over-line",edge:y.id,line:b})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of h)for(const{owner:b,rect:E}of Fo(e))b===y.id||m.has(b)||Yp(y.label,E,ua)&&n.push({kind:"pool-name-over-label",pool:y.id,label:b});const _=Fo(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:b,rect:E}of _)b!==y.id&&Yp(y,E,ua)&&n.push({kind:"annotation-over-label",annotation:y.id,label:b});const v=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const b=y.parent??cC(y,e,v);if(!b)continue;const E=v.get(b);!E||!E.container||iC(E,y,nC)||y.type==="bpmn:TextAnnotation"&&!lC(y,E,e)||n.push({kind:"shape-outside-container",shape:y.id,container:E.id})}return n.sort((y,b)=>ct(y).localeCompare(ct(b)))}const Ft=e=>typeof e=="object"&&e!==null?e:void 0,Xt=e=>typeof e=="number"?e:0,ho=e=>{const t=Ft(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function uC(e){const t=Ft(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const o=t[i];for(const r of Array.isArray(o)?o:[o]){const a=ho(r);a&&n.push(a)}}return n}function pC(e){const t=Ft(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:ho(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:ho(t.targetRef);return n&&i?{source:n,target:i}:{}}function fC(e,t){const n=Ft(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=ho(n);return o?t.get(o):void 0}if(Bc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return ho(n)}function Sm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ft(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ft(e))==null?void 0:s.rootElements)??[]){const f=Ft(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Ft(d),h=ho(g),m=ho(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=Ft((c=Ft(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Ft(g);if(!h)continue;const m=Ft(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const v=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",y=Ft(h.bounds);if(y){const E=h.isExpanded===!1&&v!=="bpmn:Participant",w=Ft((l=Ft(h.label))==null?void 0:l.bounds),P={id:_,type:v,x:Xt(y.x),y:Xt(y.y),width:Xt(y.width),height:Xt(y.height),container:Bc.has(v)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:fC(m,o)}:{},...w?{label:{x:Xt(w.x),y:Xt(w.y),width:Xt(w.width),height:Xt(w.height)}}:{},...v==="bpmn:Group"?xm(bm(m)):{}},T=h.isHorizontal!==!1,O=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(_)&&T&&O&&(P.label=Wp(P,O)),t.push(P);continue}const b=h.waypoint;if(Array.isArray(b)){const E=Ft((u=Ft(h.label))==null?void 0:u.bounds);n.push({id:_,type:v,waypoints:b.map(w=>{var P,T;return{x:Xt((P=Ft(w))==null?void 0:P.x),y:Xt((T=Ft(w))==null?void 0:T.y)}}),endpoints:uC(m),...pC(m),...E?{label:{x:Xt(E.x),y:Xt(E.y),width:Xt(E.width),height:Xt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Rm(e){return pt(Sm(e),{includeObservationOnly:!0})}async function dC(e){const{definitions:t,warnings:n}=await aa(e);return{findings:Rm(t),warnings:n}}function Ve(e){var i;const t=[],n=[];for(const o of e.getAll()){const r=o;if(r.type==="label"||r.labelTarget)continue;const a=typeof r.type=="string"?r.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=r.waypoints;if(s){const h=Ft(r.label),m=ho(r.source),_=ho(r.target);n.push({id:r.id,type:a,waypoints:s.map(v=>({x:Xt(v.x),y:Xt(v.y)})),endpoints:[m,_].filter(v=>!!v),...m&&_?{source:m,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Xt(h.y),width:Xt(h.width),height:Xt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ft(r.businessObject),l=Ft(r.label);let u=Ft(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Ft(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Bc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:r.id,type:a,x:r.x,y:r.y,width:Xt(r.width),height:Xt(r.height),container:Bc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Xt(l.y),width:Xt(l.width),height:Xt(l.height)}}:{},...a==="bpmn:Group"?xm(bm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Ft(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Wp(d,g)),t.push(d)}return{shapes:t,edges:n}}const hC={"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 gC(e,t){const n=hC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Cm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Mm(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 gC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Cm(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Cm(i):void 0},endpointsOf:n=>{var o,r;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(o=i.source)==null?void 0:o.id,target:(r=i.target)==null?void 0:r.id}},eventDefinitionOf:n=>{var r;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const o=(((r=i.businessObject)==null?void 0:r.eventDefinitions)??[]).map(a=>a.$type);return mp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Lo(i.businessObject).map(o=>o.locale)}}}const Xp=20,mC=4,Je=(e,t)=>Math.abs(e-t)<.5;function Hc(e,t,n,i=Xp){if(Je(e.y,t.y)&&!Je(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x);if(!(o<n.x-i&&n.x+n.width+i<r))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Je(e.x,t.x)&&!Je(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y);if(!(o<n.y-i&&n.y+n.height+i<r))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Am(e,t,n,i=Xp){if(n.length<2)return null;if(Je(e.y,t.y)&&!Je(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(o<a&&s<r))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(Je(e.x,t.x)&&!Je(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(o<a&&s<r))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function Pm(e,t,n=Xp){if(e.length!==4)return null;const[i,o,r,a]=e;if(Je(i.y,o.y)&&Je(o.x,r.x)&&Je(r.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Je(i.x,o.x)&&Je(o.y,r.y)&&Je(r.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function zc(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(o>=i.y&&o<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=o>r,l=[{x:n.x+n.width,y:o},{x:a,y:o},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:r},{x:i.x,y:r}];return[l,u]}const Gc=30,yC=[0,-25,25,-40,40];function vC(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+Gc:s-Gc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return yC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>zt({...e,endpoints:[],waypoints:f},[n]).length===0)}const Zp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],fa=(e,t,n)=>zt({...e,waypoints:t},n).length;function Qp(e,t,n,i){let o=[...e.waypoints],r=fa(e,o,t);if(r===0)return null;let a=!1;for(const p of zc(e,t))if(fa(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(on),c=p=>on({...e,waypoints:p}).some(f=>Fc(f,s).length>0),l=vC(e,t).filter(p=>fa(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&Je(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(Je(d[0].y,d[1].y)&&!Je(d[0].x,d[1].x)){const g=t.filter(v=>!e.endpoints.includes(v.id)&&zt({...e,waypoints:d},[v]).length>0),h=g.length>=2?Am(d[0],d[1],g):null,_=(h?h.map(v=>[d[0],...v,d[1]]):g.length===1?(Hc(d[0],d[1],g[0])??[]).map(v=>[d[0],...v,d[1]]):g.length===0?[d]:[]).filter(v=>fa(e,v,t)===0&&v.length<=o.length).sort((v,y)=>Number(u(y))-Number(u(v)));if(_.length)return _.find(v=>!c(v))??_[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&zt({...e,waypoints:[f,d]},[_]).length>0);if(g.length<2)continue;const h=Am(f,d,g);if(!h)continue;const m=h.map(_=>Zp(o,p,_)).filter(_=>fa(e,_,t)===0).sort((_,v)=>Number(u(v))-Number(u(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let p=0;p<mC&&r>0;p++){let f=!1;for(let d=0;d+1<o.length&&!f;d++){const g=o[d],h=o[d+1];for(const m of t){if(e.endpoints.includes(m.id)||zt({...e,waypoints:[g,h]},[m]).length===0)continue;const _=Hc(g,h,m),v=_?_.map(b=>Zp(o,d,b)):Pm(o,m)??[];if(!v.length)continue;const y=[...v].sort((b,E)=>Number(u(E))-Number(u(b)));for(const b of y){const E=fa(e,b,t);if(E<r){o=b,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function Jp(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=Gn(r),s=new Set,c=pt(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ct(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=r.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=zt(p,a);if(!n&&h.length&&h.every(b=>b.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=Qp(p,a,g,r.edges);if(!m){h.some(b=>b.type==="bpmn:TextAnnotation")&&s.add(u);continue}const _=r.edges.filter(b=>b.id!==u),v=di(p,_);di({...p,waypoints:m},_)>v||o.updateWaypoints(f,m)}return s}const bC=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,o.x)-1,y:Math.min(i.y,o.y)-1,width:Math.max(2,Math.abs(o.x-i.x)+2),height:Math.max(2,Math.abs(o.y-i.y)+2),container:!1,attached:!1})}return t};function ef(e){const t=e.parent;return t&&typeof t.x=="number"&&typeof t.width=="number"?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0}const tf=(e,t)=>!t||e.every(n=>n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height),nf=(e,t)=>cs(e,[t])>0;function Tm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=Gn(r);let s=r;const c=new Set(pt(r).map(ct));for(const[l,u]of $o(r))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(P=>P.id===p),g=s.edges.find(P=>P.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=ef(h),_=bC(g),v=[...zc(d,a)??[]],y=Qp(d,[...a,..._],m,r.edges);y&&v.push(y);for(let P=0;P+1<d.waypoints.length;P++)for(const T of _)for(const O of Hc(d.waypoints[P],d.waypoints[P+1],T)??[])v.push(Zp(d.waypoints,P,O));const b=s.edges.filter(P=>P.id!==p),E=P=>({...s,edges:s.edges.map(T=>T.id===p?{...T,waypoints:P}:T)}),w=v.find(P=>{const T={...d,waypoints:P};return nf(T,g)||!tf(P,m)||b.some(O=>O.id!==f&&!nf(d,O)&&nf(T,O))?!1:pt(E(P)).every(O=>c.has(ct(O)))});if(w){o.updateWaypoints(h,w),s=E(w);break}}}const xC=["top","bottom","left","right"],km={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},us=20,_C=20;function wC(e,t){const n=e.x>=t.x-.5&&e.x<=t.x+t.width+.5,i=e.y>=t.y-.5&&e.y<=t.y+t.height+.5,o=[];return n&&Je(e.y,t.y)&&o.push("top"),n&&Je(e.y,t.y+t.height)&&o.push("bottom"),i&&Je(e.x,t.x)&&o.push("left"),i&&Je(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const EC=(e,t)=>t==="top"?{x:e.x+e.width/2,y:e.y}:t==="bottom"?{x:e.x+e.width/2,y:e.y+e.height}:t==="left"?{x:e.x,y:e.y+e.height/2}:{x:e.x+e.width,y:e.y+e.height/2};function Om(e,t,n,i){const o=km[t],r=km[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",f=a?"x":"y",d=o[p],g=r[p];if(Je(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=us?[e,n]:null;let h;if(d===-g){const _=e[p]+d*us,v=n[p]-d*us;if(d*(v-_)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+Gc:Math.min(e[p],n[p])-Gc;const m=(_,v)=>a?{x:v,y:_}:{x:_,y:v};return[e,m(h,e[f]),m(h,n[f]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=us&&u>=us?[e,c,n]:null}function SC(e,t,n){const i=e.waypoints;if(i.length<2||!e.source||!e.target||e.source===e.target)return[];const o=e.source===t.id,r=n.get(o?e.target:e.source),a=o?i[i.length-1]:i[0],s=r?wC(a,r):null;if(!s)return[];const c=[];for(const l of xC){const u=EC(t,l),p=o?Om(u,l,a,s):Om(a,s,u,l);p&&c.push(p)}return c}const Dm=e=>e.slice(1).reduce((t,n,i)=>t+Math.abs(n.x-e[i].x)+Math.abs(n.y-e[i].y),0);function RC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(pt(r).map(ct));let c=r;for(const[l,u]of qi(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(O=>O.id===l),f=c.edges.find(O=>O.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!qi({edges:[p,f]}).length)continue;const d=p.endpoints.find(O=>f.endpoints.includes(O)),g=d?a.get(d):void 0;if(!g||g.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const _=O=>n.has(O.id)?[O.waypoints]:[O.waypoints,...SC(O,g,a)],v=O=>O.length-2,y=_(p).flatMap(O=>_(f).map(N=>({pa:O,pb:N}))).filter(({pa:O,pb:N})=>O!==p.waypoints||N!==f.waypoints).map(O=>({...O,cost:Dm(O.pa)+Dm(O.pb)+_C*(v(O.pa)+v(O.pb))})).sort((O,N)=>O.cost-N.cost),b=ef(h),E=ef(m),w=qi(c).length,P=new Set($o(c).map(([O,N])=>`${O}|${N}`)),T=y.find(({pa:O,pb:N})=>{const $={...p,waypoints:O},H={...f,waypoints:N};if(qi({edges:[$,H]}).length||Sr($,H)||!tf(O,b)||!tf(N,E))return!1;const Q={...c,edges:c.edges.map(J=>J.id===l?$:J.id===u?H:J)};return qi(Q).length>=w||$o(Q).some(([J,V])=>!P.has(`${J}|${V}`))?!1:pt(Q).every(J=>s.has(ct(J)))});T&&(T.pa!==p.waypoints&&o.updateWaypoints(h,T.pa),T.pb!==f.waypoints&&o.updateWaypoints(m,T.pb),c={...c,edges:c.edges.map(O=>O.id===l?{...p,waypoints:T.pa}:O.id===u?{...f,waypoints:T.pb}:O)})}}const CC=40,MC=20;function AC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ve(i),p=qi(u);return{keys:new Set(pt(u).map(ct)),crossings:$o(u).length,shared:p.length,mine:p.filter(([f,d])=>f===l||d===l).length}},a=(l,u)=>{const p=Ve(i),f=p.edges.find(d=>d.id===l);return f?new Set(zt({...f,waypoints:u},Gn(p)).map(d=>d.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,f=s(u)?u:s(p)?p:void 0;if(!f)continue;const d=f===u?p:u;if(!d||d.type==="bpmn:Participant")continue;const g=d.x+d.width/2;if(g>=f.x+10&&g<=f.x+f.width-10)continue;const h=g>f.x+f.width,m=f.y>d.y,_=m?d.y+d.height:d.y,v=m?f.y:f.y+f.height,y=Math.round((_+v)/2),b=N=>f===u?[...N].reverse():N,E=(l.waypoints??[]).map(N=>({x:N.x,y:N.y})),w=r(l.id),P=a(l.id,E)??new Set,T=h?f.x+f.width:f.x,O=f.x+f.width/2;for(let N=Math.min(CC,f.width/4);h?T-N>O:T+N<O;N+=MC){const $=Math.round(h?T-N:T+N),H=b([{x:g,y:_},{x:g,y},{x:$,y},{x:$,y:v}]),Q=a(l.id,H);if(!Q||[...Q].some(V=>!P.has(V)))continue;o.updateWaypoints(l,H);const J=r(l.id);if(J.crossings<=w.crossings&&J.shared<=w.shared&&J.mine<=w.mine&&[...J.keys].every(V=>w.keys.has(V)))break;o.updateWaypoints(l,E)}}}const PC=10;function Lm(e,t){if(e.parent){const o=t.find(r=>r.id===e.parent);if(o)return o}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(o=>n>=o.x&&n<=o.x+o.width&&i>=o.y&&i<=o.y+o.height)}function Im(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),o=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!o)return null;const r=Lm(i,n),a=Lm(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(H=>H.id!==r.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,Q)=>H.y-Q.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,m=s?g:d,_=e.waypoints[0],v=e.waypoints[e.waypoints.length-1],y=Gn(t),b=t.edges.filter(H=>H.id!==e.id),E=hi(e,b),w=zt(e,y).length;if(E===0&&w===0||w===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(H=>H.x)),T=Math.max(...u.map(H=>H.x+H.width)),O=(_.x+v.x)/2,N=H=>H.filter((Q,J)=>J===0||!(Je(Q.x,H[J-1].x)&&Je(Q.y,H[J-1].y)));let $;for(let H=P;H<=T;H+=PC){const Q=N([_,{x:_.x,y:h},{x:H,y:h},{x:H,y:m},{x:v.x,y:m},v]),J={...e,waypoints:Q};if(zt(J,y).length>0)continue;const V=hi(J,b),we=Math.abs(H-O);(!$||V<$.cross||V===$.cross&&we<$.detour)&&($={pts:Q,cross:V,detour:we})}return $&&(w>0?$.cross<=E:$.cross<E)?$.pts:null}const TC=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function kC(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ve(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Gn(a);for(const p of t.edges){if(!TC.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const f=i.get(p.id);if(!(f!=null&&f.waypoints)||((l=f.source)==null?void 0:l.id)!==p.source||((u=f.target)==null?void 0:u.id)!==p.target)continue;const d=r.get(p.source),g=r.get(p.target),h=s.get(p.source),m=s.get(p.target);if(!d||!g||!h||!m||!Je(d.width,h.width)||!Je(d.height,h.height)||!Je(g.width,m.width)||!Je(g.height,m.height))continue;const _=h.x-d.x,v=h.y-d.y;if(Je(_,0)&&Je(v,0)||!Je(m.x-g.x,_)||!Je(m.y-g.y,v))continue;const y=p.waypoints.map(w=>({x:w.x+_,y:w.y+v})),b=f.waypoints.map(w=>({x:w.x,y:w.y}));b.length===y.length&&b.every((w,P)=>Je(w.x,y[P].x)&&Je(w.y,y[P].y))||b.length===2&&(Je(b[0].x,b[1].x)||Je(b[0].y,b[1].y))&&zt({...p,waypoints:b},c).length===0||zt({...p,waypoints:y},c).length>0||o.updateWaypoints(f,y)}}function Bm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ve(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Im(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const of=20,Nm=10,Ni=10,rf=40,OC=6,DC=40,$m=50;function LC(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=OC})}function af(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(Je(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function IC(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function sf(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Nm;o<=n-t;o+=Nm)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function BC(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,f=t.x+t.width/2,d=(V,we)=>we>V.x+Ni&&we<V.x+V.width-Ni,g=(V,we)=>V.width<=2*rf?V.x+V.width/2:Math.min(Math.max(we,V.x+rf),V.x+V.width-rf),h=Math.max(e.x,t.x)+Ni,m=Math.min(e.x+e.width,t.x+t.width)-Ni;if(h<=m){const V=!a&&d(t,p)?p:!s&&d(e,f)?f:Math.round((h+m)/2);r.push([{x:V,y:l},{x:V,y:u}])}const _=s?g(t,p):f,v=a?g(e,f):p;if(!a&&!d(e,_)){const V=_<e.x?e.x:e.x+e.width;for(const we of sf(e.y+e.height/2,e.y+Ni,e.y+e.height-Ni))r.push([{x:V,y:we},{x:_,y:we},{x:_,y:u}])}if(!s&&!d(t,v)){const V=v<t.x?t.x:t.x+t.width;for(const we of sf(t.y+t.height/2,t.y+Ni,t.y+t.height-Ni))r.push([{x:v,y:l},{x:v,y:we},{x:V,y:we}])}const y=(V,we)=>{if(Math.abs(we-V)<2*Ni)return[];const Ce=Math.min(V,we)+Ni,ke=Math.max(V,we)-Ni;return sf(Math.round((V+we)/2),Ce,ke)};if(!a&&n)for(const V of y(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:V},{x:_,y:V},{x:_,y:u}]);if(!s&&i)for(const V of y(u,c?i.y:i.y+i.height))r.push([{x:v,y:l},{x:v,y:V},{x:f,y:V},{x:f,y:u}]);const b=Math.min(v,_),E=Math.max(v,_),w=[];for(const[V,we]of o.filter(Ce=>Ce.x<E&&Ce.x+Ce.width>b).map(Ce=>[Ce.y,Ce.y+Ce.height]).sort((Ce,ke)=>Ce[0]-ke[0])){const Ce=w[w.length-1];Ce&&V<=Ce[1]?Ce[1]=Math.max(Ce[1],we):w.push([V,we])}const P=[];for(let V=1;V<w.length;V++)w[V][0]-w[V-1][1]>=DC&&P.push(Math.round((w[V-1][1]+w[V][0])/2));w.length&&P.push(w[0][0]-$m,w[w.length-1][1]+$m);const T=(V,we)=>we<V.y?V.y:we>V.y+V.height?V.y+V.height:void 0,O=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(V=>!!V)),N=e.y+e.height/2,$=t.y+t.height/2,H=$>N?1:-1,Q=(V,we,Ce)=>o.some(ke=>!O.has(ke.id)&&ke.x<V&&V<ke.x+ke.width&&ke.y<Math.max(we,Ce)-1&&ke.y+ke.height>Math.min(we,Ce)+1),J=[];for(const V of P){const we=T(e,V),Ce=T(t,V);we===void 0||Ce===void 0||(V-N)*H<0&&Q(v,we,V)||(V-$)*H>0&&Q(_,Ce,V)||J.push({pts:[{x:v,y:we},{x:v,y:V},{x:_,y:V},{x:_,y:Ce}],len:Math.abs(V-we)+(E-b)+Math.abs(Ce-V)})}return{inPools:r,outside:J.sort((V,we)=>V.len-we.len).map(V=>V.pts)}}function NC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(d=>[d.id,d.waypoints])),a=n.shapes.filter(d=>d.type==="bpmn:Participant"),s=d=>{let g=d;for(;g&&g.type!=="bpmn:Participant";)g=g.parent;return g==null?void 0:g.id},c=()=>{const d=Ve(i);return{keys:new Set(pt(d).map(ct)),crossings:$o(d).length,shared:qi(d).length}},l=(d,g)=>d.length===g.length&&d.every((h,m)=>Je(h.x,g[m].x)&&Je(h.y,g[m].y)),u=d=>{const g=d.source,h=d.target;if(!g||!h)return"skip";const m=Ve(i),_=new Map(m.shapes.map(Y=>[Y.id,Y])),v=s(g),y=s(h),b=new Set([v,y].filter(Y=>!!Y)),E=m.shapes.filter(Y=>Y.type==="bpmn:Participant"),w=(d.waypoints??[]).map(Y=>({x:Y.x,y:Y.y})),P=af(w,b,E);if(P<of)return"skip";if(t.has(d.id)){const Y=r.get(d.id);if(Y&&l(Y,w)||P-(Y?af(Y,b,a):0)<of)return"skip"}const T=_.get(g.id),O=_.get(h.id),N=m.edges.find(Y=>Y.id===d.id);if(!T||!O||!N)return"skip";const $=Gn(m),H=new Set(zt(N,$).map(Y=>Y.id)),Q=Fo(m).filter(Y=>Y.owner!==d.id&&Y.owner!==T.id&&Y.owner!==O.id),J=[...m.shapes.filter(Y=>!Y.container&&Y.id!==T.id&&Y.id!==O.id),...Q.map(Y=>Y.rect)],V=Y=>on({...N,waypoints:Y}).some(ne=>LC(ne,J)),we=BC(T,O,v?_.get(v):void 0,y?_.get(y):void 0,E),Ce=Y=>Y.map((ne,W)=>({pts:ne,i:W,key:ne.length*2+(V(ne)?1:0)})).sort((ne,W)=>ne.key-W.key||ne.i-W.i).map(ne=>ne.pts),ke=[...Ce(we.inPools),...Ce(we.outside)],Ee=c();for(const Y of ke){if(af(Y,b,E)>=of)continue;const ne={...N,waypoints:Y};if(zt(ne,$).some(oe=>!H.has(oe.id))||on(ne).some(oe=>IC(oe,m.shapes)||Q.some(he=>Bi(he.rect,oe))))continue;o.updateWaypoints(d,Y);const Z=c();if(Z.crossings<=Ee.crossings&&Z.shared<=Ee.shared&&[...Z.keys].every(oe=>Ee.keys.has(oe)))return"fixed";o.updateWaypoints(d,w)}return"stuck"},p=i.getAll().filter(d=>d.type==="bpmn:MessageFlow"),f=[];for(const d of p)u(d)==="stuck"&&f.push(d);for(const d of f)u(d)}const Yi=[25,-25,40,-40],da=35;function $C(e,t,n=[]){const i=e.x+e.width/2,o=t.x+t.width/2,r=[],a=n.filter(s=>!s.container&&s.id!==e.id&&s.id!==t.id&&s.label).map(s=>({...s.label,id:`${s.id}:label`,type:"label",container:!1,attached:!1}));for(const s of[!0,!1]){const c=s?e.y:e.y+e.height,l=s?t.y:t.y+t.height,u=s?Math.min(e.y,t.y)-da:Math.max(e.y+e.height,t.y+t.height)+da,p=jC(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,FC]];for(const[d,g]of f)for(const h of[0,...Yi])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...Yi]){if(Math.abs(m)>=t.width/2-5)continue;const _=i+h,v=o+m,y=[{x:_,y:c},{x:_,y:d},{x:v,y:d},{x:v,y:l}];g&&zt({endpoints:[],waypoints:y},a).length||r.push({pts:y,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const FC=45,Vc=20;function jC(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,_)=>m.width*m.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),f=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!f.length)return null;const d=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...f.map(v=>v.y));for(let v=!0;v;){v=!1;for(const y of d)y.y<m&&y.y<l&&y.y+y.height>m-Vc&&(m=y.y,v=!0)}const _=Math.max(u.y,...d.filter(v=>v.y+v.height<=m).map(v=>v.y+v.height));return m-_>=Vc?Math.round((m+_)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const _ of d)_.y+_.height>g&&_.y+_.height>l&&_.y<g+Vc&&(g=_.y+_.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=Vc?Math.round((g+h)/2):null}function Wc(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const o=n.y+n.height/2;if(o>=i.y&&o<=i.y+i.height)return $C(n,i,[...t.values()]);const r=i.x+i.width/2,a=n.x+n.width/2,s=o<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-da:n.y+n.height+da,p=[];for(const v of[0,...Yi]){if(Math.abs(v)>=i.width/2-5)continue;const y=r+v;p.push({pts:[{x:n.x,y:o},{x:y,y:o},{x:y,y:c}],cost:Math.abs(v)});for(const b of[0,...Yi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:y,y:u},{x:y,y:c}],cost:Math.abs(v)+Math.abs(b)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const v of[0,...Yi]){if(Math.abs(v)>=n.width/2-5)continue;const y=a+v;p.push({pts:[{x:y,y:g},{x:y,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(v)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+da:i.y-da;for(const v of[0,...Yi]){if(Math.abs(v)>=i.width/2-5)continue;const y=r+v;for(const b of[0,...Yi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:g},{x:E,y:_},{x:y,y:_},{x:y,y:m}],cost:h+Math.abs(v)+Math.abs(b)})}}return p}const Uc=30;function Fm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=Je(i.y,o.y)&&!Je(i.x,o.x),a=Je(i.x,o.x)&&!Je(i.y,o.y);if(!(!r&&!a))for(const s of t)if(r){const c=Math.min(i.x,o.x);if(Math.max(i.x,o.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Uc||Math.abs(i.y-(s.y+s.height))<Uc)return!0}else{const c=Math.min(i.y,o.y);if(Math.max(i.y,o.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Uc||Math.abs(i.x-(s.x+s.width))<Uc)return!0}}return!1}const qc=40;function HC(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-qc,a=o.x+o.width+qc,s=o.y-qc,c=o.y+o.height+qc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>r&&f.y<c&&d.y>s){i++;break}}}return i}function jm(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),o=Gn(t),r=t.edges.filter(w=>w.id!==e.id),a=di(e,r),s=hi(e,r),c=w=>HC(w,t.shapes,e.endpoints)+(Fm(w,n)?1:0),l=c(e.waypoints),u=w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.find(O=>O.type==="bpmn:Lane"&&P>=O.x&&P<=O.x+O.width&&T>=O.y&&T<=O.y+O.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=w=>{if(!d||!f)return!1;for(let P=1;P<w.length-2;P++){const T=w[P],O=w[P+1];if(Je(T.y,O.y)&&!Je(T.x,O.x)&&T.y>f.y&&T.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),_=(w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.filter(O=>O.type==="bpmn:Participant"&&P>=O.x&&P<=O.x+O.width&&T>=O.y&&T<=O.y+O.height).sort((O,N)=>O.width*O.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),v=w=>{if(!_)return 0;let P=0;for(let T=1;T<w.length-1;T++){const O=w[T];(O.x<_.x||O.x>_.x+_.width||O.y<_.y||O.y>_.y+_.height)&&P++}return P},y=v(e.waypoints);if(!Fm(e.waypoints,n)&&!(d&&!h)&&y===0)return null;const b=w=>w.reduce((P,T,O)=>O?P+Math.abs(T.x-w[O-1].x)+Math.abs(T.y-w[O-1].y):0,0);let E;for(const{pts:w,cost:P}of Wc(e,i)){const T={...e,waypoints:w};if(zt(T,o).length>0)continue;const O=di(T,r);if(O>a)continue;const N=v(w);if(N>y)continue;const $=N<y&&O===0;if(!$&&hi(T,r)>s)continue;const H=c(w),Q=g(w);if(!$&&!(Q&&!h)&&H>=l)continue;const V=Q?0:1,we=b(w);(!E||N<E.out||N===E.out&&(V<E.lane||V===E.lane&&(O<E.opp||O===E.opp&&(H<E.sc||H===E.sc&&(P<E.cost||P===E.cost&&we<E.len)))))&&(E={pts:w,out:N,sc:H,lane:V,opp:O,cost:P,len:we})}return(E==null?void 0:E.pts)??null}function zC(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,o=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),r=o.filter(p=>p.endpoints[1]===i),a=o.filter(p=>p.endpoints[0]===i);if(r.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function GC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=Ve(i),c=s.edges.find(m=>m.id===a);if(!c||c.waypoints.length<4)continue;const l=Gn(s),u=s.edges.filter(m=>m.id!==a),p=zt(c,l).length,f=di(c,u),d=hi(c,u),g=n.has(a)?new Set(pt(s).map(ct)):null,h=zc(c,s.shapes);h.length===2&&zC(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const _={...c,waypoints:m};if(zt(_,l).length>p||di(_,u)>f||hi(_,u)>d)continue;if(g){const y=new Set(pt({...s,edges:s.edges.map(w=>w.id===a?_:w)}).map(ct)),b=[...y].filter(w=>!g.has(w)).length,E=[...g].filter(w=>!y.has(w)).length;if(b>E)continue}const v=i.get(a);v&&o.updateWaypoints(v,m);break}}}function Hm(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ve(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=jm(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function cf(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],o=t.get(e.endpoints[0]??""),r=t.get(e.endpoints[1]??""),a=Je(n[0].x,n[1].x)&&!Je(n[0].y,n[1].y),s=Je(n[n.length-1].x,n[n.length-2].x)&&!Je(n[n.length-1].y,n[n.length-2].y);for(const c of Yi){if(a&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function VC(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const _ of[0,...Yi])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+_,y:l},{x:u+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+_},{x:g,y:p+_}],cost:Math.abs(_)});return m}function lf(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const o=Math.max(n.x,i.x),r=Math.min(n.x+n.width,i.x+i.width);if(r-o<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(o+r)/2,p=[];for(const f of[0,...Yi]){const d=u+f;d<=o||d>=r||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function zm(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Gn(t),o=t.edges.filter(d=>d.id!==e.id),r=di(e,o);if(r===0)return null;const a=hi(e,o);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=l?1:0},p=u(e.waypoints),f=[...Wc(e,n),...lf(e,n),...cf(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(zt(h,i).length>0)continue;const m=di(h,o),_=hi(h,o),v=r-m+(p-u(d));if(m>=r||_-a>v)continue;const y=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&y<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:y})}return(s==null?void 0:s.pts)??null}function Gm(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Sr(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function WC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Gn(t),o=t.edges.filter(f=>f.id!==e.id),r=Gm(e,o);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Wc(e,n),...lf(e,n),...VC(e,n),...cf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(zt(g,i).length>0)continue;const h=Gm(g,o);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const v=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&v<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:_,cost:d,length:v})}return(u==null?void 0:u.pts)??null}function Vm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=pt(Ve(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ct(s)));if(!r.length)return;const a=new Set;for(const s of r)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=Ve(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=WC(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Wm(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 Um(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Sr(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,o]=e.endpoints,[r,a]=t.endpoints,s=[i,o].filter(u=>u&&(u===r||u===a)).length;return!(!!o&&o===r||!!a&&a===i)||s!==1?!1:Wm(e,n)&&Wm(t,n)}function qm(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Um(e,o,n)&&i++;return i}function UC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Gn(t),o=t.edges.filter(f=>f.id!==e.id),r=qm(e,o,n);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Wc(e,n),...lf(e,n),...cf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(zt(g,i).length>0)continue;const h=qm(g,o,n);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const v=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&v<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:_,cost:d,length:v})}return(u==null?void 0:u.pts)??null}function qC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=pt(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ct(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!Um(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ve(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=UC(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function Ym(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=pt(r).filter(u=>Up(u)&&!t.has(ct(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Up(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=r.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ve(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=zm(f,p);if(!d)continue;const g=i.get(u);g&&o.updateWaypoints(g,d)}}const YC=10,KC=(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 Km(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!jc(e,i))return null;const o=Gn(t),r=i.flatMap(on);for(const a of on(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Fc(a,r))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([v,y])=>y>v)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+YC*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-um}:{x:a.at+Pn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!jc({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&KC(f,d)))return f}return null}const Pn=8;function uf(e,t){const n=e.label;if(!n)return null;const i=on(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=f=>{const d=f.axis==="h"?o:r,g=f.axis==="h"?r-f.at:o-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(on),...t.shapes.filter(f=>f.container).flatMap(pa)],l=f=>!c.some(d=>Bi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Pn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Pn,s.at-Pn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-Pn-n.height,s.at+Pn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const Xm=30,XC=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const o=t[i],r=t[i+1],a=r.x-o.x,s=r.y-o.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-o.x)*a+(e.y-o.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(o.x+l*a),e.y-(o.y+l*s)))}return n},Zm=(e,t)=>XC({x:e.x+e.width/2,y:e.y+e.height/2},t);function ZC(e,t){const n=e.label;if(!n)return null;const i=on(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(on),...t.shapes.filter(c=>c.container).flatMap(pa)],r=Fo(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!o.some(l=>Bi(c,l))&&!ls(c,t).length&&!r.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+Pn,c.at-Pn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Pn,c.at-Pn-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function Qm(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(pt(o).map(ct));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((w,P)=>w.x-u[P].x===d&&w.y-u[P].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const w=o.edges.find($=>$.id===c);if(!(w!=null&&w.label)||!ls(w.label,o).length)continue;let P={...w.label,x:l.label.x,y:l.label.y};if((ls(P,o).length||Zm(P,w.waypoints)>Xm)&&(P=null),!P&&Zm(w.label,w.waypoints)>Xm&&(P=ZC(w,o)),!P)continue;const T=P,O={...o,edges:o.edges.map($=>$.id===c?{...$,label:T}:$)},N=pt(O);if(N.some($=>!r.has(ct($))))continue;i.moveElements([f],{x:T.x-f.x,y:T.y-f.y}),o=O,r=new Set(N.map(ct));continue}const m=l.label.x+d-f.x,_=l.label.y+g-f.y;if(m===0&&_===0)continue;const v=o.edges.find(w=>w.id===c);if(!(v!=null&&v.label))continue;const y={...v.label,x:v.label.x+m,y:v.label.y+_},b={...o,edges:o.edges.map(w=>w.id===c?{...w,label:y}:w)},E=pt(b);E.some(w=>!r.has(ct(w)))||(i.moveElements([f],{x:m,y:_}),o=b,r=new Set(E.map(ct)))}}function Jm(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=uf(a,r);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&o.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function ey(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=pt(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ct(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=Km(c,r);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&o.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function ty(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(on),...t.shapes.filter(f=>f.container).flatMap(pa)],o=i.filter(f=>Bi(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Fo(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=>Bi(f,d))&&!r.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of o)f.axis==="h"?l.push({...n,y:f.at-Pn-n.height},{...n,y:f.at+Pn}):l.push({...n,x:f.at-Pn-n.width},{...n,x:f.at+Pn});const u=e.x+e.width/2,p=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+Pn},{...n,x:u-n.width/2,y:e.y-Pn-n.height},{...n,x:e.x+e.width+Pn,y:p-n.height/2},{...n,x:e.x-Pn-n.width,y:p-n.height/2}),l.find(c)??null}function ny(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=ty(r,Ve(n));if(!a)continue;const s=n.get(r.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function QC(e,t){const n=e.x,i=e.x+e.width,o=e.y,r=e.y+e.height;if(t.x<n||t.x>i||t.y<o||t.y>r)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,o),r))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-o,{x:t.x,y:o}],[r-t.y,{x:t.x,y:r}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function iy(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(pt(o).map(ct));const a=[...new Set(pt(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,m]of u){const _=h?o.shapes.find(y=>y.id===h):void 0;if(!_)continue;const v=QC(_,l[m]);v.x===l[m].x&&v.y===l[m].y||(l[m]=v,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=pt(f);if(d.some(h=>!r.has(ct(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(ct)))}}const pf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function oy(e,t){const n=(o,r,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>r?`${r}.${u}`:u;return{id:o,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((o,r)=>n(o.id,`participant.lanes[${r}]`,o))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((o,r)=>({...n(o.id,`lanes[${r}]`,o),omittedMeansRemove:(t==null?void 0:t.categoryOf(o.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function JC(e,t,n){const i=[],o=n?ns(n):[];return e.forEach((r,a)=>{if(r.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:r.id,field:"locale"});return}if(!o.includes(r.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:r.id,field:"locale",locale:r.locale,locales:o});return}t.categoryOf(r.id)!==void 0&&!t.reviewRequestLocalesOf(r.id).includes(r.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:r.id,locale:r.locale});return}for(const s of oy(r,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:o});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:o});continue}if(!l)continue;if(!pf(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):o.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:o}),p=!1);if(!p)continue;const f=o.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function bi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function eM(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:o}=n,r=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(pf(c.map)){const l=c.map;return r(c.id).texts={...l},l[o]}if(c.plain===null||c.condition===null&&c.plain===void 0){r(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(r(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=r(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=oy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=bi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=bi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:bi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:bi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:bi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:bi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(bi(c,"text",a(l[0])));break;default:s.push(pf(l[0].map)?bi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const tM=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,ry=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),ay={"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}]},ps=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yc=e=>typeof e=="string"&&e!=="";function nM(e){const t=[];function n(i,o,r,a){if(a===null){Yc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!ps(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)Yc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!ps(i)||!Yc(i.kind)||!(i.kind in ay)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of ay[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(!ps(f))break;f=f[g]}if(!ps(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(o,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}d.forEach((g,h)=>n(o,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;ps(c)&&!Yc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Mg(l)){t.push({kind:"node-type-unsupported",opIndex:o,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!Ag(p)){t.push({kind:"payload-invalid",opIndex:o,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:o,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function sy(e,t,n={}){const i=nM(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,_){if(!tM.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{..._,opIndex:h})}e.forEach((h,m)=>{var _;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(v=>v.id)});for(const v of h.participant.lanes??[])s(m,v.id,{category:"lane"});break;case"node.add":s(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(m,h.dataStore.id,{category:"dataStore"});for(const v of h.associations??[])v.id&&s(m,v.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(_=h.association)!=null&&_.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(v=>v.id));for(const v of h.lanes)t.categoryOf(v.id)===void 0&&s(m,v.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,_,v){const y=c(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:_});return}if(v&&!v.includes(y)){o.push({kind:"ref-category",opIndex:h,ref:m,role:_,expected:v.join("|"),actual:y});return}return y}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,m)=>{var _;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:y}=h.node;if(v===void 0){(p||y!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,v,"participant",["participant"])===void 0)break;y!==void 0&&((((_=r.get(v))==null?void 0:_.lanes)??a.get(v)??t.lanesOf(v)).includes(y)||o.push({kind:"lane-unknown",opIndex:m,lane:y,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:y,target:b,name:E,condition:w}=h.flow,P=u(m,y,"source",["flowNode"]),T=u(m,b,"target",["flowNode"]);P&&T&&l(y)!==l(b)&&o.push({kind:"flow-cross-pool",opIndex:m,id:v}),E!==void 0&&w!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:v});break}case"messageFlow.add":{const{id:v,source:y,target:b}=h.flow,E=u(m,y,"source",["flowNode","participant"]),w=u(m,b,"target",["flowNode","participant"]);if(E&&w){const P=l(y),T=l(b);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:m,id:v})}for(const P of[y,b])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:v,ref:P});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(E=>E===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:v.source,target:v.target});continue}const b=v.source===h.dataStore.id?v.target:v.source;u(m,b,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:y}=h.association,b=u(m,v,"source"),E=u(m,y,"target");if(b&&E){const w=new Set([b,E]);w.has("dataStore")&&w.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:v,target:y})}break}case"association.add":{const{id:v,source:y,target:b}=h.association,E=u(m,y,"source"),w=u(m,b,"target");E&&w&&E!=="annotation"&&w!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:v??`${y}->${b}`});break}case"annotation.add":{if(h.association){const{source:v,target:y}=h.association;if(v!==h.annotation.id&&y!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const b=v===h.annotation.id?y:v;u(m,b,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const y=u(m,v,"member");y&&ry.has(y)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),y=h.lanes.map(E=>E.id);for(const E of v)y.includes(E)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:E});for(const E of y)t.categoryOf(E)!==void 0&&!v.includes(E)&&o.push({kind:"id-duplicate",opIndex:m,id:E});const b=y.filter(E=>v.includes(E));b.length===v.length&&b.some((E,w)=>E!==v[w])&&o.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(g(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(g(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,y=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,b=t.endpointsOf(h.id),E=h.source??(b==null?void 0:b.source),w=h.target??(b==null?void 0:b.target);v&&y&&E!==void 0&&w!==void 0&&new Set([l(E),l(w),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":g(m,h.id,"messageFlow");break;case"dataStore.update":g(m,h.id,"dataStore");break;case"annotation.update":{if(g(m,h.id,"annotation")===void 0)break;h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.update":{if(g(m,h.id,"group")===void 0)break;for(const v of h.members??[]){const y=u(m,v,"member");y&&ry.has(y)&&o.push({kind:"ref-category",opIndex:m,ref:v,role:"member",expected:"shape",actual:y})}break}case"translation.confirm":g(m,h.id);break;case"element.remove":{g(m,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...JC(e,t,n.i18n)),o;function g(h,m,_){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const v=t.categoryOf(m);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(_&&v!==_){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:_,actual:v});return}return v}}function cy(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 Kc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Xc={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},Tn=10,iM=300,oM=160,ly=20,ff=100,uy=40,rM=10,aM=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function py(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,o=t.y+t.height/2;let r;for(const a of e.getAll()){if(a.type!=="bpmn:Lane")continue;const s=a;typeof s.x!="number"||typeof s.width!="number"||i>=s.x&&i<=s.x+s.width&&o>=s.y&&o<=s.y+s.height&&(!r||s.width*s.height<r.width*r.height)&&(r=s)}return r?{x:n.x,width:n.width,y:r.y,height:r.height}:void 0}const Zc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function Qc(e,t,n,i,o){const r=n,a=py(e,t,i),s=a??i,c=(Q,J,V=s)=>{const[we,Ce]=Xc[Q];let ke={x:t.x+t.width/2+we*(t.width/2+r.width/2+J),y:t.y+t.height/2+Ce*(t.height/2+r.height/2+J)};const Ee=V.x+Tn+r.width/2,Y=V.x+V.width-Tn-r.width/2,ne=V.y+Tn+r.height/2,W=V.y+V.height-Tn-r.height/2,Z={x:Math.min(Y,Math.max(Ee,ke.x)),y:Math.min(W,Math.max(ne,ke.y))};return(Z.x!==ke.x||Z.y!==ke.y)&&(ke=Math.abs(Z.x-(t.x+t.width/2))<(t.width+r.width)/2+Tn&&Math.abs(Z.y-(t.y+t.height/2))<(t.height+r.height)/2+Tn?{x:t.x+t.width+Tn+r.width/2,y:Z.y}:Z),ke},l=(i.children??[]).filter(Q=>!("waypoints"in Q&&Q.waypoints)&&Q.type!=="bpmn:Lane"&&Q.type!=="label"&&typeof Q.x=="number"&&Q.id!==o.selfId),u=Ve(e),p=Q=>{var V,we;if(!o.selfId)return!1;const J=e.get(Q);return!!J&&(((V=J.source)==null?void 0:V.id)===o.selfId||((we=J.target)==null?void 0:we.id)===o.selfId)},f=u.edges.filter(Q=>!p(Q.id)).flatMap(on),d=Fo(u).filter(Q=>Q.owner!==o.selfId).map(Q=>Q.rect),g=Q=>({x0:Q.x-r.width/2-Tn,x1:Q.x+r.width/2+Tn,y0:Q.y-r.height/2-Tn,y1:Q.y+r.height/2+Tn}),h=Q=>{const J=g(Q);return l.some(V=>J.x0<V.x+V.width&&J.x1>V.x&&J.y0<V.y+V.height&&J.y1>V.y)},m=Q=>{const J=g(Q);return f.some(V=>V.axis==="h"?V.at>J.y0&&V.at<J.y1&&V.lo<J.x1&&V.hi>J.x0:V.at>J.x0&&V.at<J.x1&&V.lo<J.y1&&V.hi>J.y0)},_=Q=>{const J=g(Q);return d.some(V=>J.x0<V.x+V.width&&J.x1>V.x&&J.y0<V.y+V.height&&J.y1>V.y)},v=u.shapes.filter(Q=>Q.type==="bpmn:Group").flatMap(Q=>[{axis:"h",at:Q.y,lo:Q.x,hi:Q.x+Q.width},{axis:"h",at:Q.y+Q.height,lo:Q.x,hi:Q.x+Q.width},{axis:"v",at:Q.x,lo:Q.y,hi:Q.y+Q.height},{axis:"v",at:Q.x+Q.width,lo:Q.y,hi:Q.y+Q.height}]),y=Q=>{const J=g(Q);return v.some(V=>V.axis==="h"?V.at>J.y0&&V.at<J.y1&&V.lo<J.x1&&V.hi>J.x0:V.at>J.x0&&V.at<J.x1&&V.lo<J.y1&&V.hi>J.y0)},b=Q=>h(Q)||m(Q)||_(Q)||y(Q),E=Q=>Q.x-r.width/2>=i.x&&Q.x+r.width/2<=i.x+i.width&&Q.y-r.height/2>=i.y&&Q.y+r.height/2<=i.y+i.height,w=Q=>E(Q)&&(!a||Zc(Q,r,a));if(o.placement){const Q=Ee=>Ee.startsWith("top")?Ee.replace(/^top/,"bottom"):Ee.replace(/^bottom/,"top"),J=Ee=>Ee.endsWith("left")?Ee.replace(/left$/,"right"):Ee.replace(/right$/,"left"),V=o.placement.side,we=[V,Q(V),J(V),Q(J(V)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Ce=o.placement.offset??50;let ke=c(V,Ce);if(b(ke)||a&&!Zc(ke,r,a)){const Ee=(Y,ne)=>{const W=new Set;for(const Z of we){if(W.has(Z))continue;W.add(Z);const oe=c(Z,Ce,Y);if(ne(oe)&&!b(oe))return ke=oe,!0}return!1};!Ee(s,w)&&a&&Ee(i,E)}return ke}const P=o.from,T=s.x+Tn+r.width/2,O=s.x+s.width-Tn-r.width/2,N=s.y+Tn+r.height/2,$=s.y+s.height-Tn-r.height/2;let H={x:Math.min(O,Math.max(T,P.x)),y:Math.min($,Math.max(N,P.y))};if(b(H)){const Q=(t.width+r.width)/2+Tn,V=[{x:H.x+Q,y:H.y},{x:H.x-Q,y:H.y},{x:H.x,y:H.y-r.height-Tn},{x:H.x,y:H.y+r.height+Tn}].filter(w).find(we=>!b(we));V&&(H=V)}return H}function en(e,t){return e.filter(n=>n.kind===t)}class fy extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function dy(e,t){var x1,_1,w1,E1,S1,R1,C1,M1,A1,P1,T1,k1,O1,D1,L1,I1,B1,N1,$1,F1,j1,H1,z1;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=x=>r.get(x),f=x=>{const S=p(x);if(!S)throw new Error(`하강 참조 해소 실패: ${x}`);return S},d=x=>{let S=x.parent;for(;S;){if(S.type==="bpmn:Participant")return S;S=S.parent}},g=new Map;for(const x of r.filter(S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number"))g.set(x.id,{x:x.x,y:x.y});const h=en(e,"participant.add"),m=en(e,"node.add"),_=en(e,"sequenceFlow.add"),v=en(e,"messageFlow.add"),y=en(e,"dataStore.add"),b=en(e,"dataAssociation.add"),E=en(e,"annotation.add"),w=en(e,"group.add"),P=new Map(m.map(x=>[x.node.id,x])),T=(x,S,A)=>{var F;const k=x.businessObject,L=(((F=k.extensionElements)==null?void 0:F.values)??[]).filter(I=>I.$type!==S),D=A?[...L,i.create(S,A)]:L;if(!D.length){k.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:D});D.forEach(I=>{I.$parent=j}),n.updateProperties(x,{extensionElements:j})},O=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of en(e,"element.remove")){const S=p(x.id);S&&n.removeElements([S])}const N=x=>r.filter(S=>{var A;return S.type==="bpmn:Lane"&&((A=d(S))==null?void 0:A.id)===x}).sort((S,A)=>S.y-A.y);for(const x of en(e,"participant.update")){const S=f(x.id);if(x.name!==void 0&&n.updateProperties(S,{name:x.name??void 0}),!x.lanes)continue;const A=N(x.id);if(!A.length){n.splitLane(S,x.lanes.length),N(x.id).forEach((L,D)=>{const j=x.lanes[D];j&&n.updateProperties(L,{id:j.id,name:j.name})});continue}const k=new Set(A.map(L=>L.id));x.lanes.forEach((L,D)=>{if(k.has(L.id)){n.updateProperties(f(L.id),{name:L.name});return}const j=D===0?n.addLane(N(x.id)[0],"top"):n.addLane(f(x.lanes[D-1].id),"bottom");n.updateProperties(j,{id:L.id,name:L.name})})}const $=150,H=130,Q=80,J=90,V=180,we=30,Ce=30,ke=(x,S,A,k,L)=>{const D=A-S.width/2,j=k-S.height/2;return(x.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(L!=null&&L.has(F.id))&&typeof F.x=="number"&&D<F.x+F.width+Ce&&D+S.width+Ce>F.x&&j<F.y+F.height&&j+S.height>F.y)},Ee=new Set;for(const x of h){Ee.add(`pool:${x.participant.id}`);for(const S of x.participant.lanes??[])Ee.add(S.id)}const Y=new Map;for(const x of m){const S=x.node.lane??`pool:${x.node.participant??""}`;let A=Y.get(S);A||Y.set(S,A=new Set([0])),x.band!==void 0&&A.add(x.band)}const ne=new Map;for(const[x,S]of Y){if(!Ee.has(x))continue;const A=[...S].sort((D,j)=>D-j),k=A.map((D,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),L=Math.min(...k);ne.set(x,new Map(A.map((D,j)=>[D,k[j]-L])))}{const x=new Map;for(const S of h)(S.participant.lanes??[]).forEach((A,k)=>x.set(A.id,k));for(const[S,A]of ne){if(!x.has(S)||A.size<2)continue;const k=x.get(S),L=A.get(0)??0,D=new Set;for(const ce of m){if(ce.node.lane!==S||(ce.band??0)!==0||!ce.node.type.endsWith("Gateway"))continue;const ae={in:new Set,out:new Set,cross:new Set};for(const fe of _){const ye=fe.flow.source===ce.node.id;if(!ye&&fe.flow.target!==ce.node.id)continue;const Ze=P.get(ye?fe.flow.target:fe.flow.source);if(!Ze||Ze.node.participant!==ce.node.participant||!Ze.node.lane)continue;let Be,te=!1;if(Ze.node.lane!==S){const se=x.get(Ze.node.lane);if(se===void 0)continue;Be=se>k?"down":"up",te=!0}else{const se=A.get(Ze.band??0)??L;Be=se>L?"down":se<L?"up":void 0}Be&&(ae[ye?"out":"in"].add(Be),te&&ae.cross.add(Be))}for(const fe of["up","down"])ae.in.has(fe)&&ae.out.has(fe)&&ae.cross.has(fe)&&D.add(fe)}if(D.size!==1)continue;const[j]=D,F=Math.max(...A.values()),I=j==="down"?F:0;if(L===I)continue;const q=[...A.entries()].filter(([ce])=>ce!==0).sort((ce,ae)=>ce[1]-ae[1]),X=[...Array(F+1).keys()].filter(ce=>ce!==I),re=new Map([[0,I]]);q.forEach(([ce],ae)=>re.set(ce,X[ae])),ne.set(S,re)}}const W=x=>{var S;return(((S=Y.get(x))==null?void 0:S.size)??0)>1},Z=x=>x.band??(x.node.lane||!W(`pool:${x.node.participant??""}`)?void 0:0),oe=new Map,he=x=>oe.get(x.node.id)??Z(x),De=new Set,B=new Set;{const x=new Map;for(const k of _)x.set(k.flow.target,(x.get(k.flow.target)??0)+1);const S=k=>{const L=[],D=new Set([k]),j=[k];for(;j.length;){const F=j.shift();L.push(F);for(const I of _)I.flow.source!==F||D.has(I.flow.target)||(x.get(I.flow.target)??0)!==1||(D.add(I.flow.target),j.push(I.flow.target))}return L},A=(k,L)=>{var D;return((D=ne.get(k))==null?void 0:D.get(L))??L};for(const k of m){if(!k.node.type.endsWith("Gateway"))continue;const L=k.node.lane??`pool:${k.node.participant??""}`,D=ne.get(L);if(!D||D.size<2)continue;const j=he(k);if(j===void 0||A(L,j)!==A(L,0))continue;const F=A(L,j),I=_.filter(fe=>fe.flow.source===k.node.id).map(fe=>P.get(fe.flow.target)).filter(fe=>!!fe&&(fe.node.lane??`pool:${fe.node.participant??""}`)===L),q=I.filter(fe=>{const ye=he(fe);return ye!==void 0&&A(L,ye)===F&&(x.get(fe.node.id)??0)===1}),X=I.some(fe=>{const ye=he(fe);return ye!==void 0&&A(L,ye)>F});if(q.length!==1||!X)continue;const re=new Set(I.flatMap(fe=>S(fe.node.id)));if(!_.some(fe=>fe.flow.target===k.node.id&&re.has(fe.flow.source)))continue;const ae=new Map;for(const[fe,ye]of D)ae.set(fe,ye+1);ae.set(-1,0),ne.set(L,ae);for(const fe of S(q[0].node.id))P.has(fe)&&(oe.set(fe,-1),B.add(fe));De.add(k.node.id)}}const C=(x,S)=>{var A;return((A=ne.get(x))==null?void 0:A.get(S))??S},R=(x,S,A,k)=>{const L=x?p(x):S?p(S):void 0;if(!L)return!1;const D=x?L.y+Math.min(L.height/2,J):L.y+Q;return Math.abs(D+C(x??`pool:${S??""}`,A)*$-k)<=$/2},G=new Map;for(const[x,S]of Y){let A=0;for(const k of S)A=Math.max(A,C(x,k));G.set(x,A)}const K=x=>V+$*x,ie=(x,S,A)=>{const k=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==S&&typeof L.y=="number"&&L.y>=x);k.length&&n.moveElements(k,{x:0,y:A})},Pe=(x,S,A)=>{const k=x.type==="bpmn:Participant"?x:void 0;if(!k||k.children.some(F=>F.type==="bpmn:Lane"))return;const L=A+S.height/2+we-k.y;if(k.height>=L)return;const D=L-k.height,j=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:L}),ie(j,k.id,D)},et=(x,S)=>{const A=S-x.height;if(A<=0)return;const k=d(x)??x,L=[],D=I=>{L.push(I);for(const q of I.children??[])D(q)};D(k);const j=x.y+x.height-10,F=l.calculateAdjustments(L,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},mt=(x,S,A)=>{if(x){const j=f(x),F=K(S);if(j.height>=F)return;const I=F-j.height,q=d(j),X=q?q.y+q.height:j.y+j.height;et(j,F),ie(X,q==null?void 0:q.id,I);return}if(!A)return;const k=$*(S+1);if(A.height>=k)return;const L=k-A.height,D=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:k}),ie(D,A.id,L)},qt=new Map;for(const x of _)qt.set(x.flow.target,(qt.get(x.flow.target)??0)+1);const Ct=x=>(qt.get(x)??0)<=1,vn=new Set(m.map(x=>x.node.id).filter(x=>en(e,"sequenceFlow.update").filter(S=>S.target===x).length===1&&!_.some(S=>S.flow.target===x||S.flow.source===x&&P.has(S.flow.target)))),Rn=new Map,Un=(x,S)=>{if(!x)return;const A=p(x);if(!A||A.height>=K(S))return;const k=A.y+A.height-10,L=d(A);if(L)return new Set((L.children??[]).filter(D=>D.type!=="bpmn:Lane"&&typeof D.y=="number"&&D.y>k).map(D=>D.id))},At=(x,S,A)=>{if(!x)return!0;const k=p(x);return k?A-S.height/2>=k.y&&A+S.height/2<=k.y+k.height:!0},Qt=h.map((x,S)=>({op:x,declared:S}));Qt.sort((x,S)=>{const A=x.op.order??Number.POSITIVE_INFINITY,k=S.op.order??Number.POSITIVE_INFINITY;return A!==k?A-k:x.declared-S.declared});let _n=80;for(const x of r.getAll())x.parent===u()&&"height"in x&&typeof x.y=="number"&&(_n=Math.max(_n,x.y+x.height+60));for(const{op:x}of Qt){const S=x.participant,A=m.filter(ce=>ce.node.participant===S.id).length,k=((x1=S.lanes)==null?void 0:x1.length)??0,L=Math.max(1200,A*160+300),D=(S.lanes??[]).map(ce=>K(G.get(ce.id)??0)),j=D.reduce((ce,ae)=>ce+ae,0);k&&j<300&&(D[k-1]+=300-j);const F=Math.max(300,$*((G.get(`pool:${S.id}`)??0)+1)),I=S.blackBox||A+k===0?120:k?Math.max(300,j):F,q=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:S.id,name:S.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...S.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:L,height:I,isExpanded:!0}),X=n.createShape(q,{x:100+L/2,y:_n+I/2},u()),re=S.lanes??[];if(re.length&&n.splitLane(X,re.length),re.length){const ce=r.filter(ae=>{var fe;return ae.type==="bpmn:Lane"&&((fe=d(ae))==null?void 0:fe.id)===S.id}).sort((ae,fe)=>ae.y-fe.y);if(ce.forEach((ae,fe)=>{const ye=re[fe];ye&&n.updateProperties(ae,{id:ye.id,name:ye.name})}),D.some(ae=>ae!==X.height/k)){let ae=X.y;ce.forEach((fe,ye)=>{const Ze=D[ye];n.resizeShape(fe,{x:fe.x,y:ae,width:fe.width,height:Ze}),ae+=Ze})}}_n=X.y+X.height+60}const qa=x=>{var k;const S=P.get(x);if(S)return S.node.participant??"";const A=p(x);return A?A.type==="bpmn:Participant"?A.id:((k=d(A))==null?void 0:k.id)??"":""},qn=new Map,Hi=x=>{let S=qn.get(x);return S||qn.set(x,S={nodes:[],flows:[]}),S};for(const x of m)Hi(x.node.participant??"").nodes.push(x);for(const x of _)Hi(qa(x.flow.source)).flows.push(x);const li=x=>{var S;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((S=x.condition)==null?void 0:S.label)})},nn=(x,S,A)=>o.createShape({type:Kc(x.type),...x.eventDefinition?{eventDefinitionType:Sc[x.eventDefinition]}:{},businessObject:i.create(Kc(x.type),{id:x.id,name:x.name,...S!==void 0?{"bwl:band":S}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Gr=[...Qt.map(({op:x})=>x.participant.id).filter(x=>qn.has(x)),...[...qn.keys()].filter(x=>!h.some(S=>S.participant.id===x))],Ya=x=>x.endsWith("Gateway");for(const x of Gr){const S=qn.get(x),A=x?f(x):void 0,k=A?A.x+150:250;let L=A?A.y+80:120;const D=(te,se,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,J)+C(te,se??0)*$}return se!==void 0&&A?A.y+Q+C(`pool:${x}`,se)*$:le},j=(te,se,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,J)+se*$}return A?A.y+Q+se*$:le},F=te=>te.participant?f(te.participant):u(),I=(te,se,le,be,tt,nt,It,jt)=>{const xe=le!==void 0||be!==void 0,ve=Ne=>{const Me=()=>mt(le,Ne,A);jt?jt(Me):Me()},ue=C(le??`pool:${x}`,be??0);if((be===void 0||R(le,x,be,It??Number.NaN))&&It!==void 0&&At(le,se,It)&&!ke(te,se,tt,It))return{x:tt,y:It};if(xe)for(let Ne=0;Ne<4;Ne++){const Me=j(le,ue+Ne,nt);if(!ke(te,se,tt,Me,Un(le,ue+Ne)))return ve(ue+Ne),{x:tt,y:Me}}const _e=D(le,be,nt);xe?ve(ue):jt?jt(()=>Pe(te,se,se.y+se.height/2)):Pe(te,se,_e);let He=tt;for(let Ne=0;Ne<64;Ne++){const Me=ke(te,se,He,_e);if(!Me)break;He=Me.x+Me.width+H+se.width/2}return{x:He,y:_e}},q=new Set(S.flows.map(te=>te.flow.target)),X=new Map,re=te=>{if(te===void 0)return;const se=r.get(te);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+H};for(const te of S.nodes){if(q.has(te.node.id))continue;const se=nn(te.node,te.band,te.afterColumn),le=Z(te),be=te.node.lane?`${te.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",tt=F(te.node),nt=X.get(be)??k,It=re(te.afterColumn),jt=It===void 0?nt:Math.max(nt,It);let xe;const ve=I(tt,se,te.node.lane,le,jt,L,void 0,vn.has(te.node.id)&&te.node.participant!==void 0?ue=>xe=ue:void 0);if(xe?n.createShape(se,ve,tt,{autoResize:!1}):n.createShape(se,ve,tt),xe){const ue=te.node.lane?f(te.node.lane):tt;Rn.set(te.node.id,{container:ue,relCy:ve.y-ue.y,grow:xe})}X.set(be,ve.x+se.width+H),!te.node.lane&&le===void 0&&(L+=160)}const ce=new Set,ae=new Map,fe=new Map,ye=new Map;if(x&&Ee.has(`pool:${x}`)){const te=new Map;for(const xe of S.flows)te.set(xe.flow.target,(te.get(xe.flow.target)??0)+1);const se=xe=>D(xe.node.lane,he(xe),Number.NaN),le=new Set,be=xe=>{var _e;const ve=(_e=P.get(xe))==null?void 0:_e.node.participant;if(ve)return p(ve);const ue=p(xe);if(ue)return ue.type==="bpmn:Participant"?ue:d(ue)},tt=xe=>{const ve=[],ue=new Set([xe]),_e=[xe];for(;_e.length;){const He=_e.shift(),Ne=P.get(He);Ne&&ve.push(Ne);for(const Me of S.flows)Me.flow.source!==He||ue.has(Me.flow.target)||(te.get(Me.flow.target)??0)!==1||(ue.add(Me.flow.target),_e.push(Me.flow.target))}return ve},nt=xe=>{if(!A)return;const ve=new Set(xe.map(He=>He.node.id));let ue=!1,_e=!1;for(const He of v){if(!ve.has(He.flow.source))continue;const Ne=be(He.flow.target);!Ne||Ne.id===A.id||(Ne.y<A.y?ue=!0:_e=!0)}return ue&&!_e?"up":_e&&!ue?"down":void 0};for(const xe of S.nodes){if(!Ya(xe.node.type))continue;const ve=D(xe.node.lane,Z(xe),Number.NaN);if(Number.isNaN(ve))continue;const ue=[];for(const Me of S.flows){if(Me.flow.source!==xe.node.id)continue;const st=P.get(Me.flow.target);if(!st||st.node.lane!==xe.node.lane||(te.get(st.node.id)??0)!==1)continue;const ft=Z(st);if(ft===void 0)continue;const Jt=D(st.node.lane,ft,Number.NaN);if(Number.isNaN(Jt))continue;const Mn=tt(st.node.id),yt=nt(Mn);yt&&ue.push({subtree:Mn,band:ft,row:Jt,dir:yt})}if(!ue.some(Me=>Me.dir==="up")||!ue.some(Me=>Me.dir==="down")||!ue.some(Me=>Me.dir==="up"&&ue.some(st=>st.dir==="down"&&st.row<Me.row)))continue;const He=[...ue].sort((Me,st)=>Me.row-st.row);[...ue.filter(Me=>Me.dir==="up"),...ue.filter(Me=>Me.dir==="down")].sort((Me,st)=>Me.dir===st.dir?Me.row-st.row:Me.dir==="up"?-1:1).forEach((Me,st)=>{const ft=He[st].band;if(ft!==Me.band){le.add(xe.node.id);for(const Jt of Me.subtree)Z(Jt)===Me.band&&oe.set(Jt.node.id,ft)}})}const It=xe=>{if(!A)return;const ve=new Set(xe.map(He=>He.node.id));let ue=!1,_e=!1;for(const He of v){if(!ve.has(He.flow.target))continue;const Ne=be(He.flow.source);!Ne||Ne.id===A.id||(Ne.y<A.y?ue=!0:_e=!0)}return ue&&!_e?"up":_e&&!ue?"down":void 0};for(const xe of S.nodes){if(!Ya(xe.node.type))continue;const ve=xe.node.lane??`pool:${x}`,ue=ne.get(ve);if(!ue||ue.size<2)continue;const _e=ue.get(0);if(_e===void 0)continue;const He=Math.max(...ue.values()),Ne=_e===He&&_e!==0?"down":void 0;if(!Ne)continue;const Me=[];for(const yt of S.flows){if(yt.flow.source!==xe.node.id)continue;const Hn=P.get(yt.flow.target);if(!Hn||Hn.node.lane!==xe.node.lane||(te.get(Hn.node.id)??0)!==1)continue;const Qa=he(Hn);Qa!==void 0&&Me.push({t:Hn,subtree:tt(Hn.node.id),band:Qa})}const st=Me.find(yt=>(ue.get(yt.band)??yt.band)===_e);if(!st||It(st.subtree)===Ne||nt(st.subtree)===Ne)continue;const ft=Me.find(yt=>yt!==st&&It(yt.subtree)===Ne);if(!ft)continue;const Jt=st.band,Mn=ft.band;for(const yt of st.subtree)he(yt)===Jt&&oe.set(yt.node.id,Mn);for(const yt of ft.subtree)he(yt)===Mn&&oe.set(yt.node.id,Jt);le.add(xe.node.id)}for(const xe of S.nodes){if(!Ya(xe.node.type))continue;const ve=se(xe);if(Number.isNaN(ve)||E.some(Me=>{var st,ft;return(((st=Me.placement)==null?void 0:st.anchor)??(Me.association?Me.association.source===Me.annotation.id?Me.association.target:Me.association.source:void 0))===xe.node.id&&((ft=Me.placement)==null?void 0:ft.side.startsWith("bottom"))}))continue;let _e,He=!1,Ne;for(const Me of S.flows){if(Me.flow.source!==xe.node.id)continue;const st=P.get(Me.flow.target);if(!st||!st.node.lane&&Z(st)===void 0)continue;const ft=se(st);Number.isNaN(ft)||(Math.abs(ft-ve)<.5&&(He=!0),ft>ve?!_e||ft>_e.row?_e={id:st.node.id,row:ft,count:1}:ft===_e.row&&_e.count++:ft<ve&&st.node.lane===xe.node.lane&&(!Ne||ft>Ne.row?Ne={op:st,row:ft,count:1}:ft===Ne.row&&Ne.count++))}_e&&_e.count===1&&(te.get(_e.id)??0)===1&&!le.has(xe.node.id)&&ce.add(_e.id),!He&&Ne&&Ne.count===1&&(te.get(Ne.op.node.id)??0)===1&&!De.has(xe.node.id)&&ae.set(Ne.op.node.id,{lane:xe.node.lane,band:he(xe)})}const jt=new Map;for(const xe of v)jt.set(xe.flow.target,[...jt.get(xe.flow.target)??[],xe]);for(const xe of S.nodes){const ve=jt.get(xe.node.id);if(!ve||ve.length!==1||!te.get(xe.node.id)||!xe.node.lane&&Z(xe)===void 0||B.has(xe.node.id))continue;const ue=(_1=P.get(ve[0].flow.source))==null?void 0:_1.node.participant,_e=ue?p(ue):void 0;if(!_e||!A||_e.id===A.id)continue;const He=xe.node.lane??`pool:${x}`,Ne=ne.get(He);if(!Ne)continue;const Me=Ne.get(0)??0,st=(Ne.get(he(xe)??0)??Me)-Me;if(st===0)continue;const ft=_e.y<A.y;if(ft&&st<0||!ft&&st>0)continue;let Jt;for(const[Mn,yt]of Ne){const Hn=yt-Me;(ft&&Hn<0&&(!Jt||Hn<Jt.row)||!ft&&Hn>0&&(!Jt||Hn>Jt.row))&&(Jt={band:Mn,row:Hn})}Jt&&fe.set(xe.node.id,{lane:xe.node.lane,band:Jt.band})}}const Ze=new Set;let Be=0;for(;Be++<S.nodes.length+2;){for(let le=0;le<S.nodes.length+S.flows.length+2;le++){let be=!1;for(const tt of S.flows){const nt=tt.flow;if(Ze.has(nt.id))continue;const It=p(nt.source);if(!It)continue;const jt=p(nt.target),xe=P.get(nt.target);if(!jt&&xe){const ve=nn(xe.node,xe.band),ue=he(xe);if(xe.node.lane||ue!==void 0){const _e=F(xe.node),He=It,Ne=He.x+(ye.get(nt.source)??0)+He.width+H,Me=ae.get(nt.target)??fe.get(nt.target),st=I(_e,ve,Me?Me.lane:xe.node.lane,Me?Me.band:ue,ce.has(nt.target)?He.x+He.width/2:Ne,Number.NaN,Me||!Ct(nt.target)?void 0:He.y+He.height/2),ft=n.createShape(ve,st,_e);ce.has(nt.target)&&ye.set(nt.target,Ne-(ft.x+ft.width/2)),n.connect(It,ft,{type:"bpmn:SequenceFlow",businessObject:li(nt)})}else s.append(It,ve,{connection:{type:"bpmn:SequenceFlow",businessObject:li(nt)}})}else if(jt)n.connect(It,jt,{type:"bpmn:SequenceFlow",businessObject:li(nt)});else continue;Ze.add(nt.id),be=!0}if(!be)break}const te=S.nodes.filter(le=>!p(le.node.id));if(!te.length)break;const se=te[0];{const le=nn(se.node,se.band),be=F(se.node),tt=Z(se);n.createShape(le,I(be,le,se.node.lane,tt,k,L),be),!se.node.lane&&tt===void 0&&(L+=160)}}}const Cn=40,gt=x=>{const S=X=>X.kind==="label-over-line"||X.kind==="label-over-shape"||X.kind==="label-on-shared-segment"?X.edge===x.id:X.kind==="annotation-over-label"||X.kind==="pool-name-over-label"?X.label===x.id:!1,A=()=>new Set(pt(Ve(r)).filter(X=>!S(X)).map(X=>ct(X))),k=A(),L=x.waypoints.map(X=>({x:X.x,y:X.y})),D=x.label,j=D&&{x:D.x,y:D.y};n.layoutConnection(x,{waypoints:[]});const F=A(),I=[...F].filter(X=>!k.has(X)).length,q=[...k].filter(X=>!F.has(X)).length;I<=q||(n.updateWaypoints(x,L),D&&j&&(D.x!==j.x||D.y!==j.y)&&n.moveElements([D],{x:j.x-D.x,y:j.y-D.y}))},St=5,Oi=10,qE=200,mc=new Set([..._.map(x=>x.flow.id),...v.map(x=>x.flow.id),...en(e,"sequenceFlow.update").map(x=>x.id),...en(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),b5=(x,S,A,k,L,D)=>{const j=new Set(x.map(te=>te.id)),F=Math.min(...x.map(te=>te.x))+S-Oi,I=Math.max(...x.map(te=>te.x+te.width))+S+qE+Oi,q=Math.min(...x.map(te=>te.y+Math.min(0,...A)))-Oi,X=Math.max(...x.map(te=>te.y+te.height+Math.max(0,...A)))+Oi,re=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const se=te;return mc.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(be=>!be||j.has(be.id)||be.x>=k)?!1:se.waypoints.some((be,tt)=>{const nt=se.waypoints[tt+1];return!!nt&&Math.max(be.x,nt.x)>=F&&Math.min(be.x,nt.x)<=I&&Math.max(be.y,nt.y)>=q&&Math.min(be.y,nt.y)<=X})});if(!re.length)return 0;const ce=te=>{const se=new Map;for(const le of x)for(const be of A){const tt={id:le.id,type:le.type,x:le.x+S+te,y:le.y+be,width:le.width,height:le.height};for(const nt of re){let It=1/0;for(let xe=0;xe+1<nt.waypoints.length;xe++)It=Math.min(It,ss(nt.waypoints[xe],nt.waypoints[xe+1],tt));const jt=`${nt.id}|${le.id}`;se.set(jt,Math.min(se.get(jt)??1/0,It))}}return se},ae=[...ce(0)].filter(([,te])=>te<=St).map(([te])=>te);if(!ae.length)return 0;let fe=0;for(let te=1;te<=qE;te++){const se=ce(te);if([...se.values()].every(le=>le>St)&&ae.every(le=>(se.get(le)??1/0)>=Oi)){fe=te;break}}if(!fe)return 0;const ye=Math.min(...x.map(te=>te.x))+S+fe,Ze=new Set(ae.map(te=>te.slice(0,te.indexOf("|"))));return re.some(te=>te.type==="bpmn:SequenceFlow"&&Ze.has(te.id)&&te.waypoints.some((se,le)=>{const be=te.waypoints[le+1];if(!be||Math.min(se.y,be.y)>D||Math.max(se.y,be.y)<D||se.y===be.y)return!1;const tt=se.x+(D-se.y)*(be.x-se.x)/(be.y-se.y);return tt>L&&tt<ye}))?0:fe},Vr=(x,S=()=>!0)=>{const A=p(x);if(!A)return[];const k=[A],L=new Set([x]);for(let D=0;D<k.length;D++){const j=k[D].id;for(const F of _){const I=F.flow.target;if(F.flow.source!==j||L.has(I)||!P.has(I))continue;L.add(I);const q=p(I);q&&S(q)&&k.push(q)}}return k},x5=(x,S=()=>!0)=>{const A=p(x);if(!A)return[];const k=[A],L=new Set([x]);for(let D=0;D<k.length;D++){const j=k[D].id;for(const F of _){const I=F.flow.source;if(F.flow.target!==j||L.has(I)||!P.has(I))continue;L.add(I);const q=p(I);q&&S(q)&&k.push(q)}}return k},Di=30,Li=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",Ka=(x,S)=>hf(n,x,S),yc=(x,S,A=!1)=>{const k=new Set(x.flatMap(I=>I.subtree.map(q=>q.id)));for(const I of x){const q=(I.pool.children??[]).filter(Li).filter(re=>!k.has(re.id));if(I.subtree.some(re=>q.some(ce=>re.x+S<ce.x+ce.width+Di&&re.x+S+re.width+Di>ce.x&&re.y<ce.y+ce.height&&re.y+re.height>ce.y)))return null}const L=x.map(I=>I.pool.width),D=A?r.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(q=>({x:q.x,y:q.y}))})):[],j=r.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(x.flatMap(I=>I.subtree),{x:S,y:0});const F=x.map(I=>{const X=Math.max(...I.subtree.map(re=>re.x+re.width))+hy-(I.pool.x+I.pool.width);return X>0&&Ka(I.pool,I.pool.width+X),X});return()=>{n.moveElements(x.flatMap(I=>I.subtree),{x:-S,y:0}),x.forEach((I,q)=>{F[q]>0&&Ka(I.pool,L[q])});for(const{c:I,wps:q}of D){const X=I.waypoints??[];X.length===q.length&&X.every((ce,ae)=>Math.abs(ce.x-q[ae].x)<=.5&&Math.abs(ce.y-q[ae].y)<=.5)||n.updateWaypoints(I,q.map(ce=>({x:ce.x,y:ce.y})))}for(let I=0;I<3;I++){let q=0;for(const X of j){const re=X.x-X.label.x,ce=X.y-X.label.y;Math.abs(re)<=.5&&Math.abs(ce)<=.5||(n.moveElements([X.label],{x:re,y:ce}),q++)}if(!q)break}}},yg=x=>{var L,D;const S=new Map,A=new Map;for(const j of r.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(S.set(F.id,F),A.set(F.id,[]))}for(const j of r.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,I=(L=F.source)==null?void 0:L.id,q=(D=F.target)==null?void 0:D.id;I&&q&&A.has(I)&&A.get(I).push(q),I&&q&&A.has(q)&&A.get(q).push(I)}const k=[];for(const[j,F]of A)F.length&&F.every(I=>x.has(I))&&k.push(S.get(j));return k},YE=(x,S)=>{if(!x.length)return null;const A=new Set(x.map(X=>X.id)),k=r.getAll().filter(X=>X.type==="bpmn:Participant"&&!A.has(X.id)),L=Math.min(...k.filter(X=>(X.children??[]).length>0).map(X=>X.x)),D=new Set(x.filter(X=>Math.abs(X.x-L)<=2).map(X=>X.id));if(x.some(X=>{const re=D.has(X.id)?X.x:X.x+S,ce=D.has(X.id)?X.width+S:X.width;return k.some(ae=>re<ae.x+ae.width+Di&&re+ce+Di>ae.x&&X.y<ae.y+ae.height&&X.y+X.height>ae.y)}))return null;const F=r.filter(X=>X.type==="label").map(X=>({label:X,x:X.x,y:X.y})),I=x.filter(X=>!D.has(X.id)),q=x.filter(X=>D.has(X.id)).map(X=>({pool:X,was:{x:X.x,y:X.y,width:X.width,height:X.height}}));I.length&&n.moveElements(I,{x:S,y:0});for(const{pool:X,was:re}of q)n.resizeShape(X,{...re,width:re.width+S});return()=>{for(const{pool:X,was:re}of q)n.resizeShape(X,re);I.length&&n.moveElements(I,{x:-S,y:0});for(let X=0;X<3;X++){let re=0;for(const ce of F){const ae=ce.x-ce.label.x,fe=ce.y-ce.label.y;Math.abs(ae)<=.5&&Math.abs(fe)<=.5||(n.moveElements([ce.label],{x:ae,y:fe}),re++)}if(!re)break}}},KE=(x,S,A)=>{const k=A.x+A.width/2,L=S.y>A.y,D=L?A.y+A.height:A.y,j=L?S.y:S.y+S.height,F=x.source===S?[{x:k,y:j},{x:k,y:D}]:[{x:k,y:D},{x:k,y:j}],I=Ve(r),q={...I.edges.find(X=>X.id===x.id),waypoints:F};return zt(q,Gn(I)).length?!1:(n.updateWaypoints(x,F),!0)},_5=()=>{const x=r.filter(j=>j.type==="bpmn:Participant"),S=Math.min(...x.filter(j=>(j.children??[]).length>0).map(j=>j.x)),A=j=>h.some(F=>F.participant.id===j.id),k=j=>!!j&&j.type==="bpmn:Participant"&&!(j.children??[]).length&&Math.abs(j.x-S)<=2&&!A(j),L=j=>!!j&&j.type==="bpmn:Participant"&&(j.children??[]).length>0&&!A(j),D=new Set;for(const j of r.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j;if((F.waypoints??[]).length!==2)continue;const I=[F.source,F.target].find(re=>k(re)||L(re)),q=I===F.source?F.target:F.source;if(!I||!q||q.type==="bpmn:Participant")continue;const X=q.x+q.width/2;L(I)&&(X<I.x||X>I.x+I.width)||D.add(F.id)}return D},w5=x=>{var A;const S=new Map;for(const k of x){const L=r.get(k);if(!L||(L.waypoints??[]).length===2)continue;const D=((A=L.source)==null?void 0:A.type)==="bpmn:Participant"?L.source:L.target,j=D===L.source?L.target:L.source;if(j.x+j.width/2<=D.x+D.width)continue;const F=S.get(D.id)??{pool:D,msgs:[]};F.msgs.push({conn:L,other:j}),S.set(D.id,F)}for(const{pool:k,msgs:L}of S.values()){const D=Math.max(...L.map(({other:fe})=>fe.x+fe.width/2))+ff;if(r.getAll().some(fe=>{if(fe.type!=="bpmn:Participant"||fe.id===k.id)return!1;const ye=fe;return k.x<ye.x+ye.width+Di&&D+Di>ye.x&&k.y<ye.y+ye.height&&k.y+k.height>ye.y}))continue;const F={x:k.x,y:k.y,width:k.width,height:k.height},I=[...k.incoming??[],...k.outgoing??[]],q=I.map(fe=>({c:fe,wps:(fe.waypoints??[]).map(ye=>({x:ye.x,y:ye.y}))})),X=I.flatMap(fe=>{const ye=fe.label;return ye?[{label:ye,x:ye.x,y:ye.y}]:[]}),re=gr();Ka(k,D-k.x);const ce=L.filter(({conn:fe,other:ye})=>KE(fe,k,ye)).length,ae=gr();if(!(ce>0&&ae.messages>re.messages&&ae.lines>=re.lines)){Ka(k,F.width);for(const{c:fe,wps:ye}of q){const Ze=fe.waypoints??[];Ze.length===ye.length&&Ze.every((te,se)=>Math.abs(te.x-ye[se].x)<=.5&&Math.abs(te.y-ye[se].y)<=.5)||n.updateWaypoints(fe,ye.map(te=>({x:te.x,y:te.y})))}for(let fe=0;fe<3;fe++){let ye=0;for(const Ze of X){const Be=Ze.x-Ze.label.x,te=Ze.y-Ze.label.y;Math.abs(Be)<=.5&&Math.abs(te)<=.5||(n.moveElements([Ze.label],{x:Be,y:te}),ye++)}if(!ye)break}}}},XE=()=>{let x=0;for(const S of r.getAll()){if(S.type!=="bpmn:DataInputAssociation"&&S.type!=="bpmn:DataOutputAssociation")continue;const A=S.waypoints??[];for(let k=1;k<A.length;k++)x+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return x},ZE=()=>{let x=0;for(const S of r.getAll()){if(S.type!=="bpmn:Association")continue;const A=S.waypoints??[];for(let k=1;k<A.length;k++)x+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return x},E5=x=>{const S=[];for(const A of r.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const k=A;if(x.has(k.id))continue;const D=[...k.incoming??[],...k.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===k?I.target:I.source);if(!D.length||D.some(I=>I===void 0))continue;const j=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const q=I,X=[q.source,q.target];return X.some(re=>!re)?[]:X.map(re=>re.id)},F=D.flatMap(I=>j(I));F.length&&F.every(I=>x.has(I))&&S.push(k)}return S},QE=()=>pt(Ve(r)).filter(x=>x.kind==="edge-crosses-shape").length,JE=x=>{const S=(x.children??[]).filter(Li);let A=0;for(let k=0;k<S.length;k++)for(let L=k+1;L<S.length;L++){const D=S[k],j=S[L];D.x<j.x+j.width&&D.x+D.width>j.x&&D.y<j.y+j.height&&D.y+D.height>j.y&&A++}return A},gr=()=>{const x=Ve(r),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:x.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:x.edges.filter(A=>S(A.waypoints)).length}},e1=x=>{const S=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const L=k;if(!L.waypoints||L.waypoints.length!==2)continue;const D=L.source,j=L.target;if(!D||!j)continue;const F=x.has(D.id);if(F===x.has(j.id))continue;const I=F?j:D,q=d(I);if(!q||x.has(I.id))continue;const X=S.get(q.id);X?I.x<X.minX&&(X.minX=I.x):S.set(q.id,{pool:q,minX:I.x})}const A=[];for(const{pool:k,minX:L}of S.values()){const D=(k.children??[]).filter(j=>Li(j)&&!x.has(j.id)&&j.x>=L);D.length&&A.push({subtree:D,pool:k})}return A},S5=(x,S,A)=>{const k=new Map(S.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),L=new Set(x);for(const j of S)for(const F of j.subtree)L.add(F.id);let D=!1;for(;;){let j=0;for(const F of e1(L)){if(F.pool===A)continue;const I=k.get(F.pool.id);I?I.subtree.push(...F.subtree):k.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const q of F.subtree)L.add(q.id);j+=F.subtree.length}if(!j)break;D=!0}return D?[...k.values()]:null},R5=(x,S)=>{const A=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const D=L,j=D.waypoints;if(!j||j.length<2||!j.every(ae=>Math.abs(ae.x-j[0].x)<1))continue;const F=D.source,I=D.target;if(!F||!I)continue;const q=x.has(F.id);if(q===x.has(I.id))continue;const X=q?I:F,re=d(X);if(!re||re===S||re===d(q?F:I))continue;const ce=A.get(re.id);ce?X.x<ce.minX&&(ce.minX=X.x):A.set(re.id,{pool:re,minX:X.x})}const k=[];for(const{pool:L,minX:D}of A.values()){const j=(L.children??[]).filter(F=>Li(F)&&!x.has(F.id)&&F.x>=D);j.length&&k.push({subtree:j,pool:L})}return k},t1=x=>{const S=Ve(r),A=S.shapes.filter(L=>x.has(L.id)),k=new Set;for(const L of S.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const D of zt(L,A))k.add(`${L.id}|${D.id}`);return k},n1=new Map;for(const x of en(e,"sequenceFlow.update")){if(x.target===void 0)continue;const S=P.get(x.target);if(!S)continue;const A=p(x.target),k=p(x.id);if(!A||!k)continue;const L=x.source!==void 0?p(x.source):k.source,D=k.target;if(!L||!D||D.id===A.id)continue;const j=k.waypoints&&k.waypoints.length>=3&&Math.abs(k.waypoints[0].x-k.waypoints[1].x)<1&&Math.abs(k.waypoints[0].y-k.waypoints[1].y)>1?{x:k.waypoints[0].x,y:k.waypoints[0].y}:void 0,F=j?k.waypoints[1].y:void 0,I=j&&k.label?{x:k.label.x,y:k.label.y}:void 0,q=I&&k.label&&Math.abs(I.y+k.label.height/2-F)<=$/5&&I.x+k.label.width>j.x?I.x+k.label.width+6:void 0,X=(L.outgoing??[]).filter(Te=>Te.type==="bpmn:SequenceFlow"&&Te.id!==k.id&&Te.target&&!mc.has(Te.id)),re=new Set(X.map(Te=>Te.target.id)),ce=Te=>{const Pt={type:"bpmn:Task",x:Te.x+2,y:Te.y+2,width:Te.width-4,height:Te.height-4};return X.find(_t=>(_t.waypoints??[]).some((fn,Oe)=>!!_t.waypoints[Oe+1]&&ss(fn,_t.waypoints[Oe+1],Pt)===0))},ae=Vr(x.target),fe=new Set(ae.map(Te=>Te.id)),ye=Rn.has(x.target)?{autoResize:!1}:void 0,Ze=Math.min(...ae.map(Te=>Te.x)),Be=Math.max(...ae.map(Te=>Te.x+Te.width)),te=L.x+L.width,se=D.x+D.width<=L.x,le=(()=>{if(!se)return;const Te=d(A),Pt=((Te==null?void 0:Te.children)??[]).filter(Ie=>Li(Ie)&&!fe.has(Ie.id)&&Ie.type!=="bpmn:Group"&&Ie.type!=="bpmn:Participant"),_t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],fn=r.getAll().filter(Ie=>{if(!_t.includes(Ie.type))return!1;const Bt=Ie;return Bt.id===k.id||mc.has(Bt.id)||!Bt.waypoints||Bt.waypoints.length<2?!1:![Bt.source,Bt.target].some(Tt=>!Tt||fe.has(Tt.id))}),Oe=(Ie,Bt)=>ae.every(Tt=>{var Yr;const bt={id:Tt.id,type:Tt.type,x:Tt.x+Ie,y:Tt.y+Bt,width:Tt.width,height:Tt.height};return Te&&(bt.x<Te.x||bt.x+bt.width>Te.x+Te.width||bt.y<Te.y||bt.y+bt.height>Te.y+Te.height)||!At((Yr=P.get(Tt.id))==null?void 0:Yr.node.lane,Tt,Tt.y+Bt+Tt.height/2)||Pt.some(Yn=>bt.x<Yn.x+Yn.width+Oi&&bt.x+bt.width+Oi>Yn.x&&bt.y<Yn.y+Yn.height+Oi&&bt.y+bt.height+Oi>Yn.y)?!1:fn.every(Yn=>{for(let uo=0;uo+1<Yn.waypoints.length;uo++)if(ss(Yn.waypoints[uo],Yn.waypoints[uo+1],bt)<Oi)return!1;return!0})}),Ye=L.x+L.width/2,wt=L.y+L.height/2,Ke=k.waypoints??[],Mt=Ke.length>=2&&Math.abs(Ke[0].y-Ke[1].y)<1&&Ke[1].x<Ke[0].x;return[...F!==void 0?[{cx:Ye,cy:F}]:[],...Mt?[{cx:L.x-Cn-A.width/2,cy:Ke[0].y}]:[],{cx:Ye,cy:wt+$},{cx:Ye,cy:wt-$}].find(Ie=>Oe(Ie.cx-(A.x+A.width/2),Ie.cy-(A.y+A.height/2)))})(),be=se&&!le?te:D.x,tt=A.y+A.height/2,nt=b5(ae,te+Cn-Ze,[0,L.y+L.height/2-tt,D.y+D.height/2-tt],be,te,L.y+L.height/2),It=te+Cn+nt,jt=(()=>{if(q===void 0)return 0;const Te=te+Cn,Pt=L.y+L.height/2-A.height/2,_t={x:Te,y:Pt,width:Be-Ze,height:A.height},fn=d(L);return((fn==null?void 0:fn.children)??[]).some(Ye=>Li(Ye)&&!fe.has(Ye.id)&&Ye.id!==L.id&&Ye.id!==D.id&&Ye.type!=="bpmn:Group"&&Ye.type!=="bpmn:Participant"&&Ye.x<_t.x+_t.width&&Ye.x+Ye.width>_t.x&&Ye.y<_t.y+_t.height&&Ye.y+Ye.height>_t.y)||ce(_t)?Math.max(0,q-Te):0})(),xe=le?0:Be-Ze+Cn*2+nt+jt-(se?0:D.x-te);let ve=[];if(xe>0){const Te=d(A),Pt=(Te==null?void 0:Te.children)??[],_t=Ke=>Ke.type==="bpmn:Lane";ve=(()=>{const Ke=new Set;for(const Fe of Pt)Li(Fe)&&!fe.has(Fe.id)&&Fe.id!==L.id&&Fe.x>=be&&Ke.add(Fe.id);const Mt=[];for(const Fe of Pt){if(Fe.type!=="bpmn:DataStoreReference"&&Fe.type!=="bpmn:DataObjectReference")continue;const Ie=Fe,Tt=[...Ie.incoming??[],...Ie.outgoing??[]].filter(bt=>bt.type==="bpmn:DataInputAssociation"||bt.type==="bpmn:DataOutputAssociation").map(bt=>bt.source===Ie?bt.target:bt.source);Tt.length&&Tt.every(bt=>bt!==void 0&&Ke.has(bt.id))&&Mt.push(Ie)}return Mt})();const Oe=Pt.filter(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&!_t(Ke)&&Ke.type!=="label"&&!fe.has(Ke.id)&&Ke.id!==L.id&&Ke.x>=be),Ye=Oe.flatMap(Ke=>Ke.labels??[]),wt=Te?[Te,...Pt.filter(Ke=>_t(Ke))]:[];if(Oe.length){const Ke=new Set(Oe.map(Qe=>Qe.id)),Mt=e1(Ke),Fe=Mt.length?S5(Ke,Mt,Te):null,Ie=Qe=>{const xt=new Set(Ke);for(const Nt of Qe)for(const ko of Nt.subtree)xt.add(ko.id);return E5(xt)},Bt=Ie(Mt),Tt=Fe?Ie(Fe):Bt,bt=yg(Ke),Yr=new Set(Ke);for(const Qe of Mt)for(const xt of Qe.subtree)Yr.add(xt.id);const Yn=Mt.length?yg(Yr):bt,uo=(()=>{if(!Fe)return[];const Qe=new Set(Ke);for(const xt of Fe)for(const Nt of xt.subtree)Qe.add(Nt.id);return yg(Qe)})(),Ja=Fe??Mt,Kr=(()=>{const Qe=new Set(Ke);for(const xt of Ja)for(const Nt of xt.subtree)Qe.add(Nt.id);return R5(Qe,Te)})(),Rg=Kr.length?Ie([...Ja,...Kr]):Bt,Gi=new Set([...Oe,...wt].map(Qe=>Qe.id)),vt=Pt.filter(Qe=>{const xt=Qe.labelTarget;return Qe.type==="label"&&!!xt&&"waypoints"in xt&&!!xt.source&&!!xt.target&&Gi.has(xt.source.id)&&Gi.has(xt.target.id)}),wn=_5();n.createSpace([...Oe,...Ye,...vt],wt,{x:xe,y:0},"e",be-1);const Yt=(Qe,xt,Nt)=>{const ko=gr(),dp=Nt?t1(Nt):null,hp=yc(Qe,xe,!!Nt);if(!hp)return!1;const xc=xt.length?YE(xt,xe):null,gp=gr(),Kt=!!Nt&&!!dp&&[...t1(Nt)].some(Zr=>!dp.has(Zr));return gp.messages>ko.messages&&gp.lines>=ko.lines&&!Kt?!0:(xc==null||xc(),hp(),!1)},ui=Kr.length>0&&Yt([...Ja,...Kr],Fe?uo:Yn,new Set(Kr.flatMap(Qe=>Qe.subtree.map(xt=>xt.id)))),Xr=!ui&&Fe?Yt(Fe,uo):!1;let po=ui||Xr;!po&&Mt.length&&(po=Yt(Mt,Yn));const es=ui?Rg:Xr?Tt:Bt;if(!po){for(const Qe of Mt){const xt=gr(),Nt=yc([Qe],xe);if(!Nt)continue;const ko=gr();(ko.messages<=xt.messages||ko.lines<xt.lines)&&Nt()}if(bt.length){const Qe=gr(),xt=YE(bt,xe);if(xt){const Nt=gr();(Nt.messages<=Qe.messages||Nt.lines<Qe.lines)&&xt()}}}if(w5(wn),es.length){const Qe=()=>new Set(pt(Ve(r)).map(Nt=>ct(Nt))),xt=Nt=>{const ko=ZE(),dp=Qe(),hp=Nt.map(Kt=>({a:Kt,x:Kt.x,y:Kt.y})),xc=r.filter(Kt=>Kt.type==="label").map(Kt=>({label:Kt,x:Kt.x,y:Kt.y}));n.moveElements(Nt,{x:xe,y:0});const gp=[...Qe()].filter(Kt=>!dp.has(Kt));if(ZE()<ko&&gp.length===0)return!0;for(const{a:Kt,x:Zr,y:_c}of hp)(Kt.x!==Zr||Kt.y!==_c)&&n.moveElements([Kt],{x:Zr-Kt.x,y:_c-Kt.y});for(const Kt of xc){const Zr=Kt.x-Kt.label.x,_c=Kt.y-Kt.label.y;(Zr!==0||_c!==0)&&n.moveElements([Kt.label],{x:Zr,y:_c})}return!1};if(!xt(es)&&es.length>1)for(const Nt of es)xt([Nt])}}}const ue=S.node.lane!==void 0?p(S.node.lane):S.node.participant!==void 0?p(S.node.participant):void 0,_e=Te=>{if(!ue)return!0;const Pt=Te.y+Te.height/2;return Pt>=ue.y&&Pt<=ue.y+ue.height},He=!_e(L)&&_e(D),Ne=Te=>Te.y+Te.height/2,Me=()=>{const Te=L.x+L.width,Pt=D.x,_t=Ne(D)-A.height/2,fn=Ne(D)+A.height/2;return!r.getAll().some(Oe=>Li(Oe)&&Oe.type!=="bpmn:Participant"&&Oe.type!=="bpmn:Group"&&Oe.type!=="bpmn:TextAnnotation"&&Oe.id!==L.id&&Oe.id!==D.id&&Oe.id!==A.id&&Oe.x<Pt&&Oe.x+Oe.width>Te&&Oe.y<fn&&Oe.y+Oe.height>_t)},st=!He&&S.band!==void 0&&_e(D)&&!R(S.node.lane,S.node.participant,S.band,Ne(L))&&R(S.node.lane,S.node.participant,S.band,Ne(D))&&D.x>=L.x+L.width&&Me(),ft=He||st?D:L,Jt=ft.y+ft.height/2,Mn=Jt-(A.y+A.height/2),yt=S.band!==void 0,Hn=yt?[A]:ae,Qa=(S.band===void 0||R(S.node.lane,S.node.participant,S.band,Jt))&&Ct(x.target)&&Hn.every(Te=>{var Pt;return At((Pt=P.get(Te.id))==null?void 0:Pt.node.lane,Te,Te.y+Te.height/2+Mn)}),Y5=Te=>Math.abs(Te.y+Te.height/2-(A.y+A.height/2))<=$/2;if(Qa&&yt){const Te=Math.abs(Mn)<=$/2?ae.filter(Oe=>Oe.id!==A.id&&Y5(Oe)):[],Pt=A.y+A.height/2,fn=S.band!==void 0&&!R(S.node.lane,S.node.participant,S.band,Pt)?ae.filter(Oe=>{var Ye,wt;return Oe.id!==A.id&&!Te.includes(Oe)&&((Ye=P.get(Oe.id))==null?void 0:Ye.band)===S.band&&((wt=P.get(Oe.id))==null?void 0:wt.node.lane)===S.node.lane&&(Math.abs(Oe.y+Oe.height/2-Pt)<=$/2||R(S.node.lane,S.node.participant,S.band,Oe.y+Oe.height/2))}).map(Oe=>({t:Oe,dy:Jt-(Oe.y+Oe.height/2)})).filter(({dy:Oe})=>Oe!==0):[];if(n.moveElements(ae,{x:It-Ze,y:0},void 0,ye),n.moveElements([A],{x:0,y:Mn},void 0,ye),Te.length){const Oe=()=>new Set(pt(Ve(r)).map(Ie=>ct(Ie))),Ye=Oe(),wt=r.filter(Ie=>Ie.type==="label").map(Ie=>({label:Ie,x:Ie.x,y:Ie.y}));n.moveElements(Te,{x:0,y:Mn});const Ke=Oe(),Mt=[...Ke].filter(Ie=>!Ye.has(Ie)).length,Fe=[...Ye].filter(Ie=>!Ke.has(Ie)).length;if(Mt>Fe){n.moveElements(Te,{x:0,y:-Mn});for(const Ie of wt){const Bt=Ie.x-Ie.label.x,Tt=Ie.y-Ie.label.y;(Bt!==0||Tt!==0)&&n.moveElements([Ie.label],{x:Bt,y:Tt})}}}if(fn.length){const Oe=new Set(ae.map(Ye=>Ye.id));for(const{t:Ye,dy:wt}of fn)ke(Ye.parent,Ye,Ye.x+Ye.width/2,Ye.y+Ye.height/2+wt,Oe)||n.moveElements([Ye],{x:0,y:wt})}}else n.moveElements(ae,{x:It-Ze,y:Qa?Mn:0},void 0,ye);const zi=d(A);if(!Qa&&S.node.lane===void 0&&S.band!==void 0&&zi){const Te=zi.y+Q+C(`pool:${S.node.participant??""}`,S.band)*$,Pt=Te-(A.y+A.height/2);Pt!==0&&!ke(zi,A,A.x+A.width/2,Te,fe)&&n.moveElements([A],{x:0,y:Pt},void 0,ye)}if(le)n.moveElements(ae,{x:le.cx-(A.x+A.width/2),y:le.cy-(A.y+A.height/2)},void 0,ye);else if(zi){const Te=(zi.children??[]).filter(Oe=>Li(Oe)&&!fe.has(Oe.id)&&Oe.type!=="bpmn:Group"&&Oe.type!=="bpmn:Participant"),Pt=(Oe,Ye,wt,Ke,Mt)=>Oe.x+Ye<Mt.x+Mt.width+Ke&&Oe.x+Ye+Oe.width+Ke>Mt.x&&Oe.y+wt<Mt.y+Mt.height+Ke&&Oe.y+wt+Oe.height+Ke>Mt.y,_t=Te.find(Oe=>Pt(A,0,0,0,Oe)),fn=_t?void 0:ce(A);if(_t||fn){const Oe=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Ye=r.getAll().filter(vt=>{if(!Oe.includes(vt.type))return!1;const wn=vt;return mc.has(wn.id)||!wn.waypoints||wn.waypoints.length<2?!1:![wn.source,wn.target].some(Yt=>!Yt||fe.has(Yt.id))}),wt=(vt,wn,Yt)=>{var ui;return At((ui=P.get(vt.id))==null?void 0:ui.node.lane,vt,vt.y+Yt+vt.height/2)&&vt.x+wn>=zi.x&&vt.x+wn+vt.width<=zi.x+zi.width&&vt.y+Yt>=zi.y&&vt.y+Yt+vt.height<=zi.y+zi.height},Ke=(vt,wn)=>ae.every(Yt=>wt(Yt,vt,wn)&&!Te.some(ui=>Pt(Yt,vt,wn,Oi,ui))&&Ye.every(ui=>{const Xr={id:Yt.id,type:Yt.type,x:Yt.x+vt,y:Yt.y+wn,width:Yt.width,height:Yt.height};for(let po=0;po+1<ui.waypoints.length;po++)if(ss(ui.waypoints[po],ui.waypoints[po+1],Xr)<Oi)return!1;return!0})),Mt=A.y+A.height/2,Fe=[F,D.y+D.height/2].filter(vt=>vt!==void 0&&Math.abs(vt-Mt)>=1),Ie=_t&&re.has(_t.id)?_t:fn==null?void 0:fn.target,Bt=Ie?Ie.x-A.x:0,Tt=Math.max(...ae.map(vt=>vt.x+vt.width)),bt=[...Bt!==0?[Bt]:[],...nt!==0?[-nt]:[],0],Yr=q===void 0?[]:bt.map(vt=>Math.max(vt,q-A.x)),Yn=vt=>Tt+vt+Cn<=D.x,uo=[...new Set([...Yr,...bt])].filter(Yn),Ja=_t&&re.has(_t.id)?[_t.x+_t.width+Cn-A.x]:[],Kr=q===void 0?[]:Ja.map(vt=>Math.max(vt,q-A.x)),Rg=[...new Set([...Kr,...Ja])].filter(vt=>Yn(vt)&&!uo.includes(vt));let Gi;for(const vt of[uo,Rg]){for(const wn of Fe){for(const Yt of vt)if(Ke(Yt,wn-Mt)){Gi={dx:Yt,dy:wn-Mt};break}if(Gi)break}if(Gi)break}if(Gi){const vt=Qe=>{const xt=Qe;return[xt.edge,xt.other,...Array.isArray(xt.edges)?xt.edges:[]].some(Nt=>typeof Nt=="string"&&mc.has(Nt))},wn=()=>new Set(pt(Ve(r)).filter(Qe=>!vt(Qe)).map(Qe=>ct(Qe))),Yt=wn(),ui=r.filter(Qe=>Qe.type==="label").map(Qe=>({label:Qe,x:Qe.x,y:Qe.y}));n.moveElements(ae,{x:Gi.dx,y:Gi.dy},void 0,ye);const Xr=wn(),po=[...Xr].filter(Qe=>!Yt.has(Qe)).length,es=[...Yt].filter(Qe=>!Xr.has(Qe)).length;if(po>es){n.moveElements(ae,{x:-Gi.dx,y:-Gi.dy},void 0,ye);for(const Qe of ui){const xt=Qe.x-Qe.label.x,Nt=Qe.y-Qe.label.y;(xt!==0||Nt!==0)&&n.moveElements([Qe.label],{x:xt,y:Nt})}}else j&&n1.set(k.id,{exit:j,channelY:F,label:I})}}}{const Te=new Set(ae.map(Ye=>Ye.id)),Pt=new Set(_.map(Ye=>Ye.flow.id)),_t=20,fn=Ye=>{const wt=Ye.source,Ke=Ye.target,Mt=Math.min(wt.x,Ke.x)-_t,Fe=Math.max(wt.x+wt.width,Ke.x+Ke.width)+_t,Ie=Math.min(wt.y,Ke.y)-_t,Bt=Math.max(wt.y+wt.height,Ke.y+Ke.height)+_t;return Ye.waypoints.some(Tt=>Tt.x<Mt||Tt.x>Fe||Tt.y<Ie||Tt.y>Bt)},Oe=new Map;for(const Ye of ae)for(const wt of[...Ye.incoming??[],...Ye.outgoing??[]])wt.id!==x.id&&Pt.has(wt.id)&&!(Te.has(wt.source.id)&&Te.has(wt.target.id))&&Oe.set(wt.id,wt);for(const Ye of Oe.values())fn(Ye)&>(Ye)}const lo=ve.length?d(ve[0]):void 0;if(lo){const Te={assoc:XE(),overlaps:JE(lo),crosses:QE()},Pt=ve.map(Fe=>({st:Fe,x:Fe.x})),_t=r.filter(Fe=>Fe.type==="label").map(Fe=>({label:Fe,x:Fe.x,y:Fe.y})),fn=Math.min(...ve.flatMap(Fe=>[...Fe.incoming??[],...Fe.outgoing??[]].filter(Ie=>Ie.type==="bpmn:DataInputAssociation"||Ie.type==="bpmn:DataOutputAssociation").map(Ie=>(Ie.source===Fe?Ie.target:Ie.source).x))),Oe=new Set(ve.map(Fe=>Fe.id)),Ye=(lo.children??[]).filter(Li).filter(Fe=>!Oe.has(Fe.id));let wt=fn;for(const Fe of[...ve].sort((Ie,Bt)=>Ie.x-Bt.x)){let Ie=wt;for(let Bt=0;Bt<100;Bt++){const Tt=Ye.find(bt=>Ie<bt.x+bt.width+Di&&Ie+Fe.width+Di>bt.x&&Fe.y<bt.y+bt.height&&Fe.y+Fe.height>bt.y);if(!Tt)break;Ie=Tt.x+Tt.width+Di}Ie!==Fe.x&&n.moveElements([Fe],{x:Ie-Fe.x,y:0}),wt=Ie+Fe.width+Di}const Ke=wt+150-(lo.x+lo.width);Ke>0&&Ka(lo,lo.width+Ke);const Mt={assoc:XE(),overlaps:JE(lo),crosses:QE()};if(Mt.assoc>=Te.assoc||Mt.overlaps>Te.overlaps||Mt.crosses>Te.crosses){for(const{st:Fe,x:Ie}of Pt)Fe.x!==Ie&&n.moveElements([Fe],{x:Ie-Fe.x,y:0});Ke>0&&Ka(lo,lo.width-Ke);for(const Fe of _t){const Ie=Fe.x-Fe.label.x,Bt=Fe.y-Fe.label.y;(Ie!==0||Bt!==0)&&n.moveElements([Fe.label],{x:Ie,y:Bt})}}}}for(const[x,S]of Rn){const A=p(x);if(!A)continue;const k=S.container,L=Math.abs(A.y+A.height/2-k.y-S.relCy)>=.5,D=A.label,j=Math.min(A.y,D&&!D.hidden?D.y:A.y),F=Math.max(A.y+A.height,D&&!D.hidden?D.y+D.height:0);if(L&&j>=k.y&&F<=k.y+k.height)continue;const I=A.y;S.grow(),A.y!==I&&n.moveElements([A],{x:0,y:I-A.y},void 0,{autoResize:!1})}const i1=(x,S)=>{const A=S.target===x,k=f(S.source),L=f(S.target),D=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,L,S.id?{type:D,businessObject:i.create(D,{id:S.id})}:{type:D})},o1=x=>{for(const S of h){if(!S.participant.blackBox)continue;const A=p(S.participant.id);if(!A)continue;const k=[];for(const D of v){const j=D.flow.source===S.participant.id?D.flow.target:D.flow.target===S.participant.id?D.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&k.push(F)}if(!k.length)continue;if(!x&&S.order===void 0){const D=(()=>{var F;const j=new Map;for(const I of k){const q=d(I);if(!q)continue;const X=j.get(q.id);X?X.n+=1:j.set(q.id,{shape:q,n:1})}return(F=[...j.values()].sort((I,q)=>q.n-I.n)[0])==null?void 0:F.shape})();if(D){const j=q=>q.reduce((X,re)=>X+re,0)/q.length,F=j(k.map(q=>q.y+q.height/2))<D.y+D.height/2,I=r.filter(q=>q.type==="bpmn:Participant"&&q.id!==S.participant.id&&q.id!==D.id).filter(q=>F?q.y+q.height<=D.y+5:q.y>=D.y+D.height-5);if(I.length){const q=[...I.reduce((le,be)=>le.set(be.y,(le.get(be.y)??0)+1),new Map)].sort((le,be)=>be[1]-le[1]||(F?be[0]-le[0]:le[0]-be[0]))[0][0],X=Math.min(A.width,iM),re=oM,ce=k.map(le=>le.x+le.width/2),ae=Math.round(j(ce)-X/2),fe=Math.max(...ce)+ff,ye=le=>({x:le,width:Math.max(X,fe-le)}),Ze=I.filter(le=>Math.min(le.y+le.height,q+re)-Math.max(le.y,q)>0),Be=le=>{const be=ye(le);return Ze.some(tt=>tt.x<be.x+be.width&&be.x<tt.x+tt.width)},te=le=>{const be=ye(le);return ce.filter(tt=>tt>=be.x+10&&tt<=be.x+be.width-10).length},se=(()=>{if(!Be(ae))return ae;const le=te(ae);return Ze.flatMap(be=>[be.x+be.width+ly,be.x-ly-X]).map(be=>Math.round(be)).filter(be=>!Be(be)&&te(be)>=le).sort((be,tt)=>Math.abs(be-ae)-Math.abs(tt-ae))[0]??ae})();if(se!==A.x||q!==A.y||X!==A.width||re!==A.height){const le=()=>new Set(pt(Ve(r)).map(xe=>ct(xe))),be=le(),tt={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:se,y:q,width:X,height:re});const nt=le(),It=[...nt].filter(xe=>!be.has(xe)).length,jt=[...be].filter(xe=>!nt.has(xe)).length;It>jt&&n.resizeShape(A,tt)}}}}const L=Math.max(...k.map(D=>D.x+D.width/2))+ff;if(L>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:L-A.x,height:A.height}),!!x)for(const D of v){const j=p(D.flow.id),F=D.flow.source===S.participant.id?D.flow.target:D.flow.target===S.participant.id?D.flow.source:void 0,I=F?p(F):void 0;if(!j||!I||I.type==="bpmn:Participant")continue;const q=I.x+I.width/2;q<A.x+10||q>A.x+A.width-10||KE(j,A,I)}}};o1(!1);for(const x of v){const S=x.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([..._.map(I=>I.flow.id),...v.map(I=>I.flow.id)].filter(I=>!!I)),k=r.filter(I=>!!I.waypoints),L=(I,q)=>Math.abs(q.x-I.x)<2?"L":Math.abs(q.x-(I.x+I.width))<2?"R":Math.abs(q.y-I.y)<2?"T":Math.abs(q.y-(I.y+I.height))<2?"B":void 0,D=new Map,j=(I,q,X)=>{if(!I||!q||typeof I.x!="number")return;const re=L(I,q);if(!re)return;let ce=D.get(I.id);ce||D.set(I.id,ce=new Map),ce.set(re,[...ce.get(re)??[],X])};for(const I of k){const q=I.waypoints;!q||q.length<2||(j(I.source,q[0],{id:I.id,dir:"out"}),j(I.target,q[q.length-1],{id:I.id,dir:"in"}))}const F=new Set;for(const[I,q]of D){const X=p(I);if(!X||typeof X.x!="number")continue;const re=te=>{var le;const se=(le=p(te.id))==null?void 0:le.source;return!!se&&typeof se.x=="number"&&se.x+se.width/2>X.x+X.width/2};if(![...q.values()].some(te=>te.length>=3&&te.some(se=>se.dir==="out")&&te.some(se=>se.dir==="in"&&A.has(se.id)&&re(se))))continue;const ae=d(X);if(!ae||F.has(ae.id)||(ae.children??[]).some(te=>te.type==="bpmn:Lane"))continue;const fe=(w1=q.get("T"))!=null&&w1.length?(E1=q.get("B"))!=null&&E1.length?void 0:"B":"T";if(!fe||(fe==="T"?X.y-ae.y:ae.y+ae.height-(X.y+X.height))>=$)continue;const Ze=(ae.children??[]).filter(te=>!("waypoints"in te&&te.waypoints)&&te.type!=="label"&&typeof te.x=="number"),Be=ae.y+ae.height;n.resizeShape(ae,{x:ae.x,y:ae.y,width:ae.width,height:ae.height+$}),ie(Be,ae.id,$),fe==="T"&&Ze.length&&n.moveElements(Ze,{x:0,y:$}),F.add(ae.id)}}const vg=20,r1=4,C5=3,M5=2,A5=[10,30,80],mr=()=>{const x=Ve(r);return{bad:pt(x).filter(S=>S.kind==="edge-crosses-shape"||S.kind==="edge-overlap-opposite"||S.kind==="edge-overlap-mixed").length,crossings:mm(x),straight:x.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length}},Xa=x=>{const S=Ve(r),A=S.edges.find(k=>k.id===x);return A?zt(A,Gn(S)).length:0},lp=x=>Xa(x)>0,up=x=>Ve(r).edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.id!==x&&S.waypoints.length===2).length,P5=(x,S,A)=>yc([{subtree:x,pool:S}],A),a1=(x,S)=>S.bad>x.bad||S.crossings>x.crossings&&S.straight<=x.straight&&S.bad>=x.bad,Za=(x,S)=>a1(x,S)||S.straight<x.straight,Wr=(x,S,A=()=>!0,k=a1,L=!1)=>{const D=mr(),j=yc(x,S,L);if(!j)return!1;const F=mr();return k(D,F)||!A()?(j(),!1):!0},T5=(x,S,A,k=()=>!0)=>Wr([{subtree:x,pool:S}],A,k),Ur=x=>{var S;return!!((S=P.get(x))!=null&&S.node.participant)},vc=new Map;for(const x of v){if(!Ur(x.flow.target))continue;const S=vc.get(x.flow.target)??[];S.push(x),vc.set(x.flow.target,S)}const pp=[...vc.keys()],bg=new Set(_.map(x=>x.flow.target)),s1=x=>Qt.findIndex(({op:S})=>S.participant.id===x);pp.sort((x,S)=>{var L,D;const A=bg.has(x)?1:0,k=bg.has(S)?1:0;return A!==k?A-k:s1((L=P.get(x))==null?void 0:L.node.participant)-s1((D=P.get(S))==null?void 0:D.node.participant)});const yr=x=>x.x+x.width/2,k5=x=>{const S=new Map;for(const L of r.getAll()){const D=L;if(!D.waypoints||!D.source||!D.target)continue;(S.get(D.source.id)??S.set(D.source.id,[]).get(D.source.id)).push(D.target.id)}const A=new Set([x]),k=[x];for(let L=0;L<k.length;L++)for(const D of S.get(k[L])??[])A.has(D)||(A.add(D),k.push(D));return A},O5=(x,S)=>{const A=k5(S);let k;for(const L of r.getAll()){const D=L;if(D.type!=="bpmn:MessageFlow"||!D.source||!D.target||D.target.id!==x||A.has(D.source.id))continue;const j=D.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=yr(j);(k===void 0||F>k)&&(k=F)}return k},xg=(x,S)=>{const A=p(x.flow.source);if(A)return A.type==="bpmn:Participant"?O5(A.id,S):yr(A)},c1=x=>{let S;for(const A of vc.get(x)??[]){const k=xg(A,x);k!==void 0&&(!S||k>S.cx)&&(S={op:A,cx:k})}return S==null?void 0:S.op},D5=x=>{const S=c1(x),A=p(x),k=S?xg(S,x):void 0;return A&&k!==void 0?k-yr(A):void 0},L5=x=>{const S=D5(x);return S!==void 0&&Math.abs(S)<vg},_g=(x,S,A,k,L)=>{var D;for(let j=!0;j;){j=!1;for(const F of v){if(F.flow.id===A)continue;const I=S.has(F.flow.source),q=S.has(F.flow.target);if(I===q||k(I?F.flow.source:F.flow.target))continue;const X=I?F.flow.target:F.flow.source;if(L(X)||!Ur(X))continue;const re=p(F.flow.id);if(!(re!=null&&re.waypoints)||re.waypoints.length!==2)continue;const ce=p(X),ae=(D=P.get(X))==null?void 0:D.node.participant;if(!ce||!ae)continue;const fe=Vr(X,ye=>ye.x>=ce.x).filter(ye=>!S.has(ye.id));if(!(!fe.length||fe.some(ye=>L(ye.id)))){for(const ye of fe)S.add(ye.id);x.set(ae,[...x.get(ae)??[],...fe]),j=!0}}}return[...x].map(([j,F])=>({subtree:F,pool:f(j)}))},l1=(x,S,A,k,L)=>_g(new Map([[S,[...x]]]),new Set(x.map(D=>D.id)),k,D=>D===A,D=>D===L),wg=x=>{const S=c1(x);if(!S)return null;const A=p(x),k=p(S.flow.source),L=xg(S,x);if(!A||!k||L===void 0)return null;const D=L-yr(A);if(D>=vg){const j=P.get(x).node.participant,F=Vr(x,I=>I.x>=A.x);return{groups:l1(F,j,x,S.flow.id,S.flow.source),dx:D}}if(-D>=vg&&Ur(S.flow.source)){const j=P.get(S.flow.source).node.participant,F=Vr(S.flow.source,I=>I.x>=k.x&&!L5(I.id));return{groups:l1(F,j,S.flow.source,S.flow.id,x),dx:-D}}return null},u1=()=>pp.map(x=>({id:x,plan:wg(x)})).filter(x=>!!x.plan).sort((x,S)=>Math.min(...x.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))-Math.min(...S.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))).map(x=>x.id);for(let x=0;x<3;x++){const S=mr(),A=[];for(const L of u1()){const D=wg(L);if(!D)continue;const j=yc(D.groups,D.dx);j&&A.push(j)}if(!A.length)break;if(!Za(S,mr()))continue;for(const L of A.reverse())L();let k=!1;for(const L of u1()){const D=wg(L);D&&Wr(D.groups,D.dx,()=>!0,Za)&&(k=!0)}if(!k)break}for(const x of pp){if(bg.has(x))continue;const S=P.get(x);if(!S||S.node.lane!==void 0)continue;const A=Z(S);if(A===void 0)continue;const k=p(x),L=k?d(k):void 0;if(!k||!L)continue;const D=L.y+Q+C(`pool:${S.node.participant??""}`,A)*$,j=D-(k.y+k.height/2);j!==0&&!ke(L,k,k.x+k.width/2,D)&&n.moveElements([k],{x:0,y:j})}const p1=new Set;for(let x=0,S=!0;S&&x<C5;x++){S=!1;for(const A of pp.flatMap(k=>vc.get(k)??[])){if(p1.has(A.flow.id)||!lp(A.flow.id))continue;const k=p(A.flow.target);if(!k)continue;const L=f(P.get(A.flow.target).node.participant),D=Vr(A.flow.target,q=>q.x>=k.x),j=k.width+H,F=Xa(A.flow.id),I=up(A.flow.id);for(let q=1;q<=r1;q++){const X=()=>Xa(A.flow.id)<F&&up(A.flow.id)>=I;if(T5(D,L,j*q,X)){p1.add(A.flow.id),S=!0;break}}}}const Eg=v.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),f1=new Set(Eg.map(x=>x.id));for(const x of r.filter(S=>S.type==="bpmn:MessageFlow"))f1.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&Eg.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of Eg){if(!lp(x.id))continue;const S=p(x.source),A=p(x.target);if(!S||!A)continue;let k,L,D;if(x.preexisting){const[F,I]=S.type==="bpmn:Participant"?[A,S]:[S,A];if(k=yr(F),k<I.x||k>I.x+I.width)continue;[L,D]=F.y<I.y?[F.y+F.height,I.y]:[I.y+I.height,F.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;[L,D]=S.y<A.y?[S.y+S.height,A.y]:[A.y+A.height,S.y]}const j=[...P.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==S.id&&F.id!==A.id).filter(F=>F.x<=k&&k<=F.x+F.width&&F.y+F.height>L&&F.y<D).sort((F,I)=>F.x-I.x);for(const F of j){const I=(S1=P.get(F.id))==null?void 0:S1.node.participant,q=I?p(I):void 0;if(!I||!q)continue;const X=[...P.values()].filter(se=>se.node.participant===I).map(se=>se.node.id),re=se=>se.map(le=>p(le)).filter(le=>!!le),ae=[x5(F.id,se=>{var le;return((le=P.get(se.id))==null?void 0:le.node.participant)===I}),re(X)].filter(se=>se.length).map(se=>[{subtree:se,pool:q}]);if(x.preexisting){const se=re(X);se.length&&ae.push(_g(new Map([[I,[...se]]]),new Set(se.map(le=>le.id)),x.id,()=>!1,le=>le===S.id||le===A.id))}const fe=F.width+H,ye=Xa(x.id),Ze=up(x.id),Be=()=>Xa(x.id)<ye&&up(x.id)>=Ze;let te=!1;for(const se of ae){for(let le=1;le<=r1;le++)if(Wr(se,fe*le,Be)){te=!0;break}if(te)break}if(!lp(x.id))break}}const fp=()=>{var S;const x=new Set;for(const A of pt(Ve(r)))A.kind!=="edge-crosses-shape"||f1.has(A.edge)||((S=p(A.edge))==null?void 0:S.type)==="bpmn:MessageFlow"&&x.add(`${A.edge}>${A.shape}`);return x},I5=(x,S)=>mr().bad>=x&&[...fp()].some(A=>!S.has(A)),d1=x=>{var S,A;return Xa(x)===0&&((A=(S=p(x))==null?void 0:S.waypoints)==null?void 0:A.length)===2},B5=(x,S,A)=>{const k=new Set(x.flatMap(D=>D.subtree.map(j=>j.id))),L=[...fp()].filter(D=>!A.has(D)).map(D=>D.split(">")[1]);return[...new Set(L)].filter(D=>k.has(D)&&D!==S.source&&D!==S.target)},N5=(x,S,A,k,L)=>{const D=x.map(q=>({...q,subtree:q.subtree.filter(X=>!L.includes(X.id))})).filter(q=>q.subtree.length),j=new Set(D.flatMap(q=>q.subtree.map(X=>X.id))),F=()=>L.every(q=>{const X=p(q);return!!X&&_.filter(re=>re.flow.target===q&&j.has(re.flow.source)).every(re=>{const ce=p(re.flow.source);return!!ce&&ce.x+ce.width<=X.x})});return Wr(D,S,()=>d1(A.id)&&[...fp()].every(q=>k.has(q))&&F(),Za,!0)};for(const x of v){if(!lp(x.flow.id))continue;const S=p(x.flow.id);if(((R1=S==null?void 0:S.waypoints)==null?void 0:R1.length)!==2)continue;const A=p(x.flow.source),k=p(x.flow.target);if(!A||!k||A.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!Ur(x.flow.source)||!Ur(x.flow.target)||Math.abs(yr(A)-yr(k))>M5)continue;const L=yr(A),D=S.waypoints.map(ye=>ye.y),[j,F]=[Math.min(...D),Math.max(...D)],I=Gn(Ve(r)).filter(ye=>ye.id!==A.id&&ye.id!==k.id&&ye.x<L&&L<ye.x+ye.width&&j<ye.y+ye.height&&ye.y<F);if(!I.length)continue;const q=(C1=P.get(x.flow.source))==null?void 0:C1.node.participant,X=(M1=P.get(x.flow.target))==null?void 0:M1.node.participant;if(!q||!X)continue;const re=new Map;for(const[ye,Ze,Be]of[[x.flow.source,A,q],[x.flow.target,k,X]]){const te=re.get(Be)??[],se=Vr(ye,le=>le.x>=Ze.x).filter(le=>!te.some(be=>be.id===le.id));re.set(Be,[...te,...se])}const ce=new Set([...re.values()].flat().map(ye=>ye.id)),ae=_g(re,ce,x.flow.id,ye=>ye===x.flow.source||ye===x.flow.target,()=>!1),fe=Math.max(...I.map(ye=>ye.x+ye.width));for(const ye of A5){const Ze=fe+ye-L;if(Ze<=0)continue;const Be=mr().bad,te=fp();let se=[],le=!0;const be=()=>!d1(x.flow.id)||le&&(se=B5(ae,x.flow,te),se.length)?!1:!I5(Be,te);if(Wr(ae,Ze,be,Za))break;if(se.length&&(N5(ae,Ze,x.flow,te,se)||(le=!1,Wr(ae,Ze,be,Za))))break}}{const x=A=>A.y+A.height/2,S=[];for(const A of P.keys()){if(!Ur(A))continue;const k=_.filter(j=>j.flow.target===A);if(k.length!==1)continue;const L=p(k[0].flow.source),D=p(A);!L||!D||!P.has(L.id)||Math.abs(x(L)-x(D))>1||D.x-(L.x+L.width)<=H+1||S.push({id:A,pred:L,node:D})}S.sort((A,k)=>A.node.x-k.node.x);for(const{id:A}of S){const k=P.get(A),L=p(A),D=p(_.find(ce=>ce.flow.target===A).flow.source);if(!L||!D)continue;const j=L.x-(D.x+D.width);if(j<=H+1)continue;const F=f(k.node.participant),I=Vr(A,ce=>ce.x>=L.x),q=mr(),X=P5(I,F,-(j-H));if(!X)continue;const re=mr();(re.bad>q.bad||re.crossings>=q.crossings||re.straight<q.straight)&&X()}}o1(!0);const $5=10,F5=400,j5=x=>[...x.incoming??[],...x.outgoing??[]].filter(S=>S.type==="bpmn:DataInputAssociation"||S.type==="bpmn:DataOutputAssociation").map(S=>S.source===x?S.target:S.source).filter(S=>!!S&&typeof S.y=="number"),H5=r.filter(x=>x.type==="bpmn:DataStoreReference"&&g.has(x.id)),z5=(x,S)=>{const A=x.x+x.width/2,k=x.y+x.height/2;let L;for(const D of H5){if((d(D)??u())!==S||D.y<x.y+x.height)continue;const j=Math.abs(D.x+D.width/2-A);j>F5||j<D.width||!j5(D).some(I=>I.height===x.height&&Math.abs(I.y+I.height/2-k)<=$5&&D.y>=I.y+I.height)||(!L||j<L.dx||j===L.dx&&D.id<L.id)&&(L={dx:j,id:D.id,cy:D.y+D.height/2})}return L==null?void 0:L.cy};for(const x of y){const S=x.associations??[],A=S.map(D=>D.source===x.dataStore.id?D.target:D.source).map(p).find(Boolean),k=A?d(A)??u():u(),L=A?{x:A.x+A.width/2,y:z5(A,k)??A.y+A.height+110}:{x:200,y:_n+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},L,k);for(const D of S)i1(x.dataStore.id,D)}for(const x of b){const A=f(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;i1(A,x.association)}let h1=0;const qr=10,g1=40,G5=(x,S)=>{const A=S.map(I=>d(I)).filter(I=>!!I);for(const I of A){const q=qr,X=I.y,re=I.y+I.height,ce=I.x,ae=I.x+I.width;if(Math.abs(x.y-X)<q){const fe=X+q-x.y;x.y+=fe,x.height-=fe}if(Math.abs(x.y+x.height-re)<q&&(x.height=re-q-x.y),Math.abs(x.x-ce)<q){const fe=ce+q-x.x;x.x+=fe,x.width-=fe}Math.abs(x.x+x.width-ae)<q&&(x.width=ae-q-x.x)}if(!A.length)return;const k=Math.min(...A.map(I=>I.y)),L=Math.max(...A.map(I=>I.y+I.height)),D=k-x.y,j=x.y+x.height-L,F=g1-qr;if(D>0!=j>0)if(D>0&&D<F){const I=D+qr;x.y+=I,x.height-=I}else j>0&&j<F&&(x.height-=j+qr)},V5=(x,S)=>{const A=qr,k=30,L=r.filter(D=>D.type==="bpmn:Group"&&D.id!==S);for(const D of L){const j=D.x,F=D.x+D.width,I=D.y,q=D.y+D.height,X=x.y<q&&I<x.y+x.height,re=x.x<F&&j<x.x+x.width;if(X){if(Math.abs(x.x-F)<A){const ce=Math.min(F+A-x.x,k);ce>0&&x.width-ce>0&&(x.x+=ce,x.width-=ce)}if(Math.abs(x.x+x.width-j)<A){const ce=Math.min(x.x+x.width-(j-A),k);ce>0&&x.width-ce>0&&(x.width-=ce)}}if(re){if(Math.abs(x.y-q)<A){const ce=Math.min(q+A-x.y,k);ce>0&&x.height-ce>0&&(x.y+=ce,x.height-=ce)}if(Math.abs(x.y+x.height-I)<A){const ce=Math.min(x.y+x.height-(I-A),k);ce>0&&x.height-ce>0&&(x.height-=ce)}}}},Sg=(x,S)=>{const A=g1,k=Math.min(...x.map(I=>I.x))-A,L=Math.min(...x.map(I=>I.y))-A,D=Math.max(...x.map(I=>I.x+I.width))+A,j=Math.max(...x.map(I=>I.y+I.height))+A,F={x:k,y:L,width:D-k,height:j-L};return G5(F,x),V5(F,S),F};for(const x of w){const S=(x.group.members??[]).map(p).filter(L=>!!L);let A;S.length?A=Sg(S,x.group.id):(A={x:300+h1*350,y:40,width:300,height:200},h1++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());x.group.name&&n.updateLabel(k,x.group.name),(A1=x.group.members)!=null&&A1.length&&T(k,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(L=>!!L.waypoints),S=new Map,A=(L,D)=>{!L||!D||(S.has(L)||S.set(L,new Set),S.get(L).add(D))};for(const L of x){const D=(P1=L.source)==null?void 0:P1.id,j=(T1=L.target)==null?void 0:T1.id;A(D,j),((k1=L.type)!=null&&k1.includes("DataOutputAssociation")||(O1=L.type)!=null&&O1.includes("DataInputAssociation")||L.type==="bpmn:Association")&&A(j,D)}const k=r.filter(L=>L.type==="bpmn:Group");for(const L of k){const j=(((D1=L.businessObject.extensionElements)==null?void 0:D1.values)??[]).find(Be=>Be.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const I=new Set(F),q=[...F];for(;q.length;){const Be=q.shift();for(const te of S.get(Be)??[])I.has(te)||(I.add(te),q.push(te))}const X=L.x,re=L.x+L.width,ce=L.y,ae=L.y+L.height,fe=Be=>_.filter(te=>te.flow.target===Be).length,ye=Be=>{var se;const te=((se=p(Be))==null?void 0:se.type)??"";if(te==="bpmn:StartEvent"&&fe(Be)===0)return!1;if(te.endsWith("Gateway")){const le=_.filter(be=>be.flow.target===Be).map(be=>be.flow.source);if(le.length&&le.every(be=>{var tt;return((tt=p(be))==null?void 0:tt.type)==="bpmn:StartEvent"&&fe(be)===0}))return!1}return!0},Ze=r.filter(Be=>Li(Be)).filter(Be=>Be.type!=="bpmn:Group"&&Be.type!=="bpmn:Participant"&&Be.type!=="bpmn:TextAnnotation"&&!I.has(Be.id)&&Ur(Be.id)&&ye(Be.id)&&Be.x<re&&Be.x+Be.width>X&&Be.y<ae&&Be.y+Be.height>ce);if(Ze.length)for(const Be of[-1,1]){const te=Ze.filter(ve=>(ve.x+ve.width-X<=re-ve.x?-1:1)===Be);if(!te.length)continue;const se=[];for(const ve of te){const ue=se.find(_e=>_e.some(He=>ve.y<He.y+He.height&&ve.y+ve.height>He.y));ue?ue.push(ve):se.push([ve])}const le=new Map;for(const ve of se){let ue=Be<0?X-qr:re+qr;for(const _e of[...ve].sort((He,Ne)=>Be<0?Ne.x-He.x:He.x-Ne.x)){const He=Be<0?Math.min(_e.x,ue-_e.width):Math.max(_e.x,ue);ue=Be<0?He-Di:He+_e.width+Di,He!==_e.x&&Math.sign(He-_e.x)===Be&&le.set(_e.id,He-_e.x)}}const be=new Map,tt=ve=>be.get(ve)===ve||!be.get(ve)?ve:tt(be.get(ve));for(const ve of te)be.set(ve.id,ve.id);for(const ve of v){const ue=le.has(ve.flow.source)?ve.flow.source:void 0,_e=le.has(ve.flow.target)?ve.flow.target:void 0;if(!ue||!_e)continue;const He=p(ve.flow.id);((L1=He==null?void 0:He.waypoints)==null?void 0:L1.length)===2&&be.set(tt(ue),tt(_e))}const nt=new Map;for(const ve of te){if(!le.has(ve.id))continue;const ue=tt(ve.id);nt.set(ue,[...nt.get(ue)??[],ve])}const It=[...nt.values()].sort((ve,ue)=>Be<0?Math.min(...ve.map(_e=>_e.x))-Math.min(...ue.map(_e=>_e.x)):Math.max(...ue.map(_e=>_e.x))-Math.max(...ve.map(_e=>_e.x))),jt=[];let xe=!0;for(const ve of It){const ue=ve.map(Ne=>le.get(Ne.id)??0).reduce((Ne,Me)=>Math.abs(Me)>Math.abs(Ne)?Me:Ne,0),_e=new Map;let He=!0;for(const Ne of ve){const Me=d(Ne);if(!Me){He=!1;break}_e.has(Me.id)||_e.set(Me.id,{subtree:[],pool:Me}),_e.get(Me.id).subtree.push(Ne)}He&&Wr([..._e.values()],ue,()=>!0,Za)?jt.push({shapes:ve,dx:ue}):xe=!1}if(!xe)for(const ve of jt.reverse())n.moveElements(ve.shapes,{x:-ve.dx,y:0})}}}{const x=new Set([...w.map(S=>S.group.id),...en(e,"group.update").map(S=>S.id)]);for(const S of r.filter(A=>A.type==="bpmn:Group")){if(x.has(S.id))continue;const k=(((I1=S.businessObject.extensionElements)==null?void 0:I1.values)??[]).find(F=>F.$type==="bwl:Members"),L=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!L.length||!L.some(F=>{const I=g.get(F.id);return!I||I.x!==F.x||I.y!==F.y})||!L.some(F=>F.x<S.x||F.y<S.y||F.x+F.width>S.x+S.width||F.y+F.height>S.y+S.height)||n.resizeShape(S,Sg(L,S.id))}}{const S=new Map(Fo(Ve(r)).map(F=>[F.owner,F.rect])),A=r.filter(F=>!!F.waypoints),k=new Map,L=(F,I)=>{!F||!I||(k.has(F)||k.set(F,new Set),k.get(F).add(I))};for(const F of A){const I=(B1=F.source)==null?void 0:B1.id,q=(N1=F.target)==null?void 0:N1.id;L(I,q),(($1=F.type)!=null&&$1.includes("DataOutputAssociation")||(F1=F.type)!=null&&F1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&L(q,I)}const D=F=>_.filter(I=>I.flow.target===F).length,j=F=>{var q;const I=((q=p(F))==null?void 0:q.type)??"";if(I==="bpmn:StartEvent"&&D(F)===0)return!1;if(I.endsWith("Gateway")){const X=_.filter(re=>re.flow.target===F).map(re=>re.flow.source);if(X.length&&X.every(re=>{var ce;return((ce=p(re))==null?void 0:ce.type)==="bpmn:StartEvent"&&D(re)===0}))return!1}return!0};for(const F of r.filter(I=>I.type==="bpmn:Group")){const q=(((j1=F.businessObject.extensionElements)==null?void 0:j1.values)??[]).find(ue=>ue.$type==="bwl:Members"),X=((q==null?void 0:q.refs)??"").split(" ").filter(Boolean);if(!X.length)continue;const re=X.map(p).filter(ue=>!!ue);if(!re.length||!(w.some(ue=>ue.group.id===F.id)||en(e,"group.update").some(ue=>ue.id===F.id)||re.some(ue=>{const _e=g.get(ue.id);return!_e||_e.x!==ue.x||_e.y!==ue.y})))continue;const ae=new Set(X),fe=[...X];for(;fe.length;){const ue=fe.shift();for(const _e of k.get(ue)??[])ae.has(_e)||(ae.add(_e),fe.push(_e))}const ye=F.x,Ze=F.x+F.width,Be=F.y,te=F.y+F.height,se=ue=>{const _e=S.get(ue.id),He={x:ue.x,y:ue.y,width:ue.width,height:ue.height};return _e?[He,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[He]},le=re.flatMap(se),be=Math.min(...le.map(ue=>ue.x)),tt=Math.max(...le.map(ue=>ue.x+ue.width)),nt=Math.min(...le.map(ue=>ue.y)),It=Math.max(...le.map(ue=>ue.y+ue.height)),jt={L:be-ye,R:Ze-tt,T:nt-Be,B:te-It},xe=r.filter(ue=>Li(ue)).filter(ue=>ue.type!=="bpmn:Group"&&ue.type!=="bpmn:Participant"&&ue.type!=="bpmn:TextAnnotation"&&!ae.has(ue.id)&&j(ue.id)&&ue.x<Ze&&ue.x+ue.width>ye&&ue.y<te&&ue.y+ue.height>Be);if(!xe.length)continue;const ve={L:0,R:0,T:0,B:0};for(const ue of xe){const _e=se(ue),He=Math.min(..._e.map(yt=>yt.x)),Ne=Math.max(..._e.map(yt=>yt.x+yt.width)),Me=Math.min(..._e.map(yt=>yt.y)),st=Math.max(..._e.map(yt=>yt.y+yt.height)),ft={L:Ne-ye,R:Ze-He,T:st-Be,B:te-Me},Jt=["L","R","T","B"].filter(yt=>ft[yt]<=jt[yt]+.001);if(!Jt.length)continue;const Mn=Jt.reduce((yt,Hn)=>ft[Hn]<ft[yt]?Hn:yt,Jt[0]);ve[Mn]=Math.max(ve[Mn],Math.min(ft[Mn]+10,jt[Mn]))}!ve.L&&!ve.R&&!ve.T&&!ve.B||n.resizeShape(F,{x:F.x+ve.L,y:F.y+ve.T,width:F.width-ve.L-ve.R,height:F.height-ve.T-ve.B})}}const m1=x=>{const S=x.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=x;return{x:A.x,y:A.y,width:A.width,height:A.height}};let bc=0;const y1=12,v1=14,W5=15,U5=300,q5=x=>{const S=x.split(`
|
|
7
|
+
`),A=Math.max(...S.map(D=>ca(D,y1))),k=Math.max(100,Math.min(U5,Math.ceil(A)+v1)),L=S.reduce((D,j)=>D+Math.max(1,Math.ceil((ca(j,y1)+v1)/k)),0);return{width:k,height:Math.max(30,L*W5+10)}};for(const x of E){const S=x.association,A=((H1=x.placement)==null?void 0:H1.anchor)??(S?S.source===x.annotation.id?S.target:S.source:void 0),k=A?p(A):void 0,L=k?m1(k):void 0,D=q5(x.annotation.text??"");let j;if(L&&x.placement){const[X,re]=Xc[x.placement.side],ce=x.placement.offset??50;j={x:L.x+L.width/2+X*(L.width/2+D.width/2+ce),y:L.y+L.height/2+re*(L.height/2+D.height/2+ce)}}else L?(j={x:L.x+L.width/2+180+bc%3*260,y:L.y-110-bc%2*95},bc++):(j={x:300+bc*260,y:60},bc++);const F=k?d(k)??u():u(),I=F;L&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(j=Qc(r,L,D,I,x.placement?{placement:x.placement}:{from:j}));const q=n.createShape({type:"bpmn:TextAnnotation",width:D.width,height:D.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},j,F);if(S){const X=re=>re===x.annotation.id?q:f(re);n.connect(X(S.source),X(S.target),S.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:S.id})}:{type:"bpmn:Association"})}x.placement&&T(q,"bwl:Placement",O(x.placement))}for(const x of en(e,"association.add")){const S=x.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 b1=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of en(e,"node.update")){let S=f(x.id);if(x.type&&Kc(x.type)!==S.type){const A=S.x+S.width/2,k=S.y+S.height/2,L=b1();S=c.replaceElement(S,{type:Kc(x.type),...x.eventDefinition?{eventDefinitionType:Sc[x.eventDefinition]}:{}});const D=b1(),j=[...L].filter(q=>q!==x.id&&!D.has(q));if(j.length)throw new fy({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:j});const F=Math.round(A-(S.x+S.width/2)),I=Math.round(k-(S.y+S.height/2));if(F!==0||I!==0){n.moveShape(S,{x:F,y:I});for(const q of[...S.incoming??[],...S.outgoing??[]])gt(q)}}if(x.name!==void 0&&n.updateProperties(S,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(S,{"bwl:band":x.band});const A=S.y+S.height/2,k=d(S),L=x.lane?f(x.lane):((k==null?void 0:k.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);x.band!==void 0&&mt(L==null?void 0:L.id,x.band,k);const D=L?L.y+(x.band===void 0?L.height/2:Math.min(L.height/2,J)+C(L.id,x.band)*$):x.band!==void 0&&k?k.y+Q+C(`pool:${k.id}`,x.band)*$:void 0;if(D!==void 0){const j=D-A;j!==0&&n.moveElements([S],{x:0,y:j})}}}for(const x of en(e,"sequenceFlow.update")){const S=f(x.id);if(x.source!==void 0||x.target!==void 0){const A=S,k=x.source!==void 0?f(x.source):A.source,L=x.target!==void 0?f(x.target):A.target,D=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(A,k,L,[D(k),D(L)]);const j=n1.get(A.id),F=L.y+L.height/2;if(j&&L.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:L.x,y:F}]);const I=A.label;if(I&&j.label){const X=Math.abs(j.label.y+I.height/2-j.channelY)<=$/5&&j.label.x+I.width>j.exit.x,re=j.exit.x+6,ce=L.x-6-I.width,ae=X?ce>=re?{x:Math.max(re,Math.min(j.label.x,ce)),y:j.label.y+(F-j.channelY)}:void 0:j.label;ae&&(ae.x!==I.x||ae.y!==I.y)&&n.moveElements([I],{x:ae.x-I.x,y:ae.y-I.y})}}else Math.abs(F-(k.y+k.height/2))>1&>(A)}x.name!==void 0&&n.updateProperties(S,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(S,{name:((z1=x.condition)==null?void 0:z1.label)??void 0})}for(const x of en(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(f(x.id),{name:x.name??void 0});for(const x of en(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(f(x.id),{name:x.name??void 0});for(const x of en(e,"annotation.update")){const S=f(x.id);if(x.text!==void 0&&n.updateProperties(S,{text:x.text}),x.placement===null)T(S,"bwl:Placement",null);else if(x.placement){const A=f(x.placement.anchor),k=m1(A),L=d(A)??u(),D=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[j,F]=Xc[x.placement.side],I=x.placement.offset??50,q={x:k.x+k.width/2+j*(k.width/2+S.width/2+I),y:k.y+k.height/2+F*(k.height/2+S.height/2+I)},X=D?Qc(r,k,{width:S.width,height:S.height},L,{placement:x.placement,selfId:x.id}):q;n.moveElements([S],{x:X.x-(S.x+S.width/2),y:X.y-(S.y+S.height/2)}),T(S,"bwl:Placement",O(x.placement))}}for(const x of en(e,"group.update")){const S=f(x.id);if(x.name!==void 0&&n.updateLabel(S,x.name??""),x.members){const A=x.members.map(p).filter(k=>!!k);A.length&&n.resizeShape(S,Sg(A,x.id)),T(S,"bwl:Members",{refs:x.members.join(" ")})}}}function df(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 sM(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>pt(f).filter(d=>!t.has(ct(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ve(i),c=r(s),l=[...new Set(c.flatMap(df))].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 V=d.x+d.width/2,we=d.y+d.height/2;h=i.getAll().find(Ce=>{if(Ce.type!=="bpmn:Participant")return!1;const ke=Ce;return typeof ke.x=="number"&&typeof ke.width=="number"&&V>=ke.x&&V<=ke.x+ke.width&&we>=ke.y&&we<=ke.y+ke.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(V=>V.$type==="bwl:Placement"),v=[...d.incoming??[],...d.outgoing??[]].find(V=>V.type==="bpmn:Association"),y=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(v?((p=v.source)==null?void 0:p.id)===f?v.target:v.source:void 0);if(!y)continue;const b=y.waypoints,E=b!=null&&b.length?{x:b[Math.floor((b.length-1)/2)].x,y:b[Math.floor((b.length-1)/2)].y,width:0,height:0}:{x:y.x,y:y.y,width:y.width,height:y.height},w={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},T=_==null?void 0:_.side,O=py(i,E,h),N=[];if(T&&T in Xc&&N.push(Qc(i,E,w,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:f})),O&&!Zc(P,w,O))for(const V of aM)N.push(Qc(i,E,w,h,{placement:{side:V,offset:null},selfId:f}));for(const[V,we]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Ce=1;Ce<=rM;Ce++)N.push({x:P.x+V*uy*Ce,y:P.y+we*uy*Ce});const $={...s,edges:s.edges.filter(V=>V.id!==(v==null?void 0:v.id))},H=r($),Q=H.filter(V=>df(V).includes(f)).length;if(!Q)continue;let J;for(const V of N){const we=V.x-P.x,Ce=V.y-P.y;if(!we&&!Ce||V.x-w.width/2<h.x||V.x+w.width/2>h.x+h.width||V.y-w.height/2<h.y||V.y+w.height/2>h.y+h.height||O&&!Zc(V,w,O))continue;const ke={...$,shapes:$.shapes.map(W=>W.id===f?{...W,x:W.x+we,y:W.y+Ce}:W)},Ee=r(ke),Y=Ee.filter(W=>df(W).includes(f)).length;if(Y>=Q||Ee.length>H.length)continue;const ne=Math.abs(we)+Math.abs(Ce);if((!J||Y<J.mine||Y===J.mine&&(Ee.length<J.all||Ee.length===J.all&&ne<J.dist))&&(J={x:V.x,y:V.y,mine:Y,all:Ee.length,dist:ne}),J.mine===0&&J.all<H.length)break}J&&o.moveElements([d],{x:J.x-P.x,y:J.y-P.y})}}const cM=60;function hf(e,t,n,i){const o=t.x+t.width,r=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(r.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of r)Math.abs(c.x+c.width-o)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function lM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=u=>pt(u).filter(p=>!t.has(ct(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let m=!1;for(const _ of n.shapes)_.type!=="bpmn:Group"||f.has(_.id)||[...d].some(v=>{const y=s.get(v);return y&&c(_,y)})&&(f.add(_.id),m=!0);for(const _ of n.shapes)_.type!=="bpmn:Participant"||d.has(_.id)||[...f].some(v=>{const y=s.get(v);return y&&c(y,_)})&&(d.add(_.id),m=!0);if(!m)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(m=>{const _=s.get(m);return _&&c(_,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Ve(i),f=r(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(b=>[b.id,b]));let h=null;for(const b of d){if(b.kind!=="pool-overlap")continue;const[E,w]=b.pools,P=g.get(E),T=g.get(w);if(!P||!T)continue;const[O,N]=P.x<=T.x?[P,T]:[T,P];if(b.contained)continue;const $=s.get(O.id),H=s.get(N.id),Q=$&&H?Math.max(H.x-($.x+$.width),0):cM,J=O.x+O.width+Q-N.x;if(J<=0)continue;const V=l(N.id).filter(we=>i.get(we));V.length&&(!h||J>h.dx)&&(h={movers:V,dx:J})}if(!h)return;const m=h.movers.map(b=>i.get(b)).filter(b=>!!b&&typeof b.x=="number");if(!m.length)return;const _=f.length,v=d.length;o.moveElements(m,{x:h.dx,y:0});const y=r(Ve(i));if(!(a(y).length<v&&y.length<=_)){o.moveElements(m,{x:-h.dx,y:0});return}}}const fs=.5,hy=150;function uM(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of pM(n))i.length<n.length&&i.some(r=>fM(e.elementRegistry.get(r.id)))||dM(e,i)}function pM(e){const t=[...e].sort((i,o)=>i.x+i.width-(o.x+o.width)),n=[];for(const i of t){const o=n[n.length-1],r=o==null?void 0:o[o.length-1];o&&r&&i.x+i.width-(r.x+r.width)<=fs?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function fM(e){var i,o,r;const t=(i=e==null?void 0:e.businessObject)==null?void 0:i.processRef;if(!t)return!0;const n=(t.laneSets??[]).reduce((a,s)=>{var c;return a+(((c=s.lanes)==null?void 0:c.length)??0)},0);return(((o=t.flowElements)==null?void 0:o.length)??0)+n+(((r=t.artifacts)==null?void 0:r.length)??0)===0}function dM(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(v=>v.x+v.width),r=Math.max(...o);if(r-Math.min(...o)>fs)return;const a=t.map(v=>n.get(v.id)).filter(v=>!!v&&typeof v.x=="number");if(a.length<2)return;const s=new Map(t.map(v=>[v.id,v.x]));if(a.some(v=>Math.abs(v.x-s.get(v.id))>fs))return;const c=a.map(v=>v.x+v.width);if(Math.max(...c)-Math.min(...c)<=fs)return;const l=v=>v.x+v.width,u=v=>!!v&&typeof v.width=="number",p=v=>{const y={shapes:[],edges:[],lanes:[]},b=E=>{for(const w of E.children??[]){if("waypoints"in w&&w.waypoints){y.edges.push(w);continue}w.type!=="label"&&(w.type==="bpmn:Lane"?y.lanes.push(w):y.shapes.push(w),b(w))}};return b(v),y},f=new Map(a.map(v=>[v.id,p(v)]));let d=r;for(const v of a){const{shapes:y}=f.get(v.id),b=y.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(d=Math.max(d,Math.max(...b)+hy))}const g=a.filter(v=>Math.abs(l(v)-d)>fs);if(!g.length)return;for(const v of g){const y=l(v),{shapes:b,edges:E,lanes:w}=f.get(v.id);if([...b.flatMap(O=>[l(O),...u(O.label)?[l(O.label)]:[]]),...E.flatMap(O=>[...O.waypoints.map(N=>N.x),...u(O.label)?[l(O.label)]:[]])].some(O=>O>d)||[...(v.incoming??[]).map(O=>O.waypoints[O.waypoints.length-1]),...(v.outgoing??[]).map(O=>O.waypoints[0])].some(O=>!O||O.x>d||Math.abs(O.x-y)<1))return;if(d>y){const O={x:y,y:v.y,width:d-y,height:v.height},N=new Set([v.id,...b.map(H=>H.id),...E.map(H=>H.id),...w.map(H=>H.id)]);if(n.getAll().some(H=>{var V;if("waypoints"in H&&H.waypoints||H.type==="bpmn:Group"||!u(H))return!1;const Q=H.type==="label"?(V=H.labelTarget)==null?void 0:V.id:H.id;if(!Q||N.has(Q)||N.has(H.id))return!1;const J=H;return J.x<O.x+O.width&&J.x+J.width>O.x&&J.y<O.y+O.height&&J.y+J.height>O.y}))return}}const h=()=>new Set(pt(Ve(n)).map(ct)),m=h(),_=g.map(v=>v.width);for(const v of g)hf(i,v,d-v.x,{layout:!1});[...h()].every(v=>m.has(v))||g.forEach((v,y)=>hf(i,v,_[y],{layout:!1}))}function hM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>pt(l).filter(u=>!t.has(ct(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(w=>w.id!==l.id&&w.type!=="bpmn:Group"&&a(l,w));if(!p.length)continue;const f=p.map(w=>i.get(w.id)).filter(w=>!!w&&typeof w.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),m=g.t+(l.y-d.t),_=g.r+(l.x+l.width-d.r),v=g.b+(l.y+l.height-d.b),y={x:h,y:m,width:_-h,height:v-m};if(y.width<=0||y.height<=0||Math.abs(y.x-u.x)<1&&Math.abs(y.y-u.y)<1&&Math.abs(y.width-u.width)<1&&Math.abs(y.height-u.height)<1)continue;const b=r(Ve(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,y),r(Ve(i)).length>b&&o.resizeShape(u,E)}}const Jc=20,el=10;function gM(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(pt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ct)),s=Ve(o),c=pt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(ct(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(De=>De.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const m=l.get(d);if(!(!m||Math.abs(m.x-h.x)>=.5||Math.abs(m.y-h.y)>=.5||Math.abs(m.width-h.width)>=.5||Math.abs(m.height-h.height)>=.5))continue;const v=h.members.map(De=>o.get(De)).filter(De=>!!De&&typeof De.x=="number");if(!v.length)continue;const y=Math.min(...v.map(De=>De.x)),b=Math.min(...v.map(De=>De.y)),E=Math.max(...v.map(De=>De.x+De.width)),w=Math.max(...v.map(De=>De.y+De.height)),P=h.x,T=h.y,O=h.x+h.width,N=h.y+h.height;let $=P,H=T,Q=O,J=N;for(const De of g){const B=s.edges.find(R=>R.id===De.edge);if(!B)continue;const C=B.endpoints.some(R=>{const G=s.shapes.find(Pe=>Pe.id===R);if(!G||G.container)return!1;const K=G.x+G.width/2,ie=G.y+G.height/2;return P<K&&K<O&&T<ie&&ie<N});for(const R of on(B)){const G=R.axis==="v"?[T,N]:[P,O];Math.min(R.hi,G[1])-Math.max(R.lo,G[0])<Vp||(R.axis==="v"?P<R.at&&R.at<O:T<R.at&&R.at<N)&&C||(R.axis==="v"?(Math.abs(R.at-P)<=la&&($=Math.max($,R.at+Jc)),Math.abs(R.at-O)<=la&&(Q=Math.min(Q,R.at-Jc))):(Math.abs(R.at-T)<=la&&(H=Math.max(H,R.at+Jc)),Math.abs(R.at-N)<=la&&(J=Math.min(J,R.at-Jc))))}}if($>y-el&&($=P),H>b-el&&(H=T),Q<E+el&&(Q=O),J<w+el&&(J=N),$===P&&H===T&&Q===O&&J===N)continue;const V=o.get(d),we={x:V.x,y:V.y,width:V.width,height:V.height},Ce=Ve(o),ke=new Set(pt(Ce).map(ct)),Ee=a(Ce);r.resizeShape(V,{x:$,y:H,width:Q-$,height:J-H});let Y=Ve(o),ne=pt(Y).filter(De=>!ke.has(ct(De)));const W=[];if(ne.length>0&&ne.every(De=>De.kind==="label-over-line"&&!i.has(De.edge)&&Y.edges.some(B=>B.id===De.edge))){for(const De of ne){if(De.kind!=="label-over-line")continue;const B=Y.edges.find(ie=>ie.id===De.edge),C=B&&uf(B,Y),R=(f=o.get(De.edge))==null?void 0:f.label;if(!C||!R)continue;const G=C.x-R.x,K=C.y-R.y;r.moveElements([R],{x:G,y:K}),W.push({label:R,dx:G,dy:K})}Y=Ve(o),ne=pt(Y).filter(De=>!ke.has(ct(De)))}const oe=a(Y),he=[...oe].some(De=>!Ee.has(De));if(ne.length||he||oe.size>=Ee.size){for(const De of W.reverse())r.moveElements([De.label],{x:-De.dx,y:-De.dy});r.resizeShape(V,we)}}}function mM(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Ep((o==null?void 0:o.$parent)??o),a=ns(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:Sp(u,i,r),requests:Ap(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...r?{rootLang:r}:{},before:s.get(l)}]:[]})}}function gy(e,t,n={}){var H,Q;const{i18n:i,lower:o=dy}=n,r=cy(e),a=Mm(r.elementRegistry),s=sy(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0},sharedEndpointCrossings:{before:0,after:0,pairs:[]}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=eM(t,a,i),u=i&&l.writes.size?mM(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ve(r.elementRegistry),f=new Set(pt(p).map(ct)),d=new Set(pt(p,{includeObservationOnly:!0}).map(ct)),g=new Set(p.edges.map(J=>J.id)),h=new Set(t.flatMap(J=>J.kind==="sequenceFlow.update"&&(J.source!==void 0||J.target!==void 0)?[J.id]:[])),m=new Set(p.shapes.map(J=>J.id)),_=$o(p),v=_.length,y=new Set(_.map(([J,V])=>`${J}|${V}`)),b=qi(p),E=new Set(b.map(([J,V])=>`${J}|${V}`)),w=new Map;for(const J of r.elementRegistry.filter(V=>"waypoints"in V&&!!V.waypoints))J.label&&w.set(J.id,{wps:J.waypoints.map(V=>({x:V.x,y:V.y})),label:{x:J.label.x,y:J.label.y},source:(H=J.source)==null?void 0:H.id,target:(Q=J.target)==null?void 0:Q.id});const P=e.get("commandStack");try{Og(P,()=>{o(l.ops,r);for(const V of(u==null?void 0:u.contexts())??[])P.execute(Cp,V);lM(r,f,p),uM(r,p),hM(r,f,p),kC(r,p,h),AC(r,g,m),Bm(r,g);const J=Jp(r,f);Tm(r,y,g),Ym(r,f,g),Hm(r,g),GC(r,g,h),Vm(r,f,g),qC(r,f,g),RC(r,E,g),NC(r,g,p),ey(r,f,g),Jm(r,g,h),ny(r,m),sM(r,f,m),Jp(r,f,J),gM(r,d,p,g),iy(r,f),Qm(r,w)})}catch(J){return{ok:!1,issues:[J instanceof fy?J.issue:{kind:"lower-failed",message:J instanceof Error?J.message:String(J)}],findings:[],stats:c}}const T=Ve(r.elementRegistry),O=pt(T,{includeObservationOnly:!0}).filter(J=>!d.has(ct(J))),N=ym(T),$=qi(T);return{ok:!0,issues:[],findings:O,stats:{edgeCrossings:{before:v,after:N.pairs.length,pairs:N.pairs,solidPairs:N.solidPairs,dashedPairs:N.dashedPairs,mixedPairs:N.mixedPairs,crossPoolMessages:N.crossPoolMessages},sharedEndpointCrossings:{before:b.length,after:$.length,pairs:$}}}}function yM(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function my(e,t){return typeof e.get=="function"?e.get(t):e[t]}function yy(e,t){const n=my(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function vy(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function vM(e){return typeof e=="string"&&vp.includes(e)}function $i(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function by(e,t={}){const n=e.rootElements??[],i=n.find(Y=>Y.$type==="bpmn:Collaboration"),o=new Map(n.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],_=[],v=[],y=new Map,b=new Set,E=new Set,w=Y=>{Y&&b.add(Y)},P=Y=>{b.add(Y),E.add(Y)},T=Y=>{const ne=vy(Y,"bwl:Placement");if(!ne)return;const W=typeof ne.anchor=="string"?ne.anchor:void 0;if(!W||!vM(ne.side))return;const Z=typeof ne.offset=="number"?ne.offset:void 0;m.push({owner:Y.id,anchor:W,side:ne.side,...Z!==void 0?{offset:Z}:{}})},O=Y=>{const ne=vy(Y,"bwl:Members"),W=typeof(ne==null?void 0:ne.refs)=="string"?ne.refs.split(/\s+/).filter(Boolean):[];W.length&&v.push({owner:Y.id,refs:W})},N=Y=>{var ne;for(const W of Y)switch(w(W.id),W.$type){case"bpmn:TextAnnotation":P(W.id),y.set(W.id,W),c.push({id:W.id,text:typeof W.text=="string"?W.text:""}),T(W);break;case"bpmn:Association":g.push({id:W.id,type:W.$type,source:$i(W.sourceRef),target:$i(W.targetRef)});break;case"bpmn:Group":{P(W.id),y.set(W.id,W);const Z=(ne=W.categoryValueRef)==null?void 0:ne.value;l.push({id:W.id,...typeof Z=="string"&&Z?{name:Z}:{}}),O(W);break}default:u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"})}},$=Y=>{for(const ne of Y.flowElements??[])w(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"}),(ne.flowElements??[]).length&&$(ne);for(const ne of Y.artifacts??[])w(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"})},H=(Y,ne)=>{const W=Y.flowElements??[],Z=(Y.laneSets??[]).flatMap(he=>he.lanes??[]),oe=new Map;for(const he of Z){w(he.id),y.set(he.id,he);for(const De of he.flowNodeRef??[]){const B=$i(De);B&&oe.set(B,he.id)}}for(const he of W){if(w(he.id),y.set(he.id,he),he.$type==="bpmn:SequenceFlow"){f.push({id:he.id,source:$i(he.sourceRef),target:$i(he.targetRef),...typeof he.name=="string"&&he.name?{name:he.name}:{}});continue}if(he.$type==="bpmn:DataStoreReference"){P(he.id),s.push({id:he.id,...he.name?{name:he.name}:{}});continue}const De=yM(he.$type),B=De==="intermediateCatchEvent"?mp((he.eventDefinitions??[]).map(K=>K.$type)):void 0;if(!Cg(De)||De==="intermediateCatchEvent"&&!B){u.push({id:he.id,type:he.$type,reason:"type-outside-mvp"});continue}P(he.id);const C=De==="boundaryEvent"?$i(he.attachedToRef):void 0;a.push({id:he.id,type:De,...he.name?{name:he.name}:{},...ne?{participant:ne}:{},...oe.has(he.id)?{lane:oe.get(he.id)}:{},...C?{attachedTo:C}:{},...B?{eventDefinition:B}:{}}),De==="subProcess"&&$(he);const R=yy(he,"bwl:band");R!==void 0&&(p.bands[he.id]=R);const G=my(he,"bwl:afterColumn");typeof G=="string"&&G!==""&&_.push([he.id,G]);for(const K of he.dataOutputAssociations??[])w(K.id),h.push({id:K.id,type:K.$type,source:he.id,target:$i(K.targetRef)});for(const K of he.dataInputAssociations??[])w(K.id),h.push({id:K.id,type:K.$type,source:$i((K.sourceRef??[])[0]),target:he.id})}N(Y.artifacts??[])};if(i){const Y=new Set;for(const ne of i.participants??[]){P(ne.id),y.set(ne.id,ne);const W=$i(ne.processRef);W&&Y.add(W);const Z=W?o.get(W):void 0,oe=((Z==null?void 0:Z.laneSets)??[]).flatMap(C=>C.lanes??[]),he=oe.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of he)P(C.id);const De=!Z||(Z.flowElements??[]).length===0&&oe.length===0&&(Z.artifacts??[]).length===0;r.push({id:ne.id,...ne.name?{name:ne.name}:{},...De?{blackBox:!0}:{},...he.length?{lanes:he}:{}});const B=yy(ne,"bwl:poolOrder");B!==void 0&&(p.poolOrders[ne.id]=B),Z&&H(Z,ne.id)}for(const ne of i.messageFlows??[])w(ne.id),y.set(ne.id,ne),d.push({id:ne.id,source:$i(ne.sourceRef),target:$i(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});N(i.artifacts??[]);for(const[ne,W]of o)!Y.has(ne)&&(W.flowElements??[]).length>0&&u.push({id:ne,type:W.$type,reason:"unreachable-process"})}else for(const Y of o.values())H(Y);const Q=[],J=[],V=[],we=[],Ce=(Y,ne)=>!!Y&&!!ne&&E.has(Y)&&E.has(ne);for(const Y of f){if(!Ce(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),E.add(Y.id)}for(const Y of d){if(!Ce(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}J.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),E.add(Y.id)}for(const Y of h){if(!Ce(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}we.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&E.add(Y.id)}for(const Y of g){if(!Ce(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}V.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const ke=new Map(l.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:ne}of v){const W=ne.filter(oe=>b.has(oe)),Z=ke.get(Y);Z&&W.length&&(Z.members=W)}for(const Y of m)b.has(Y.anchor)&&(p.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});for(const[Y,ne]of _)b.has(ne)&&(p.afterColumns[Y]=ne);const Ee={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Q,...J.length?{messageFlows:J}:{},...s.length?{dataStores:s}:{},...we.length?{dataAssociations:we}:{},...c.length?{annotations:c}:{},...V.length?{associations:V}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Ee,hints:p,omitted:u,i18n:bM(Ee,y,e,t.i18n)}:{definition:Ee,hints:p,omitted:u}}function bM(e,t,n,i){const o=Ep(n),r=ns(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Sp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Ap(u))r.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:r.slice(1),reviewRequests:a}}async function xM(e,t={}){const{definitions:n,warnings:i}=await aa(e);return{...by(n,t),warnings:i}}const _M=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function gf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function wM(e){return gf(e.processRef)!==void 0}function EM(e){const t=new Set,n=o=>{const r=gf(o);r&&t.add(r)},i=o=>{for(const r of o.flowElements??[]){n(r.sourceRef),n(r.targetRef),r.attachedToRef&&(n(r.attachedToRef),t.add(r.id));for(const a of r.dataOutputAssociations??[])t.add(r.id),n(a.targetRef);for(const a of r.dataInputAssociations??[]){t.add(r.id);for(const s of a.sourceRef??[])n(s)}(r.flowElements??[]).length&&i(r)}for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)};for(const o of e.rootElements??[])if(o.$type==="bpmn:Process")i(o);else if(o.$type==="bpmn:Collaboration"){for(const r of o.messageFlows??[])n(r.sourceRef),n(r.targetRef);for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)}return t}function SM(e){const t=[],n=i=>{for(const o of i.flowElements??[])_M.has(o.$type)&&t.push(o),(o.flowElements??[]).length&&n(o)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function RM(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 mf(e){const t=[],n=e.rootElements??[],i=EM(e);for(const r of SM(e))i.has(r.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[r.id],params:{type:r.$type}});const o=n.find(r=>r.$type==="bpmn:Collaboration");if(o){const r=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of o.participants??[])wM(s)&&RM(r.get(gf(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 CM(e){const{definitions:t,warnings:n}=await aa(e);return{issues:mf(t),warnings:n}}const MM=.5,AM=8,PM=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),ha=e=>typeof e=="number"?e:Number(e??NaN),tl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function TM(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${tl(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${tl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(tl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function kM(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},o=a=>{const s=a;return s?[ha(s.x),ha(s.y),ha(s.width),ha(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=tl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[ha(f.x),ha(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function xy(e){const t=kM(e),n=new Map,i=new Set,o=r=>{if(Array.isArray(r))return r.forEach(o);if(!r||typeof r!="object"||i.has(r))return;i.add(r);const a=r,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!PM.has(s)&&n.set(c,{type:s,props:TM(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&o(l)};return o(e),n}function _y(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),o=t===""?[]:t.split(",").map(Number);return i.length!==o.length?!0:i.some((r,a)=>Math.abs(r-o[a])>n)}function wy(e,t,n={}){const i=n.moveTolerance??MM,o=xy(e),r=xy(t),a=[],s=[],c=[];for(const[l,u]of r){const p=o.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||_y(p.geometry,u.geometry,i)||_y(p.label,u.label,n.labelTolerance??AM))&&c.push(l)}for(const l of o.keys())r.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function OM(e,t,n={}){const[i,o]=await Promise.all([aa(e),aa(t)]);return{...wy(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function DM(e){return new Set([...e.added,...e.modified])}function LM(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Ey(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=gy(e,t.ops,{i18n:i});if(!o.ok)return{status:"rejected",issues:o.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:o.findings,stats:o.stats}}const IM=new Set(["lasso","lasso.selection","hand","hand.move"]),Sy=1e4,BM="bwl-edit-locked",Ry=new WeakMap;function NM(e){const t=Ry.get(e);if(t)return t;const n=e.get("eventBus"),i=e.get("dragging",!1);let o=!1,r=!1;n.on("drag.init",Sy,()=>{var s;if(o)return IM.has((s=i==null?void 0:i.context())==null?void 0:s.prefix)?void 0:!1}),n.on(["contextPad.open.allowed","contextPad.trigger","palette.trigger","element.dblclick"],Sy,()=>o?!1:void 0);const a={get locked(){return o},set(s){var l,u,p;if(s===o)return;o=s,e.get("canvas").getContainer().classList.toggle(BM,s);const c=e.get("keyboard",!1);s?(i==null||i.cancel(),(l=e.get("contextPad",!1))==null||l.close(),(u=e.get("popupMenu",!1))==null||u.close(),(p=e.get("directEditing",!1))==null||p.complete(),r=!!(c!=null&&c.getBinding()),c==null||c.unbind()):r&&(c.bind(),r=!1)}};return Ry.set(e,a),a}const $M=Symbol("bpmn-editor"),yf={geometry:[],semantic:[]};function FM(){const e=me.ref(!1),t=me.ref(!0),n=me.ref(!1),i=me.shallowRef(yf),o=me.shallowRef(void 0),r=me.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=yf;return}const _=pt(Ve(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:_,semantic:v?mf(v):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const _=u();if(!_||!a){r.value=void 0;return}const v=_.locales(),y={};for(const b of v)y[b]={untranslated:_.untranslatedCount(b),reviewRequested:_.reviewRequestedCount(b)};r.value={designLocale:a.designLocale,locales:v,displayLocale:_.getDisplayLocale()??a.designLocale,counts:y}}function f(){const _=u();_&&(_.configure(a),a&&s&&(s=_.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(_,v){NM(_).set(!v)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function m(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:o,i18n:r,configureI18n(_){a=_,f(),p()},setDisplayLocale(_){var y;s=_;const v=(y=u())==null?void 0:y.setDisplayLocale(_);v&&(s=v),p()},setChangeScope(_){o.value=_===void 0?void 0:new Set(_)},requestFocus(_){if(!c)return;const v=c.get("elementRegistry").get(_);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(_){const v=c==null?void 0:c.get("elementRegistry").get(_),y=v==null?void 0:v.businessObject;if(!y)return;const b=typeof y.name=="string"&&y.name.trim()!==""?y.name:y.text;return{name:typeof b=="string"&&b.trim()!==""?b.trim():void 0,type:typeof y.$type=="string"?y.$type:""}},attach(_){c&&this.detach(),c=_,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=yf,o.value=void 0,r.value=void 0},setEditable(_){t.value=_,c&&g(c,_)},async applyAgentBatch(_,v){const y=h();n.value=!0;try{const b=await Ey(y,_,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return b.status==="applied"&&(e.value=!1),b}finally{n.value=!1}},async importXml(_){const{warnings:v}=await h().importXML(_);return e.value=!1,o.value=void 0,l(),{warnings:Gp(v)}},async saveXml(){const{xml:_}=await h().saveXML({format:!0});return e.value=!1,_??""},undo:()=>{var _;return(_=m())==null?void 0:_.undo()},redo:()=>{var _;return(_=m())==null?void 0:_.redo()},canUndo:()=>{var _;return((_=m())==null?void 0:_.canUndo())??!1},canRedo:()=>{var _;return((_=m())==null?void 0:_.canRedo())??!1}}}const jM=new RegExp("\\p{Script=Hangul}","u"),HM=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,zM=new RegExp("\\p{Script=Han}","u");function vf(e){const t=jM.test(e),n=HM.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:zM.test(e)?"han":"other"}}function Cy(e){var t,n;return((t=e==null?void 0:e.get)==null?void 0:t.call(e,"xml:lang"))??((n=e==null?void 0:e.$attrs)==null?void 0:n["xml:lang"])}function My(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=xr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:ia(a).filter(l=>Nn(l))})}return n}const ds=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function GM(e){const t=Cy(e),n=My(e);let i;const o={},r=[],a=[],s=[];for(const g of n){const h=g.trs.filter(m=>(m.body??"")===g.name).map(Nn);if(h.length){const m=[...h].sort().join("+");o[m]=(o[m]??0)+1,i=i?new Set([...i].filter(_=>h.includes(_))):new Set(h)}else g.trs.some(m=>m.body)?r.push(ds(g)):s.push({e:g,inference:vf(g.name)});for(const m of g.trs){const _=Nn(m),v=m.body??"",y=vf(v);y.locale&&y.locale!==_?a.push({...ds(g),locale:_,script:y.script}):_==="ko"&&y.script==="han"&&g.trs.some(b=>b!==m&&b.body===v)&&a.push({...ds(g),locale:_,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...ds(g),locale:h.locale}):d.push({...ds(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function VM(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Cy(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(My(e).map(r=>[r.bo.id,r]));for(const{id:r,name:a,locale:s}of t.additions){const c=o.get(r);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>Nn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(na,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ae(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function WM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bf={exports:{}},Ay;function UM(){if(Ay)return bf.exports;Ay=1;var e=bf.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,t/o))/Math.log(n)*o;for(var r=i-Math.floor(i),a="",o=0;o<Math.floor(i);o++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(r){var c=Math.pow(n,r),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var o=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(r,c));return r[c]=a,c},r=o.hats={};return o.get=function(a){return o.hats[a]},o.set=function(a,s){return o.hats[a]=s,o},o.bits=t||128,o.base=n||16,o},bf.exports}var qM=UM(),YM=WM(qM);function Ki(e){if(!(this instanceof Ki))return new Ki(e);e=e||[128,36,1],this._seed=e.length?YM.rack(e[0],e[1],e[2]):e}Ki.prototype.next=function(e){return this._seed(e||!0)},Ki.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Ki.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Ki.prototype.assigned=function(e){return this._seed.get(e)||!1},Ki.prototype.unclaim=function(e){delete this._seed.hats[e]},Ki.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const gn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};gn.td=gn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],gn.option=gn.optgroup=[1,'<select multiple="multiple">',"</select>"],gn.thead=gn.tbody=gn.colgroup=gn.caption=gn.tfoot=[1,"<table>","</table>"],gn.polyline=gn.ellipse=gn.polygon=gn.circle=gn.text=gn.line=gn.path=gn.rect=gn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function $t(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(gn,i)?gn[i]:gn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function KM(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function Vn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(o,r){n[r]=o})}),e}function En(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const XM=Object.prototype.toString;function Rt(e){return new jo(e)}function jo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}jo.prototype.add=function(e){return this.list.add(e),this},jo.prototype.remove=function(e){return XM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},jo.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},jo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},jo.prototype.array=function(){return Array.from(this.list)},jo.prototype.has=jo.prototype.contains=function(e){return this.list.contains(e)};function nl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Rr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function ZM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var il={},Py;function QM(){if(Py)return il;Py=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return il.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},il.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},il}var Ty=QM(),JM=ZM(Ty),$e=KM({__proto__:null,default:JM},[Ty]),ky=["focus","blur"];function eA(e,t,n,i,o){return ky.indexOf(n)!==-1&&(o=!0),$e.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Rr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function tA(e,t,n,i){return ky.indexOf(t)!==-1&&(i=!0),$e.unbind(e,t,n,i)}var ti={bind:eA,unbind:tA};function xf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Et(e,t){return t=t||document,t.querySelector(e)}function hs(e,t){return t=t||document,t.querySelectorAll(e)}function Xi(e){e.parentNode&&e.parentNode.removeChild(e)}function nA(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function iA(e,t){return t.appendChild(nA(e,t))}function qe(e,t){return iA(t,e),e}var _f=2,Oy={"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":_f,"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":_f,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function oA(e,t){return Oy[t]?e.style[t]:e.getAttributeNS(null,t)}function Dy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Oy[i];o?(o===_f&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function rA(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Dy(e,o,t[o])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)Dy(e,t,n);else return oA(e,t);else rA(e,t);return e}const aA=Object.prototype.toString;function lt(e){return new Ho(e)}function Ho(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ho.prototype.add=function(e){return this.list.add(e),this},Ho.prototype.remove=function(e){return aA.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ho.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},Ho.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ho.prototype.array=function(){return Array.from(this.list)},Ho.prototype.has=Ho.prototype.contains=function(e){return this.list.contains(e)};function gs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function wf(e){return e.cloneNode(!0)}var Ef={svg:"http://www.w3.org/2000/svg"},Ly='<svg xmlns="'+Ef.svg+'"';function sA(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Ef.svg)===-1&&(e=Ly+e.substring(4)):(e=Ly+">"+e+"</svg>",t=!0);var n=cA(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function cA(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Le(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=sA(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ef.svg,e),t&&Se(n,t),n}var Sf=null;function Iy(){return Sf===null&&(Sf=Le("svg")),Sf}function By(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function lA(e,t,n,i,o,r){var a=Iy().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return By(a,e);case 6:return By(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function ms(e){return Iy().createSVGTransform()}var Ny=/([&<>]{1})/g,uA=/([&<>\n\r"]{1})/g,pA={"&":"&","<":"<",">":">",'"':"'"};function Rf(e,t){function n(i,o){return pA[o]||o}return e.replace(t,n)}function $y(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Rf(e.textContent,Ny));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(o=e.attributes,n=0,i=o.length;n<i;++n)r=o.item(n),t.push(" ",r.name,'="',Rf(r.value,uA),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)$y(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Rf(e.nodeValue,Ny),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function fA(e){for(var t=e.firstChild,n=[];t;)$y(t,n),t=t.nextSibling;return n.join("")}function Fy(e,t){return fA(e)}function rn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function dA(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function hA(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(dA(e,i))}function ys(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),hA(n,t)),n.consolidate()}const gA=/^class[ {]/;function mA(e){return gA.test(e.toString())}function Cf(e){return Array.isArray(e)}function Mf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ol(...e){e.length===1&&Cf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const yA=/constructor\s*[^(]*\(\s*([^)]*)\)/m,vA=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,bA=/\/\*([^*]*)\*\//m;function xA(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(mA(e)?yA:vA);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(bA);return(o&&o[1]||i).trim()})||[]}function jy(e,t){const n=t||{get:function(y,b){if(i.push(y),b===!1)return null;throw s(`No provider for "${y}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(y){const b=i.join(" -> ");return i.length=0,new Error(b?`${y} (Resolving: ${b})`:y)};function c(y,b){if(!o[y]&&y.includes(".")){const E=y.split(".");let w=c(E.shift());for(;E.length;)w=w[E.shift()];return w}if(Mf(r,y))return r[y];if(Mf(o,y)){if(i.indexOf(y)!==-1)throw i.push(y),s("Cannot resolve circular dependency!");return i.push(y),r[y]=o[y][0](o[y][1]),i.pop(),r[y]}return n.get(y,b)}function l(y,b){if(typeof b>"u"&&(b={}),typeof y!="function")if(Cf(y))y=ol(y.slice());else throw s(`Cannot invoke "${y}". Expected a function!`);const w=(y.$inject||xA(y)).map(P=>Mf(b,P)?b[P]:c(P));return{fn:y,dependencies:w}}function u(y){const{fn:b,dependencies:E}=l(y),w=Function.prototype.bind.call(b,null,...E);return new w}function p(y,b,E){const{fn:w,dependencies:P}=l(y,E);return w.apply(b,P)}function f(y){return ol(b=>y.get(b))}function d(y,b){if(b&&b.length){const E=Object.create(null),w=Object.create(null),P=[],T=[],O=[];let N,$,H,Q;for(let J in o)N=o[J],b.indexOf(J)!==-1&&(N[2]==="private"?($=P.indexOf(N[3]),$===-1?(H=N[3].createChild([],b),Q=f(H),P.push(N[3]),T.push(H),O.push(Q),E[J]=[Q,J,"private",H]):E[J]=[O[$],J,"private",T[$]]):E[J]=[N[2],N[1]],w[J]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&b.forEach(V=>{N[1].$scope.indexOf(V)!==-1&&(E[J]=[N[2],N[1]],w[V]=!0)});b.forEach(J=>{if(!w[J])throw new Error('No provider for "'+J+'". Cannot use provider from the parent!')}),y.unshift(E)}return new jy(y,a)}const g={factory:p,type:u,value:function(y){return y}};function h(y,b){const E=y.__init__||[];return function(){E.forEach(w=>{typeof w=="string"?b.get(w):b.invoke(w)})}}function m(y){const b=y.__exports__;if(b){const E=y.__modules__,w=Object.keys(y).reduce(($,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&($[H]=y[H]),$),Object.create(null)),P=(E||[]).concat(w),T=d(P),O=ol(function($){return T.get($)});b.forEach(function($){o[$]=[O,$,"private",T]});const N=(y.__init__||[]).slice();return N.unshift(function(){T.init()}),y=Object.assign({},y,{__init__:N}),h(y,T)}return Object.keys(y).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const w=y[E];if(w[2]==="private"){o[E]=w;return}const P=w[0],T=w[1];o[E]=[g[P],_A(P,T),P]}),h(y,a)}function _(y,b){return y.indexOf(b)!==-1||(y=(b.__depends__||[]).reduce(_,y),y.indexOf(b)!==-1)?y:y.concat(b)}function v(y){const b=y.reduce(_,[]).map(m);let E=!1;return function(){E||(E=!0,b.forEach(w=>w()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=v(e)}function _A(e,t){return e!=="value"&&Cf(t)&&(t=ol(t.slice())),t}var wA=1e3;function go(e,t){var n=this;t=t||wA,e.on(["render.shape","render.connection"],t,function(i,o){var r=i.type,a=o.element,s=o.gfx,c=o.attrs;if(n.canRender(a))return r==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,o){if(n.canRender(o))return i.type==="render.getShapePath"?n.getShapePath(o):n.getConnectionPath(o)})}go.prototype.canRender=function(e){},go.prototype.drawShape=function(e,t){},go.prototype.drawConnection=function(e,t){},go.prototype.getShapePath=function(e){},go.prototype.getConnectionPath=function(e){};function Cr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function EA(e){return["M",e.x,e.y]}function Af(e){return["L",e.x,e.y]}function SA(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function RA(e,t){const n=e.length,i=[EA(e[0])];for(let o=1;o<n;o++){const r=e[o-1],a=e[o],s=e[o+1];if(!s||!t){i.push(Af(a));continue}const c=Math.min(t,Pf(a.x-r.x,a.y-r.y),Pf(s.x-a.x,s.y-a.y));if(!c){i.push(Af(a));continue}const l=rl(a,r,c),u=rl(a,r,c*.5),p=rl(a,s,c),f=rl(a,s,c*.5);i.push(Af(l)),i.push(SA(u,f,p))}return i}function rl(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Pf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Pf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function vs(e,t,n){Ge(t)&&(n=t,t=null),t||(t={});const i=Le("path",t);return Ge(n)&&(i.dataset.cornerRadius=String(n)),Tf(i,e)}function Tf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:Cr(RA(t,n))}),e}function al(e){var t=new Set(e);return rt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Mr(e,t,n){n=n||0,ze(e)||(e=[e]),z(e,function(i,o){var r=t(i,o,n);ze(r)&&r.length&&Mr(r,t,n+1)})}function kf(e,t,n){var i=new Set,o=new Set;return Mr(e,function(r,a,s){i.add(r);var c=r.children;if(c&&!o.has(c))return o.add(c),c}),Array.from(i)}function bs(e,t){return kf(e)}function CA(e,t,n){br(t)&&(t=!0),hn(t)&&(n=t,t=!0),n=n||{};var i=xs(n.allShapes),o=xs(n.allConnections),r=xs(n.enclosedElements),a=xs(n.enclosedConnections),s=xs(n.topLevel,t&&ea(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,z(u.incoming,c),z(u.outgoing,c),u.children}return Mr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function an(e,t){t=!!t,ze(e)||(e=[e]);var n,i,o,r;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=an(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function ga(e,t){var n={};return z(e,function(i){var o=i;o.waypoints&&(o=an(o)),!Ge(t.y)&&o.x>t.x&&(n[i.id]=i),!Ge(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Ge(t.width)&&Ge(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Ge(t.width)||!Ge(t.height))&&(n[i.id]=i)}),n}function Hy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function zy(e){return!!(e&&e.isFrame)}function xs(e,t){return U({},e||{},t||{})}var MA=1;function zo(e,t){go.call(this,e,MA),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})}Ae(zo,go),zo.prototype.canRender=function(){return!0},zo.prototype.drawShape=function(t,n,i){var o=Le("rect");return Se(o,{x:0,y:0,width:n.width||0,height:n.height||0}),zy(n)?Se(o,U({},this.FRAME_STYLE,i||{})):Se(o,U({},this.SHAPE_STYLE,i||{})),qe(t,o),o},zo.prototype.drawConnection=function(t,n,i){var o=vs(n.waypoints,U({},this.CONNECTION_STYLE,i||{}));return qe(t,o),o},zo.prototype.getShapePath=function(t){var n=t.x,i=t.y,o=t.width,r=t.height,a=[["M",n,i],["l",o,0],["l",0,r],["l",-o,0],["z"]];return Cr(a)},zo.prototype.getConnectionPath=function(t){var n=t.waypoints,i,o,r=[];for(i=0;o=n[i];i++)o=o.original||o,r.push([i===0?"M":"L",o.x,o.y]);return Cr(r)},zo.$inject=["eventBus","styles"];function AA(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,o){var r=this.style(i,o);return U(r,{class:n})},this.style=function(n,i){!ze(n)&&!i&&(i=n,n=[]);var o=ei(n,function(r,a){return U(r,e[a]||{})},{});return i?U(o,i):o},this.computeStyle=function(n,i,o){return ze(i)||(o=i,i=[]),t.style(i||[],U({},o,n||{}))}}const PA={__init__:["defaultRenderer"],defaultRenderer:["type",zo],styles:["type",AA]};function Zt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function tn(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Of(e,t){return!e||!t?-1:e.indexOf(t)}function _s(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Df(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=_s(e,t);return Math.abs(o/r)<=i}var TA=2;function mo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(kA(o,n))return r;return!1}function kA(e,t){const n=t[0];return Oo(t,function(i){return Math.abs(n[e]-i[e])<=TA})}function Gy(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 OA=/,?([a-z]),?/gi,Vy=parseFloat,sn=Math,Go=sn.PI,Zi=sn.min,Qi=sn.max,Wy=sn.pow,Vo=sn.abs,DA=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,LA=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Uy=Array.isArray||function(e){return e instanceof Array};function IA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function BA(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 NA(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),o=t.cache=t.cache||{},r=t.count=t.count||[];return IA(o,i)?(BA(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function $A(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(DA,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(LA,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([o,...a.splice(0,2)]),s="l",o=o=="m"?"l":"L");a.length>=t[s]&&(n.push([o,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Bf,n}function FA(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 jA(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 If(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 Bf(){return this.join(",").replace(OA,"$1")}function HA(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var o=e[n],r=t[n]=new Array(o.length),a=0,s=o.length;a<s;a++)r[a]=o[a];return t.toString=Bf,t}function qy(e,t,n,i,o,r,a,s,c){var l=1-c,u=Wy(l,3),p=Wy(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*o+d*a,h=u*t+p*3*c*i+l*3*c*c*r+d*s;return{x:sl(g),y:sl(h)}}function Yy(e){var t=qA(...e);return If(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Wo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function zA(e,t){return e=If(e),t=If(t),Wo(t,e.x,e.y)||Wo(t,e.x2,e.y)||Wo(t,e.x,e.y2)||Wo(t,e.x2,e.y2)||Wo(e,t.x,t.y)||Wo(e,t.x2,t.y)||Wo(e,t.x,t.y2)||Wo(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 Ky(e,t,n,i,o){var r=-3*t+9*n-9*i+3*o,a=e*r+6*t-12*n+6*i;return e*a-3*t+3*n}function Xy(e,t,n,i,o,r,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<u;g++){var h=l*p[g]+l,m=Ky(h,e,n,o,a),_=Ky(h,t,i,r,s),v=m*m+_*_;d+=f[g]*sn.sqrt(v)}return l*d}function GA(e,t,n,i,o,r,a,s){if(!(Qi(e,n)<Zi(o,a)||Zi(e,n)>Qi(o,a)||Qi(t,i)<Zi(r,s)||Zi(t,i)>Qi(r,s))){var c=(e*i-t*n)*(o-a)-(e-n)*(o*s-r*a),l=(e*i-t*n)*(r-s)-(t-i)*(o*s-r*a),u=(e-n)*(r-s)-(t-i)*(o-a);if(u){var p=sl(c/u),f=sl(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Zi(e,n).toFixed(2)||d>+Qi(e,n).toFixed(2)||d<+Zi(o,a).toFixed(2)||d>+Qi(o,a).toFixed(2)||g<+Zi(t,i).toFixed(2)||g>+Qi(t,i).toFixed(2)||g<+Zi(r,s).toFixed(2)||g>+Qi(r,s).toFixed(2)))return{x:p,y:f}}}}function sl(e){return Math.round(e*1e11)/1e11}function VA(e,t,n){var i=Yy(e),o=Yy(t);if(!zA(i,o))return[];var r=Xy(...e),a=Xy(...t),s=Qy(e)?1:~~(r/5)||1,c=Qy(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=qy(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=qy(...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 m=l[d],_=l[d+1],v=u[g],y=u[g+1],b=Vo(_.x-m.x)<.01?"y":"x",E=Vo(y.x-v.x)<.01?"y":"x",w=GA(m.x,m.y,_.x,_.y,v.x,v.y,y.x,y.y),P;if(w){if(P=w.x.toFixed(9)+"#"+w.y.toFixed(9),p[P])continue;p[P]=!0;var T=m.t+Vo((w[b]-m[b])/(_[b]-m[b]))*(_.t-m.t),O=v.t+Vo((w[E]-v[E])/(y[E]-v[E]))*(y.t-v.t);T>=0&&T<=1&&O>=0&&O<=1&&f.push({x:w.x,y:w.y,t1:T,t2:O})}}return f}function Zy(e,t,n){e=tv(e),t=tv(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,v=t.length;_<v;_++){var y=t[_];if(y[0]=="M")r=l=y[1],a=u=y[2];else{y[0]=="C"?(f=[r,a,...y.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var b=VA(p,f);{for(var E=0,w=b.length;E<w;E++)b[E].segment1=g,b[E].segment2=_,b[E].bez1=p,b[E].bez2=f;d=d.concat(b)}}}}}return d}function WA(e){return Uy(e)&&Uy(e[0])}function UA(e){if(FA(e))return e;var t=new Array(e.length),n=0,i=0,o=0,r=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],o=n,r=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":o=+l[1]+n,r=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Bf,t}function Qy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function cl(e,t,n,i){return[e,t,n,i,n,i]}function Jy(e,t,n,i,o,r){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*o+s*n,a*r+s*i,o,r]}function ev(e,t,n,i,o,r,a,s,c,l){var u=Go*120/180,p=Go/180*(+o||0),f=[],d,g=NA(function(B,C,R){var G=B*sn.cos(R)-C*sn.sin(R),K=B*sn.sin(R)+C*sn.cos(R);return{x:G,y:K}});if(l)P=l[0],T=l[1],E=l[2],w=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,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=sn.sqrt(_),n=_*n,i=_*i);var v=n*n,y=i*i,b=(r==a?-1:1)*sn.sqrt(Vo((v*y-v*m*m-y*h*h)/(v*m*m+y*h*h))),E=b*n*m/i+(e+s)/2,w=b*-i*h/n+(t+c)/2,P=sn.asin(((t-w)/i).toFixed(9)),T=sn.asin(((c-w)/i).toFixed(9));P=e<E?Go-P:P,T=s<E?Go-T:T,P<0&&(P=Go*2+P),T<0&&(T=Go*2+T),a&&P>T&&(P=P-Go*2),!a&&T>P&&(T=T-Go*2)}var O=T-P;if(Vo(O)>u){var N=T,$=s,H=c;T=P+u*(a&&T>P?1:-1),s=E+n*sn.cos(T),c=w+i*sn.sin(T),f=ev(s,c,n,i,o,0,a,$,H,[T,N,E,w])}O=T-P;var Q=sn.cos(P),J=sn.sin(P),V=sn.cos(T),we=sn.sin(T),Ce=sn.tan(O/4),ke=4/3*n*Ce,Ee=4/3*i*Ce,Y=[e,t],ne=[e+ke*J,t-Ee*Q],W=[s+ke*we,c-Ee*V],Z=[s,c];if(ne[0]=2*Y[0]-ne[0],ne[1]=2*Y[1]-ne[1],l)return[ne,W,Z].concat(f);f=[ne,W,Z].concat(f).join().split(",");for(var oe=[],he=0,De=f.length;he<De;he++)oe[he]=he%2?g(f[he-1],f[he],p).y:g(f[he],f[he+1],p).x;return oe}function qA(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,_,v=0;v<2;++v){if(v==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,f=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,f=3*i-3*t),Vo(u)<1e-12){if(Vo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,_=sn.sqrt(m),!(m<0)&&(g=(-p+_)/(2*u),0<g&&g<1&&c.push(g),h=(-p-_)/(2*u),0<h&&h<1&&c.push(h))}for(var y=c.length,b=y,E;y--;)d=c[y],E=1-d,l[0][y]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][y]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:Zi(...l[0]),y0:Zi(...l[1]),x1:Qi(...l[0]),y1:Qi(...l[1])}}function tv(e){if(WA(e)||(e=$A(e)),jA(e))return e;for(var t=HA(UA(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,m;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",...ev(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),f=["C",h,m,...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",...Jy(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",...Jy(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...cl(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...cl(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...cl(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...cl(d.x,d.y,d.X,d.Y)];break}return f},o=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)r[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),l=t.length}},r=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(r[c]=a,c&&(s=r[c-1])),t[c]=i(t[c],n,s),r[c]!="A"&&a=="C"&&(r[c]="C"),o(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Vy(u[p-4])||n.x,n.by=Vy(u[p-3])||n.y}return t}function kt(e){return hn(e)&&Jn(e,"waypoints")}function it(e){return hn(e)&&Jn(e,"labelTarget")}function YA(e){return hn(e)&&Qr(e.parent)}function nv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function yo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function je(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ll(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function KA(e){return yo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function XA(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=JA(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),o=i/2,r=0,a=n[r];a.endLength<o;)a=n[++r];var s=(o-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function We(e){return kt(e)?XA(e):KA(e)}function kn(e,t,n){n=n||0,hn(n)||(n={x:n,y:n});var i=je(e),o=je(t),r=i.bottom+n.y<=o.top,a=i.left-n.x>=o.right,s=i.top-n.y>=o.bottom,c=i.right+n.x<=o.left,l=r?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function ws(e,t,n){var i=ZA(e,t);return i.length===1||i.length===2&&_s(i[0],i[1])<1?yo(i[0]):i.length>1?(i=Vi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),yo(i[n?0:i.length-1])):null}function ZA(e,t){return Zy(e,t)}function QA(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],_s(n,o)===0||Df(i,o,n)?e.splice(t,1):t++;return e}function JA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ul(e,t){return Math.round(e*t)/t}function iv(e){return Ge(e)?e+"px":e}function eP(e){for(;e.parent;)e=e.parent;return e}function tP(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"),Vn(n,{position:"relative",overflow:"hidden",width:iv(e.width),height:iv(e.height)}),t.appendChild(n),n}function ov(e,t,n){const i=Le("g");lt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const nP="base",rv=0,iP=1,oP={shape:["x","y","width","height"],connection:["waypoints"]};function Ue(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||{})}Ue.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ue.prototype._init=function(e){const t=this._eventBus,n=this._container=tP(e),i=this._svg=Le("svg");Se(i,{width:"100%",height:"100%"}),En(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),qe(n,i);const o=this._viewport=ov(i,"viewport");e.deferUpdate&&(this._viewboxChanged=wp(this._viewboxChanged,300)),this._restoreFocus=wp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:o})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ue.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},Ue.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ue.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Hy(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ue.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ue.prototype.restoreFocus=function(){this._restoreFocus()},Ue.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ue.prototype.isFocused=function(){return this._focused},Ue.prototype.getDefaultLayer=function(){return this.getLayer(nP,rv)},Ue.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},Ue.prototype._getChildIndex=function(e){return ei(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ue.prototype._createLayer=function(e,t){typeof t>"u"&&(t=iP);const n=this._getChildIndex(t);return{group:ov(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ue.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,o=t.index;if(t.visible)return i;const r=this._getChildIndex(o);return n.insertBefore(i,n.childNodes[r]||null),t.visible=!0,i},Ue.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(rn(n),t.visible=!1),n},Ue.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],rn(t.group))},Ue.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ue.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(eP(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},Ue.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ue.prototype._findPlaneForRoot=function(e){return Lt(this._planes,function(t){return t.rootElement===e})},Ue.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ue.prototype._resolveElements=function(e){return ze(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ue.prototype.getContainer=function(){return this._container},Ue.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),lt(o).add(t)):(e.markers.delete(t),lt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ue.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ue.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ue.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ue.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ue.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ue.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,rv);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ue.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},Ue.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},Ue.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)},Ue.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})},Ue.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})},Ue.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=oP[e];if(!Oo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ue.prototype._setParent=function(e,t,n){tn(t.children,e,n),e.parent=t},Ue.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const o=this._eventBus,r=this._graphicsFactory;this._ensureValid(e,t),o.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=r.create(e,t,i);return this._elementRegistry.add(t,a),r.update(e,t,a),o.fire(e+".added",{element:t,gfx:a}),t},Ue.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ue.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ue.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e),!!e)return o.fire(t+".remove",{element:e}),i.remove(e),Zt(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},Ue.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ue.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ue.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ue.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ue.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ue.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,o,r,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ys(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=ys(t),o=a?a.matrix:lA(),s=ul(o.a,1e3),c=ul(-o.e||0,1e3),l=ul(-o.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Ue.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),av(t,n)}),{x:n.e,y:n.f}},Ue.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const o=this.findRoot(i);if(!o)return;o!==this.getRootElement()&&this.setRootElement(o);const r=i.filter(g=>g!=o);if(!r.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=an(r),s=je(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=je(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),m=Math.max(0,s.bottom-f.bottom),_=Math.min(0,s.top-f.top);u=g||h,p=m||_}this.scroll({dx:-u*l,dy:-p*l})},Ue.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)}),ul(i.a,1e3)};function av(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ue.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let o,r;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?r={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(o=Math.min(1,n.width/i.width,n.height/i.height),r={x:i.x+(e?i.width/2-n.width/o/2:0),y:i.y+(e?i.height/2-n.height/o/2:0),width:n.width/o,height:n.height/o}),this.viewbox(r),this.viewbox(!1).scale},Ue.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=U(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),av(this._viewport,u),u},Ue.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ue.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale,r=n.width*t.scale,a=n.height*t.scale;return{x:i,y:o,width:r,height:a}},Ue.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ma="data-element-id";function gi(e){this._elements={},this._eventBus=e}gi.$inject=["eventBus"],gi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,ma,i),n&&Se(n,ma,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},gi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,ma,""),i.secondaryGfx&&Se(i.secondaryGfx,ma,""),delete t[n])},gi.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},gi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Se(t,ma,i),t},gi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,ma);var n=this._elements[t];return n&&n.element},gi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},gi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},gi.prototype.getAll=function(){return this.filter(function(e){return e})},gi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},gi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},gi.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function rP(e,t,n,i){var o=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var a=this.indexOf(r);return a!==-1&&(this.splice(a,1),t.unset(r,o,i)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,a){var s=this.indexOf(r);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,r),s===-1&&t.set(r,o,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function aP(e){return e.__refs_collection===!0}function sP(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function sv(e,t,n){var i=rP(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(o){e.set(o,t.inverse,n)})}function cP(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(r){if(r!==o){var a=o;o=null,a&&e.unset(a,i,n),o=r,e.set(o,i,n)}}})}function xi(e,t){if(!(this instanceof xi))return new xi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}xi.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?sv(this,t,e):cP(this,t,e)},xi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return aP(n)||sv(this,t,e),n},xi.prototype.ensureBound=function(e,t){sP(e,t)||this.bind(e,t)},xi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},xi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Nf=new xi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),cv=new xi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),lv=new xi({name:"attachers",collection:!0},{name:"host"}),uv=new xi({name:"outgoing",collection:!0},{name:"source"}),pv=new xi({name:"incoming",collection:!0},{name:"target"});function ya(){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)}}),Nf.bind(this,"parent"),cv.bind(this,"labels"),uv.bind(this,"outgoing"),pv.bind(this,"incoming")}function Es(){ya.call(this),Nf.bind(this,"children"),lv.bind(this,"host"),lv.bind(this,"attachers")}Ae(Es,ya);function fv(){ya.call(this),Nf.bind(this,"children")}Ae(fv,Es);function dv(){Es.call(this),cv.bind(this,"labelTarget")}Ae(dv,Es);function hv(){ya.call(this),uv.bind(this,"source"),pv.bind(this,"target")}Ae(hv,ya);var lP={connection:hv,shape:Es,label:dv,root:fv};function uP(e,t){var n=lP[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}function pP(e){return e instanceof ya}function vo(){this._uid=12}vo.prototype.createRoot=function(e){return this.create("root",e)},vo.prototype.createLabel=function(e){return this.create("label",e)},vo.prototype.createShape=function(e){return this.create("shape",e)},vo.prototype.createConnection=function(e){return this.create("connection",e)},vo.prototype.create=function(e,t){return t=U({},t||{}),t.id||(t.id=e+"_"+this._uid++),uP(e,t)};var pl="__fn",gv=1e3,fP=Array.prototype.slice;function ni(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ni.prototype.on=function(e,t,n,i){if(e=ze(e)?e:[e],bn(t)&&(i=n,n=t,t=gv),!Ge(t))throw new Error("priority must be a number");var o=n;i&&(o=Kn(n,i),o[pl]=n[pl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ni.prototype.once=function(e,t,n,i){var o=this;if(bn(t)&&(i=n,n=t,t=gv),!Ge(t))throw new Error("priority must be a number");function r(){r.__isTomb=!0;var a=n.apply(i,arguments);return o.off(e,r),a}r[pl]=n,this.on(e,t,r)},ni.prototype.off=function(e,t){e=ze(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ni.prototype.createEvent=function(e){var t=new Ss;return t.init(e),t},ni.prototype.fire=function(e,t){var n,i,o,r;if(r=fP.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 Ss?n=t:n=this.createEvent(t),r[0]=n;var a=n.type;e!==a&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==a&&(n.type=a)}return o===void 0&&n.defaultPrevented&&(o=!1),o}},ni.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ni.prototype._destroy=function(){this._listeners={}},ni.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ni.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=dP(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(o){if(!this.handleError(o))throw console.error("unhandled error in event listener",o),o}return i},ni.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},ni.prototype._getListeners=function(e){return this._listeners[e]},ni.prototype._setListeners=function(e,t){this._listeners[e]=t},ni.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,o,r;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,r=n.callback,(r===t||r[pl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Ss(){}Ss.prototype.stopPropagation=function(){this.cancelBubble=!0},Ss.prototype.preventDefault=function(){this.defaultPrevented=!0},Ss.prototype.init=function(e){U(this,e||{})};function dP(e,t){return e.apply(null,t)}function Uo(e){return e.childNodes[0]}function hP(e){return e.parentNode.childNodes[1]}function fl(e,t,n,i,o){var r=ms();r.setTranslate(t,n);var a=ms();a.setRotate(i||0,0,0);var s=ms();s.setScale(1,1),ys(e,[r,a,s])}function On(e,t,n){var i=ms();i.setTranslate(t,n),ys(e,i)}function mv(e,t){var n=ms();n.setRotate(t,0,0),ys(e,n)}function mi(e,t){this._eventBus=e,this._elementRegistry=t}mi.$inject=["eventBus","elementRegistry"],mi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=hP(t),n||(n=Le("g"),lt(n).add("djs-children"),qe(t.parentNode,n))):n=t,n},mi.prototype._clear=function(e){var t=Uo(e);return nl(t),t},mi.prototype._createContainer=function(e,t,n,i){var o=Le("g");lt(o).add("djs-group"),typeof n<"u"?gP(o,t,t.childNodes[n]):qe(t,o);var r=Le("g");lt(r).add("djs-element"),lt(r).add("djs-"+e),i&<(r).add("djs-frame"),qe(o,r);var a=Le("g");return lt(a).add("djs-visual"),qe(r,a),r},mi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,zy(t))},mi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ei(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),z(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;z(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},mi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},mi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},mi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},mi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},mi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),On(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},mi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);rn(t.parentNode)};function gP(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const mP={__depends__:[PA],__init__:["canvas"],canvas:["type",Ue],elementRegistry:["type",gi],elementFactory:["type",vo],eventBus:["type",ni],graphicsFactory:["type",mi]};function yP(e){var t=new jy(e);return t.init(),t}function vP(e){e=e||{};var t={config:["value",e]},n=[t,mP].concat(e.modules||[]);return yP(n)}function qo(e,t){this._injector=t||vP(e),this.get("eventBus").fire("diagram.init")}qo.prototype.get=function(e,t){return this._injector.get(e,t)},qo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},qo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},qo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Fn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Xn(e,t){return e.$instanceOf(t)}function bP(e){return Lt(e.rootElements,function(t){return Xn(t,"bpmn:Process")||Xn(t,"bpmn:Collaboration")})}function xP(e){var t={},n=[],i={};function o(W,Z){return function(oe){W(oe,Z)}}function r(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Z){var oe=W.gfx;if(oe)throw new Error(`already rendered ${Fn(W)}`);return e.element(W,i[W.id],Z)}function c(W,Z){return e.root(W,i[W.id],Z)}function l(W,Z){try{var oe=i[W.id]&&s(W,Z);return r(W),oe}catch(he){u(he.message,{element:W,error:he}),console.error(`failed to import ${Fn(W)}`,he)}}function u(W,Z){e.error(W,Z)}var p=this.registerDi=function(Z){var oe=Z.bpmnElement;oe?i[oe.id]?u(`multiple DI elements defined for ${Fn(oe)}`,{element:oe}):i[oe.id]=Z:u(`no bpmnElement referenced in ${Fn(Z)}`,{element:Z})};function f(W){d(W.plane)}function d(W){p(W),z(W.planeElement,g)}function g(W){p(W)}this.handleDefinitions=function(Z,oe){var he=Z.diagrams;if(oe&&he.indexOf(oe)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!oe&&he&&he.length&&(oe=he[0]),!oe)throw new Error("no diagram to display");i={},f(oe);var De=oe.plane;if(!De)throw new Error(`no plane for ${Fn(oe)}`);var B=De.bpmnElement;if(!B)if(B=bP(Z),B)u(`correcting missing bpmnElement on ${Fn(De)} to ${Fn(B)}`),De.bpmnElement=B,p(De);else throw new Error("no process or collaboration to display");var C=c(B,De);if(Xn(B,"bpmn:Process")||Xn(B,"bpmn:SubProcess"))m(B,C);else if(Xn(B,"bpmn:Collaboration"))Y(B,C),_(Z.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Fn(De)}: ${Fn(B)}`);h(n)};var h=this.handleDeferred=function(){for(var Z;n.length;)Z=n.shift(),Z()};function m(W,Z){Ce(W,Z),O(W.ioSpecification,Z),T(W.artifacts,Z),r(W)}function _(W,Z){var oe=rt(W,function(he){return!a(he)&&Xn(he,"bpmn:Process")&&he.laneSets});oe.forEach(o(m,Z))}function v(W,Z){l(W,Z)}function y(W,Z){z(W,o(v,Z))}function b(W,Z){l(W,Z)}function E(W,Z){l(W,Z)}function w(W,Z){l(W,Z)}function P(W,Z){l(W,Z)}function T(W,Z){z(W,function(oe){Xn(oe,"bpmn:Association")?n.push(function(){P(oe,Z)}):P(oe,Z)})}function O(W,Z){W&&(z(W.dataInputs,o(E,Z)),z(W.dataOutputs,o(w,Z)))}var N=this.handleSubProcess=function(Z,oe){Ce(Z,oe),T(Z.artifacts,oe)};function $(W,Z){var oe=l(W,Z);Xn(W,"bpmn:SubProcess")&&N(W,oe||Z),Xn(W,"bpmn:Activity")&&O(W.ioSpecification,Z),n.push(function(){z(W.dataInputAssociations,o(b,Z)),z(W.dataOutputAssociations,o(b,Z))})}function H(W,Z){l(W,Z)}function Q(W,Z){l(W,Z)}function J(W,Z){n.push(function(){var oe=l(W,Z);W.childLaneSet&&V(W.childLaneSet,oe||Z),ne(W)})}function V(W,Z){z(W.lanes,o(J,Z))}function we(W,Z){z(W,o(V,Z))}function Ce(W,Z){ke(W.flowElements,Z),W.laneSets&&we(W.laneSets,Z)}function ke(W,Z){z(W,function(oe){Xn(oe,"bpmn:SequenceFlow")?n.push(function(){H(oe,Z)}):Xn(oe,"bpmn:BoundaryEvent")?n.unshift(function(){$(oe,Z)}):Xn(oe,"bpmn:FlowNode")?$(oe,Z):Xn(oe,"bpmn:DataObject")||(Xn(oe,"bpmn:DataStoreReference")||Xn(oe,"bpmn:DataObjectReference")?Q(oe,Z):u(`unrecognized flowElement ${Fn(oe)} in context ${Fn(Z&&Z.businessObject)}`,{element:oe,context:Z}))})}function Ee(W,Z){var oe=l(W,Z),he=W.processRef;he&&m(he,oe||Z)}function Y(W,Z){z(W.participants,o(Ee,Z)),n.push(function(){y(W.messageFlows,Z)}),T(W.artifacts,Z)}function ne(W){z(W.flowNodeRef,function(Z){var oe=Z.get("lanes");oe&&oe.push(W)})}}function _P(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},f=new xP(p);u=u||l.diagrams&&l.diagrams[0];var d=wP(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(g+"_plane")||r.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),o=e.get("eventBus"),r=e.get("canvas"),o.fire("import.render.start",{definitions:t}),c(t,n),o.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function wP(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=EP(n));var o;M(i,"bpmn:Collaboration")?o=i:o=Lt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Lt(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Bn(o.participants,function(l){return l.processRef}),r.push(o));var a=yv(r),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function yv(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(yv(n.flowElements)))}),t}function EP(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var SP='<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>',vv=SP,bv={verticalAlign:"middle"},xv={color:"#404040"},RP={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},CP={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},MP={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"},AP='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+vv+'</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>',Ji;function PP(){Ji=$t(AP),Vn(Ji,RP),Vn(Et("svg",Ji),bv),Vn(Et(".backdrop",Ji),CP),Vn(Et(".notice",Ji),MP),Vn(Et(".link",Ji),xv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function TP(){Ji||(PP(),ti.bind(Ji,".backdrop","click",function(e){document.body.removeChild(Ji)})),document.body.appendChild(Ji)}const dl=5,_v="djs-outline-hidden";function Gt(e){e=U({},OP,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),LP(this._container)}Ae(Gt,qo),Gt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),hl(s,r),s=kP(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw hl(r,[]),r}if(typeof t=="string"&&(i=DP(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw hl(r,[]),r}try{this.clear()}catch(r){throw hl(r,[]),r}const{warnings:o}=await _P(this,n,i);return{warnings:o}},Gt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Et(":scope > defs",i._svg),a=Fy(o),s=r?"<defs>"+Fy(r)+"</defs>":"",c=i.getContainer();Rt(c).add(_v);let l;try{l=o.getBBox()}finally{Rt(c).remove(_v)}const u=l.x-dl,p=l.y-dl,f=l.width+dl*2,d=l.height+dl*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
8
8
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
9
9
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
10
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Gt.prototype._setDefinitions=function(e){this._definitions=e},Gt.prototype.getModules=function(){return this._modules},Gt.prototype.clear=function(){this.getDefinitions()&&qo.prototype.clear.call(this)},Gt.prototype.destroy=function(){qo.prototype.destroy.call(this),Xi(this._container)},Gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gt.prototype.getDefinitions=function(){return this._definitions},Gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=U(Wi(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:a});qo.call(this,s),n&&n.container&&this.attachTo(n.container)},Gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gt.prototype._createContainer=function(e){const t=$t('<div class="bjs-container"></div>');return Vn(t,{width:wv(e.width),height:wv(e.height),position:e.position}),t},Gt.prototype._createModdle=function(e){const t=U({},this._moddleExtensions,e.moddleExtensions);return new tm(t)},Gt.prototype._modules=[];function dl(e,t){return e.warnings=t,e}function kP(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 OP={width:"100%",height:"100%",position:"relative"};function wv(e){return e+(Ge(e)?"px":"")}function DP(e,t){return t&&Lt(e.diagrams,function(n){return n.id===t})||null}function LP(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+vv+"</a>",i=$t(n);Vn(Et("svg",i),bv),Vn(i,xv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),$e.bind(i,"click",function(o){TP(),o.preventDefault()})}function va(e){Gt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ae(va,Gt),va.prototype._createModdle=function(e){var t=Gt.prototype._createModdle.call(this,e);return t.ids=new Ki([32,36,1]),t},va.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,o;i.clear();for(o in t)i.claim(o,t[o])};function ut(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||dt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!ge(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=dt(e).isHorizontal;return t===void 0?!0:t}}function IP(e){return e&&ge(e).isInterrupting!==!1}function jn(e){return e&&!!ge(e).triggeredByEvent}function ba(e,t){var n=ge(e).eventDefinitions;return Do(n,function(i){return M(i,t)})}function BP(e){return ba(e,"bpmn:ErrorEventDefinition")}function NP(e){return ba(e,"bpmn:EscalationEventDefinition")}function $P(e){return ba(e,"bpmn:CompensateEventDefinition")}var Ar={width:90,height:20},Ev=15;function Yo(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 hl(e){return it(e.label)}function FP(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=jP(e),r=Math.atan((i.y-n.y)/(i.x-n.x)),a=o.x,s=o.y;return Math.abs(r)<Math.PI/2?s-=Ev:a+=Ev,{x:a,y:s}}function jP(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 $f(e){return e.waypoints?FP(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ar.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ar.height/2}}function HP(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Ar.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=$f(t),i=Ar),U({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Sv(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 zP(e){var t=e.categoryValueRef;return t&&t.value||""}function yi(e){var t=e.businessObject,n=Sv(t);if(n)return n==="categoryValueRef"?zP(t):t[n]||""}function GP(e,t){var n=e.businessObject,i=Sv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function VP(e){return it(e)&&Yo(e.labelTarget)}var xa=7;function Rv(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 Ss(e){const t=new Map;return z(kf(e),n=>{z(Rv(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 Ff="hsl(225, 10%, 15%)",WP="white";function eo(e,t){return Do(e.eventDefinitions,function(n){return n.$type===t})}function UP(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function qP(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function at(e,t,n){var i=dt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||WP}function Re(e,t,n){var i=dt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Ff}function Rs(e,t,n,i){var o=dt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Re(e,n)}function Cv(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,o=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Cr(o)}function jf(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=[["M",n+t,i],["l",o-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-o,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return Cr(a)}function YP(e){var t=e.width,n=e.height,i=e.x,o=e.y,r=t/2,a=n/2,s=[["M",i+r,o],["l",r,a],["l",-r,a],["l",-r,-a],["z"]];return Cr(s)}function KP(e){var t=e.x,n=e.y,i=e.width,o=e.height,r=[["M",t,n],["l",i,0],["l",0,o],["l",-i,0],["z"]];return Cr(r)}function Cs(e,t={}){return{width:_i(e,t),height:ii(e,t)}}function _i(e,t={}){return Jn(t,"width")?t.width:e.width}function ii(e,t={}){return Jn(t,"height")?t.height:e.height}var XP=new Ki,ZP=10,gl=3,QP=1.5,ml=10,JP=4,_a=.95,eT=1,tT=.25;function Pr(e,t,n,i,o,r,a){go.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(B){return n.computeStyle(B,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ff,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ff,strokeWidth:2})}function f(B,C){var{ref:R={x:0,y:0},scale:G=1,element:K,parentGfx:ie=o._svg}=C,Pe=Le("marker",{id:B,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});qe(Pe,K);var et=Et(":scope > defs",ie);et||(et=Le("defs"),qe(ie,et)),qe(et,Pe)}function d(B,C,R,G){var K=XP.nextPrefixed("marker-");return g(B,K,C,R,G),"url(#"+K+")"}function g(B,C,R,G,K){if(R==="sequenceflow-end"){var ie=Le("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:K,stroke:K,strokeWidth:1})});f(C,{element:ie,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(R==="messageflow-start"){var Pe=Le("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:K,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Pe,ref:{x:6,y:6},parentGfx:B})}if(R==="messageflow-end"){var et=Le("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:K,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:et,ref:{x:8.5,y:5},parentGfx:B})}if(R==="association-start"){var mt=Le("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:K,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(R==="association-end"){var qt=Le("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:K,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:qt,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(R==="conditional-flow-marker"){var Ct=Le("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:K})});f(C,{element:Ct,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(R==="conditional-default-flow-marker"){var vn=Le("path",{d:"M 6 4 L 10 16",...u({stroke:K,fill:"none"})});f(C,{element:vn,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function h(B,C,R,G,K={}){hn(G)&&(K=G,G=0),G=G||0,K=u(K);var ie=C/2,Pe=R/2,et=Le("circle",{cx:ie,cy:Pe,r:Math.round((C+R)/4-G),...K});return qe(B,et),et}function m(B,C,R,G,K,ie){hn(K)&&(ie=K,K=0),K=K||0,ie=u(ie);var Pe=Le("rect",{x:K,y:K,width:C-K*2,height:R-K*2,rx:G,ry:G,...ie});return qe(B,Pe),Pe}function _(B,C,R,G){var K=C/2,ie=R/2,Pe=[{x:K,y:0},{x:C,y:ie},{x:K,y:R},{x:0,y:ie}],et=Pe.map(function(qt){return qt.x+","+qt.y}).join(" ");G=u(G);var mt=Le("polygon",{...G,points:et});return qe(B,mt),mt}function v(B,C,R,G){R=p(R);var K=ys(C,R,G);return qe(B,K),K}function y(B,C,R){return v(B,C,R,5)}function b(B,C,R){R=p(R);var G=Le("path",{...R,d:C});return qe(B,G),G}function E(B,C,R,G){return b(C,R,U({"data-marker":B},G))}function w(B){return De[B]}function P(B){return function(C,R,G){return w(B)(C,R,G)}}var T={"bpmn:MessageEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill),Pe=G?at(C,s,R.fill):Re(C,c,R.stroke),et=b(B,K,{fill:ie,stroke:Pe,strokeWidth:1});return et},"bpmn:TimerEventDefinition":function(B,C,R={}){var G=R.width||C.width,K=R.height||C.height,ie=R.width?1:2,Pe=h(B,G,K,.2*K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:ie}),et=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:K,position:{mx:.5,my:.5}});b(B,et,{stroke:Re(C,c,R.stroke),strokeWidth:ie});for(var mt=0;mt<12;mt++){var qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:K,position:{mx:.5,my:.5}}),Ct=G/2,vn=K/2;b(B,qt,{strokeWidth:1,stroke:Re(C,c,R.stroke),transform:"rotate("+mt*30+","+vn+","+Ct+")"})}return Pe},"bpmn:EscalationEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,C,R={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return b(B,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ie=G?Re(C,c,R.stroke):"none",Pe=b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1});return mv(Pe,45),Pe},"bpmn:CompensateEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{strokeWidth:1,fill:ie,stroke:Re(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,C,R={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return b(B,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,C,R={}){var G=h(B,C.width,C.height,8,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:4});return G}};function D(B,C,R={},G){var K=ge(B),ie=UP(K),Pe=G||B;return K.get("eventDefinitions")&&K.get("eventDefinitions").length>1?K.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](C,Pe,R,ie):T["bpmn:MultipleEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](C,Pe,R,ie):null}var N={ParticipantMultiplicityMarker:function(B,C,R={}){var G=_i(C,R),K=ii(C,R),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2-6)/G,my:(K-15)/K}});E("participant-multiplicity",B,ie,{strokeWidth:2,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},SubProcessMarker:function(B,C,R={}){var G=m(B,14,14,0,{strokeWidth:1,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)});On(G,C.width/2-7.5,C.height-20);var K=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2-7.5)/C.width,my:(C.height-20)/C.height}});E("sub-process",B,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},ParallelMarker:function(B,C,R){var G=_i(C,R),K=ii(C,R),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.parallel)/G,my:(K-20)/K}});E("parallel",B,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},SequentialMarker:function(B,C,R){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",B,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},CompensationMarker:function(B,C,R){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",B,G,{strokeWidth:1,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},LoopMarker:function(B,C,R){var G=_i(C,R),K=ii(C,R),ie=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.loop)/G,my:(K-7)/K}});E("loop",B,ie,{strokeWidth:1.5,fill:"none",stroke:Re(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,C,R){var G=_i(C,R),K=ii(C,R),ie=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.adhoc)/G,my:(K-15)/K}});E("adhoc",B,ie,{strokeWidth:1,fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke)})}};function $(B,C,R,G){N[B](C,R,G)}function H(B,C,R=[],G={}){G={fill:G.fill,stroke:G.stroke,width:_i(C,G),height:ii(C,G)};var K=ge(C),ie=R.includes("SubProcessMarker");ie?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},K.get("isForCompensation")&&R.push("CompensationMarker"),M(K,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),ie||U(G,{compensation:G.compensation-18}));var Pe=K.get("loopCharacteristics"),et=Pe&&Pe.get("isSequential");Pe&&(U(G,{compensation:G.compensation-18}),R.includes("AdhocMarker")&&U(G,{seq:-23,loop:-18,parallel:-24}),et===void 0&&R.push("LoopMarker"),et===!1&&R.push("ParallelMarker"),et===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&U(G,{compensation:-8}),z(R,function(mt){$(mt,B,C,G)})}function Z(B,C,R={}){R=U({size:{width:100}},R);var G=r.createText(C||"",R);return lt(G).add("djs-label"),qe(B,G),G}function J(B,C,R,G={}){var K=ge(C),ie=Cs({x:C.x,y:C.y,width:C.width,height:C.height},G);return Z(B,K.name,{align:R,box:ie,padding:7,style:{fill:Rs(C,l,c,G.stroke)}})}function V(B,C,R={}){var G={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Z(B,yi(C),{box:G,style:U({},r.getExternalStyle(),{fill:Rs(C,l,c,R.stroke)})})}function we(B,C,R,G={}){var K=xn(R),ie=Z(B,C,{box:{height:30,width:K?ii(R,G):_i(R,G)},align:"center-middle",style:{fill:Rs(R,l,c,G.stroke)}});if(K){var Pe=-1*ii(R,G);pl(ie,0,-Pe,270)}}function Ce(B,C,R={}){var{width:G,height:K}=Cs(C,R);return m(B,G,K,ml,{...R,fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke)})}function ke(B,C,R={}){var G=ge(C),K=at(C,s,R.fill),ie=Re(C,c,R.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(R.markerEnd=d(B,"association-end",K,ie)),G.get("associationDirection")==="Both"&&(R.markerStart=d(B,"association-start",K,ie)),R=ht(R,["markerStart","markerEnd"]),y(B,C.waypoints,{...R,stroke:ie,strokeDasharray:"0, 5"})}function Ee(B,C,R={}){var G=at(C,s,R.fill),K=Re(C,c,R.stroke),ie=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Pe=b(B,ie,{fill:G,fillOpacity:_a,stroke:K}),et=ge(C);if(qP(et)){var mt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});b(B,mt,{strokeWidth:2,fill:G,stroke:K})}return Pe}function q(B,C,R={}){return h(B,C.width,C.height,{fillOpacity:_a,...R,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})}function ne(B,C,R={}){return _(B,C.width,C.height,{fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke)})}function W(B,C,R={}){var G=m(B,_i(C,R),ii(C,R),0,{fill:at(C,s,R.fill),fillOpacity:R.fillOpacity||_a,stroke:Re(C,c,R.stroke),strokeWidth:1.5}),K=ge(C);if(M(K,"bpmn:Lane")){var ie=K.get("name");we(B,ie,C,R)}return G}function X(B,C,R={}){var G=Ce(B,C,R),K=ut(C);if(jn(C)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!K)){var ie=ge(C).flowElements||[],Pe=ie.filter(et=>M(et,"bpmn:StartEvent"));Pe.length===1&&oe(Pe[0],B,R,C)}return J(B,C,K?"center-top":"center-middle",R),K?H(B,C,void 0,R):H(B,C,["SubProcessMarker"],R),G}function oe(B,C,R,G){var K=22,ie={fill:at(G,s,R.fill),stroke:Re(G,c,R.stroke),width:K,height:K},Pe=ge(B).isInterrupting,et=Pe?0:3,mt=Pe?1:1.2,qt=20,Ct=(K-qt)/2,vn="translate("+Ct+","+Ct+")";h(C,qt,qt,{fill:ie.fill,stroke:ie.stroke,strokeWidth:mt,strokeDasharray:et,transform:vn}),D(B,C,ie,G)}function he(B,C,R={}){var G=Ce(B,C,R);return J(B,C,"center-middle",R),H(B,C,void 0,R),G}var De=this.handlers={"bpmn:AdHocSubProcess":function(B,C,R={}){return ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]),X(B,C,R)},"bpmn:Association":function(B,C,R={}){return R=ht(R,["fill","stroke"]),ke(B,C,R)},"bpmn:BoundaryEvent":function(B,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=ge(C),ie=K.get("cancelActivity");R={strokeWidth:1.5,fill:at(C,s,R.fill),fillOpacity:eT,stroke:Re(C,c,R.stroke)},ie||(R.strokeDasharray="6");var Pe=q(B,C,R);return h(B,C.width,C.height,gl,{...R,fill:"none"}),G&&D(C,B,R),Pe},"bpmn:BusinessRuleTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ie=b(B,K);Se(ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1});var Pe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),et=b(B,Pe);return Se(et,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,C,R={}){return R=ht(R,["fill","stroke"]),X(B,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(B,C,R),K=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(B,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),K=Ee(B,C,R);return b(B,G,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1}),K},"bpmn:DataInputAssociation":function(B,C,R={}){return R=ht(R,["fill","stroke"]),ke(B,C,{...R,markerEnd:d(B,"association-end",at(C,s,R.fill),Re(C,c,R.stroke))})},"bpmn:DataObject":function(B,C,R={}){return R=ht(R,["fill","stroke"]),Ee(B,C,R)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),K=Ee(B,C,R);return b(B,G,{strokeWidth:1,fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke)}),K},"bpmn:DataOutputAssociation":function(B,C,R={}){return R=ht(R,["fill","stroke"]),ke(B,C,{...R,markerEnd:d(B,"association-end",at(C,s,R.fill),Re(C,c,R.stroke))})},"bpmn:DataStoreReference":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(B,G,{fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=q(B,C,{...R,strokeWidth:4});return G&&D(C,B,R),K},"bpmn:EventBasedGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=ne(B,C,R);h(B,C.width,C.height,C.height*.2,{fill:at(C,"none",R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1});var ie=G.get("eventGatewayType"),Pe=!!G.get("instantiate");function et(){var qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(B,qt,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:2})}if(ie==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(B,mt,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1})}else ie==="Exclusive"&&(Pe||h(B,C.width,C.height,C.height*.26,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1}),et());return K},"bpmn:ExclusiveGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(B,C,R),K=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ie=dt(C);return ie.get("isMarkerVisible")&&b(B,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,C,R={}){return R=ht(R,["fill","stroke"]),ne(B,C,R)},"bpmn:Group":function(B,C,R={}){return R=ht(R,["fill","stroke","width","height"]),m(B,C.width,C.height,ml,{stroke:Re(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(C,R),height:ii(C,R)})},"bpmn:InclusiveGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(B,C,R);return h(B,C.width,C.height,C.height*.24,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=q(B,C,{...R,strokeWidth:1.5});return h(B,C.width,C.height,gl,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1.5}),G&&D(C,B,R),K},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,C,R={}){return R=ht(R,["fill","stroke","width","height"]),W(B,C,{...R,fillOpacity:tT})},"bpmn:ManualTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(B,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=dt(C),ie=at(C,s,R.fill),Pe=Re(C,c,R.stroke),et=y(B,C.waypoints,{markerEnd:d(B,"messageflow-end",ie,Pe),markerStart:d(B,"messageflow-start",ie,Pe),stroke:Pe,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=et.getPointAtLength(et.getTotalLength()/2),qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),Ct={strokeWidth:1};K.get("messageVisibleKind")==="initiating"?(Ct.fill=ie,Ct.stroke=Pe):(Ct.fill=Pe,Ct.stroke=ie);var vn=b(B,qt,Ct),Rn=G.get("messageRef"),Un=Rn.get("name"),At=Z(B,Un,{align:"center-top",fitBox:!0,style:{fill:Pe}}),Qt=vn.getBBox(),_n=At.getBBox(),qa=mt.x-_n.width/2,qn=mt.y+Qt.height/2+ZP;pl(At,qa,qn,0)}return et},"bpmn:ParallelGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(B,C,R),K=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(B,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,C,R={}){R=ht(R,["fill","stroke","width","height"]);var G=W(B,C,R),K=ut(C),ie=xn(C),Pe=ge(C),et=Pe.get("name");if(K){var mt=ie?[{x:30,y:0},{x:30,y:ii(C,R)}]:[{x:0,y:30},{x:_i(C,R),y:30}];v(B,mt,{stroke:Re(C,c,R.stroke),strokeWidth:QP}),we(B,et,C,R)}else{var qt=Cs(C,R);ie||(qt.height=_i(C,R),qt.width=ii(C,R));var Ct=Z(B,et,{box:qt,align:"center-middle",style:{fill:Rs(C,l,c,R.stroke)}});if(!ie){var vn=-1*ii(C,R);pl(Ct,0,-vn,270)}}return Pe.get("participantMultiplicity")&&$("ParticipantMultiplicityMarker",B,C,R),G},"bpmn:ReceiveTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=he(B,C,R),ie;return G.get("instantiate")?(h(B,28,28,20*.22,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),ie=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ie=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(B,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),K},"bpmn:ScriptTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(B,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(B,K,{fill:Re(C,c,R.stroke),stroke:at(C,s,R.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=at(C,s,R.fill),K=Re(C,c,R.stroke),ie=y(B,C.waypoints,{markerEnd:d(B,"sequenceflow-end",G,K),stroke:K}),Pe=ge(C),{source:et}=C;if(et){var mt=ge(et);Pe.get("conditionExpression")&&M(mt,"bpmn:Activity")&&Se(ie,{markerStart:d(B,"conditional-flow-marker",G,K)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Pe&&Se(ie,{markerStart:d(B,"conditional-default-flow-marker",G,K)})}return ie},"bpmn:ServiceTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R);h(B,10,10,{fill:at(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(B,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),h(B,10,10,{fill:at(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var ie=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(B,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=ge(C);K.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var ie=q(B,C,R);return G&&D(C,B,R),ie},"bpmn:SubProcess":function(B,C,R={}){return ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]),X(B,C,R)},"bpmn:Task":function(B,C,R={}){return R=ht(R,["fill","stroke"]),he(B,C,R)},"bpmn:TextAnnotation":function(B,C,R={}){R=ht(R,["fill","stroke"]);var{width:G,height:K}=Cs(C,R),ie=m(B,G,K,0,0,{fill:"none",stroke:"none"}),Pe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:0,my:0}});b(B,Pe,{stroke:Re(C,c,R.stroke)});var et=ge(C),mt=et.get("text")||"";return Z(B,mt,{align:"left-top",box:Cs(C,R),padding:xa,style:{fill:Rs(C,l,c,R.stroke)}}),ie},"bpmn:Transaction":function(B,C,R={}){ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]);var G=X(B,C,{strokeWidth:1.5,...R}),K=n.style(["no-fill","no-events"],{stroke:Re(C,c,R.stroke),strokeWidth:1.5}),ie=ut(C);return ie||(R={}),m(B,_i(C,R),ii(C,R),ml-gl,gl,K),G},"bpmn:UserTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=15,ie=12,Pe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:K,y:ie}});b(B,Pe,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:K,y:ie}});b(B,et,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:K,y:ie}});return b(B,mt,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:.5}),G},label:function(B,C,R={}){return V(B,C,R)}};this._drawPath=b,this._renderer=w}Ae(Pr,go),Pr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Pr.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},Pr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Pr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Pr.prototype.getShapePath=function(e){return it(e)?jf(e,JP):M(e,"bpmn:Event")?Cv(e):M(e,"bpmn:Activity")?jf(e,ml):M(e,"bpmn:Gateway")?YP(e):KP(e)};function ht(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var nT=0,iT={width:150,height:50};function oT(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function rT(e){return hn(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Hf=null;function aT(){return Hf||(Hf=document.createElement("canvas").getContext("2d")),Hf}function sT(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(Mv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Mv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function cT(e,t){var n=aT();if(!n)return{width:0,height:0};n.font=sT(t),"letterSpacing"in n&&(n.letterSpacing=Mv(t.letterSpacing)||"0px");var i=e==="",o=i?"dummy":e.replace(/\s+$/,""),r=n.measureText(o);return{width:i?0:r.width,height:"fontBoundingBoxAscent"in r?r.fontBoundingBoxAscent+r.fontBoundingBoxDescent:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent}}function lT(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=cT(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return uT(e,o,i,r);o=fT(o,r.width,t)}}function uT(e,t,n,i){if(t.length<n.length){var o=n.slice(t.length).trim();e.unshift(o)}return{width:i.width,height:i.height,text:t}}var Av="";function pT(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,o=[],r=0;if(n.length>1)for(;i=n.shift();)if(i.length+r<t)o.push(i),r+=i.length;else{(i==="-"||i===Av)&&o.pop();break}var a=o[o.length-1];return a&&a===Av&&(o[o.length-1]="-"),o.join("")}function fT(e,t,n){var i=Math.max(e.length*(n/t),1),o=pT(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function yl(e){this._config=U({},{size:iT,padding:nT,style:{},align:"center-top"},e||{})}yl.prototype.createText=function(e,t){return this.layoutText(e,t).element},yl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},yl.prototype.layoutText=function(e,t){for(var n=U({},this._config.size,t.box),i=U({},this._config.style,t.style),o=oT(t.align||this._config.align),r=rT(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=dT(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(lT(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ei(l,function(m,_,v){return m+(s||_.height)},0)+r.top+r.bottom,f=ei(l,function(m,_,v){return _.width>m?_.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Le("text");Se(g,i),z(l,function(m){var _;switch(d+=s||m.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?f:u)-r.right-m.width;break;default:_=Math.max(((a?f:u)-m.width)/2+r.left,0)}var v=Le("tspan");Se(v,{x:_,y:d}),v.textContent=m.text,qe(g,v)});var h={width:f,height:p};return{dimensions:h,element:g}};function dT(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var hT=12,gT=1.2,mT=40;function Pv(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:hT,fontWeight:"normal",lineHeight:gT},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=U({},t,{fontSize:n},e&&e.externalStyle||{}),o=new yl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Ar.width),height:30},l=r(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=r(s,a,{style:t,align:"left-top",padding:xa});return{x:a.x,y:a.y,width:a.width,height:Math.max(mT,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,U({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Pv.$inject=["config.textRenderer"];function yT(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],o,r;n.abspos?(o=n.abspos.x,r=n.abspos.y):(o=n.containerWidth*n.position.mx,r=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=_T(i.d,{mx:o,my:r,e:a});return p}}var vT=/\{([^{}]+)\}/g,bT=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function xT(e,t,n){var i=n;return t.replace(bT,function(o,r,a,s,c){r=r||s,i&&(r in i&&(i=i[r]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function _T(e,t){return String(e).replace(vT,function(n,i){return xT(n,i,t)})}const wT={__init__:["bpmnRenderer"],bpmnRenderer:["type",Pr],textRenderer:["type",Pv],pathMap:["type",yT]};function ET(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ms={translate:["value",ET]};function vl(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function ST(e,t,n){var i=e.waypoint;return!i||i.length<2?[We(t),We(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Tv(e,t,n){return new Error(`element ${Fn(t)} referenced by ${Fn(e)}#${n} not yet drawn`)}function bo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}bo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],bo.prototype.add=function(e,t,n){var i,o,r;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(vl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!ut(e,t),c=CT(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(vl(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(r=0),M(e,"bpmn:DataStoreReference")&&(RT(n,We(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(vl(e,t,{hidden:o,source:u,target:p,waypoints:ST(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Fn(t)} for element ${Fn(e)}`);return Yo(e)&&yi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},bo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Fn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Tv(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},bo.prototype.addLabel=function(e,t,n){var i,o,r;return i=HP(t,n),o=yi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(vl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!yi(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(r,n.parent)},bo.prototype._getConnectedElement=function(e,t){var n,i,o=e.$type;if(i=e[t+"Ref"],t==="source"&&o==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&o==="bpmn:DataOutputAssociation"||t==="target"&&o==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Tv(e,i,t+"Ref"):new Error(`${Fn(e)}#${t} Ref not specified`)},bo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},bo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},bo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function RT(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 CT(e){return M(e,"bpmn:Group")}const kv={__depends__:[wT,{__depends__:[Ms],bpmnImporter:["type",bo]}]};function As(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Fi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zf(e){return Math.log(e)/Math.log(10)}var MT=1e3;function de(e){this._eventBus=e}de.$inject=["eventBus"];function AT(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}de.prototype.on=function(e,t,n,i,o,r){if((bn(t)||Ge(t))&&(r=o,o=i,i=n,n=t,t=null),bn(n)&&(r=o,o=i,i=n,n=MT),hn(o)&&(r=o,o=!1),!bn(i))throw new Error("handlerFn must be a function");ze(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?AT(i,r):i,r)})},de.prototype.canExecute=xo("canExecute"),de.prototype.preExecute=xo("preExecute"),de.prototype.preExecuted=xo("preExecuted"),de.prototype.execute=xo("execute"),de.prototype.executed=xo("executed"),de.prototype.postExecute=xo("postExecute"),de.prototype.postExecuted=xo("postExecuted"),de.prototype.revert=xo("revert"),de.prototype.reverted=xo("reverted");function xo(e){return function(n,i,o,r,a){(bn(n)||Ge(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Gf=["top","bottom","left","right"],bl=10;function Vf(e,t){de.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(hl(o)&&!kt(o)){var r=kT(o);r&&i(o,r)}}function i(o,r){var a=We(o),s=o.label,c=We(s);if(s.parent){var l=je(o),u;switch(r){case"top":u={x:a.x,y:l.top-bl-s.height/2};break;case"left":u={x:l.left-bl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+bl+s.height/2};break;case"right":u={x:l.right+bl+s.width/2,y:a.y};break}var p=Fi(u,c);t.moveShape(s,p)}}}Ae(Vf,de),Vf.$inject=["eventBus","modeling"];function PT(e){var t=e.host,n=We(e),i=kn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Gf.filter(function(a){return o.indexOf(a)===-1});return r}function TT(e){var t=We(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 Ov(t,i)});return n}function kT(e){var t=We(e.label),n=We(e),i=Ov(n,t);if(OT(i)){var o=TT(e);if(e.host){var r=PT(e);o=o.concat(r)}var a=Gf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?kn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Ov(e,t){return kn(t,e,5)}function OT(e){return Gf.indexOf(e)!==-1}function Wf(e){de.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)}Ae(Wf,de),Wf.$inject=["eventBus"];var DT=1500;function Uf(e,t,n){e.invoke(de,this),this.preExecute("elements.delete",DT,function(o){var r=o.context,a=r.elements,s=i(a);s.length&&(r.elements=a.concat(s))}),t.on("shape.move.start",function(o){var r=o.context.shapes,a=i(r);a.length&&(o.context.shapes=r.concat(a))});function i(o){var r=rt(o,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(r,l=>{const u=new Set(Jr(ga(Array.from(s),an(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ae(Uf,de),Uf.$inject=["injector","eventBus","canvas"];function qf(e,t){e.invoke(de,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=rt(o.incoming.concat(o.outgoing),function(a){return M(a,"bpmn:Association")});z(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ae(qf,de),qf.$inject=["injector","modeling"];function wa(e,t){for(Qn(t)&&(t=[t]);e=e.parent;)if(ot(e,t))return e;return null}function Dv(e,t){var n=wa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=wa(e,i),n)return xn(n);if(ot(e,i))return xn(e);var o;for(o=ge(e);o&&!M(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=ge(a);return s&&s.get("processRef")===o});return r?xn(r):!0}var Lv=500;function xl(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Lv,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Iv(r,a)}),o.length===1&&o.map(function(r){return o.indexOf(r)}).forEach(function(r){var a=o[r];i.elements[r]=n._replaceShape(o[r],a)})},!0),this.preExecute("elements.move",Lv,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Iv(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}xl.$inject=["bpmnReplace","injector"],Ae(xl,de),xl.prototype._replaceShape=function(e,t){var n=LT(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function LT(e){var t=ge(e),n=t.eventDefinitions;return n&&n[0]}function Iv(e,t){return!it(e)&&ot(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Yf(e,t){de.call(this,e);function n(i){return rt(i.attachers,function(o){return M(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);M(o,"bpmn:EventBasedGateway")&&M(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;M(o,"bpmn:Gateway")&&M(r,"bpmn:EventBasedGateway")&&z(r.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Yf.$inject=["eventBus","modeling"],Ae(Yf,de);function Bv(e){return e.create("bpmn:Category")}function IT(e){return e.create("bpmn:CategoryValue")}function Nv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=IT(e)),n.$parent||(n.$parent=Bv(e)),n}function BT(e,t,n){return tn(t.get("categoryValue"),e),e.$parent=t,tn(n.get("rootElements"),t),t.$parent=n,e}function NT(e){var t=e.$parent;return t&&(Zt(t.get("categoryValue"),e),e.$parent=null),e}function $T(e){var t=e.$parent;return t&&(Zt(t.get("rootElements"),e),e.$parent=null),e}var FT=500;function Kf(e,t,n){n.invoke(de,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(ge).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&BT(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&$T(l),c&&!o(c,u)&&NT(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,ge(l))},!0),this.executed(["shape.move","shape.resize"],FT,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,ge(l))},!0),this.executed("group.updateRefs",function(c){$v(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){$v(c).forEach(function(l){s(l.categoryValue,l.category,ge(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ge(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Kf.$inject=["bpmnjs","elementRegistry","injector"],Ae(Kf,de);function $v(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Xf(e,t,n){de.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(m){const _=m.source,v=m.target;Ea(_)&&Ps(v)&&u(v)}function o(m){const _=m.connection,v=m.source,y=m.target;Ea(v)&&_l(y)&&(l(y),f(v,[_]))}function r(m){const _=m.newTarget,v=m.oldSource,y=m.oldTarget;if(y!==_){const b=v;Ps(y)&&u(y),Ea(b)&&_l(_)&&l(_)}}function a(m){const{element:_}=m;Ps(_)?(p(_),d(_)):_l(_)&&g(_)}function s(m){const{newData:_,oldShape:v}=m;if(Ea(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const y=v.outgoing.find(({target:b})=>Ps(b));y&&y.target&&(m._connectionTarget=y.target)}else if(!Ea(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const y=v.outgoing.find(({target:b})=>_l(b));y&&y.target&&(m._connectionTarget=y.target),h(v)}}function c(m){const{_connectionTarget:_,newShape:v}=m;_&&t.connect(v,_)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function f(m,_){m.outgoing.filter(b=>M(b,"bpmn:Association")).filter(b=>Ps(b.target)&&!_.includes(b)).forEach(b=>t.removeConnection(b))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(v=>Ea(v.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(v=>M(v,"bpmn:SequenceFlow"));t.removeElements(_)}}Ae(Xf,de),Xf.$inject=["eventBus","modeling","bpmnRules"];function Ps(e){const t=ge(e);return t&&t.get("isForCompensation")}function Ea(e){return e&&M(e,"bpmn:BoundaryEvent")&&ba(e,"bpmn:CompensateEventDefinition")}function _l(e){return e&&M(e,"bpmn:Activity")&&!jn(e)}function Zf(e){e.invoke(de,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;M(i,"bpmn:Lane")&&!M(o,"bpmn:Lane")&&(n.parent=wa(i,"bpmn:Participant"))})}Zf.$inject=["injector"],Ae(Zf,de);function Qf(e,t){de.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(M(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}Qf.$inject=["eventBus","bpmnFactory"],Ae(Qf,de);var Jf=20,ed=20,Fv=30,wl=2e3;function td(e,t,n){de.call(this,t),t.on(["create.start","shape.move.start"],wl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!it(p)&&!kt(p)});if(c.length){var l=an(c),u=jT(a,l);U(a,u),r.createConstraints=HT(a,l)}}}),t.on("create.start",wl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",wl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return M(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",wl,function(o){var r=o.elements,a=o.parent,s=zT(r),c;s&&M(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=ge(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;M(a,"bpmn:Participant")&&M(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=ge(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&ge(s).set("processRef",ge(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&ge(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}td.$inject=["canvas","eventBus","modeling"],Ae(td,de);function jT(e,t){t={width:t.width+Jf*2+Fv,height:t.height+ed*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 HT(e,t){return t=je(t),{bottom:t.top+e.height/2-ed,left:t.right-e.width/2+Jf,top:t.bottom-e.height/2+ed,right:t.left+e.width/2-Jf-Fv}}function zT(e){return Lt(e,function(t){return M(t,"bpmn:Participant")})}var jv="__targetRef_placeholder";function nd(e,t){de.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Hv(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Hv(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Lt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Lt(c,function(u){return u.name===jv});return!l&&s&&(l=t.create("bpmn:Property",{name:jv}),tn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||Zt(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(_=i(p,!0),m.targetRef=_):m.targetRef=null}}nd.$inject=["eventBus","bpmnFactory"],Ae(nd,de);function Hv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function El(e){this._bpmnUpdater=e}El.$inject=["bpmnUpdater"],El.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},El.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,o=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]};function id(e,t,n,i){de.call(this,i),t.registerHandler("dataStore.updateContainment",El);function o(){return n.filter(function(s){return M(s,"bpmn:Participant")&&ge(s).processRef})[0]}function r(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:dt(s),newSemanticParent:u.processRef||u,newDiParent:dt(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:VT(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();ot(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&r(u).filter(function(p){return GT(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=r(l);p.forEach(function(f){M(u,"bpmn:Process")&&a(f,u)})})}id.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ae(id,de);function GT(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 VT(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var Sl=Math.max,Rl=Math.min,WT=20;function zv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function UT(e,t,n){var i=n.x,o=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+o,r.height=e.height-o):t.indexOf("s")!==-1&&(r.height=e.height+o),t.indexOf("e")!==-1?r.width=e.width+i:t.indexOf("w")!==-1&&(r.x=e.x+i,r.width=e.width-i),r}function qT(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 Cl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Ge(o)&&(i=(/top|left/.test(e)?Rl:Sl)(i,o)),Ge(r)&&(i=(/top|left/.test(e)?Sl:Rl)(i,r)),i}function YT(e,t){if(!t)return e;var n=je(e);return cl({top:Cl("top",n,t),right:Cl("right",n,t),bottom:Cl("bottom",n,t),left:Cl("left",n,t)})}function KT(e,t,n,i){var o=je(t),r={top:/n/.test(e)?o.bottom-n.height:o.top,left:/w/.test(e)?o.right-n.width:o.left,bottom:/s/.test(e)?o.top+n.height:o.bottom,right:/e/.test(e)?o.left+n.width:o.right},a=i?je(i):r,s={top:Rl(r.top,a.top),left:Rl(r.left,a.left),bottom:Sl(r.bottom,a.bottom),right:Sl(r.right,a.right)};return cl(s)}function Ts(e,t){return typeof e<"u"?e:WT}function XT(e,t){var n,i,o,r;return typeof t=="object"?(n=Ts(t.left),i=Ts(t.right),o=Ts(t.top),r=Ts(t.bottom)):n=i=o=r=Ts(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function ZT(e){return!(e.waypoints||e.type==="label")}function Gv(e,t){var n;if(e.length===void 0?n=rt(e.children,ZT):n=e,n.length)return XT(an(n),t)}var Ko=Math.abs;function QT(e,t){return zv(je(t),je(e))}var JT=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function Ml(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(Ml(n,t),t.push(n))}),t}function Xo(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ei(e){return wa(e,JT)||e}function ek(e,t){var n=Ei(e),i=M(n,"bpmn:Process")?[]:[n],o=Ml(n,i),r=je(e),a=je(t),s=QT(e,t),c=[],l=xn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=je(u);s.top&&(Ko(h.bottom-r.top)<10&&(d=a.top-h.bottom),Ko(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Ko(h.right-r.left)<10&&(f=a.left-h.right),Ko(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Ko(h.top-r.bottom)<10&&(p=a.bottom-h.top),Ko(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Ko(h.left-r.right)<10&&(g=a.right-h.left),Ko(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:qT(u,{top:p,right:f,bottom:d,left:g})})}}),c}var tk=500;function od(e,t){de.call(this,e);function n(i,o){var r=xn(i),a=Xo(o),s=[],c=[],l=[],u=[];if(Mr(a,function(m){return r?m.y>i.y?c.push(m):s.push(m):m.x>i.x?u.push(m):l.push(m),m.children}),!!a.length){var p;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var 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",tk,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;M(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}od.$inject=["eventBus","spaceTool"],Ae(od,de);var Vv=500;function Al(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Vv,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Wv(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Vv,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Wv(a,ik(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Al.$inject=["bpmnReplace","injector"],Ae(Al,de),Al.prototype._replaceShape=function(e){var t=nk(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function nk(e){var t=ge(e),n=t.eventDefinitions;return n&&n[0]}function Wv(e,t){return!it(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function ik(e,t){return e.indexOf(t)!==-1}var Pl=Math.round,ok=Math.max;function rk(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 ak(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Uv=10;function sk(e,t){var n,i;for(n=0;i=e[n];n++)if(xs(i,t)<=Uv)return{point:e[n],bendpoint:!0,index:n};return null}function ck(e,t){var n=Zy(rk(t,Uv),ak(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=ok(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Pl(i.x+o.x)/2,y:Pl(i.y+o.y)/2},index:i.segment2}:{point:{x:Pl(i.x),y:Pl(i.y)},index:i.segment2}:null}function rd(e,t){return sk(e,t)||ck(e,t)}function ad(e,t,n){de.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,f,d,g,h=o.outgoing.slice(),m=o.incoming.slice(),_;Ge(a.width)?_=We(a):_=a;var v=rd(s,_);if(v){if(c=s.slice(0,v.index),l=s.slice(v.index+(v.bendpoint?1:0)),!c.length||!l.length)return;u=v.bendpoint?s[v.index]:_,(c.length===1||!qv(o,c[c.length-1]))&&c.push(Yv(u)),(l.length===1||!qv(o,l[0]))&&l.unshift(Yv(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),g=r));var y=[].concat(d&&rt(m,function(b){return b.source===d.source})||[],g&&rt(h,function(b){return b.target===g.target})||[]);y.length&&n.removeElements(y)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=We(c),u={x:l.x+s.x,y:l.y+s.y},p=Lt(r.children,function(f){var d=t.canInsert(a,f);return d&&rd(f.waypoints,u)});p&&(o.targetFlow=p,o.position=u)}},!0),this.postExecuted("elements.move",function(o){var r=o.shapes,a=o.targetFlow,s=o.position;a&&i(r[0],a,s)},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;t.canInsert(a,r)&&(o.targetFlow=r,o.parent=r.parent)},!0),this.postExecuted("shape.create",function(o){var r=o.shape,a=o.targetFlow,s=o.position;a&&i(r,a,s)},!0)}Ae(ad,de),ad.$inject=["eventBus","bpmnRules","modeling"];function qv(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 Yv(e){return U({},e)}function sd(e,t){de.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Sa(o)){var c=[];M(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Sa(l)):c=a.incoming.filter(l=>l!==o&&Sa(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(M(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Sa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Sa).forEach(function(s){const c=a.incoming.filter(Sa).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}sd.$inject=["eventBus","modeling"],Ae(sd,de);function Sa(e){return M(e,"bpmn:SequenceFlow")}var Tl=1500,Kv=2e3;function Xv(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"],Tl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!ot(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||ot(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Tl,function(i){var o=i.hover;M(o,"bpmn:Lane")&&(i.hover=Ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Tl,function(i){var o=i.context,r=i.hover,a=o.type;M(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Tl,function(i){var o=i.context,r=o.start;M(r,"bpmn:Lane")&&(o.start=Ei(r)||r)}),t.on("shape.move.start",Kv,function(i){var o=i.shape;M(o,"bpmn:Lane")&&(i.shape=Ei(o)||o)}),t.on("spaceTool.move",Kv,function(i){var o=i.hover;o&&M(o,"bpmn:Lane")&&(i.hover=Ei(o))})}Xv.$inject=["elementRegistry","eventBus","canvas"];var Zv=770;function cd(e,t,n,i){n.invoke(de,this);function o(s,c){var l=ge(s),u=c.categoryValue||l.categoryValueRef;u||(u=Nv(e,l));var p=c.category||u.$parent||Bv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=ge(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ge(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=ge(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&&!ge(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ge(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||ge(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Zv,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=ge(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",Zv,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})}cd.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ae(cd,de);function ld(e,t,n,i){var o,r,a,s,c;return o=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),o==0?null:(r=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*r-(i.y-n.y)*a,s=c/o,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Qv(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=ld(i,o,r,a),l=ld(i,o,r,s),u;c&&l?Jv(c,r)>Jv(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],We(i.source)),t(o[o.length-1],o[o.length-2],We(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Qv.$inject=["eventBus"];function Jv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ud(e){de.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=ge(i),r=dt(i);if(ot(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}ud.$inject=["eventBus"],Ae(ud,de);function eb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function tb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function lk(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 uk(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],o=i[0].n*t[0]+i[1].n*t[1],r=i[0].lambda*t[0]+i[1].lambda*t[1];return-o/r}function pd(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=uk([n.x,n.y],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function nb(e,t){var n=pd(e,t),i={x:n.x-e.x,y:n.y-e.y};return eb(i)}function ks(e,t){return eb({x:e.x-t.x,y:e.y-t.y})}var ib=Math.sqrt,ob=Math.min,pk=Math.max,rb=Math.abs;function ab(e){return Math.pow(e,2)}function Os(e,t){return ib(ab(e.x-t.x)+ab(e.y-t.y))}function fk(e,t){var n=0,i,o,r,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],cb(i,o)?l=[i]:(r=Os(e,i),a=Os(e,o),c=ob(r,a),l=dk(i,o,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:cb(i,l[0])?n:n+1}),l.length===2&&(s=gk(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Os(i,s)/Os(i,o)}),p=Os(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function dk(e,t,n,i){var o=t.x-e.x,r=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=o*o+r*r,l=o*a+r*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=ib(d),h=-p+g,m=-p-g,_={x:e.x-o*h,y:e.y-r*h};if(d===0)return[_];var v={x:e.x-o*m,y:e.y-r*m};return[_,v].filter(function(y){return hk(y,e,t)})}function hk(e,t,n){return sb(e.x,t.x,n.x)&&sb(e.y,t.y,n.y)}function sb(e,t,n){return e>=ob(t,n)-kl&&e<=pk(t,n)+kl}function gk(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var kl=.1;function cb(e,t){return rb(e.x-t.x)<=kl&&rb(e.y-t.y)<=kl}function mk(e,t,n,i){var o=n.segmentIndex,r=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return o===a?s:o>=s?o+r<s?s:o+r:o}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(r===0)return o;if(o>=l&&(u=c?o+1:o-1),o<l&&(u=o,c&&n.type!=="bendpoint"&&l-1===o)){var p=ub(t,l);p<n.relativeLocation&&u++}return u}return r===0?o:i.connectionStart&&o===0?0:i.connectionEnd&&o===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function lb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=fk(e,n),c=s.segmentIndex,l=mk(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=pb(n,c),p=pb(t,l),f=s.position,d=vk(u,f),g=yk(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-1)return a;if(h===0){var v=t[m];return o=v.x-s.position.x,r=v.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&m!==0&&m<n.length-1&&(d=ub(n,m))}var y={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},b=lk({x:e.x-f.x,y:e.y-f.y},g);return o=y.x+b.x-e.x,r=y.y+b.y-e.y,{point:yo(y),delta:yo({x:o,y:r})}}function ub(e,t){var n=ks(e[t-1],e[t]),i=ks(e[t],e[t+1]),o=n/(n+i);return o}function yk(e,t){var n=tb(e),i=tb(t);return i-n}function pb(e,t){return[e[t],e[t+1]]}function vk(e,t){var n=ks(e[0],e[1]),i=ks(e[0],t);return n===0?0:i/n}function bk(e,t,n,i){var o=We(e);return lb(o,t,n,i).delta}function Ds(e,t,n){var i=As(t),o=As(n),r=Fi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return yo({x:o.x+a.x,y:o.y+a.y})}function fb(e,t,n){var i=As(e),o=As(t),r=As(n),a=Fi(e,i),s=Fi(i,o),c=xk(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:r.x+l.x,y:r.y+l.y};return yo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function xk(e,t,n){var i=je(t),o=je(n);if(_k(i,o))return null;var r=kn(t,e),a,s,c;if(r==="top")a={x:0,y:o.bottom-i.bottom};else if(r==="bottom")a={x:0,y:o.top-i.top};else if(r==="right")a={x:o.left-i.left,y:0};else if(r==="left")a={x:o.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=kn(n,s),c!==r?null:a}function _k(e,t){return wk(e,t)||Ek(e,t)}function wk(e,t){return e.right!==t.right&&e.left!==t.left}function Ek(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var db="name",hb="text";function fd(e,t,n,i){de.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{ge(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(db in l&&t.updateLabel(c,l[db]),hb in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[hb]||"");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;it(l)||!Yo(l)||yi(l)&&t.updateLabel(l,yi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function r(a){var s=a.context,c=s.connection,l=c.label,u=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),bk(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ge(c);u&&Yo(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(!(!it(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(yi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(hl(c)){var p=c.label,f=We(p),d=Ck(u),g=Rk(f,d),h=Sk(g,u,l);t.moveShape(p,h)}})}Ae(fd,de),fd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function Sk(e,t,n){var i=Ds(e,t,n);return yo(Fi(i,e))}function Rk(e,t){if(t.length){var n=Mk(e,t);return pd(e,n)}}function Ck(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 Mk(e,t){var n=t.map(function(o){return{line:o,distance:nb(e,o)}}),i=Vi(n,"distance");return i[0].line}function Ak(e,t,n,i){return lb(e,t,n,i).point}function dd(e,t){de.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=U({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),Ak(o,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming,c=o.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ae(dd,de),dd.$inject=["eventBus","modeling"];function Ol(e,t,n){var i=Ll(e),o=mb(i,t),r=i[0];return o.length?o[o.length-1]:Ds(r.original||r,n,t)}function Dl(e,t,n){var i=Ll(e),o=mb(i,t),r=i[i.length-1];return o.length?o[0]:Ds(r.original||r,n,t)}function hd(e,t,n){var i=Ll(e),o=gb(t,n),r=i[0];return Ds(r.original||r,o,t)}function gd(e,t,n){var i=Ll(e),o=gb(t,n),r=i[i.length-1];return Ds(r.original||r,o,t)}function gb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ll(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function mb(e,t){var n=Bn(e,Tk);return rt(n,function(i){return Pk(i,t)})}function Pk(e,t){return kn(t,e,1)==="intersect"}function Tk(e){return e.original||e}function md(e,t){de.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(kk(i,o)){var r=Ok(i);r.incoming.forEach(function(a){var s=Dl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Ol(a,o,i);t.reconnectStart(a,o,s)})}},!0)}md.$inject=["eventBus","modeling"],Ae(md,de);function kk(e,t){return M(e,"bpmn:Participant")&&ut(e)&&M(t,"bpmn:Participant")&&!ut(t)}function Ok(e){var t=vs([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){M(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){M(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const Dk=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function yb(e){const t=ge(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&jn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:Dk.some(i=>M(n[0],i))}function vb(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function yd(e,t){e.invoke(de,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!yb(o))return;const a=vb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=ge(i).get(a),l=ge(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}yd.$inject=["injector","modeling"],Ae(yd,de);function vd(e,t){de.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=dt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ae(vd,de),vd.$inject=["eventBus","modeling"];function bd(e,t,n){de.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!M(r,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=Lk(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ae(bd,de),bd.$inject=["eventBus","bpmnRules","modeling"];function Ra(e){return e.original||e}function Lk(e,t){var n=ld(Ra(e[e.length-2]),Ra(e[e.length-1]),Ra(t[1]),Ra(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ra(e[0]),Ra(t[t.length-1])]}function xd(e,t){de.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;M(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}xd.$inject=["eventBus","modeling"],Ae(xd,de);function _d(e,t,n,i){de.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,o&&s(u,g))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Lt(p.outgoing,ta({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})})}Ae(_d,de),_d.$inject=["eventBus","modeling","bpmnRules","injector"];function Il(e,t,n,i,o,r){i.invoke(de,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=ei(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){jn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Ae(Il,de),Il.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;z(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},Il.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Ik=1500,Bk={width:140,height:120},wd={width:300,height:60},Ed={width:60,height:300},Bl={width:300,height:150},Nl={width:150,height:300},bb={width:140,height:120},xb={width:100,height:40};function _b(e){e.on("resize.start",Ik,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=Hk(i,o,r)),M(i,"bpmn:SubProcess")&&ut(i)&&(n.minDimensions=bb),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=xb)})}_b.$inject=["eventBus"];var Zo=Math.abs,Nk=Math.min,$k=Math.max;function wb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ca(e,t,n){return wb(e,t,n,Nk)}function Ma(e,t,n){return wb(e,t,n,$k)}var Fk={top:20,left:50,right:20,bottom:20},jk={top:50,left:20,right:20,bottom:20};function Hk(e,t,n){var i=Ei(e),o=!0,r=!0,a=Ml(i,[i]),s=je(e),c={},l={},u=xn(e),p=u?wd:Ed;/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=je(g);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&Zo(s.top-h.bottom)<10&&Ma(c,"top",h.top+p.height),Zo(s.top-h.top)<5&&Ca(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Zo(s.right-h.left)<10&&Ca(c,"right",h.right-p.width),Zo(s.right-h.right)<5&&Ma(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Zo(s.bottom-h.top)<10&&Ca(c,"bottom",h.bottom-p.height),Zo(s.bottom-h.bottom)<5&&Ma(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Zo(s.left-h.right)<10&&Ma(c,"left",h.left+p.width),Zo(s.left-h.left)<5&&Ca(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?Fk:jk;return f.forEach(function(g){var h=je(g);/n/.test(t)&&(!u||o)&&Ca(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Ma(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Ma(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Ca(l,"left",h.left-d.left)}),{min:l,max:c}}function Eb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Aa(e){return e.originalEvent||e.srcEvent}function Sd(e){Eb(e),Eb(Aa(e))}function Tr(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 Sb(){return/mac/i.test(navigator.platform)}function Rb(e,t){return(Aa(e)||e).button===t}function Qo(e){return Rb(e,0)}function zk(e){return Rb(e,1)}function Ls(e){var t=Aa(e)||e;return Qo(e)?Sb()?t.metaKey:t.ctrlKey:!1}function $l(e){var t=Aa(e)||e;return Qo(e)&&t.shiftKey}var Cb=1001;function Mb(e,t){e.on("resize.start",Cb+500,function(n){var i=n.context,o=i.shape;(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))&&(i.balanced=!Ls(n))}),e.on("resize.end",Cb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))return r&&(a=nv(a),t.resizeLane(o,a,i.balanced)),!1})}Mb.$inject=["eventBus","modeling"];var Gk=500;function Rd(e,t,n,i,o){n.invoke(de,this);function r(u){return ot(u,["bpmn:ReceiveTask","bpmn:SendTask"])||Vk(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Lt(f,ta({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(ot(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(ot(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var f=ge(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),tn(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Zt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=ge(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",Gk,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,o.create(d.$type))),l(f,d),delete p.referencedRootElement)})}Rd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ae(Rd,de);function Vk(e,t){return ze(t)||(t=[t]),Do(t,function(n){return ba(e,n)})}var Ab=Math.max;function Pb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(r[s]=Uk(a,i,o)),M(a,"bpmn:Lane")&&(r[s]=xn(a)?wd:Ed),M(a,"bpmn:SubProcess")&&ut(a)&&(r[s]=bb),M(a,"bpmn:TextAnnotation")&&(r[s]=xb),M(a,"bpmn:Group")&&(r[s]=Bk)}),r})}Pb.$inject=["eventBus"];function Wk(e){return e==="x"}function Uk(e,t,n){var i=xn(e);if(!Kk(e))return i?Bl:Nl;var o=Wk(t),r={};return o?i?r=Bl:r={width:Yk(e,n,o),height:Nl.height}:i?r={width:Bl.width,height:qk(e,n,o)}:r=Nl,r}function qk(e,t,n){var i;return i=Xk(e,t,n),Ab(Bl.height,i)}function Yk(e,t,n){var i;return i=Zk(e,t,n),Ab(Nl.width,i)}function Kk(e){return!!Xo(e).length}function Xk(e,t,n){var i=Xo(e),o;return o=Cd(i,t,n),e.height-o.height+wd.height}function Zk(e,t,n){var i=Xo(e),o;return o=Cd(i,t,n),e.width-o.width+Ed.width}function Cd(e,t,n){var i,o,r;for(i=0;i<e.length;i++)if(o=e[i],!n&&t>=o.y&&t<=o.y+o.height||n&&t>=o.x&&t<=o.x+o.width)return r=Xo(o),r.length?Cd(r,t,n):o}var Tb="_plane";function kb(e){var t=e.id;return Qk(t)}function to(e){var t=e.id;return M(e,"bpmn:SubProcess")?Ob(t):t}function kr(e){return Ob(e)}function Fl(e){var t=dt(e);return M(t,"bpmndi:BPMNPlane")}function Ob(e){return e+Tb}function Qk(e){return e.replace(new RegExp(Tb+"$"),"")}var Db=400,Jk=600,Lb={x:180,y:160};function _o(e,t,n,i,o,r,a){de.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return M(p,"bpmn:SubProcess")&&!ut(p)}function l(p){var f=p.shape,d=p.newRootElement,g=ge(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=ge(f);s._removeDiagram(d);var g=p.newRootElement=a.get(to(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(to(d));if(!(!g||!d.children||!d.children.length)){var h=Ib(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")||!ut(f)||z(Ss([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(to(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(to(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(to(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,m=d.id;if(h!==m){if(Fl(f)){a.updateId(f,kr(m)),a.updateId(h,m);return}var _=a.get(kr(h));_&&a.updateId(kr(h),kr(m))}}},!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,m=d.id;if(h!==m){if(Fl(f)){a.updateId(f,kr(h)),a.updateId(m,h);return}var _=a.get(kr(m));_&&a.updateId(_,kr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Fl(f)){var d=f,g=a.get(kb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Db,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ut(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Db,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ut(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",Jk,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(ut(f))s._moveChildrenToShape(d.children.slice(),f),z(Ss(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),z(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Ib(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=to(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,m=M(dt(h),"bpmndi:BPMNPlane");if(m){var _=kb(h),v=Lt(g,function(y){return y.id===_});v&&(f.parent=v.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ae(_o,de),_o.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var o=an(i),r;if(!t.x)r={x:Lb.x-o.x,y:Lb.y-o.y};else{var a=We(t),s=We(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},_o.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Rv(e).map(i=>i.annotation));n.size&&z(Ss(e.children),i=>{n.has(i.annotation)&&z(i.associations,o=>{t.removeConnection(o)})})},_o.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(o){o.hidden=!!t,i=i.concat(o),o.children&&(i=i.concat(n._showRecursively(o.children,o.collapsed||t)))}),i},_o.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},_o.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:to(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},_o.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Lt(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},_o.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function e2(e){var t=[];return z(Ss(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Ib(e){return e.children.slice().concat(e2(e.children)).concat(t2(e))}function t2(e){return kf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Md(e,t){e.invoke(de,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!M(o,"bpmn:SubProcess")||M(o,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!ut(o))){var r=n2(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Md.$inject=["injector","modeling"],Ae(Md,de);function n2(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Ad(e,t){de.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&M(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!M(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,yi(o)||""),c=a.y!==o.y&&Math.abs(a.y+a.height-(o.y+o.height))<=1,l=o.y+o.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ae(Ad,de),Ad.$inject=["eventBus","textRenderer"];function Pd(e,t){de.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ut(i))return;var o=vs(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){r(l,!0)}),z(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,We(i)):t.reconnectStart(a,i,We(i)))}},!0)}Ae(Pd,de),Pd.$inject=["eventBus","modeling"];var Td=500;function kd(e,t,n){de.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=i2(c).concat([a]),p=Gv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function r(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Td,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?dt(c).isExpanded=!1:(i(c.children),dt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Td,function(a){var s=a.context,c=s.shape;c.collapsed?dt(c).isExpanded=!1:dt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Td,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=r(s,c):l=o(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ae(kd,de),kd.$inject=["eventBus","elementFactory","modeling"];function i2(e){return e.filter(function(t){return!t.hidden})}function Od(e,t,n,i){t.invoke(de,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;it(a)||(M(a,"bpmn:Participant")&&ut(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;M(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ae(Od,de),Od.$inject=["canvas","injector","moddle","modeling"];function Dd(e,t){de.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;o2(o,r)&&t.updateProperties(r,{default:null})})}Ae(Dd,de),Dd.$inject=["eventBus","modeling"];function o2(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=ge(t),i=ge(e);return n.get("default")===i}var r2=500,a2=5e3,Bb=["shape.create","shape.delete","shape.move","shape.resize"],Nb=[...Bb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Ld(e,t){de.call(this,e);var n;function i(){return n=n||new s2,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(Nb,a2,function(){i()}),this.postExecuted(Nb,r2,function(){r()}),this.preExecute(Bb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Ld.$inject=["eventBus","modeling"],Ae(Ld,de);function s2(){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 c2=500,l2=5e3,$b=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Fb=[...$b,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Id(e,t){de.call(this,e);var n;function i(){return n=n||new u2,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Fb,l2,function(){i()}),this.postExecuted(Fb,c2,function(){r()}),this.preExecute($b,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&o().addGroup(s)})}Id.$inject=["eventBus","modeling"],Ae(Id,de);function u2(){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 Bd(e,t){de.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)p2(r)&&!d2(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ae(Bd,de),Bd.$inject=["eventBus","modeling"];function p2(e){const t=ge(e);return t&&t.isForCompensation}function f2(e){return e&&M(e,"bpmn:BoundaryEvent")&&ba(e,"bpmn:CompensateEventDefinition")}function d2(e){return e.incoming.filter(n=>f2(n.source)).length>0}const h2={__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",Vf],appendBehavior:["type",Wf],associationBehavior:["type",qf],attachEventBehavior:["type",xl],artifactBehavior:["type",Uf],boundaryEventBehavior:["type",Yf],categoryRootElementReferenceBehavior:["type",Kf],compensateBoundaryEventBehaviour:["type",Xf],createBehavior:["type",Zf],createDataObjectBehavior:["type",Qf],createParticipantBehavior:["type",td],dataInputAssociationBehavior:["type",nd],dataStoreBehavior:["type",id],deleteLaneBehavior:["type",od],detachEventBehavior:["type",Al],dropOnFlowBehavior:["type",ad],eventBasedGatewayBehavior:["type",sd],fixHoverBehavior:["type",Xv],groupBehavior:["type",cd],importDockingFix:["type",Qv],isHorizontalFix:["type",ud],labelBehavior:["type",fd],layoutConnectionBehavior:["type",dd],messageFlowBehavior:["type",md],nonInterruptingBehavior:["type",yd],removeElementBehavior:["type",bd],removeEmbeddedLabelBoundsBehavior:["type",vd],removeParticipantBehavior:["type",xd],replaceConnectionBehavior:["type",_d],replaceElementBehaviour:["type",Il],resizeBehavior:["type",_b],resizeLaneBehavior:["type",Mb],rootElementReferenceBehavior:["type",Rd],spaceToolBehavior:["type",Pb],subProcessPlaneBehavior:["type",_o],subProcessStartEventBehavior:["type",Md],textAnnotationBehavior:["type",Ad],toggleCollapseConnectionBehaviour:["type",Pd],toggleElementCollapseBehaviour:["type",kd],unclaimIdBehavior:["type",Od],unsetDefaultFlowBehavior:["type",Dd],updateFlowNodeRefsBehavior:["type",Ld],updateCategoryValueRefsBehavior:["type",Id],setCompensationActivityAfterPasteBehavior:["type",Bd]};function Nd(e){this._commandStack=e.get("commandStack",!1)}Nd.$inject=["injector"],Nd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const no={__init__:["rules"],rules:["type",Nd]};function Si(e){de.call(this,e),this.init()}Si.$inject=["eventBus"],Ae(Si,de),Si.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(o){i.canExecute(o,t,function(r,a,s){return n(r)},!0)})},Si.prototype.init=function(){};function jb(e,t){var n=kn(e,t,-15);return n!=="intersect"?n:null}function Dn(e){Si.call(this,e)}Ae(Dn,Si),Dn.$inject=["eventBus"],Dn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return g2(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},o=i.targetParent,r=i.targetAttach;if(r)return!1;o&&(n.parent=o);try{return Hl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Hl(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 Jb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return kt(i)&&!zl(t,i)?!1:Oo(t,function(o){return kt(o)?Hl(o.source,o.target,o):o.host?Is(o,o.host,null,n):Hd(o,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,o=e.hints;return o!=null&&o.keyboardMove&&n.some(function(a){return qb(a)&&!n.includes(a.host)})?!1:Is(n,t,null,i)||Zb(n,t,i)||Qb(n,t)||zl(n,t)}),this.addRule("shape.create",function(e){return Hd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Is(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return ox(n,t)})},Dn.prototype.canConnectMessageFlow=nx,Dn.prototype.canConnectSequenceFlow=ix,Dn.prototype.canConnectDataAssociation=zd,Dn.prototype.canConnectAssociation=ex,Dn.prototype.canConnectCompensationAssociation=tx,Dn.prototype.canMove=Qb,Dn.prototype.canAttach=Is,Dn.prototype.canReplace=Zb,Dn.prototype.canDrop=Pa,Dn.prototype.canInsert=zl,Dn.prototype.canCreate=Hd,Dn.prototype.canConnect=Hl,Dn.prototype.canResize=Jb,Dn.prototype.canCopy=ox;function g2(e){return $d(e)?null:ot(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function $d(e){return!e||it(e)}function Hb(e){do{if(M(e,"bpmn:Process"))return ge(e);if(M(e,"bpmn:Participant"))return ge(e).processRef||ge(e)}while(e=e.parent)}function Fd(e){return M(e,"bpmn:TextAnnotation")}function jd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function zb(e){return M(e,"bpmn:BoundaryEvent")&&io(e,"bpmn:CompensateEventDefinition")}function jl(e){return ge(e).isForCompensation}function m2(e,t){var n=Hb(e),i=Hb(t);return n===i}function y2(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&Wb(e,"bpmn:MessageEventDefinition"))}function v2(e){return M(e,"bpmn:InteractionNode")&&!jl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&Wb(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!io(e,"bpmn:MessageEventDefinition"))}function Gb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return ge(t);if(M(t,"bpmn:Participant"))return ge(t).processRef}return null}function Vb(e,t){var n=Gb(e),i=Gb(t);return n===i}function io(e,t){var n=ge(e);return!!Lt(n.eventDefinitions||[],function(i){return M(i,t)})}function Wb(e,t){var n=ge(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function b2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!zb(e)&&!jl(e)}function x2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!jl(e)}function _2(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(io(e,"bpmn:MessageEventDefinition")||io(e,"bpmn:TimerEventDefinition")||io(e,"bpmn:ConditionalEventDefinition")||io(e,"bpmn:SignalEventDefinition"))}function w2(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ub(e,t){var n=w2(t);return n.indexOf(e)!==-1}function Hl(e,t,n){if($d(e)||$d(t))return null;if(!M(n,"bpmn:DataAssociation")){if(nx(e,t))return{type:"bpmn:MessageFlow"};if(ix(e,t))return{type:"bpmn:SequenceFlow"}}var i=zd(e,t);return i||(tx(e,t)?{type:"bpmn:Association",associationDirection:"One"}:ex(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Pa(e,t){return it(e)||jd(e)?!0:M(t,"bpmn:Participant")&&!ut(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):ot(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")&&!E2(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?ut(t):ot(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?Do(ge(t).get("participants"),function(n){return!!n.get("processRef")}):ot(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ot(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 E2(e){return ge(e).cancelActivity&&(Yb(e)||Kb(e))}function qb(e){return!it(e)&&M(e,"bpmn:BoundaryEvent")}function S2(e){return M(e,"bpmn:Lane")}function R2(e){return qb(e)||M(e,"bpmn:IntermediateThrowEvent")&&Yb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&Kb(e)}function Yb(e){var t=ge(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Kb(e){return Xb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Xb(e,t){return t.some(function(n){return io(e,n)})}function C2(e){return M(e,"bpmn:ReceiveTask")&&Lt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function Is(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return it(o)||!R2(o)||jn(t)||!M(t,"bpmn:Activity")||jl(t)||i&&!jb(i,t)||C2(t)?!1:"attach"}function Zb(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(o){jn(t)||M(o,"bpmn:StartEvent")&&o.type!=="label"&&Pa(o,t)&&(IP(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(BP(o)||NP(o)||$P(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),Xb(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||io(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(M(o,"bpmn:EndEvent")&&Pa(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),M(o,"bpmn:BoundaryEvent")&&Is(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Qb(e,t){return Do(e,S2)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Pa(n,t)})}function Hd(e,t,n,i){return t?it(e)||jd(e)?!0:Pa(e,t)||zl(e,t):!1}function Jb(e,t,n){return M(e,"bpmn:SubProcess")?ut(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:Fd(e)?n?n==="e"||n==="w":!0:jd(e)?!0:it(e)?n?n==="e"||n==="w":!0:!1}function M2(e,t){var n=Fd(e),i=Fd(t);return(n||i)&&n!==i}function ex(e,t){return Ub(t,e)||Ub(e,t)?!1:M2(e,t)?!0:!!zd(e,t)}function tx(e,t){return Vb(e,t)&&zb(e)&&M(t,"bpmn:Activity")&&!P2(t,e)&&!jn(t)}function nx(e,t){return ax(e)&&!ax(t)?!1:y2(e)&&v2(t)&&!m2(e,t)}function ix(e,t){return b2(e)&&x2(t)&&Vb(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!_2(t))}function zd(e,t){return ot(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ot(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ot(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ot(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function zl(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:ot(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!it(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&Pa(e,t.parent)}function Gd(e,t){return e&&t&&e.indexOf(t)!==-1}function ox(e,t){return it(t)?!0:!(M(t,"bpmn:Lane")&&!Gd(e,t.parent)||M(t,"bpmn:MessageFlow")&&!A2(e,t))}function A2(e,t){var n=rx(t.source),i=rx(t.target);return Gd(e,n)&&Gd(e,i)}function rx(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function ax(e){return wa(e,"bpmn:Process")||wa(e,"bpmn:Collaboration")}function P2(e,t){return e.attachers.includes(t)}const T2={__depends__:[no],__init__:["bpmnRules"],bpmnRules:["type",Dn]};var k2=2e3;function sx(e,t){e.on("saveXML.start",k2,n);function n(){var i=t.getRootElements();z(i,function(o){var r=dt(o),a,s;a=vs([o]),a=rt(a,function(c){return c!==o&&!c.labelTarget}),s=Bn(a,dt),r.set("planeElement",s)})}}sx.$inject=["eventBus","canvas"];const O2={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",sx]};function Gl(e){de.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Gl.prototype.getOrdering=function(e,t){return null},Ae(Gl,de);function Vd(e,t){Gl.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=Lt(n,function(c){return ot(a,[c.type])});return s&&s.order||{level:1}}function o(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function r(a,s,c){for(var l=s;l&&!ot(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=Dg(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<o(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Vd.$inject=["eventBus","canvas"],Ae(Vd,Gl);const D2={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Vd]};function Bs(){}Bs.prototype.get=function(){return this._data},Bs.prototype.set=function(e){this._data=e},Bs.prototype.clear=function(){var e=this._data;return delete this._data,e},Bs.prototype.isEmpty=function(){return!this._data};const L2={clipboard:["type",Bs]};var cx=1500;function lx(e,t,n){var i=this,o=n.get("dragging",!1);function r(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),o.hover({element:l,gfx:c}),o.move(s))}}o&&t.on("drag.start",function(a){t.once("drag.move",cx,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",cx,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=Tr(a),c=document.elementFromPoint(s.x,s.y),I2(c)}}lx.$inject=["elementRegistry","eventBus","injector"];function I2(e){return Rr(e,"svg, .djs-element",!0)}const B2={__init__:["hoverFix"],hoverFix:["type",lx]};function N2(e){return!0}function Vl(e){return Qo(e)||zk(e)}var ux=500;function px(e,t,n){var i=this;function o(T,D,N){if(!s(T,D)){var $,H,Z;N?H=t.getGraphics(N):($=D.delegateTarget||D.target,$&&(H=$,N=t.get(H))),!(!H||!N)&&(Z=e.fire(T,{element:N,gfx:H,originalEvent:D}),Z===!1&&(D.stopPropagation(),D.preventDefault()))}}var r={};function a(T){return r[T]}function s(T,D){var N=l[T]||Qo;return!N(D)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":N2,"element.mousedown":Vl,"element.mouseup":Vl,"element.click":Vl,"element.dblclick":Vl};function u(T,D,N){var $=c[T];if(!$)throw new Error("unmapped DOM event name <"+T+">");return o($,D,N)}var p="svg, .djs-element";function f(T,D,N,$){var H=r[N]=function(Z){o(N,Z)};$&&(l[N]=$),H.$delegate=ti.bind(T,p,D,H)}function d(T,D,N){var $=a(N);$&&ti.unbind(T,D,$.$delegate)}function g(T){z(c,function(D,N){f(T,N,D)})}function h(T){z(c,function(D,N){d(T,N,D)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var D=T.element,N=T.gfx;e.fire("interactionEvents.createHit",{element:D,gfx:N})}),e.on(["shape.changed","connection.changed"],ux,function(T){var D=T.element,N=T.gfx;e.fire("interactionEvents.updateHit",{element:D,gfx:N})}),e.on("interactionEvents.createHit",ux,function(T){var D=T.element,N=T.gfx;i.createDefaultHit(D,N)}),e.on("interactionEvents.updateHit",function(T){var D=T.element,N=T.gfx;i.updateDefaultHit(D,N)});var m=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),v=E("djs-hit djs-hit-all"),y=E("djs-hit djs-hit-no-move"),b={all:v,"click-stroke":_,stroke:m,"no-move":y};function E(T,D){return D=U({stroke:"white",strokeWidth:15},D||{}),n.cls(T,["no-fill","no-border"],D)}function w(T,D){var N=b[D];if(!N)throw new Error("invalid hit type <"+D+">");return Se(T,N),T}function P(T,D){qe(T,D)}this.removeHits=function(T){var D=ds(".djs-hit",T);z(D,rn)},this.createDefaultHit=function(T,D){var N=T.waypoints,$=T.isFrame,H;return N?this.createWaypointsHit(D,N):(H=$?"stroke":"all",this.createBoxHit(D,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,D){var N=ys(D);return w(N,"stroke"),P(T,N),N},this.createBoxHit=function(T,D,N){N=U({x:0,y:0},N);var $=Le("rect");return w($,D),Se($,N),P(T,$),$},this.updateDefaultHit=function(T,D){var N=Et(".djs-hit",D);if(N)return T.waypoints?Tf(N,T.waypoints):Se(N,{width:T.width,height:T.height}),N},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}px.$inject=["eventBus","elementRegistry","styles"];const Wl={__init__:["interactionEvents"],interactionEvents:["type",px]};function Ta(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var o=i.element;n.deselect(o)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ta.$inject=["eventBus","canvas"],Ta.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()})}},Ta.prototype.get=function(){return Array.from(this._selectedElements)},Ta.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ta.prototype.select=function(e,t){var n=this.get();ze(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?z(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var fx="hover",dx="selected";function hx(e,t){this._canvas=e;function n(o,r){e.addMarker(o,r)}function i(o,r){e.removeMarker(o,r)}t.on("element.hover",function(o){n(o.element,fx)}),t.on("element.out",function(o){i(o.element,fx)}),t.on("selection.changed",function(o){function r(l){i(l,dx)}function a(l){n(l,dx)}var s=new Set(o.oldSelection),c=new Set(o.newSelection);for(let l of s)c.has(l)||r(l);for(let l of c)s.has(l)||a(l)})}hx.$inject=["canvas","eventBus"];function gx(e,t,n,i){e.on("create.end",500,function(o){var r=o.context,a=r.canExecute,s=r.elements,c=r.hints||{},l=c.autoSelect;if(a){if(l===!1)return;ze(l)?t.select(l):t.select(s.filter($2))}}),e.on("connect.end",500,function(o){var r=o.context,a=r.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(o){var r=o.previousSelection||[],a=i.get(o.context.shape.id),s=Lt(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(Qo(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=$l(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}gx.$inject=["eventBus","selection","canvas","elementRegistry"];function $2(e){return!e.hidden}const Ri={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Wl],selection:["type",Ta],selectionVisuals:["type",hx],selectionBehavior:["type",gx]};var F2=/^djs-cursor-.*$/;function Ul(e){var t=Rt(document.body);t.removeMatching(F2),e&&t.add("djs-cursor-"+e)}function mx(){Ul(null)}var j2=5e3;function yx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,j2,n),function(){e.off(t,n)}}var H2=["c","C"],z2=["v","V"],G2=["d","D"],V2=["x","X"],W2=["y","Y"],vx=["z","Z"];function U2(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function oi(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function mn(e,t){return e=ze(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Wd(e){return e.shiftKey}function q2(e){return oi(e)&&mn(H2,e)}function Y2(e){return oi(e)&&mn(z2,e)}function K2(e){return oi(e)&&mn(G2,e)}function X2(e){return oi(e)&&mn(V2,e)}function Z2(e){return oi(e)&&!Wd(e)&&mn(vx,e)}function Q2(e){return oi(e)&&(mn(W2,e)||mn(vx,e)&&Wd(e))}var ka=Math.round,bx="djs-drag-active";function Or(e){e.preventDefault()}function J2(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function eO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function xx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(y){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(y.x-E.left)/b.scale,y:b.y+(y.y-E.top)/b.scale}}function s(y,b){b=b||r;var E=e.createEvent(U({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+y,E)===!1?!1:e.fire(b.prefix+"."+y,E)}function c(y){var b=y.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function l(y,b){var E=r.payload,w=r.displacement,P=r.globalStart,T=Tr(y),D=Fi(T,P),N=r.localStart,$=a(T),H=Fi($,N);if(!r.active&&(b||eO(D)>r.threshold)){if(U(E,{x:ka(N.x+w.x),y:ka(N.y+w.y),dx:0,dy:0},{originalEvent:y}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&Ul(r.cursor),t.addMarker(t.getRootElement(),bx)}Sd(y),r.active&&(U(E,{x:ka($.x+w.x),y:ka($.y+w.y),dx:ka(H.x),dy:ka(H.y)},{originalEvent:y}),s("move"))}function u(y){var b,E=!0;r.active&&(y&&(r.payload.originalEvent=y,Sd(y)),E=s("end")),E===!1&&s("rejected"),b=_(E!==!0),s("ended",b)}function p(y){mn("Escape",y)&&(Or(y),m())}function f(y){var b;r.active&&(b=yx(e),setTimeout(b,400),Or(y)),u(y)}function d(y){l(y)}function g(y){var b=r.payload;b.hoverGfx=y.gfx,b.hover=y.element,s("hover")}function h(y){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function m(y){var b;if(r){var E=r.active;E&&s("cancel"),b=_(y),E&&s("canceled",b)}}function _(y){var b,E;s("cleanup"),mx(),r.trapClick?E=f:E=u,$e.unbind(document,"mousemove",l),$e.unbind(document,"dragstart",Or),$e.unbind(document,"selectstart",Or),$e.unbind(document,"mousedown",E,!0),$e.unbind(document,"mouseup",E,!0),$e.unbind(document,"keyup",p),$e.unbind(document,"touchstart",d,!0),$e.unbind(document,"touchcancel",m,!0),$e.unbind(document,"touchmove",l,!0),$e.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),bx);var w=r.payload.previousSelection;return y!==!1&&w&&!n.get().length&&c(w),b=r,r=null,b}function v(y,b,E,w){r&&m(!1),typeof b=="string"&&(w=E,E=b,b=null),w=U({},o,w||{});var P=w.data||{},T,D,N,$,H;if(w.trapClick?$=f:$=u,y?(T=Aa(y)||y,D=Tr(y),Sd(y),T.type==="dragstart"&&Or(T)):(T=null,D={x:0,y:0}),N=a(D),b||(b=N),H=J2(T),r=U({prefix:E,data:P,payload:{},globalStart:D,displacement:Fi(b,N),localStart:N,isTouch:H},w),w.manual||(H?($e.bind(document,"touchstart",d,!0),$e.bind(document,"touchcancel",m,!0),$e.bind(document,"touchmove",l,!0),$e.bind(document,"touchend",u,!0)):($e.bind(document,"mousemove",l),$e.bind(document,"dragstart",Or),$e.bind(document,"selectstart",Or),$e.bind(document,"mousedown",$,!0),$e.bind(document,"mouseup",$,!0)),$e.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;w.autoActivate&&l(y,!0)}e.on("diagram.destroy",m),this.init=v,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(y){U(o,y)}}xx.$inject=["eventBus","canvas","selection","elementRegistry"];const wo={__depends__:[B2,Ri],dragging:["type",xx]};function Dr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Dr.prototype.next=function(){return this._prefix+ ++this._counter};const tO=new Dr("ps");var nO=["marker-start","marker-mid","marker-end"],iO=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Jo(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Jo.$inject=["elementRegistry","eventBus","canvas","styles"],Jo.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")},Jo.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Jo.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=wf(n);return this._cloneMarkers(Uo(o),i),Se(o,this._styles.cls(i,[])),qe(t,o),Se(o,"data-preview-support-element-id",e.id),o},Jo.prototype.addFrame=function(e,t){var n=Le("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return qe(t,n),Se(n,"data-preview-support-element-id",e.id),n},Jo.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),sO(e)&&nO.forEach(function(o){if(Se(e,o)){var r=oO(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},Jo.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,tO.next()].join("-"),a=Et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||wf(n);s.id=r,lt(s).add(o);var c=Et(":scope > defs",e);c||(c=Le("defs"),qe(e,c)),qe(c,s);var l=aO(s.id);Se(t,i,l)};function oO(e,t,n){var i=rO(Se(e,t));return Et("marker#"+i,n||document)}function rO(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function aO(e){return"url(#"+e+")"}function sO(e){return iO.indexOf(e.nodeName)!==-1}const Oa={__init__:["previewSupport"],previewSupport:["type",Jo]};var cO="drop-ok",_x="drop-not-ok",wx="attach-ok",Ex="new-parent",Sx="create",lO=2e3;function Rx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=rt(c,function(v){var y=v.labelTarget;return!v.parent&&!(it(v)&&c.indexOf(y)!==-1)});var d=Lt(c,function(v){return!kt(v)}),g=!1,h=!1,m=!1;Mx(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(Mx(c)?m=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:_===p?d:p,target:_===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[wx,cO,_x,Ex].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}Cx(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,wx):a(p,h?Ex:_x))}),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,m=g&&g.connect,_=l.hints||{};if(g===!1||!d)return!1;Cx(c);var v={x:c.x,y:c.y};m?p=i.appendShape(u,p,v,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(f=i.createElements(f,v,d,U({},_,{attach:h})),p=Lt(f,function(y){return!kt(y)})),U(l,{elements:f,shape:p}),U(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Sx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],lO,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){ze(l)||(l=[l]);var p=Lt(l,function(g){return!kt(g)});if(p){u=U({elements:l,hints:{},shape:p},u||{}),z(l,function(g){Ge(g.x)||(g.x=0),Ge(g.y)||(g.y=0)});var f=rt(l,function(g){return!g.hidden}),d=an(f);z(l,function(g){kt(g)&&(g.waypoints=Bn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),U(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Sx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Rx.$inject=["canvas","dragging","eventBus","modeling","rules"];function Cx(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function Mx(e){return e&&e.length===1&&!kt(e[0])}var uO=750;function Ax(e,t,n,i,o){function r(a){var s=Le("g");Se(s,o.cls("djs-drag-group",["no-events"]));var c=Le("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Uo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Uo(u),l),On(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",uO,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),qe(p,u)),On(u,a.x,a.y)):rn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&rn(c)})}Ax.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ql={__depends__:[wo,Oa,no,Ri],__init__:["create","createPreview"],create:["type",Rx],createPreview:["type",Ax]};function Ud(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var o=t._svg=i.svg;o.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Ud.$inject=["eventBus"],Ud.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||pO(0,0)};function pO(e,t){var n=document.createEvent("MouseEvent"),i=e,o=t,r=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,o,r,a,!1,!1,!1,!1,0,null),n}const Ns={__init__:["mouse"],mouse:["type",Ud]};var Px=2e3;function ri(e,t,n,i,o,r,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=o,this._modeling=r,this._mouse=a,this._rules=s,o.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),fO(u)&&(l.priority=2,l.host=u.host.id),kt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=dO(u)),it(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){Ge(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Px,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Px,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;U(l,{createElementsBehavior:!1})})}ri.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ri.prototype.copy=function(e,t={}){var n,i;return ze(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ze(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ri.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var o=t.hints,r=this._createElements(i);if(t.element&&t.point)return this._paste(r,t.element,t.point,o);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:o})}}},ri.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ri.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(o){return n[o.id]});return i.length>0&&this._modeling.removeElements(i),t},ri.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},ri.prototype._paste=function(e,t,n,i){z(e,function(r){Ge(r.x)||(r.x=0),Ge(r.y)||(r.y=0)});var o=an(e);return z(e,function(r){kt(r)&&(r.waypoints=Bn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),U(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,U({},i))},ri.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return z(e,function(r,a){r=Vi(r,"priority"),z(r,function(s){var c=U({},Wi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(kt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(it(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),o.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),o.push(l)})}),o},ri.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Wi(e,["id"]));return t},ri.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Wi(e,["id"]));return t},ri.prototype.createShape=function(e){var t=this._elementFactory.createShape(Wi(e,["id"]));return t},ri.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(kt(e)&&(!n.has(e.source)||!n.has(e.target))||it(e)&&!n.has(e.labelTarget))},ri.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=rl(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=r.get(p);if(!d){var g={element:p,depth:f};o.push(g),r.set(p,g);return}if(d.depth<f){o=l(d,o);var h={element:d.element,depth:f};o.push(h),r.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Mr(a,function(p,f,d){if(it(p))return;z(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&z(m,function(_){z(_.labels,function(v){c(v,d)}),c(_,d)})}z([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Bn(o,function(p){return p.element});var u=new Set(e);return o=Bn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Vi(o,function(p){return p.descriptor.priority}),e=Bn(o,function(p){return p.element}),z(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){kx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){kx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function fO(e){return!!e.host}function dO(e){return Bn(e.waypoints,function(t){return t=Tx(t),t.original&&(t.original=Tx(t.original)),t})}function Tx(e){return U({},e)}function kx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const hO={__depends__:[L2,ql,Ns,no],__init__:["copyPaste"],copyPaste:["type",ri]};function qd(e,t,n){ze(n)||(n=[n]),z(n,function(i){br(e[i])||(t[i]=e[i])})}var Yd=750;function Ox(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=ge(u);if(it(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(dt(u),!0);d.bpmnElement=f,qd(f,l,"name"),qd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=ge(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(ge(c).attachedToRef=ge(l[c.host])),Wi(u,ei(u,function(f,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,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(it(u)){u.businessObject=ge(l[u.labelTarget]),u.di=dt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,qd(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=ge(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(Ss(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,r(l)))})}Ox.$inject=["bpmnFactory","eventBus","moddleCopy"];const gO=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],mO=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function $s(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return Vi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=hn(o)&&o.$descriptor;if(a&&mO.includes(a))return r;if(a&&gO.includes(a)||a&&s&&!Lt(s.properties,ta({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(M(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}$s.$inject=["eventBus","bpmnFactory","moddle"],$s.prototype.copyElement=function(e,t,n,i=!1){n&&!ze(n)&&(n=[n]),n=n||Kd(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(ze(o)&&(n=o),z(n,r=>{let a;Jn(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!dn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},$s.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return hn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):ze(e)?ei(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:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},$s.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 Kd(e,t){return ei(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Dx={__depends__:[hO],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ox],moddleCopy:["type",$s]};var Lx=Math.round;function Xd(e,t){this._modeling=e,this._eventBus=t}Xd.$inject=["modeling","eventBus"],Xd.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,o=this._eventBus;o.fire("replace.start",{element:e,attrs:t,hints:n});var r=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Lx(s+r/2),u=Lx(c+a/2),p=i.replaceShape(e,U({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Ix(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Ix.$inject=["selection","eventBus"];const yO={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ix],replace:["type",Xd]};function vO(e,t,n){ze(n)||(n=[n]),z(n,function(i){br(e[i])||(t[i]=e[i])})}var bO=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function xO(e,t){var n=e&&Jn(e,"collapsed")?e.collapsed:!ut(e),i;return t&&(Jn(t,"collapsed")||Jn(t,"isExpanded"))?i=Jn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Bx(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Yl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&xO(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),vO(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Kd(p.$descriptor),h=Kd(f.$descriptor,!0),m=_O(g,h);U(f,Ii(c,bO));var _=rt(m,function(b){return b==="eventDefinitions"?Nx(s,c.eventDefinitionType):b==="loopCharacteristics"?!jn(f):Jn(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!jn(f):!0});if(f=n.copyElement(p,f,_),c.eventDefinitionType&&(Nx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(Yl(p))d.isExpanded=ut(s);else if(c&&Jn(c,"isExpanded")){d.isExpanded=c.isExpanded;var v=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=v.width,d.height=v.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ut(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Yl(p)&&!Yl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var y=xn(s);dt(s).isHorizontal||(dt(d).isHorizontal=y),d.width=y?s.width:t.getDefaultSize(d).width,d.height=y?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ot(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ot(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),o.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}Bx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Yl(e){return M(e,"bpmn:SubProcess")}function Nx(e,t){var n=ge(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function _O(e,t){return e.filter(function(n){return t.includes(n)})}const $x={__depends__:[Dx,yO,Ri],bpmnReplace:["type",Bx]};var wO=250;function Lr(e){this._eventBus=e,this._tools=[],this._active=null}Lr.$inject=["eventBus"],Lr.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)},Lr.prototype.isActive=function(e){return e&&this._active===e},Lr.prototype.length=function(e){return this._tools.length},Lr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Lr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),z(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,wO,function(o){this._active&&(EO(o)||this.setActive(null))},this)};function EO(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Rr(t,'.group[data-group="tools"]')}const Kl={__depends__:[wo],__init__:["toolManager"],toolManager:["type",Lr]};function SO(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 RO(e,t){var n=[],i=new Set(e);z(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;z(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function CO(e,t,n){var i=e.x,o=e.y,r=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:o+c,width:r,height:a-c};case"s":return{x:i,y:o,width:r,height:a+c};case"w":return{x:i+s,y:o,width:r-s,height:a};case"e":return{x:i,y:o,width:r+s,height:a};default:throw new Error("unknown direction: "+t)}}var Zd=Math.abs,MO=Math.round,Eo={x:"width",y:"height"},Fx="crosshair",er={n:"top",w:"left",s:"bottom",e:"right"},AO=1500,Xl={n:"s",w:"e",s:"n",e:"w"},Zl=20;function Ci(e,t,n,i,o,r,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=o,this._toolManager=r,this._mouse=a;var s=this;r.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",AO,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Hx(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){Hx(c);var h={x:0,y:0};h[u]=MO(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Ci.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ci.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Fx,data:{context:{reactivate:n}},trapClick:!1})},Ci.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Fx,data:{context:{}}})},Ci.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ci.prototype.init=function(e,t){var n=Zd(e.dx)>Zd(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Zd(i)<5)return!1;i<0&&(i*=-1),Ls(e)&&(i*=-1);var r=SO(n,i),a=this._canvas.getRootElement();!$l(e)&&e.hover&&(a=e.hover);var s=[...vs(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,o),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:r,shapes:c.resizingShapes,start:o}),u=PO(c,n,r,o,l);return U(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),Ul("resize-"+(n==="x"?"ew":"ns")),!0},Ci.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),r.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||it(d))){if(kt(d)){u.push(d);return}var g=d[t],h=g+d[Eo[t]];if(TO(d)&&(n>0&&We(d)[t]>i||n<0&&We(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&o.allowed("shape.resize",{shape:d})){f(d);return}}}),z(r,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:r,resizingShapes:a}},Ci.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ci.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function jx(e){return{top:e.top-Zl,right:e.right+Zl,bottom:e.bottom+Zl,left:e.left-Zl}}function Hx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Ge(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ge(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ge(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Ge(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function PO(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return z(a,function(f){var d=f.attachers,g=f.children,h=je(f),m=rt(g,function(H){return!kt(H)&&!it(H)&&!u.has(H)&&!p.has(H)}),_=rt(g,function(H){return!kt(H)&&!it(H)&&u.has(H)}),v,y,b,E=[],w=[],P,T,D,N;m.length&&(y=jx(je(an(m))),v=i-h[er[n]]+y[er[n]],n==="n"?s.bottom=l=Ge(l)?Math.min(l,v):v:n==="w"?s.right=l=Ge(l)?Math.min(l,v):v:n==="s"?s.top=c=Ge(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Ge(c)?Math.max(c,v):v)),_.length&&(b=jx(je(an(_))),v=i-b[er[Xl[n]]]+h[er[Xl[n]]],n==="n"?s.bottom=l=Ge(l)?Math.min(l,v):v:n==="w"?s.right=l=Ge(l)?Math.min(l,v):v:n==="s"?s.top=c=Ge(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Ge(c)?Math.max(c,v):v)),d&&d.length&&(d.forEach(function(H){u.has(H)?E.push(H):w.push(H)}),E.length&&(P=je(an(E.map(We))),T=h[er[Xl[n]]]-(P[er[Xl[n]]]-i)),w.length&&(D=je(an(w.map(We))),N=D[er[n]]-(h[er[n]]-i)),n==="n"?(v=Math.min(T||1/0,N||1/0),s.bottom=l=Ge(l)?Math.min(l,v):v):n==="w"?(v=Math.min(T||1/0,N||1/0),s.right=l=Ge(l)?Math.min(l,v):v):n==="s"?(v=Math.max(T||-1/0,N||-1/0),s.top=c=Ge(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(T||-1/0,N||-1/0),s.left=c=Ge(c)?Math.max(c,v):v));var $=o&&o[f.id];$&&(n==="n"?(v=i+f[Eo[t]]-$[Eo[t]],s.bottom=l=Ge(l)?Math.min(l,v):v):n==="w"?(v=i+f[Eo[t]]-$[Eo[t]],s.right=l=Ge(l)?Math.min(l,v):v):n==="s"?(v=i-f[Eo[t]]+$[Eo[t]],s.top=c=Ge(c)?Math.max(c,v):v):n==="e"&&(v=i-f[Eo[t]]+$[Eo[t]],s.left=c=Ge(c)?Math.max(c,v):v))}),s}}function TO(e){return!!e.host}var Qd="djs-dragging",zx="djs-resizing",kO=250,Ql=Math.max;function Gx(e,t,n,i,o){function r(a,s){z(a,function(c){o.addDragger(c,s),n.addMarker(c,Qd)})}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=Le("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),qe(s,u);var p=Le("path");Se(p,"d",l.x),lt(p).add("djs-crosshair"),qe(u,p);var f=Le("path");Se(f,"d",l.y),lt(f).add("djs-crosshair"),qe(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;On(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&rn(c)}),e.on("spaceTool.move",kO,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=Le("path"),Se(c,"d","M0,0 L0,0"),lt(c).add("djs-crosshair"),qe(f,c),s.line=c;var d=Le("g");Se(d,i.cls("djs-drag-group",["no-events"])),qe(n.getActiveLayer(),d),r(u,d);var g=new Set(u);z(p,function(w){g.add(w)});var h=new Set,m=s.movingConnections=[];g.forEach(function(w){z(w.outgoing,function(P){h.has(P)||!kt(P)||!g.has(P.target)||(h.add(P),m.push(P))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Le("g");Se(_,i.cls("djs-frame-group",["no-events"])),qe(n.getActiveLayer(),_);var v=[];z(p,function(w){var P=o.addFrame(w,_),T=P.getBBox();v.push({element:P,initialBounds:T}),n.addMarker(w,zx)}),s.frameGroup=_,s.frames=v}var y={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:y[l]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[s.axis]]=0,On(s.dragGroup,E.x,E.y),z(s.frames,function(w){var P=w.element,T=w.initialBounds,D,N;s.direction==="e"?Se(P,{width:Ql(T.width+E.x,5)}):(D=Ql(T.width-E.x,5),Se(P,{width:D,x:T.x+T.width-D})),s.direction==="s"?Se(P,{height:Ql(T.height+E.y,5)}):(N=Ql(T.height-E.y,5),Se(P,{height:N,y:T.y+T.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,Qd)}),z(l,function(g){n.removeMarker(g,Qd)}),f&&(rn(p),rn(f)),z(u,function(g){n.removeMarker(g,zx)}),d&&rn(d)})}Gx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const OO={__init__:["spaceToolPreview"],__depends__:[wo,no,Kl,Oa,Ns],spaceTool:["type",Ci],spaceToolPreview:["type",Gx]};function Jl(e,t){e.invoke(Ci,this),this._canvas=t}Jl.$inject=["injector","canvas"],Ae(Jl,Ci),Jl.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=Jr(ga(o.children.filter(l=>M(l,"bpmn:Artifact")),an(r))));const s=[...e,...a];var c=Ci.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||DO(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function DO(e){return M(e,"bpmn:Participant")&&!ge(e).processRef}const Vx={__depends__:[OO],spaceTool:["type",Jl]};function Vt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Vt.$inject=["eventBus","injector"],Vt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Vt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Vt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.register=function(e,t){this._setHandler(e,t)},Vt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Vt.prototype.canUndo=function(){return!!this._getUndoAction()},Vt.prototype.canRedo=function(){return!!this._getRedoAction()},Vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Vt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Vt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Vt.prototype._createId=function(){return this._uid++},Vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Vt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Vt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Vt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Lg("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ze(e)?e:[e],t.dirty=t.dirty.concat(e))},Vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Vt.prototype._revertedAction=function(e){this._stackIdx--},Vt.prototype._getHandler=function(e){return this._handlerMap[e]},Vt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const LO={commandStack:["type",Vt]};function tr(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 IO=250,Wx=1400;function Jd(e,t,n){de.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Wx,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=Ux(a),r.validatedShapes=Ux(s)}),i&&t.on("shape.move.start",IO,function(o){var r=o.context,a=new Set(r.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(r,c,!0)}),this.preExecuted("elements.move",Wx,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;tr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.labelTarget;s&&(r.labelTargetIndex=Of(s.labels,a),r.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(o){var r=o.context,a=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(tn(s.labels,a,c),a.labelTarget=s)})}Ae(Jd,de),Jd.$inject=["injector","eventBus","modeling"];function Ux(e){var t=new Set(e);return rt(e,function(n){return!t.has(n.labelTarget)})}const BO={__init__:["labelSupport"],labelSupport:["type",Jd]};var NO=251,qx=1401,Yx="attach-ok";function eh(e,t,n,i,o){de.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",qx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=$O(c),s.validatedShapes=FO(l)}),r&&t.on("shape.move.start",NO,function(a){var s=a.context,c=s.shapes,l=th(c);z(l,function(u){r.makeDraggable(s,u,!0),z(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Yx),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Yx)}))}}),this.preExecuted("elements.move",qx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=th(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=rt(c,function(p){var f=p.host;return jO(p)&&!HO(c,f)}),z(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),z(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;tr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&z(l.attachers,function(u){var p=fb(u,c,l);o.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=fb(d,l,u);o.moveShape(d,g,d.parent),z(d.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;tr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ae(eh,de),eh.$inject=["injector","eventBus","canvas","rules","modeling"];function th(e){return xp(Bn(e,function(t){return t.attachers||[]}))}function $O(e){var t=th(e);return K1("id",e,t)}function FO(e){var t=ea(e,"id");return rt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function jO(e){return!!e.host}function HO(e,t){return e.indexOf(t)!==-1}const zO={__depends__:[no],__init__:["attachSupport"],attachSupport:["type",eh]};function Kx(e,t,n,i){e.on("element.changed",function(o){var r=o.element;(r.parent||r===t.getRootElement())&&(o.gfx=n.getGraphics(r)),o.gfx&&e.fire(Hy(r)+".changed",o)}),e.on("elements.changed",function(o){var r=o.elements;r.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(r)}),e.on("shape.changed",function(o){i.update("shape",o.element,o.gfx)}),e.on("connection.changed",function(o){i.update("connection",o.element,o.gfx)})}Kx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const nh={__init__:["changeSupport"],changeSupport:["type",Kx]};function Mi(e){this._model=e}Mi.$inject=["moddle"],Mi.prototype._needsId=function(e){return ot(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Mi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":ot(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",U({bpmnElement:e,bounds:this.createDiBounds()},t))},Mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Mi.prototype.createDiWaypoints=function(e){var t=this;return Bn(e,function(n){return t.createDiWaypoint(n)})},Mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Ii(e,["x","y"]))},Mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",U({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",U({bpmnElement:e},t))};function ai(e,t,n){de.call(this,e),this._bpmnFactory=t;var i=this;function o(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function r(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],si(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],si(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;z(m,function(_){M(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],si(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],si(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"],si(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],si(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],si(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],si(u)),this.executed("connection.reconnect",si(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,v=ge(h),y=ge(m),b=ge(_);v.conditionExpression&&!ot(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=v.conditionExpression,delete v.conditionExpression),m!==_&&y.default===v&&(g.oldDefault=y.default,delete y.default)})),this.reverted("connection.reconnect",si(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,v=ge(h),y=ge(m),b=ge(_);g.oldConditionExpression&&(v.conditionExpression=g.oldConditionExpression),g.oldDefault&&(y.default=g.oldDefault,delete b.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],si(p)),this.reverted(["element.updateAttachment"],si(p)),this.executed("element.updateLabel",si(f)),this.reverted("element.updateLabel",si(f));function f(d){const{element:g}=d.context,h=yi(g),m=dt(g),_=m&&m.get("label");Yo(g)||Fl(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&m.set("label",void 0))}}Ae(ai,de),ai.$inject=["eventBus","bpmnFactory","connectionDocking"],ai.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ai.prototype.updateParent=function(e,t){if(!it(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=dt(e),r=n&&n.businessObject,a=dt(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),M(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},ai.prototype.updateBounds=function(e){var t=dt(e),n=VO(e);if(n){var i=Fi(n,t.get("bounds"));U(n,{x:e.x+i.x,y:e.y+i.y})}var o=it(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),U(r,{x:e.x,y:e.y,width:e.width,height:e.height})},ai.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Zt(i,e)),M(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),tn(o,e))}},ai.prototype.updateDiConnection=function(e,t,n){var i=dt(e),o=dt(t),r=dt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ge(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==ge(n)&&(i.targetElement=n&&r)},ai.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Zt(n,e),e.$parent=null)}};function GO(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ai.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)},ai.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=GO(e.$parent||t),e.$parent&&(Zt(r.get("rootElements"),o),o.$parent=null),t&&(tn(r.get("rootElements"),o),o.$parent=r))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Zt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Zt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ai.prototype.updateConnectionWaypoints=function(e){var t=dt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ai.prototype.updateConnection=function(e){var t=e.connection,n=ge(t),i=t.source,o=ge(i),r=t.target,a=ge(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(Zt(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(Zt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,r)},ai.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function si(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function VO(e){if(M(e,"bpmn:Activity")){var t=dt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function nr(e,t){vo.call(this),this._bpmnFactory=e,this._moddle=t}Ae(nr,vo),nr.$inject=["bpmnFactory","moddle"],nr.prototype._baseCreate=vo.prototype.create,nr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,U({type:"label",di:n},Ar,t))}return this.createElement(e,t)},nr.prototype.createElement=function(e,t){t=U({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!UO(o)){var r=U({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}M(i,"bpmn:Group")&&(t=U({isFrame:!0},t)),t=WO(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=ih(o,t,"isExpanded")),ot(i,["bpmn:Lane","bpmn:Participant"])&&(t=ih(o,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!ut(i,o)),M(i,"bpmn:ExclusiveGateway")&&(Jn(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),dn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),dn(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,o),t=U({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},nr.prototype.getDefaultSize=function(e,t){var n=ge(e);if(t=t||dt(e),M(n,"bpmn:SubProcess"))return ut(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 ut(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}},nr.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 WO(e,t,n){return z(n,function(i){t=ih(e,t,i)}),t}function ih(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Wi(t,[n]))}function UO(e){return ot(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function eu(e,t){this._modeling=e,this._canvas=t}eu.$inject=["modeling","canvas"],eu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(o){var r={x:0,y:0};dn(i.left)?r.x=i.left-o.x:dn(i.right)?r.x=i.right-o.width-o.x:dn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:dn(i.top)?r.y=i.top-o.y:dn(i.bottom)?r.y=i.bottom-o.height-o.y:dn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},eu.prototype.postExecute=function(e){};function tu(e){this._modeling=e}tu.$inject=["modeling"],tu.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,o=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:o.attach}),e.shape=i},tu.prototype.postExecute=function(e){var t=e.hints||{};qO(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 qO(e,t){return Do(e.outgoing,function(n){return n.target===t})}function nu(e,t){this._canvas=e,this._layouter=t}nu.$inject=["canvas","layouter"],nu.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,o=e.parent,r=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!o)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,o,r),t},nu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var iu=Math.round;function oh(e){this._modeling=e}oh.$inject=["modeling"],oh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;z(t,function(p){Ge(p.x)||(p.x=0),Ge(p.y)||(p.y=0)});var s=rt(t,function(p){return!p.hidden}),c=an(s);z(t,function(p){kt(p)&&(p.waypoints=Bn(p.waypoints,function(f){return{x:iu(f.x-c.x-c.width/2+o.x),y:iu(f.y-c.y-c.height/2+o.y)}})),U(p,{x:iu(p.x-c.x-c.width/2+o.x),y:iu(p.y-c.y-c.height/2+o.y)})});var l=new Set(rl(t)),u={};z(t,function(p){if(kt(p)){u[p.id]=Ge(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var f=U({},r);l.has(p)||(f.autoResize=!1),it(p)&&(f=Wi(f,["attach"])),u[p.id]=Ge(i)?a.createShape(p,Ii(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Ii(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Jr(u)};var Xx=Math.round;function ir(e){this._canvas=e}ir.$inject=["canvas"],ir.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?U(t,n):U(t,{x:n.x-Xx(t.width/2),y:n.y-Xx(t.height/2)}),this._canvas.addShape(t,i,o),t},ir.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Fs(e){ir.call(this,e)}Ae(Fs,ir),Fs.$inject=["canvas"];var YO=ir.prototype.execute;Fs.prototype.execute=function(e){var t=e.shape;return XO(t),t.labelTarget=e.labelTarget,YO.call(this,e)};var KO=ir.prototype.revert;Fs.prototype.revert=function(e){return e.shape.labelTarget=null,KO.call(this,e)};function XO(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function js(e,t){this._canvas=e,this._modeling=t}js.$inject=["canvas","modeling"],js.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;tr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),tr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},js.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Of(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},js.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t};function rh(e,t){this._modeling=e,this._elementRegistry=t}rh.$inject=["modeling","elementRegistry"],rh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function Hs(e,t){this._canvas=e,this._modeling=t}Hs.$inject=["canvas","modeling"],Hs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;tr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),tr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),tr(n.children,function(i){kt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Hs.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Of(i.children,n),t.removeShape(n),n},Hs.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return tn(i.children,n,o),t.addShape(n,i),n};function ou(e){this._modeling=e}ou.$inject=["modeling"];var Zx={x:"y",y:"x"};ou.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,_){var v={y:0};v[i]=m-a(_),v[i]&&(v[Zx[i]]=0,t.moveElements([_],v,_.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(m,_){var v,y,b;if(m.elements.length<2){_&&_!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}v=Vi(m.elements,i),y=v[0],_===p&&(y=v[s(v)]),b=a(y),m.range=null,z(v,function(E){if(l(b,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),_&&_!==n.length-1&&(h+=c(m.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(m,_){var v={},y;m===u||m===f||(y=n[_-1],m.range.max=0,z(m.elements,function(b,E){v[Zx[i]]=0,v[i]=y.range.max-b[i]+d,m.range.min!==b[i]&&(v[i]+=b[i]-m.range.min),v[i]&&t.moveElements([b],v,b.parent),m.range.max=Math.max(b[i]+b[o],E?m.range.max:0)}))})},ou.prototype.postExecute=function(e){};function ru(e,t){this._layouter=e,this._canvas=t}ru.$inject=["layouter","canvas"],ru.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},ru.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function ah(){}ah.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Zt(r.children,t),tn(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},ah.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return Zt(n.children,t),tn(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function sh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}sh.prototype.add=function(e,t){return this.addAll([e],t)},sh.prototype.addAll=function(e,t){var n=CA(e,!!t,this);return U(this,n),this};function zs(e){this._modeling=e}zs.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},zs.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),z(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&hd(p,p.source,t),connectionEnd:d&&gd(p,p.target,t)})})},zs.prototype.getClosure=function(e){return new sh().addAll(e,!0)};function au(e){this._helper=new zs(e)}au.$inject=["modeling"],au.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},au.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 Ir(e){this._modeling=e,this._helper=new zs(e)}Ir.$inject=["modeling"],Ir.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=Ii(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Zt(r.children,t),tn(i.children,t,o),U(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Ir.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(z(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:gd(r,t,n)})}),z(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:hd(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Ir.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return tn(n.children,t,i),U(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Ir.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Ir.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Gs(e){this._modeling=e}Gs.$inject=["modeling"],Gs.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,o=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return ze(o)&&(e.oldWaypoints=i.waypoints,i.waypoints=o),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Gs.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,o=e.dockingOrPoints,r=e.hints||{},a={};r.connectionStart&&(a.connectionStart=r.connectionStart),r.connectionEnd&&(a.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!i||r.docking==="source")&&(a.connectionStart=a.connectionStart||Qx(ze(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||Qx(ze(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Gs.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,o=e.connection;return t&&(o.source=t),n&&(o.target=n),i&&(o.waypoints=i),o};function Qx(e){return e.original||e}function So(e,t){this._modeling=e,this._rules=t}So.$inject=["modeling","rules"],So.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=o.incoming.slice(),d=o.outgoing.slice();z(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,Dl(g,s,u),a)}),z(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Ol(g,s,u),a)})},So.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},So.prototype.execute=function(e){},So.prototype.revert=function(e){},So.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},So.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},So.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Vs(e){this._modeling=e}Vs.$inject=["modeling"],Vs.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},Vs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(z(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Dl(r,n,i)})}),z(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ol(r,n,i)})}))},Vs.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 or(e){this._modeling=e}or.$inject=["modeling"],or.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),z(o,function(s){a[s.id]=QO(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(RO(i,o),t,n,r,i,o,a)},or.prototype.execute=function(){},or.prototype.revert=function(){},or.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},or.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(o){var r=CO(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},or.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);z(e,function(u){var p=u.source,f=u.target,d=ZO(u),g=e_(n),h={},m=c.has(p)||l.has(p),_=c.has(f)||l.has(f);m&&_?(d=Bn(d,function(v){return t_(v,i,n)&&(v[g]=v[g]+t[g]),v.original&&t_(v.original,i,n)&&(v.original[g]=v.original[g]+t[g]),v}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||_)&&(c.has(p)?h.connectionStart=hd(u,p,t):c.has(f)?h.connectionEnd=gd(u,f,t):l.has(p)?h.connectionStart=Ol(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Dl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function Jx(e){return U({},e)}function ZO(e){return Bn(e.waypoints,function(t){return t=Jx(t),t.original&&(t.original=Jx(t.original)),t})}function e_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function t_(e,t,n){var i=e_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function QO(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function su(e){this._modeling=e}su.$inject=["modeling"],su.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=n_(n),t.collapsed=!t.collapsed;var i=i_(n,t.collapsed);return[t].concat(i)},su.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=o_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function n_(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=U({},t,n_(n.children)))}),t}function i_(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(i_(i.children,i.collapsed||t)))}),n}function o_(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(o_(i.children,t)))}),n}function cu(e){this._modeling=e}cu.$inject=["modeling"],cu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=r_(i,t),a_(n,t),t.host=n,t},cu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,r_(n,t),a_(i,t,o),t};function r_(e,t){return Zt(e&&e.attachers,t)}function a_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),tn(i,t,n)}}function ch(){}ch.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ch.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ot(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ot.$inject=["eventBus","elementFactory","commandStack"],Ot.prototype.getHandlers=function(){return{"shape.append":tu,"shape.create":ir,"shape.delete":Hs,"shape.move":Ir,"shape.resize":Vs,"shape.replace":So,"shape.toggleCollapse":su,spaceTool:or,"label.create":Fs,"connection.create":nu,"connection.delete":js,"connection.move":ah,"connection.layout":ru,"connection.updateWaypoints":ch,"connection.reconnect":Gs,"elements.create":oh,"elements.move":au,"elements.delete":rh,"elements.distribute":ou,"elements.align":eu,"element.updateAttachment":cu}},Ot.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ot.prototype.moveShape=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},Ot.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ot.prototype.moveElements=function(e,t,n,i){i=i||{};var o=i.attach,r=n,a;o===!0?(a=n,r=n.parent):o===!1&&(a=null);var s={shapes:e,delta:t,newParent:r,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Ot.prototype.moveConnection=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},Ot.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ot.prototype.createConnection=function(e,t,n,i,o,r){typeof n=="object"&&(r=o,o=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:o,parentIndex:n,connection:i,hints:r};return this._commandStack.execute("connection.create",a),a.connection},Ot.prototype.createShape=function(e,t,n,i,o){typeof i!="number"&&(o=i,i=void 0),o=o||{};var r=o.attach,a,s;e=this._create("shape",e),r?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",c),c.shape},Ot.prototype.createElements=function(e,t,n,i,o){ze(e)||(e=[e]),typeof i!="number"&&(o=i,i=void 0),o=o||{};var r={position:t,elements:e,parent:n,parentIndex:i,hints:o};return this._commandStack.execute("elements.create",r),r.elements},Ot.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},Ot.prototype.appendShape=function(e,t,n,i,o){o=o||{},t=this._create("shape",t);var r={source:e,position:n,target:i,shape:t,connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},Ot.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ot.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ot.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ot.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ot.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ot.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ot.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Ot.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},Ot.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ot.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},Ot.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,U(i,{docking:"source"}))},Ot.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,U(i,{docking:"target"}))},Ot.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ot.prototype._create=function(e,t){return pP(t)?t:this._elementFactory.create(e,t)},Ot.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ws(e){this._elementRegistry=e}Ws.$inject=["elementRegistry"],Ws.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var o=e.changed||this._getVisualReferences(n).concat(t),r=e.oldProperties||JO(n,Cc(i));return s_(n,i),e.oldProperties=r,e.changed=o,o},Ws.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return s_(n,t),i},Ws.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?eD(e,t):[]};function JO(e,t){return ei(t,function(n,i){return n[i]=e.get(i),n},{})}function s_(e,t){z(t,function(n,i){e.set(i,n)})}function eD(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&ge(n).dataObjectRef===e})}var Us="default",Ro="id",c_="di",tD={width:0,height:0};function qs(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}qs.$inject=["elementRegistry","moddle","modeling","textRenderer"],qs.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,o=this._moddle.ids,r=t.businessObject,a=aD(e.properties),s=e.oldProperties||nD(t,a);return l_(a,r)&&(o.unclaim(r[Ro]),i.updateId(t,a[Ro]),o.claim(a[Ro],r)),Us in a&&(a[Us]&&n.push(i.get(a[Us].id)),r[Us]&&n.push(i.get(r[Us].id))),u_(t,a),e.oldProperties=s,e.changed=n,n},qs.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ge(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,tD)}},qs.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return u_(t,i),l_(n,o)&&(a.unclaim(n[Ro]),r.updateId(t,i[Ro]),a.claim(i[Ro],o)),e.changed};function l_(e,t){return Ro in e&&e[Ro]!==t[Ro]}function nD(e,t){var n=Cc(t),i=e.businessObject,o=dt(e);return ei(n,function(r,a){return a!==c_?r[a]=i.get(a):r[a]=iD(o,Cc(t.di)),r},{})}function iD(e,t){return ei(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function u_(e,t){var n=e.businessObject,i=dt(e);z(t,function(o,r){r!==c_?n.set(r,o):i&&oD(i,o)})}function oD(e,t){z(t,function(n,i){e.set(i,n)})}var rD=["default"];function aD(e){var t=U({},e);return rD.forEach(function(n){n in e&&(t[n]=ge(t[n]))}),t}function lu(e,t){this._canvas=e,this._modeling=t}lu.$inject=["canvas","modeling"],lu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=dt(o);return t.setRootElement(n),t.removeRootElement(o),tn(a.rootElements,i),i.$parent=a,Zt(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},lu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=dt(n);return t.setRootElement(o),t.removeRootElement(n),Zt(a.rootElements,i),i.$parent=null,tn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function lh(e,t){this._modeling=e,this._spaceTool=t}lh.$inject=["modeling","spaceTool"],lh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ei(i),a=r===i,s=a?i:i.parent,c=Xo(s),l=xn(i);if(l?o==="left"?o="top":o==="right"&&(o="bottom"):o==="top"?o="left":o==="bottom"&&(o="right"),!c.length){var u=l?{x:i.x+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Mr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:rt(b.children,function(E){return E!==i})});var f,d,g,h,m;o==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):o==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):o==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):o==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(p,m,f,g),v=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,v,h,g);var y=l?{x:i.x+(a?wi:0),y:d-(o==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},y,s)};function uh(e){this._modeling=e}uh.$inject=["modeling"],uh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=Xo(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Ys(e,t){this._modeling=e,this._spaceTool=t}Ys.$inject=["modeling","spaceTool"],Ys.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ys.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=ek(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Ys.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=je(e),o=je(t),r=zv(o,i),a=Ei(e),s=[],c=[];Mr(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",f=r.top>0||r.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",f=r.left>0||r.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Ks="flowNodeRef",ph="lanes";function uu(){}uu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=je(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ei(u);return o[p.id]||(o[p.id]=Ml(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ei(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,f=p.get(ph),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(Ks).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},uu.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,o=i.get(ph);n.remove.forEach(function(r){Zt(o,r),Zt(r.get(Ks),i)}),n.add.forEach(function(r){tn(o,r),tn(r.get(Ks),i)})}),[]},uu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(ph);n.add.forEach(function(r){Zt(o,r),Zt(r.get(Ks),i)}),n.remove.forEach(function(r){tn(o,r),tn(r.get(Ks),i)})}),[]};var fh="categoryValueRef";function Xs(e,t){this._bpmnFactory=e,this._elementRegistry=t}Xs.$inject=["bpmnFactory","elementRegistry"],Xs.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(v,y,b){if(y){var E=a.get(v);E||(E={},a.set(v,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:y,root:dh(v)}:E.past={categoryValue:y}))}}function c(v){o.set(v,ge(v))}function l(){n.filter(function(v){return M(v,"bpmn:FlowElement")&&!it(v)&&v.parent}).forEach(c)}function u(v){var y=ge(v),b=y.get("categoryValueRef");return b||(b=Nv(i,y),r.push(sD(v,b))),b}function p(v){return v.reduce(function(y,b){var E=dh(b),w=y.get(E);return w||(w=[],y.set(E,w)),w.push(b),y},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(v){return M(v,"bpmn:Group")&&!it(v)&&v.parent}).forEach(function(v){var y=ge(v).get("categoryValueRef");if(!y){var b=dh(v),E=f.get(b)||[],w=ga(E,v),P=Object.keys(w).length>0;P&&(y=u(v))}s(v,y,!0)}),t.forEach(function(v){s(v.groupShape,v.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(v,y){return y.present&&v.add(y.present.categoryValue),y.past&&v.add(y.past.categoryValue),v},new Set),h=new Map,m=p(d);a.forEach(function(v,y){var b=v.present;if(b){var E=m.get(b.root)||[],w=ga(E,y);E.forEach(function(P){if(w[P.id]){var T=h.get(P);T||(T=new Set,h.set(P,T)),T.add(b.categoryValue)}})}});var _=d.reduce(function(v,y){var b=o.get(y),E=b.get(fh),w=new Set(E),P=h.get(y)||new Set,T=Array.from(P).filter(function(N){return!w.has(N)}),D=E.filter(function(N){return g.has(N)&&!P.has(N)});return(T.length||D.length)&&v.push({businessObject:b,categoryValuesToAdd:T,categoryValuesToRemove:D}),v},[]);return{flowElements:_,groups:r}},Xs.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),cD(t.groups),uD(t.flowElements),[]},Xs.prototype.revert=function(e){var t=e.updates;return pD(t.flowElements),lD(t.groups),[]};function sD(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function cD(e){e.forEach(function(t){ge(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function lD(e){e.forEach(function(t){ge(t.groupShape).categoryValueRef=null})}function uD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(fh);t.categoryValuesToRemove.forEach(function(o){Zt(i,o)}),t.categoryValuesToAdd.forEach(function(o){tn(i,o,!0)})})}function pD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(fh);t.categoryValuesToAdd.forEach(function(o){Zt(i,o)}),t.categoryValuesToRemove.forEach(function(o){tn(i,o,!0)})})}function dh(e){for(;e.parent;)e=e.parent;return e}function pu(e){this._moddle=e}pu.$inject=["moddle"],pu.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},pu.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.unclaim(n):t.claim(n,i),[]};var fD={fill:void 0,stroke:void 0};function hh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Qn(t)){var n=dD(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}hh.$inject=["commandStack"],hh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||fD,i=this,o={};"fill"in n&&U(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&U(o,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(r){var a=kt(r)?Ii(o,["border-color"]):o,s=dt(r);if(hD(a),it(r)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!ot(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function dD(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 hD(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var gD={width:0,height:0};function p_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return GP(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!it(l)&&Yo(l)&&!hl(l)&&!f_(p)){var f=7,d=$f(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=yi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!it(u)&&!M(u,"bpmn:TextAnnotation"))){if(it(u)&&f_(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=yi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,gD)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}p_.$inject=["modeling","textRenderer","bpmnFactory"];function f_(e){return!e||!e.trim()}function Ln(e,t,n,i){Ot.call(this,e,t,n),this._bpmnRules=i}Ae(Ln,Ot),Ln.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Ln.prototype.getHandlers=function(){var e=Ot.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ws,e["element.updateProperties"]=qs,e["canvas.updateRoot"]=lu,e["lane.add"]=lh,e["lane.resize"]=Ys,e["lane.split"]=uh,e["lane.updateRefs"]=uu,e["group.updateRefs"]=Xs,e["id.updateClaim"]=pu,e["element.setColor"]=hh,e["element.updateLabel"]=p_,e},Ln.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Ln.prototype.connect=function(e,t,n,i){var o=this._bpmnRules;if(n||(n=o.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Ln.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Ln.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ln.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ln.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ln.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ln.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ln.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Ln.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ln.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ln.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function d_(){}d_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||We(t.source||e.source),t.connectionEnd||We(t.target||e.target)]};var fu=20,mD=5,du=Math.round,h_=20,yD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function vD(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function bD(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function g_(e,t,n){var i=kn(t,e,mD),o=n.split(":")[0],r=du((t.x-e.x)/2+e.x),a=du((t.y-e.y)/2+e.y),s,c,l=bD(o,i),u=/h|r|l/.test(o),p=!1,f=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=vD(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+fu*(/l/.test(o)?-1:1),y:f?a+fu:a}):(f=r===e.x,s={x:f?r+fu:r,y:e.y+fu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:gh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function xD(e,t,n){return g_(e,t,n)}function _D(e,t,n){var i=g_(t,e,m_(n));return{waypoints:i.waypoints.slice().reverse(),directions:m_(i.directions),turnNextDirections:i.turnNextDirections}}function wD(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var o=n+":"+i,r=gh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function m_(e){return e.split(":").reverse().join(":")}function ED(e,t,n){var i=du((t.x-e.x)/2+e.x),o=du((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:o},{x:t.x,y:o}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function gh(e,t,n){if(n=n||"h:h",!OD(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(v_(n)){var i=xD(e,t,n),o=_D(e,t,n),r=wD(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return ED(e,t,n)}function SD(e,t,n){var i=gh(e,t,n);return i.unshift(e),i.push(t),x_(i)}function RD(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=q1(r,"straight")[0]||"h:h",s=yD[a]||0,c=kn(e,t,s),l=kD(c,a);n=n||We(e),i=i||We(t);var u=l.split(":"),p=b_(n,e,u[0],DD(c)),f=b_(i,t,u[1],c);return SD(p,f,l)}function CD(e,t,n,i,o,r){ze(n)&&(o=n,r=i,n=We(e),i=We(t)),r=U({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&AD(e,t,n,i,r),c||(c=r.connectionEnd&&TD(t,e,i,o),c)||(c=r.connectionStart&&PD(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:RD(e,t,n,i,r)}function MD(e,t,n){return e>=t&&e<=n}function y_(e,t,n){var i={x:"width",y:"height"};return MD(t[e],n[e],n[e]+n[i[e]])}function AD(e,t,n,i,o){var r={},a,s;return s=kn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?y_(a,i,e)?(r[a]=i[a],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:i.x,y:i.y}]):null:y_(a,n,t)?(r[a]=n[a],[{x:n.x,y:n.y},{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y,original:{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y}}]):null):null}function PD(e,t,n,i){return mh(e,t,n,i)}function TD(e,t,n,i){var o=i.slice().reverse();return o=mh(e,t,n,o),o?o.reverse():null}function mh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Lt(u,function(p,f){var d=u[f-1];return d&&xs(p,d)<3})}function r(u,p,f){var d=mo(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(Gy(u[d],p,h_)||Gy(u[d],f,h_))return u.slice(d);return u}if(o(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=r(c[1],s,n),l=a(c,e,t),l!==c&&(c=mh(e,t,n,l)),c&&mo(c)?null:c}function kD(e,t){if(v_(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 OD(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function v_(e){return e&&/t|r|b|l/.test(e)}function DD(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function b_(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function x_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return Df(o,r,n,0)||t.push(n),t},[])}var LD=-10,ID=40,BD={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},ND={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},yh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Zs={top:"t",right:"r",bottom:"b",left:"l"};function hu(e){this._elementRegistry=e}Ae(hu,d_),hu.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,o=t.waypoints||e.waypoints,r=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(r||(r=__(o&&o[0],n)),a||(a=__(o&&o[o.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&o&&!w_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Dv(n,s)?BD:ND;return M(e,"bpmn:MessageFlow")?c=FD(n,i,u):(M(e,"bpmn:SequenceFlow")||w_(n,i))&&(n===i?c={preferredLayouts:WD(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:UD(n,i,a,u)}:Qs(n)||Qs(i)?c={preferredLayouts:u.subProcess,preserveDocking:HD(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=x_(CD(n,i,r,a,o,c))),l||[r,a]};function $D(e){var t=e.host;return kn(We(e),t,LD)}function FD(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:jD(e,t)}}function jD(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Qs(t)?"source":Qs(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function HD(e){return Qs(e)?"target":"source"}function __(e,t){return e?e.original||e:We(t)}function w_(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Qs(e){return M(e,"bpmn:SubProcess")&&ut(e)}function Br(e,t){return e===t}function zD(e,t){return t.indexOf(e)!==-1}function Da(e){var t=/right|left/.exec(e);return t&&t[0]}function La(e){var t=/top|bottom/.exec(e);return t&&t[0]}function E_(e,t){return yh[e]===t}function GD(e,t){var n=Da(e),i=yh[n];return t.indexOf(i)!==-1}function VD(e,t){var n=La(e),i=yh[n];return t.indexOf(i)!==-1}function S_(e){return e==="right"||e==="left"}function WD(e,t,n){var i=t.waypoints,o=i&&i.length&&kn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function UD(e,t,n,i){var o=We(e),r=We(t),a=$D(e),s,c,l=Br(e.host,t),u=zD(a,["top","right","bottom","left"]),p=kn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?qD(a,u,e,t,n,i):(s=YD(a,p,u,i.isHorizontal),c=KD(a,p,u,i.isHorizontal),[s+":"+c])}function qD(e,t,n,i,o,r){var a=t?e:r.isHorizontal?La(e):Da(e),s=Zs[a],c;return t?S_(e)?c=R_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=R_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function R_(e,t,n,i){var o=ID;return!(vh(e,i,n,o)||vh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||vh(e,i,We(t),o))}function vh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function YD(e,t,n,i){if(n)return Zs[e];var o=La(e),r=Da(e),a=La(t),s=Da(t);if(i){if(Br(o,a)||E_(r,s))return Zs[o]}else if(Br(r,s)||E_(o,a))return Zs[r];return Zs[i?r:o]}function KD(e,t,n,i){if(n)return S_(e)?GD(e,t)||Br(e,t)?"h":"v":VD(e,t)||Br(e,t)?"v":"h";var o=La(e),r=Da(e),a=La(t),s=Da(t);return a&&!s?"v":s&&!a?"h":i?Br(o,a)?"h":"v":Br(r,s)?"v":"h"}hu.$inject=["elementRegistry"];function C_(e){return U({original:e.point.original||e.point},e.actual)}function rr(e,t){this._elementRegistry=e,this._graphicsFactory=t}rr.$inject=["elementRegistry","graphicsFactory"],rr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(C_(i)),r.push(C_(o)),r},rr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},rr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return _s(i,o,n)},rr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},rr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},rr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const bh={__init__:["modeling","bpmnUpdater"],__depends__:[h2,T2,O2,D2,$x,LO,BO,zO,Ri,nh,Vx],bpmnFactory:["type",Mi],bpmnUpdater:["type",ai],elementFactory:["type",nr],modeling:["type",Ln],layouter:["type",hu],connectionDocking:["type",rr]};var XD=10,M_=50,ZD=250;function xh(e,t,n,i){for(var o;o=QD(e,n,t);)n=i(t,n,o);return n}function _h(e){return function(t,n,i){var o={x:n.x,y:n.y};return["x","y"].forEach(function(r){var a=e[r];if(a){var s=r==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?o[r]=Math.min(i[r]+c-t[s]/2,n[r]-l+c):o[r]=Math.max(i[r]+i[s]+c+t[s]/2,n[r]+l+c)}}),o}}function QD(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=eL(e);return Lt(o,function(r){if(r===n)return!1;var a=kn(r,i,XD);return a==="intersect"})}function JD(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||M_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||ZD,c=t.reference||"start";r||(r=iL);function l(g,h){return o==="n"?c==="start"?je(g).top-je(h).bottom:c==="center"?je(g).top-We(h).y:je(g).top-je(h).top:o==="w"?c==="start"?je(g).left-je(h).right:c==="center"?je(g).left-We(h).x:je(g).left-je(h).left:o==="s"?c==="start"?je(h).top-je(g).bottom:c==="center"?We(h).y-je(g).bottom:je(h).bottom-je(g).bottom:c==="start"?je(h).left-je(g).right:c==="center"?We(h).x-je(g).right:je(h).right-je(g).right}var u=e.incoming.filter(r).map(function(g){var h=a(g),m=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:m,weight:h}}),p=e.outgoing.filter(r).map(function(g){var h=a(g),m=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:m,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=ei(f,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function eL(e){var t=wh(e);return e.host&&(t=t.concat(wh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(wh(i))},[]))),t}function wh(e){return nL(e).concat(tL(e))}function tL(e){return e.incoming.map(function(t){return t.source})}function nL(e){return e.outgoing.map(function(t){return t.target})}function iL(){return!0}var oL=100;function A_(e,t,n){e.on("autoPlace",oL,function(i){var o=i.shape,r=i.source;return rL(r,o)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,o,r){e.fire("autoPlace.start",{source:i,shape:o});var a=e.fire("autoPlace",{source:i,shape:o}),s=t.appendShape(i,o,a,i.parent,r);return e.fire("autoPlace.end",{source:i,shape:s}),s}}A_.$inject=["eventBus","modeling","canvas"];function rL(e,t,n){n||(n={});var i=n.defaultDistance||M_,o=We(e),r=je(e);return{x:r.right+i+t.width/2,y:o.y}}function P_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}P_.$inject=["eventBus","selection"];const aL={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",A_],autoPlaceSelectionBehavior:["type",P_]};function T_(e,t,n){var i=Dv(e,n);if(M(t,"bpmn:TextAnnotation"))return cL(e,t,i);if(ot(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return lL(e,t,i);if(M(t,"bpmn:FlowNode"))return sL(e,t,i)}function sL(e,t,n){var i=je(e),o=We(e),r=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=JD(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=kn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+k_(l,c,r)}:{x:o.x+k_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return xh(e,t,u,_h(f))}function k_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function cL(e,t,n){var i=je(e),o=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};kt(e)&&(o=We(e),n?(o.x+=100,o.y-=50):(o.x+=100,o.y+=50));var r={margin:n?-30:30,minDistance:20},a=n?{y:r}:{x:r};return xh(e,t,o,_h(a))}function lL(e,t,n){var i=je(e),o=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},r={margin:30,minDistance:30},a=n?{x:r}:{y:r};return xh(e,t,o,_h(a))}function O_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return T_(o,i,t)})}O_.$inject=["eventBus","elementRegistry"];const gu={__depends__:[aL],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",O_]},D_=[kv,Ms,bh,gu,Tp];function uL(e={}){om(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new va({container:t,moddleExtensions:e.moddleExtensions??Lc,additionalModules:[...D_,...e.additionalModules??[]]})}const L_={"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":"풀"},pL={이:["이","가"],을:["을","를"],와:["과","와"]};function fL(e,t){const[n,i]=pL[t],o=e.at(-1)??"",r=o.charCodeAt(0);return r>=44032&&r<=55203?e+((r-44032)%28===0?i:n):o>="0"&&o<="9"?e+("013678".includes(o)?n:i):e+`${n}(${i})`}const dL={"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":"연관선"},hL="요소";function Eh(e){return(e&&dL[e.type])??hL}const I_=20;function gL(e){const t=e.replace(/\s+/g," ").trim();return t.length>I_?`${t.slice(0,I_)}…`:t}function mu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:gL(o.name),a=r===void 0?i+Eh(o):r,s=r===void 0?a:`「${r}」`;return n?s+fL(a,n).slice(a.length):s}function mL(e,t,n,i,o){const[r,a]=[e(t),e(n)],s=(r==null?void 0:r.name)===void 0&&(a==null?void 0:a.name)===void 0&&Eh(r)===Eh(a);return[mu(e,t,i),mu(e,n,o,s?"다른 ":"")]}function yL(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 vL(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 yu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function bL(e,t){const n=(o,r)=>mu(t,o,r),i=(o,r,a,s)=>mL(t,o,r,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[o,r]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${o} ${r} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${o} ${r} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[o,r]=i(e.edge,e.other,void 0,"와");return`${o}의 라벨이 ${r} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[o,r]=i(e.groups[0],e.groups[1],"와","이");return`${o} ${r} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${yu[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${yu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${yu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${yu[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[o,r]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${o} ${r} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${o} ${r} 겹칩니다.`}}}function xL(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${mu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const B_="기타",Sh={error:0,warning:1,info:2};function N_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:yL(i),targetRefs:vL(i),category:L_[i.kind]??B_,message:bL(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:L_[i.ruleId]??B_,message:xL(i,t)});return n}function $_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ia(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Rh(e,t){if(t===void 0||e.length===0)return!1;const n=Ia(e[0],t);return e.some(i=>Ia(i,t)!==n)}function F_(e,t){const n=Rh(e,t);return e.slice().sort((i,o)=>(n?Number(Ia(o,t))-Number(Ia(i,t)):0)||Sh[i.severity]-Sh[o.severity])}const j_="i18n-untranslated",H_="i18n-review-requested",Ch="i18nDisplay.redrawn",z_=[["untranslated",j_],["reviewRequested",H_]];class Mh{constructor(t,n,i,o,r,a,s,c){pi(this,"config");pi(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=o.drawShape.bind(o);o.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=r.activate.bind(r);r.activate=f=>this.withDisplayText(f,()=>u(f));const p=r.update.bind(r);r.update=(f,d,g,h)=>{const m=this.resolve(f);if(!m||m.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(Ac,{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(Ac,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=xr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=ia(n).filter(f=>Nn(f)),s=f=>f.body??"",c=a.find(f=>Nn(f)===o&&s(f)),l=Lo(n).some(f=>f.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===r).map(Nn);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var r;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let o=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((r=this.resolve(a))==null?void 0:r.status)===n&&o++}finally{this.displayLocale=i}return o}withDisplayText(t,n,i){var f;if(!this.config)return n();const o=this.resolve(t),r=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(r)for(const[d,g]of z_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=xr((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===o.text)return n();a[s]=o.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,o.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,o]of z_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(Ch)}}pi(Mh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const G_={__depends__:[Tp],__init__:["i18nDisplay"],i18nDisplay:["type",Mh]};var _L=new Dr("ov"),wL=500;function Sn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=_L,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=EL(n.getContainer()),this._init()}Sn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Sn.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?rt(t.overlays,ta({type:e.type})):t.overlays.slice():[]}else return e.type?rt(this._overlays,ta({type:e.type})):e.id?this._overlays[e.id]:null},Sn.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},Sn.prototype.remove=function(e){var t=this.get(e)||[];ze(t)||(t=[t]);var n=this;z(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(Xi(i.html),Xi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Sn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Sn.prototype.show=function(){vu(this._overlayRoot)},Sn.prototype.hide=function(){vu(this._overlayRoot,!1)},Sn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],tl(this._overlayRoot)},Sn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=an(t);i=r.x,o=r.y}V_(n,i,o),En(e.html,"data-container-id",t.id)},Sn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=an(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=an(i).height:s=i.height,r=t.bottom*-1+s}V_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._createOverlayContainer=function(e){var t=$t('<div class="djs-overlays" />');Vn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Sn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";W_(this._overlayRoot,n)},Sn.prototype._getOverlayContainer=function(e,t){var n=Lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Sn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Qn(i)&&(i=$t(i)),r=this._getOverlayContainer(n),o=$t('<div class="djs-overlay" data-overlay-id="'+t+'">'),Vn(o,{position:"absolute"}),o.appendChild(i),e.type&&Rt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();vu(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(dn(o)&&o>t.scale||dn(r)&&r<t.scale))&&(c=!1),vu(a,c),this._updateOverlayScale(e,t)},Sn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),dn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),dn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),dn(a)&&(s="scale("+a+","+a+")"),W_(r,s)},Sn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Sn.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var o=i.element,r=t.get({element:o});z(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){Xi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",wL,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(z(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&Rt(o.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function EL(e){var t=$t('<div class="djs-overlay-container" />');return Vn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function V_(e,t,n){Vn(e,{left:t+"px",top:n+"px"})}function vu(e,t){e.style.display=t===!1?"none":""}function W_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const bu={__init__:["overlays"],overlays:["type",Sn]};function Ah(e,t){t.invoke(de,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)})}Ae(Ah,de),Ah.$inject=["canvas","injector"];const SL={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Ah]};function Nr(e){return CSS.escape(e)}var RL={"&":"&","<":"<",">":">",'"':""","'":"'"};function U_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return RL[t]})}var CL="bjs-breadcrumbs-shown";function q_(e,t,n){var i=$t('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Rt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ge(l),p=Lt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=ML(c));var l=a.flatMap(function(p){var f=n.findRoot(to(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(m){var _=ge(m);return _&&_.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=U_(p.name||p.id),h=$t('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;r.toggle(CL,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}q_.$inject=["eventBus","elementRegistry","canvas"];function ML(e){for(var t=ge(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Y_(e,t){var n=null,i=new AL;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!M(r,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Y_.$inject=["eventBus","canvas"];function AL(){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 K_={x:180,y:160};function $r(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}$r.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)})}},$r.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;M(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),TL(a,e)&&i.push({diElement:r,parent:s})}});var o=[];return n.forEach(function(r){if(!t._processToDiagramMap[r.id]){var a=t._createDiagram(r);t._processToDiagramMap[r.id]=a,o.push(a)}}),i.forEach(function(r){for(var a=r.diElement,s=r.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),o},$r.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=PL(e),i={x:n.x-K_.x,y:n.y-K_.y};t.forEach(function(o){o.waypoint?o.waypoint.forEach(function(r){r.x=r.x-i.x,r.y=r.y-i.y}):o.bounds&&(o.bounds.x=o.bounds.x-i.x,o.bounds.y=o.bounds.y-i.y)})},$r.prototype._moveToDiPlane=function(e,t){var n=X_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},$r.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},$r.$inject=["eventBus","moddle"];function X_(e){return M(e,"bpmndi:BPMNDiagram")?e:X_(e.$parent)}function PL(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=je(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),cl(t)}function TL(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||ot(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var xu=250,kL='<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>',OL="bjs-drilldown-empty";function ar(e,t,n,i,o){de.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",xu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",xu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],xu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],xu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return r._canDrillDown(a)}).map(function(a){r._addOverlay(a)})})}Ae(ar,de),ar.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},ar.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(to(e))},ar.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ge(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Rt(i.html).toggle(OL,!o)}},ar.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ge(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=$t('<button type="button" class="bjs-drilldown">'+kL+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});r.setAttribute("title",s),r.addEventListener("click",function(){t.setRootElement(t.findRoot(to(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},ar.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},ar.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const DL={__depends__:[bu,nh,SL],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",q_],drilldownCentering:["type",Y_],drilldownOverlayBehavior:["type",ar],subprocessCompatibility:["type",$r]};function sr(e){Gt.call(this,e)}Ae(sr,Gt),sr.prototype._modules=[kv,DL,bu,Ri,Ms],sr.prototype._moddleExtensions={};var _u="keyboard.keydown",LL="keyboard.keyup",IL=1e3,Z_="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 Wn(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(Z_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Wn.$inject=["config.keyboard","eventBus"],Wn.prototype._keydownHandler=function(e){this._keyHandler(e,_u)},Wn.prototype._keyupHandler=function(e){this._keyHandler(e,LL)},Wn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||_u,i),n&&e.preventDefault()}},Wn.prototype._isEventIgnored=function(e){return!1},Wn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Z_)),this.unbind(),e=this._node=this._target,$e.bind(e,"keydown",this._keydownHandler),$e.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Wn.prototype.getBinding=function(){return this._node},Wn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),$e.unbind(e,"keydown",this._keydownHandler),$e.unbind(e,"keyup",this._keyupHandler)),this._node=null},Wn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Wn.prototype.addListener=function(e,t,n){bn(e)&&(n=t,t=e,e=IL),this._eventBus.on(n||_u,e,t)},Wn.prototype.removeListener=function(e,t){this._eventBus.off(t||_u,e)},Wn.prototype.hasModifier=U2,Wn.prototype.isCmd=oi,Wn.prototype.isShift=Wd,Wn.prototype.isKey=mn;var BL=500;function Ba(e,t){var n=this;e.on("editorActions.init",BL,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ba.$inject=["eventBus","keyboard"],Ba.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(Z2(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(Q2(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(q2(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(Y2(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(K2(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(X2(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(mn(["+","Add","="],o)&&oi(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(mn(["-","Subtract"],o)&&oi(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(mn("0",o)&&oi(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(mn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const Ph={__init__:["keyboard","keyboardBindings"],keyboard:["type",Wn],keyboardBindings:["type",Ba]};var NL={moveSpeed:50,moveSpeedAccelerated:200};function Q_(e,t,n){var i=this;this._config=U({},NL,e||{}),t.addListener(o);function o(r){var a=r.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(r){var a=0,s=0,c=r.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(r.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}Q_.$inject=["config.keyboardMove","keyboard","canvas"];const J_={__depends__:[Ph],__init__:["keyboardMove"],keyboardMove:["type",Q_]};var $L=15;function ew(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function o(s){var c=n.start,l=n.button,u=Tr(s),p=Fi(u,c);if(!n.dragging&&FL(p)>$L&&(n.dragging=!0,l===0&&yx(e),Ul("grab")),n.dragging){var f=n.last||n.start;p=Fi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){$e.unbind(document,"mousemove",o),$e.unbind(document,"mouseup",r),n=null,mx()}function a(s){if(!Rr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Tr(s)},$e.bind(document,"mousemove",o),$e.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}ew.$inject=["eventBus","canvas"];function FL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const tw={__init__:["moveCanvas"],moveCanvas:["type",ew]};function nw(e,t){var n=zf(e.min),i=zf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function jL(e,t){return Math.max(e.min,Math.min(e.max,t))}var HL=Math.sign||function(e){return e>=0?1:-1},Th={min:.2,max:4},iw=10,zL=.1,GL=.75;function oo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Kn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||GL;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}oo.$inject=["config.zoomScroll","eventBus","canvas"],oo.prototype.scroll=function(t){this._canvas.scroll(t)},oo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},oo.prototype.zoom=function(t,n){var i=nw(Th,iw*2);this._totalDelta+=t,Math.abs(this._totalDelta)>zL&&(this._zoom(t,n,i),this._totalDelta=0)},oo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Sb()&&t.metaKey,o=t.shiftKey,r=-1*this._scale,a;if(i?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*HL(t.deltaY)*r,this.zoom(a,c)}else o?a={dx:r*t.deltaY,dy:0}:a={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(a)}},oo.prototype.stepZoom=function(t,n){var i=nw(Th,iw);this._zoom(t,n,i)},oo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=zf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(jL(Th,s),t)},oo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&$e[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},oo.prototype._init=function(e){this.toggle(e)};const ow={__init__:["zoomScroll"],zoomScroll:["type",oo]};function Js(e){sr.call(this,e)}Ae(Js,sr),Js.prototype._navigationModules=[J_,tw,ow],Js.prototype._modules=[].concat(sr.prototype._modules,Js.prototype._navigationModules);function kh(e){return e&&e[e.length-1]}function rw(e){return e.y}function aw(e){return e.x}var VL={left:aw,center:aw,right:function(e){return e.x+e.width},top:rw,middle:rw,bottom:function(e){return e.y+e.height}};function Na(e,t){this._modeling=e,this._rules=t}Na.$inject=["modeling","rules"],Na.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}},Na.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Na.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(f,d){return Math.round((f[i]+d[i]+d[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=kh(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(z(t,function(f){var d=f[i]+Math.round(f[o]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Vi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=kh(c).center,r;l=t[0],t=Vi(t,function(f){return f[i]+f[o]}),u=kh(t),r[e]=p(l,u)}return r},Na.prototype.trigger=function(e,t){var n=this._modeling,i,o=rt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),ze(i)&&(o=i),!(o.length<2||!i)){var r=VL[t],a=Vi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const WL={__init__:["alignElements"],alignElements:["type",Na]},UL=new Dr;function $a(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}$a.$inject=["eventBus"],$a.prototype.schedule=function(e,t=UL.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},$a.prototype._schedule=function(e,t){const n=qL();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(o){n.reject(o)}}catch(o){console.error("Scheduler#_schedule execution failed",o)}}),promise:n.promise}},$a.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},$a.prototype._cancel=function(e){clearTimeout(e.executionId)};function qL(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const YL={scheduler:["type",$a]};var KL="djs-element-hidden",wu=".entry",XL=1e3,sw=8,ZL=300;function cn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}cn.$inject=["canvas","elementRegistry","eventBus","scheduler"],cn.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var o=i.target,r=ze(o)?o:[o],a=r.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=r.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,o=ze(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},cn.prototype._createContainer=function(){var e=$t('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},cn.prototype.registerProvider=function(e,t){t||(t=e,e=XL),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},cn.prototype.getEntries=function(e){var t=this._getProviders(),n=ze(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(o){if(bn(o[n])){var r=o[n](e);bn(r)?i=r(i):z(r,function(a,s){i[s]=a})}}),i},cn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=En(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},ZL);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},cn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(bn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},cn.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))}},cn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},cn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(o,r){var a=o.group||"default",s=$t(o.html||'<div class="entry" draggable="true"></div>'),c;En(s,"data-action",r),c=Et("[data-group="+Nr(a)+"]",n),c||(c=$t('<div class="group"></div>'),En(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&QL(s,o.className),o.title&&En(s,"title",o.title),o.imageUrl&&(i=$t("<img>"),En(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Rt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},cn.prototype._createHtml=function(e){var t=this,n=$t('<div class="djs-context-pad"></div>');return ti.bind(n,wu,"click",function(i){t.trigger("click",i)}),ti.bind(n,wu,"dragstart",function(i){t.trigger("dragstart",i)}),ti.bind(n,wu,"mouseover",function(i){t.trigger("mouseover",i)}),ti.bind(n,wu,"mouseout",function(i){t.trigger("mouseout",i)}),$e.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},cn.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()&&eI(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},cn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},cn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ze(e)!==ze(n)?!1:ze(e)?e.length===n.length&&Oo(e,function(i){return n.includes(i)}):n===e},cn.prototype.isShown=function(){return this.isOpen()&&Rt(this._current.html).has("open")},cn.prototype.show=function(){this.isOpen()&&(Rt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},cn.prototype.hide=function(){this.isOpen()&&(Rt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},cn.prototype._getPosition=function(e){if(!ze(e)&&kt(e)){var t=this._canvas.viewbox(),n=JL(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+sw*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+sw*this._canvas.zoom(),top:s.top-a.top}},cn.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")},cn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ze(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,KL)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},cn.prototype._getTargetBounds=function(e){var t=this,n=ze(e)?e:[e],i=n.map(function(o){return t._canvas.getGraphics(o)});return i.reduce(function(o,r){const a=r.getBoundingClientRect();return o.top=Math.min(o.top,a.top),o.right=Math.max(o.right,a.right),o.bottom=Math.max(o.bottom,a.bottom),o.left=Math.min(o.left,a.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function QL(e,t){var n=Rt(e);t=ze(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function JL(e){return e.waypoints[e.waypoints.length-1]}function eI(e,t){return e=ze(e)?e:[e],t=ze(t)?t:[t],e.length===t.length&&Oo(e,function(n){return t.includes(n)})}const cw={__depends__:[Wl,YL,bu],contextPad:["type",cn]};var Eu,Wt,lw,cr,uw,pw,fw,Oh,Su,ec,dw,Dh,Lh,Ih,Ru={},Cu=[],tI=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Mu=Array.isArray;function Co(e,t){for(var n in t)e[n]=t[n];return e}function Bh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hw(e,t,n){var i,o,r,a={};for(r in t)r=="key"?i=t[r]:r=="ref"?o=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?Eu.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)a[r]===void 0&&(a[r]=e.defaultProps[r]);return Au(e,a,i,o,null)}function Au(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++lw,__i:-1,__u:0};return o==null&&Wt.vnode!=null&&Wt.vnode(r),r}function Pu(e){return e.children}function Tu(e,t){this.props=e,this.context=t}function Fr(e,t){if(t==null)return e.__?Fr(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"?Fr(e):null}function nI(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Co({},t);r.__v=t.__v+1,Wt.vnode&&Wt.vnode(r),Nh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Fr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,ww(i,r,o),t.__e=t.__=null,r.__e!=n&&gw(r)}}function gw(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}),gw(e)}function mw(e){(!e.__d&&(e.__d=!0)&&cr.push(e)&&!ku.__r++||uw!=Wt.debounceRendering)&&((uw=Wt.debounceRendering)||pw)(ku)}function ku(){try{for(var e,t=1;cr.length;)cr.length>t&&cr.sort(fw),e=cr.shift(),t=cr.length,nI(e)}finally{cr.length=ku.__r=0}}function yw(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,_=i&&i.__k||Cu,v=t.length;for(c=iI(n,t,_,c,v),p=0;p<v;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&_[d.__i]||Ru,d.__i=p,m=Nh(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&$h(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=vw(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function iI(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,f=0;for(e.__k=new Array(o),r=0;r<o;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=Au(null,a,null,null,null):Mu(a)?a=e.__k[r]=Au(Pu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Au(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+f,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=oI(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?f--:o<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Fr(s)),Sw(s,s));return i}function vw(e,t,n){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=vw(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Fr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function oI(e,t,n,i){var o,r,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(o=n-1,r=n+1;o>=0||r<t.length;)if((l=t[a=o>=0?o--:r++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function bw(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||tI.test(t)?n:n+"px"}function Ou(e,t,n,i,o){var r,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||bw(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||bw(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(dw,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?i?n[ec]=i[ec]:(n[ec]=Dh,e.addEventListener(t,r?Ih:Lh,r)):e.removeEventListener(t,r?Ih:Lh,r);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function xw(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Su]==null)t[Su]=Dh++;else if(t[Su]<n[ec])return;return n(Wt.event?Wt.event(t):t)}}}function Nh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,_,v,y,b,E,w,P,T,D,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Wt.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(v=t.props,y=N.prototype&&N.prototype.render,b=(u=N.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new N(v,E):(t.__c=f=new Tu(v,E),f.constructor=N,f.render=aI),b&&b.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Co({},f.__s)),Co(f.__s,N.getDerivedStateFromProps(v,f.__s))),g=f.props,h=f.state,f.__v=t,d)y&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&N.getDerivedStateFromProps==null&&v!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(v,f.__s,E)===!1){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function($){$&&($.__=t)}),Cu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Fr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,E),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=v,f.__P=e,f.__e=!1,w=Wt.__r,P=0,y)f.state=f.__s,f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),Cu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(i=Co(Co({},i),f.getChildContext())),y&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),T=u!=null&&u.type===Pu&&u.key==null?Ew(u.props.children):u,s=yw(e,Mu(T)?T:[T],t,n,i,o,r,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),_&&(f.__E=f.__=null)}catch($){if(a.length=p,t.__v=null,c||r!=null){if($.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r!=null&&(r[r.indexOf(s)]=null),t.__e=s}else if(r!=null)for(D=r.length;D--;)Bh(r[D])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),$.then||_w(t),Wt.__e($,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=rI(n.__e,t,n,i,o,r,a,c,l);return(u=Wt.diffed)&&u(t),128&t.__u?void 0:s}function _w(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(_w))}function ww(e,t,n){for(var i=0;i<n.length;i++)$h(n[i],n[++i],n[++i]);Wt.__c&&Wt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Wt.__e(r,o.__v)}})}function Ew(e){return typeof e!="object"||e==null||e.__b>0?e:Mu(e)?e.map(Ew):e.constructor!==void 0?null:Co({},e)}function rI(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||Ru,_=t.props,v=t.type;if(v=="svg"?o="http://www.w3.org/2000/svg":v=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((d=r[l])&&"setAttribute"in d==!!v&&(v?d.localName==v:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(o,v,_.is&&_),s&&(Wt.__m&&Wt.__m(t,r),s=!1),r=null}if(v==null)m===_||s&&e.data==_||(e.data=_);else{if(r=v=="textarea"&&_.defaultValue!=null?null:r&&Eu.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(d=e.attributes[l]).name]=d.value;for(l in m)d=m[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||Ou(e,l,null,d,o);for(l in _)d=_[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||Ou(e,l,d,m[l],o);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),yw(t.type=="template"?e.content:e,Mu(f)?f:[f],t,n,i,v=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Fr(n,0),s,c),r!=null)for(l=r.length;l--;)Bh(r[l]);s&&v!="textarea"||(l="value",v=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||v=="progress"&&!g||v=="option"&&g!=m[l])&&Ou(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&Ou(e,l,h,m[l],o))}return e}function $h(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(o){Wt.__e(o,n)}}function Sw(e,t,n){var i,o;if(Wt.unmount&&Wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||$h(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Wt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&Sw(i[o],t,n||typeof e.type!="function");n||Bh(e.__e),e.__c=e.__=e.__e=void 0}function aI(e,t,n){return this.constructor(e,n)}function Rw(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Wt.__&&Wt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Nh(t,e=t.__k=hw(Pu,null,[e]),o||Ru,Ru,t.namespaceURI,o?null:t.firstChild?Eu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),ww(r,e,a),e.props.children=null}Eu=Cu.slice,Wt={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},lw=0,Tu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Co({},this.state),typeof e=="function"&&(e=e(Co({},n),this.props)),e&&Co(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),mw(this))},Tu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),mw(this))},Tu.prototype.render=Pu,cr=[],pw=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fw=function(e,t){return e.__v.__b-t.__v.__b},ku.__r=0,Oh=Math.random().toString(8),Su="__d"+Oh,ec="__a"+Oh,dw=/(PointerCapture)$|Capture$/i,Dh=0,Lh=xw(!1),Ih=xw(!0);var Cw=function(e,t,n,i){var o;t[0]=0;for(var r=1;r<t.length;r++){var a=t[r++],s=t[r]?(t[0]|=a?1:2,n[t[r++]]):t[++r];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++r]]=s:a===6?i[1][t[++r]]+=s+"":a?(o=e.apply(s,Cw(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},Mw=new Map;function sI(e){var t=Mw.get(this);return t||(t=new Map,Mw.set(this,t)),(t=Cw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(f){r===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):r===3&&(f||a)?(c.push(3,f,a),r=2):r===2&&a==="..."&&f?c.push(4,f,0):r===2&&a&&!f?c.push(5,0,!0,a):r>=5&&((a||!f&&r===5)&&(c.push(r,0,a,o),r=6),f&&(c.push(r,f,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Dt=sI.bind(hw),Fa,ln,Fh,Aw,
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Gt.prototype._setDefinitions=function(e){this._definitions=e},Gt.prototype.getModules=function(){return this._modules},Gt.prototype.clear=function(){this.getDefinitions()&&qo.prototype.clear.call(this)},Gt.prototype.destroy=function(){qo.prototype.destroy.call(this),Xi(this._container)},Gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gt.prototype.getDefinitions=function(){return this._definitions},Gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=U(Wi(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:a});qo.call(this,s),n&&n.container&&this.attachTo(n.container)},Gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gt.prototype._createContainer=function(e){const t=$t('<div class="bjs-container"></div>');return Vn(t,{width:wv(e.width),height:wv(e.height),position:e.position}),t},Gt.prototype._createModdle=function(e){const t=U({},this._moddleExtensions,e.moddleExtensions);return new tm(t)},Gt.prototype._modules=[];function hl(e,t){return e.warnings=t,e}function kP(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 OP={width:"100%",height:"100%",position:"relative"};function wv(e){return e+(Ge(e)?"px":"")}function DP(e,t){return t&&Lt(e.diagrams,function(n){return n.id===t})||null}function LP(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+vv+"</a>",i=$t(n);Vn(Et("svg",i),bv),Vn(i,xv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),$e.bind(i,"click",function(o){TP(),o.preventDefault()})}function va(e){Gt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ae(va,Gt),va.prototype._createModdle=function(e){var t=Gt.prototype._createModdle.call(this,e);return t.ids=new Ki([32,36,1]),t},va.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,o;i.clear();for(o in t)i.claim(o,t[o])};function ut(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||dt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!ge(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=dt(e).isHorizontal;return t===void 0?!0:t}}function IP(e){return e&&ge(e).isInterrupting!==!1}function jn(e){return e&&!!ge(e).triggeredByEvent}function ba(e,t){var n=ge(e).eventDefinitions;return Do(n,function(i){return M(i,t)})}function BP(e){return ba(e,"bpmn:ErrorEventDefinition")}function NP(e){return ba(e,"bpmn:EscalationEventDefinition")}function $P(e){return ba(e,"bpmn:CompensateEventDefinition")}var Ar={width:90,height:20},Ev=15;function Yo(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 gl(e){return it(e.label)}function FP(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=jP(e),r=Math.atan((i.y-n.y)/(i.x-n.x)),a=o.x,s=o.y;return Math.abs(r)<Math.PI/2?s-=Ev:a+=Ev,{x:a,y:s}}function jP(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 $f(e){return e.waypoints?FP(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ar.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ar.height/2}}function HP(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Ar.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=$f(t),i=Ar),U({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Sv(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 zP(e){var t=e.categoryValueRef;return t&&t.value||""}function yi(e){var t=e.businessObject,n=Sv(t);if(n)return n==="categoryValueRef"?zP(t):t[n]||""}function GP(e,t){var n=e.businessObject,i=Sv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function VP(e){return it(e)&&Yo(e.labelTarget)}var xa=7;function Rv(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(kf(e),n=>{z(Rv(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 Ff="hsl(225, 10%, 15%)",WP="white";function eo(e,t){return Do(e.eventDefinitions,function(n){return n.$type===t})}function UP(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function qP(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function at(e,t,n){var i=dt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||WP}function Re(e,t,n){var i=dt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Ff}function Cs(e,t,n,i){var o=dt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Re(e,n)}function Cv(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,o=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Cr(o)}function jf(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=[["M",n+t,i],["l",o-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-o,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return Cr(a)}function YP(e){var t=e.width,n=e.height,i=e.x,o=e.y,r=t/2,a=n/2,s=[["M",i+r,o],["l",r,a],["l",-r,a],["l",-r,-a],["z"]];return Cr(s)}function KP(e){var t=e.x,n=e.y,i=e.width,o=e.height,r=[["M",t,n],["l",i,0],["l",0,o],["l",-i,0],["z"]];return Cr(r)}function Ms(e,t={}){return{width:_i(e,t),height:ii(e,t)}}function _i(e,t={}){return Jn(t,"width")?t.width:e.width}function ii(e,t={}){return Jn(t,"height")?t.height:e.height}var XP=new Ki,ZP=10,ml=3,QP=1.5,yl=10,JP=4,_a=.95,eT=1,tT=.25;function Pr(e,t,n,i,o,r,a){go.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(B){return n.computeStyle(B,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ff,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ff,strokeWidth:2})}function f(B,C){var{ref:R={x:0,y:0},scale:G=1,element:K,parentGfx:ie=o._svg}=C,Pe=Le("marker",{id:B,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});qe(Pe,K);var et=Et(":scope > defs",ie);et||(et=Le("defs"),qe(ie,et)),qe(et,Pe)}function d(B,C,R,G){var K=XP.nextPrefixed("marker-");return g(B,K,C,R,G),"url(#"+K+")"}function g(B,C,R,G,K){if(R==="sequenceflow-end"){var ie=Le("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:K,stroke:K,strokeWidth:1})});f(C,{element:ie,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(R==="messageflow-start"){var Pe=Le("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:K,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Pe,ref:{x:6,y:6},parentGfx:B})}if(R==="messageflow-end"){var et=Le("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:K,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:et,ref:{x:8.5,y:5},parentGfx:B})}if(R==="association-start"){var mt=Le("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:K,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(R==="association-end"){var qt=Le("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:K,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:qt,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(R==="conditional-flow-marker"){var Ct=Le("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:K})});f(C,{element:Ct,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(R==="conditional-default-flow-marker"){var vn=Le("path",{d:"M 6 4 L 10 16",...u({stroke:K,fill:"none"})});f(C,{element:vn,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function h(B,C,R,G,K={}){hn(G)&&(K=G,G=0),G=G||0,K=u(K);var ie=C/2,Pe=R/2,et=Le("circle",{cx:ie,cy:Pe,r:Math.round((C+R)/4-G),...K});return qe(B,et),et}function m(B,C,R,G,K,ie){hn(K)&&(ie=K,K=0),K=K||0,ie=u(ie);var Pe=Le("rect",{x:K,y:K,width:C-K*2,height:R-K*2,rx:G,ry:G,...ie});return qe(B,Pe),Pe}function _(B,C,R,G){var K=C/2,ie=R/2,Pe=[{x:K,y:0},{x:C,y:ie},{x:K,y:R},{x:0,y:ie}],et=Pe.map(function(qt){return qt.x+","+qt.y}).join(" ");G=u(G);var mt=Le("polygon",{...G,points:et});return qe(B,mt),mt}function v(B,C,R,G){R=p(R);var K=vs(C,R,G);return qe(B,K),K}function y(B,C,R){return v(B,C,R,5)}function b(B,C,R){R=p(R);var G=Le("path",{...R,d:C});return qe(B,G),G}function E(B,C,R,G){return b(C,R,U({"data-marker":B},G))}function w(B){return De[B]}function P(B){return function(C,R,G){return w(B)(C,R,G)}}var T={"bpmn:MessageEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill),Pe=G?at(C,s,R.fill):Re(C,c,R.stroke),et=b(B,K,{fill:ie,stroke:Pe,strokeWidth:1});return et},"bpmn:TimerEventDefinition":function(B,C,R={}){var G=R.width||C.width,K=R.height||C.height,ie=R.width?1:2,Pe=h(B,G,K,.2*K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:ie}),et=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:K,position:{mx:.5,my:.5}});b(B,et,{stroke:Re(C,c,R.stroke),strokeWidth:ie});for(var mt=0;mt<12;mt++){var qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:K,position:{mx:.5,my:.5}}),Ct=G/2,vn=K/2;b(B,qt,{strokeWidth:1,stroke:Re(C,c,R.stroke),transform:"rotate("+mt*30+","+vn+","+Ct+")"})}return Pe},"bpmn:EscalationEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,C,R={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return b(B,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ie=G?Re(C,c,R.stroke):"none",Pe=b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1});return mv(Pe,45),Pe},"bpmn:CompensateEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{strokeWidth:1,fill:ie,stroke:Re(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(B,C,R={},G){var K=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),ie=G?Re(C,c,R.stroke):at(C,s,R.fill);return b(B,K,{fill:ie,stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,C,R={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return b(B,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,C,R={}){var G=h(B,C.width,C.height,8,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:4});return G}};function O(B,C,R={},G){var K=ge(B),ie=UP(K),Pe=G||B;return K.get("eventDefinitions")&&K.get("eventDefinitions").length>1?K.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](C,Pe,R,ie):T["bpmn:MultipleEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](C,Pe,R,ie):eo(K,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](C,Pe,R,ie):null}var N={ParticipantMultiplicityMarker:function(B,C,R={}){var G=_i(C,R),K=ii(C,R),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2-6)/G,my:(K-15)/K}});E("participant-multiplicity",B,ie,{strokeWidth:2,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},SubProcessMarker:function(B,C,R={}){var G=m(B,14,14,0,{strokeWidth:1,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)});On(G,C.width/2-7.5,C.height-20);var K=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2-7.5)/C.width,my:(C.height-20)/C.height}});E("sub-process",B,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},ParallelMarker:function(B,C,R){var G=_i(C,R),K=ii(C,R),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.parallel)/G,my:(K-20)/K}});E("parallel",B,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},SequentialMarker:function(B,C,R){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",B,G,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},CompensationMarker:function(B,C,R){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",B,G,{strokeWidth:1,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})},LoopMarker:function(B,C,R){var G=_i(C,R),K=ii(C,R),ie=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.loop)/G,my:(K-7)/K}});E("loop",B,ie,{strokeWidth:1.5,fill:"none",stroke:Re(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,C,R){var G=_i(C,R),K=ii(C,R),ie=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:(G/2+R.adhoc)/G,my:(K-15)/K}});E("adhoc",B,ie,{strokeWidth:1,fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke)})}};function $(B,C,R,G){N[B](C,R,G)}function H(B,C,R=[],G={}){G={fill:G.fill,stroke:G.stroke,width:_i(C,G),height:ii(C,G)};var K=ge(C),ie=R.includes("SubProcessMarker");ie?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},K.get("isForCompensation")&&R.push("CompensationMarker"),M(K,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),ie||U(G,{compensation:G.compensation-18}));var Pe=K.get("loopCharacteristics"),et=Pe&&Pe.get("isSequential");Pe&&(U(G,{compensation:G.compensation-18}),R.includes("AdhocMarker")&&U(G,{seq:-23,loop:-18,parallel:-24}),et===void 0&&R.push("LoopMarker"),et===!1&&R.push("ParallelMarker"),et===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&U(G,{compensation:-8}),z(R,function(mt){$(mt,B,C,G)})}function Q(B,C,R={}){R=U({size:{width:100}},R);var G=r.createText(C||"",R);return lt(G).add("djs-label"),qe(B,G),G}function J(B,C,R,G={}){var K=ge(C),ie=Ms({x:C.x,y:C.y,width:C.width,height:C.height},G);return Q(B,K.name,{align:R,box:ie,padding:7,style:{fill:Cs(C,l,c,G.stroke)}})}function V(B,C,R={}){var G={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Q(B,yi(C),{box:G,style:U({},r.getExternalStyle(),{fill:Cs(C,l,c,R.stroke)})})}function we(B,C,R,G={}){var K=xn(R),ie=Q(B,C,{box:{height:30,width:K?ii(R,G):_i(R,G)},align:"center-middle",style:{fill:Cs(R,l,c,G.stroke)}});if(K){var Pe=-1*ii(R,G);fl(ie,0,-Pe,270)}}function Ce(B,C,R={}){var{width:G,height:K}=Ms(C,R);return m(B,G,K,yl,{...R,fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke)})}function ke(B,C,R={}){var G=ge(C),K=at(C,s,R.fill),ie=Re(C,c,R.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(R.markerEnd=d(B,"association-end",K,ie)),G.get("associationDirection")==="Both"&&(R.markerStart=d(B,"association-start",K,ie)),R=ht(R,["markerStart","markerEnd"]),y(B,C.waypoints,{...R,stroke:ie,strokeDasharray:"0, 5"})}function Ee(B,C,R={}){var G=at(C,s,R.fill),K=Re(C,c,R.stroke),ie=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Pe=b(B,ie,{fill:G,fillOpacity:_a,stroke:K}),et=ge(C);if(qP(et)){var mt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});b(B,mt,{strokeWidth:2,fill:G,stroke:K})}return Pe}function Y(B,C,R={}){return h(B,C.width,C.height,{fillOpacity:_a,...R,fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke)})}function ne(B,C,R={}){return _(B,C.width,C.height,{fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke)})}function W(B,C,R={}){var G=m(B,_i(C,R),ii(C,R),0,{fill:at(C,s,R.fill),fillOpacity:R.fillOpacity||_a,stroke:Re(C,c,R.stroke),strokeWidth:1.5}),K=ge(C);if(M(K,"bpmn:Lane")){var ie=K.get("name");we(B,ie,C,R)}return G}function Z(B,C,R={}){var G=Ce(B,C,R),K=ut(C);if(jn(C)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!K)){var ie=ge(C).flowElements||[],Pe=ie.filter(et=>M(et,"bpmn:StartEvent"));Pe.length===1&&oe(Pe[0],B,R,C)}return J(B,C,K?"center-top":"center-middle",R),K?H(B,C,void 0,R):H(B,C,["SubProcessMarker"],R),G}function oe(B,C,R,G){var K=22,ie={fill:at(G,s,R.fill),stroke:Re(G,c,R.stroke),width:K,height:K},Pe=ge(B).isInterrupting,et=Pe?0:3,mt=Pe?1:1.2,qt=20,Ct=(K-qt)/2,vn="translate("+Ct+","+Ct+")";h(C,qt,qt,{fill:ie.fill,stroke:ie.stroke,strokeWidth:mt,strokeDasharray:et,transform:vn}),O(B,C,ie,G)}function he(B,C,R={}){var G=Ce(B,C,R);return J(B,C,"center-middle",R),H(B,C,void 0,R),G}var De=this.handlers={"bpmn:AdHocSubProcess":function(B,C,R={}){return ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]),Z(B,C,R)},"bpmn:Association":function(B,C,R={}){return R=ht(R,["fill","stroke"]),ke(B,C,R)},"bpmn:BoundaryEvent":function(B,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=ge(C),ie=K.get("cancelActivity");R={strokeWidth:1.5,fill:at(C,s,R.fill),fillOpacity:eT,stroke:Re(C,c,R.stroke)},ie||(R.strokeDasharray="6");var Pe=Y(B,C,R);return h(B,C.width,C.height,ml,{...R,fill:"none"}),G&&O(C,B,R),Pe},"bpmn:BusinessRuleTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ie=b(B,K);Se(ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1});var Pe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),et=b(B,Pe);return Se(et,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,C,R={}){return R=ht(R,["fill","stroke"]),Z(B,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(B,C,R),K=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(B,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),K=Ee(B,C,R);return b(B,G,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1}),K},"bpmn:DataInputAssociation":function(B,C,R={}){return R=ht(R,["fill","stroke"]),ke(B,C,{...R,markerEnd:d(B,"association-end",at(C,s,R.fill),Re(C,c,R.stroke))})},"bpmn:DataObject":function(B,C,R={}){return R=ht(R,["fill","stroke"]),Ee(B,C,R)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),K=Ee(B,C,R);return b(B,G,{strokeWidth:1,fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke)}),K},"bpmn:DataOutputAssociation":function(B,C,R={}){return R=ht(R,["fill","stroke"]),ke(B,C,{...R,markerEnd:d(B,"association-end",at(C,s,R.fill),Re(C,c,R.stroke))})},"bpmn:DataStoreReference":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(B,G,{fill:at(C,s,R.fill),fillOpacity:_a,stroke:Re(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=Y(B,C,{...R,strokeWidth:4});return G&&O(C,B,R),K},"bpmn:EventBasedGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=ne(B,C,R);h(B,C.width,C.height,C.height*.2,{fill:at(C,"none",R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1});var ie=G.get("eventGatewayType"),Pe=!!G.get("instantiate");function et(){var qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(B,qt,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:2})}if(ie==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(B,mt,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1})}else ie==="Exclusive"&&(Pe||h(B,C.width,C.height,C.height*.26,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1}),et());return K},"bpmn:ExclusiveGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(B,C,R),K=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ie=dt(C);return ie.get("isMarkerVisible")&&b(B,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,C,R={}){return R=ht(R,["fill","stroke"]),ne(B,C,R)},"bpmn:Group":function(B,C,R={}){return R=ht(R,["fill","stroke","width","height"]),m(B,C.width,C.height,yl,{stroke:Re(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(C,R),height:ii(C,R)})},"bpmn:InclusiveGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(B,C,R);return h(B,C.width,C.height,C.height*.24,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=Y(B,C,{...R,strokeWidth:1.5});return h(B,C.width,C.height,ml,{fill:"none",stroke:Re(C,c,R.stroke),strokeWidth:1.5}),G&&O(C,B,R),K},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,C,R={}){return R=ht(R,["fill","stroke","width","height"]),W(B,C,{...R,fillOpacity:tT})},"bpmn:ManualTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(B,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=dt(C),ie=at(C,s,R.fill),Pe=Re(C,c,R.stroke),et=y(B,C.waypoints,{markerEnd:d(B,"messageflow-end",ie,Pe),markerStart:d(B,"messageflow-start",ie,Pe),stroke:Pe,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=et.getPointAtLength(et.getTotalLength()/2),qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),Ct={strokeWidth:1};K.get("messageVisibleKind")==="initiating"?(Ct.fill=ie,Ct.stroke=Pe):(Ct.fill=Pe,Ct.stroke=ie);var vn=b(B,qt,Ct),Rn=G.get("messageRef"),Un=Rn.get("name"),At=Q(B,Un,{align:"center-top",fitBox:!0,style:{fill:Pe}}),Qt=vn.getBBox(),_n=At.getBBox(),qa=mt.x-_n.width/2,qn=mt.y+Qt.height/2+ZP;fl(At,qa,qn,0)}return et},"bpmn:ParallelGateway":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ne(B,C,R),K=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(B,K,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,C,R={}){R=ht(R,["fill","stroke","width","height"]);var G=W(B,C,R),K=ut(C),ie=xn(C),Pe=ge(C),et=Pe.get("name");if(K){var mt=ie?[{x:30,y:0},{x:30,y:ii(C,R)}]:[{x:0,y:30},{x:_i(C,R),y:30}];v(B,mt,{stroke:Re(C,c,R.stroke),strokeWidth:QP}),we(B,et,C,R)}else{var qt=Ms(C,R);ie||(qt.height=_i(C,R),qt.width=ii(C,R));var Ct=Q(B,et,{box:qt,align:"center-middle",style:{fill:Cs(C,l,c,R.stroke)}});if(!ie){var vn=-1*ii(C,R);fl(Ct,0,-vn,270)}}return Pe.get("participantMultiplicity")&&$("ParticipantMultiplicityMarker",B,C,R),G},"bpmn:ReceiveTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=ge(C),K=he(B,C,R),ie;return G.get("instantiate")?(h(B,28,28,20*.22,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),ie=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ie=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(B,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),K},"bpmn:ScriptTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(B,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(B,K,{fill:Re(C,c,R.stroke),stroke:at(C,s,R.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=at(C,s,R.fill),K=Re(C,c,R.stroke),ie=y(B,C.waypoints,{markerEnd:d(B,"sequenceflow-end",G,K),stroke:K}),Pe=ge(C),{source:et}=C;if(et){var mt=ge(et);Pe.get("conditionExpression")&&M(mt,"bpmn:Activity")&&Se(ie,{markerStart:d(B,"conditional-flow-marker",G,K)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Pe&&Se(ie,{markerStart:d(B,"conditional-default-flow-marker",G,K)})}return ie},"bpmn:ServiceTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R);h(B,10,10,{fill:at(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(B,K,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),h(B,10,10,{fill:at(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var ie=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(B,ie,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,C,R={}){var{renderIcon:G=!0}=R;R=ht(R,["fill","stroke"]);var K=ge(C);K.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var ie=Y(B,C,R);return G&&O(C,B,R),ie},"bpmn:SubProcess":function(B,C,R={}){return ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]),Z(B,C,R)},"bpmn:Task":function(B,C,R={}){return R=ht(R,["fill","stroke"]),he(B,C,R)},"bpmn:TextAnnotation":function(B,C,R={}){R=ht(R,["fill","stroke"]);var{width:G,height:K}=Ms(C,R),ie=m(B,G,K,0,0,{fill:"none",stroke:"none"}),Pe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:K,position:{mx:0,my:0}});b(B,Pe,{stroke:Re(C,c,R.stroke)});var et=ge(C),mt=et.get("text")||"";return Q(B,mt,{align:"left-top",box:Ms(C,R),padding:xa,style:{fill:Cs(C,l,c,R.stroke)}}),ie},"bpmn:Transaction":function(B,C,R={}){ut(C)?R=ht(R,["fill","stroke","width","height"]):R=ht(R,["fill","stroke"]);var G=Z(B,C,{strokeWidth:1.5,...R}),K=n.style(["no-fill","no-events"],{stroke:Re(C,c,R.stroke),strokeWidth:1.5}),ie=ut(C);return ie||(R={}),m(B,_i(C,R),ii(C,R),yl-ml,ml,K),G},"bpmn:UserTask":function(B,C,R={}){R=ht(R,["fill","stroke"]);var G=he(B,C,R),K=15,ie=12,Pe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:K,y:ie}});b(B,Pe,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:K,y:ie}});b(B,et,{fill:at(C,s,R.fill),stroke:Re(C,c,R.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:K,y:ie}});return b(B,mt,{fill:Re(C,c,R.stroke),stroke:Re(C,c,R.stroke),strokeWidth:.5}),G},label:function(B,C,R={}){return V(B,C,R)}};this._drawPath=b,this._renderer=w}Ae(Pr,go),Pr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Pr.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},Pr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Pr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Pr.prototype.getShapePath=function(e){return it(e)?jf(e,JP):M(e,"bpmn:Event")?Cv(e):M(e,"bpmn:Activity")?jf(e,yl):M(e,"bpmn:Gateway")?YP(e):KP(e)};function ht(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var nT=0,iT={width:150,height:50};function oT(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function rT(e){return hn(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Hf=null;function aT(){return Hf||(Hf=document.createElement("canvas").getContext("2d")),Hf}function sT(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(Mv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Mv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function cT(e,t){var n=aT();if(!n)return{width:0,height:0};n.font=sT(t),"letterSpacing"in n&&(n.letterSpacing=Mv(t.letterSpacing)||"0px");var i=e==="",o=i?"dummy":e.replace(/\s+$/,""),r=n.measureText(o);return{width:i?0:r.width,height:"fontBoundingBoxAscent"in r?r.fontBoundingBoxAscent+r.fontBoundingBoxDescent:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent}}function lT(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=cT(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return uT(e,o,i,r);o=fT(o,r.width,t)}}function uT(e,t,n,i){if(t.length<n.length){var o=n.slice(t.length).trim();e.unshift(o)}return{width:i.width,height:i.height,text:t}}var Av="";function pT(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,o=[],r=0;if(n.length>1)for(;i=n.shift();)if(i.length+r<t)o.push(i),r+=i.length;else{(i==="-"||i===Av)&&o.pop();break}var a=o[o.length-1];return a&&a===Av&&(o[o.length-1]="-"),o.join("")}function fT(e,t,n){var i=Math.max(e.length*(n/t),1),o=pT(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function vl(e){this._config=U({},{size:iT,padding:nT,style:{},align:"center-top"},e||{})}vl.prototype.createText=function(e,t){return this.layoutText(e,t).element},vl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},vl.prototype.layoutText=function(e,t){for(var n=U({},this._config.size,t.box),i=U({},this._config.style,t.style),o=oT(t.align||this._config.align),r=rT(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=dT(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(lT(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ei(l,function(m,_,v){return m+(s||_.height)},0)+r.top+r.bottom,f=ei(l,function(m,_,v){return _.width>m?_.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Le("text");Se(g,i),z(l,function(m){var _;switch(d+=s||m.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?f:u)-r.right-m.width;break;default:_=Math.max(((a?f:u)-m.width)/2+r.left,0)}var v=Le("tspan");Se(v,{x:_,y:d}),v.textContent=m.text,qe(g,v)});var h={width:f,height:p};return{dimensions:h,element:g}};function dT(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var hT=12,gT=1.2,mT=40;function Pv(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:hT,fontWeight:"normal",lineHeight:gT},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=U({},t,{fontSize:n},e&&e.externalStyle||{}),o=new vl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Ar.width),height:30},l=r(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=r(s,a,{style:t,align:"left-top",padding:xa});return{x:a.x,y:a.y,width:a.width,height:Math.max(mT,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,U({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Pv.$inject=["config.textRenderer"];function yT(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],o,r;n.abspos?(o=n.abspos.x,r=n.abspos.y):(o=n.containerWidth*n.position.mx,r=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=_T(i.d,{mx:o,my:r,e:a});return p}}var vT=/\{([^{}]+)\}/g,bT=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function xT(e,t,n){var i=n;return t.replace(bT,function(o,r,a,s,c){r=r||s,i&&(r in i&&(i=i[r]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function _T(e,t){return String(e).replace(vT,function(n,i){return xT(n,i,t)})}const wT={__init__:["bpmnRenderer"],bpmnRenderer:["type",Pr],textRenderer:["type",Pv],pathMap:["type",yT]};function ET(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const As={translate:["value",ET]};function bl(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function ST(e,t,n){var i=e.waypoint;return!i||i.length<2?[We(t),We(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Tv(e,t,n){return new Error(`element ${Fn(t)} referenced by ${Fn(e)}#${n} not yet drawn`)}function bo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}bo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],bo.prototype.add=function(e,t,n){var i,o,r;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(bl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!ut(e,t),c=CT(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(bl(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(r=0),M(e,"bpmn:DataStoreReference")&&(RT(n,We(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(bl(e,t,{hidden:o,source:u,target:p,waypoints:ST(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Fn(t)} for element ${Fn(e)}`);return Yo(e)&&yi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},bo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Fn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Tv(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},bo.prototype.addLabel=function(e,t,n){var i,o,r;return i=HP(t,n),o=yi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(bl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!yi(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(r,n.parent)},bo.prototype._getConnectedElement=function(e,t){var n,i,o=e.$type;if(i=e[t+"Ref"],t==="source"&&o==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&o==="bpmn:DataOutputAssociation"||t==="target"&&o==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Tv(e,i,t+"Ref"):new Error(`${Fn(e)}#${t} Ref not specified`)},bo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},bo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},bo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function RT(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 CT(e){return M(e,"bpmn:Group")}const kv={__depends__:[wT,{__depends__:[As],bpmnImporter:["type",bo]}]};function Ps(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Fi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zf(e){return Math.log(e)/Math.log(10)}var MT=1e3;function de(e){this._eventBus=e}de.$inject=["eventBus"];function AT(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}de.prototype.on=function(e,t,n,i,o,r){if((bn(t)||Ge(t))&&(r=o,o=i,i=n,n=t,t=null),bn(n)&&(r=o,o=i,i=n,n=MT),hn(o)&&(r=o,o=!1),!bn(i))throw new Error("handlerFn must be a function");ze(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?AT(i,r):i,r)})},de.prototype.canExecute=xo("canExecute"),de.prototype.preExecute=xo("preExecute"),de.prototype.preExecuted=xo("preExecuted"),de.prototype.execute=xo("execute"),de.prototype.executed=xo("executed"),de.prototype.postExecute=xo("postExecute"),de.prototype.postExecuted=xo("postExecuted"),de.prototype.revert=xo("revert"),de.prototype.reverted=xo("reverted");function xo(e){return function(n,i,o,r,a){(bn(n)||Ge(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Gf=["top","bottom","left","right"],xl=10;function Vf(e,t){de.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(gl(o)&&!kt(o)){var r=kT(o);r&&i(o,r)}}function i(o,r){var a=We(o),s=o.label,c=We(s);if(s.parent){var l=je(o),u;switch(r){case"top":u={x:a.x,y:l.top-xl-s.height/2};break;case"left":u={x:l.left-xl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+xl+s.height/2};break;case"right":u={x:l.right+xl+s.width/2,y:a.y};break}var p=Fi(u,c);t.moveShape(s,p)}}}Ae(Vf,de),Vf.$inject=["eventBus","modeling"];function PT(e){var t=e.host,n=We(e),i=kn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Gf.filter(function(a){return o.indexOf(a)===-1});return r}function TT(e){var t=We(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 Ov(t,i)});return n}function kT(e){var t=We(e.label),n=We(e),i=Ov(n,t);if(OT(i)){var o=TT(e);if(e.host){var r=PT(e);o=o.concat(r)}var a=Gf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?kn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Ov(e,t){return kn(t,e,5)}function OT(e){return Gf.indexOf(e)!==-1}function Wf(e){de.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)}Ae(Wf,de),Wf.$inject=["eventBus"];var DT=1500;function Uf(e,t,n){e.invoke(de,this),this.preExecute("elements.delete",DT,function(o){var r=o.context,a=r.elements,s=i(a);s.length&&(r.elements=a.concat(s))}),t.on("shape.move.start",function(o){var r=o.context.shapes,a=i(r);a.length&&(o.context.shapes=r.concat(a))});function i(o){var r=rt(o,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(r,l=>{const u=new Set(Jr(ga(Array.from(s),an(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ae(Uf,de),Uf.$inject=["injector","eventBus","canvas"];function qf(e,t){e.invoke(de,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=rt(o.incoming.concat(o.outgoing),function(a){return M(a,"bpmn:Association")});z(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ae(qf,de),qf.$inject=["injector","modeling"];function wa(e,t){for(Qn(t)&&(t=[t]);e=e.parent;)if(ot(e,t))return e;return null}function Dv(e,t){var n=wa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=wa(e,i),n)return xn(n);if(ot(e,i))return xn(e);var o;for(o=ge(e);o&&!M(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=ge(a);return s&&s.get("processRef")===o});return r?xn(r):!0}var Lv=500;function _l(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Lv,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Iv(r,a)}),o.length===1&&o.map(function(r){return o.indexOf(r)}).forEach(function(r){var a=o[r];i.elements[r]=n._replaceShape(o[r],a)})},!0),this.preExecute("elements.move",Lv,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Iv(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}_l.$inject=["bpmnReplace","injector"],Ae(_l,de),_l.prototype._replaceShape=function(e,t){var n=LT(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function LT(e){var t=ge(e),n=t.eventDefinitions;return n&&n[0]}function Iv(e,t){return!it(e)&&ot(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Yf(e,t){de.call(this,e);function n(i){return rt(i.attachers,function(o){return M(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);M(o,"bpmn:EventBasedGateway")&&M(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;M(o,"bpmn:Gateway")&&M(r,"bpmn:EventBasedGateway")&&z(r.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Yf.$inject=["eventBus","modeling"],Ae(Yf,de);function Bv(e){return e.create("bpmn:Category")}function IT(e){return e.create("bpmn:CategoryValue")}function Nv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=IT(e)),n.$parent||(n.$parent=Bv(e)),n}function BT(e,t,n){return tn(t.get("categoryValue"),e),e.$parent=t,tn(n.get("rootElements"),t),t.$parent=n,e}function NT(e){var t=e.$parent;return t&&(Zt(t.get("categoryValue"),e),e.$parent=null),e}function $T(e){var t=e.$parent;return t&&(Zt(t.get("rootElements"),e),e.$parent=null),e}var FT=500;function Kf(e,t,n){n.invoke(de,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(ge).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&BT(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&$T(l),c&&!o(c,u)&&NT(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,ge(l))},!0),this.executed(["shape.move","shape.resize"],FT,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,ge(l))},!0),this.executed("group.updateRefs",function(c){$v(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){$v(c).forEach(function(l){s(l.categoryValue,l.category,ge(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ge(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Kf.$inject=["bpmnjs","elementRegistry","injector"],Ae(Kf,de);function $v(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Xf(e,t,n){de.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(m){const _=m.source,v=m.target;Ea(_)&&Ts(v)&&u(v)}function o(m){const _=m.connection,v=m.source,y=m.target;Ea(v)&&wl(y)&&(l(y),f(v,[_]))}function r(m){const _=m.newTarget,v=m.oldSource,y=m.oldTarget;if(y!==_){const b=v;Ts(y)&&u(y),Ea(b)&&wl(_)&&l(_)}}function a(m){const{element:_}=m;Ts(_)?(p(_),d(_)):wl(_)&&g(_)}function s(m){const{newData:_,oldShape:v}=m;if(Ea(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const y=v.outgoing.find(({target:b})=>Ts(b));y&&y.target&&(m._connectionTarget=y.target)}else if(!Ea(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const y=v.outgoing.find(({target:b})=>wl(b));y&&y.target&&(m._connectionTarget=y.target),h(v)}}function c(m){const{_connectionTarget:_,newShape:v}=m;_&&t.connect(v,_)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function f(m,_){m.outgoing.filter(b=>M(b,"bpmn:Association")).filter(b=>Ts(b.target)&&!_.includes(b)).forEach(b=>t.removeConnection(b))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(v=>Ea(v.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(v=>M(v,"bpmn:SequenceFlow"));t.removeElements(_)}}Ae(Xf,de),Xf.$inject=["eventBus","modeling","bpmnRules"];function Ts(e){const t=ge(e);return t&&t.get("isForCompensation")}function Ea(e){return e&&M(e,"bpmn:BoundaryEvent")&&ba(e,"bpmn:CompensateEventDefinition")}function wl(e){return e&&M(e,"bpmn:Activity")&&!jn(e)}function Zf(e){e.invoke(de,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;M(i,"bpmn:Lane")&&!M(o,"bpmn:Lane")&&(n.parent=wa(i,"bpmn:Participant"))})}Zf.$inject=["injector"],Ae(Zf,de);function Qf(e,t){de.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(M(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}Qf.$inject=["eventBus","bpmnFactory"],Ae(Qf,de);var Jf=20,ed=20,Fv=30,El=2e3;function td(e,t,n){de.call(this,t),t.on(["create.start","shape.move.start"],El,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!it(p)&&!kt(p)});if(c.length){var l=an(c),u=jT(a,l);U(a,u),r.createConstraints=HT(a,l)}}}),t.on("create.start",El,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",El,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return M(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",El,function(o){var r=o.elements,a=o.parent,s=zT(r),c;s&&M(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=ge(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;M(a,"bpmn:Participant")&&M(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=ge(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&ge(s).set("processRef",ge(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&ge(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}td.$inject=["canvas","eventBus","modeling"],Ae(td,de);function jT(e,t){t={width:t.width+Jf*2+Fv,height:t.height+ed*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 HT(e,t){return t=je(t),{bottom:t.top+e.height/2-ed,left:t.right-e.width/2+Jf,top:t.bottom-e.height/2+ed,right:t.left+e.width/2-Jf-Fv}}function zT(e){return Lt(e,function(t){return M(t,"bpmn:Participant")})}var jv="__targetRef_placeholder";function nd(e,t){de.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Hv(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Hv(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Lt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Lt(c,function(u){return u.name===jv});return!l&&s&&(l=t.create("bpmn:Property",{name:jv}),tn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||Zt(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(_=i(p,!0),m.targetRef=_):m.targetRef=null}}nd.$inject=["eventBus","bpmnFactory"],Ae(nd,de);function Hv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function Sl(e){this._bpmnUpdater=e}Sl.$inject=["bpmnUpdater"],Sl.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},Sl.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,o=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]};function id(e,t,n,i){de.call(this,i),t.registerHandler("dataStore.updateContainment",Sl);function o(){return n.filter(function(s){return M(s,"bpmn:Participant")&&ge(s).processRef})[0]}function r(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:dt(s),newSemanticParent:u.processRef||u,newDiParent:dt(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:VT(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();ot(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&r(u).filter(function(p){return GT(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=r(l);p.forEach(function(f){M(u,"bpmn:Process")&&a(f,u)})})}id.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ae(id,de);function GT(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 VT(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var Rl=Math.max,Cl=Math.min,WT=20;function zv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function UT(e,t,n){var i=n.x,o=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+o,r.height=e.height-o):t.indexOf("s")!==-1&&(r.height=e.height+o),t.indexOf("e")!==-1?r.width=e.width+i:t.indexOf("w")!==-1&&(r.x=e.x+i,r.width=e.width-i),r}function qT(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 Ml(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Ge(o)&&(i=(/top|left/.test(e)?Cl:Rl)(i,o)),Ge(r)&&(i=(/top|left/.test(e)?Rl:Cl)(i,r)),i}function YT(e,t){if(!t)return e;var n=je(e);return ll({top:Ml("top",n,t),right:Ml("right",n,t),bottom:Ml("bottom",n,t),left:Ml("left",n,t)})}function KT(e,t,n,i){var o=je(t),r={top:/n/.test(e)?o.bottom-n.height:o.top,left:/w/.test(e)?o.right-n.width:o.left,bottom:/s/.test(e)?o.top+n.height:o.bottom,right:/e/.test(e)?o.left+n.width:o.right},a=i?je(i):r,s={top:Cl(r.top,a.top),left:Cl(r.left,a.left),bottom:Rl(r.bottom,a.bottom),right:Rl(r.right,a.right)};return ll(s)}function ks(e,t){return typeof e<"u"?e:WT}function XT(e,t){var n,i,o,r;return typeof t=="object"?(n=ks(t.left),i=ks(t.right),o=ks(t.top),r=ks(t.bottom)):n=i=o=r=ks(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function ZT(e){return!(e.waypoints||e.type==="label")}function Gv(e,t){var n;if(e.length===void 0?n=rt(e.children,ZT):n=e,n.length)return XT(an(n),t)}var Ko=Math.abs;function QT(e,t){return zv(je(t),je(e))}var JT=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function Al(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(Al(n,t),t.push(n))}),t}function Xo(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ei(e){return wa(e,JT)||e}function ek(e,t){var n=Ei(e),i=M(n,"bpmn:Process")?[]:[n],o=Al(n,i),r=je(e),a=je(t),s=QT(e,t),c=[],l=xn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=je(u);s.top&&(Ko(h.bottom-r.top)<10&&(d=a.top-h.bottom),Ko(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Ko(h.right-r.left)<10&&(f=a.left-h.right),Ko(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Ko(h.top-r.bottom)<10&&(p=a.bottom-h.top),Ko(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Ko(h.left-r.right)<10&&(g=a.right-h.left),Ko(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:qT(u,{top:p,right:f,bottom:d,left:g})})}}),c}var tk=500;function od(e,t){de.call(this,e);function n(i,o){var r=xn(i),a=Xo(o),s=[],c=[],l=[],u=[];if(Mr(a,function(m){return r?m.y>i.y?c.push(m):s.push(m):m.x>i.x?u.push(m):l.push(m),m.children}),!!a.length){var p;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var 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",tk,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;M(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}od.$inject=["eventBus","spaceTool"],Ae(od,de);var Vv=500;function Pl(e,t){t.invoke(de,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Vv,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Wv(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Vv,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Wv(a,ik(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Pl.$inject=["bpmnReplace","injector"],Ae(Pl,de),Pl.prototype._replaceShape=function(e){var t=nk(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function nk(e){var t=ge(e),n=t.eventDefinitions;return n&&n[0]}function Wv(e,t){return!it(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function ik(e,t){return e.indexOf(t)!==-1}var Tl=Math.round,ok=Math.max;function rk(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 ak(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Uv=10;function sk(e,t){var n,i;for(n=0;i=e[n];n++)if(_s(i,t)<=Uv)return{point:e[n],bendpoint:!0,index:n};return null}function ck(e,t){var n=Zy(rk(t,Uv),ak(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=ok(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Tl(i.x+o.x)/2,y:Tl(i.y+o.y)/2},index:i.segment2}:{point:{x:Tl(i.x),y:Tl(i.y)},index:i.segment2}:null}function rd(e,t){return sk(e,t)||ck(e,t)}function ad(e,t,n){de.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,f,d,g,h=o.outgoing.slice(),m=o.incoming.slice(),_;Ge(a.width)?_=We(a):_=a;var v=rd(s,_);if(v){if(c=s.slice(0,v.index),l=s.slice(v.index+(v.bendpoint?1:0)),!c.length||!l.length)return;u=v.bendpoint?s[v.index]:_,(c.length===1||!qv(o,c[c.length-1]))&&c.push(Yv(u)),(l.length===1||!qv(o,l[0]))&&l.unshift(Yv(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),g=r));var y=[].concat(d&&rt(m,function(b){return b.source===d.source})||[],g&&rt(h,function(b){return b.target===g.target})||[]);y.length&&n.removeElements(y)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=We(c),u={x:l.x+s.x,y:l.y+s.y},p=Lt(r.children,function(f){var d=t.canInsert(a,f);return d&&rd(f.waypoints,u)});p&&(o.targetFlow=p,o.position=u)}},!0),this.postExecuted("elements.move",function(o){var r=o.shapes,a=o.targetFlow,s=o.position;a&&i(r[0],a,s)},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;t.canInsert(a,r)&&(o.targetFlow=r,o.parent=r.parent)},!0),this.postExecuted("shape.create",function(o){var r=o.shape,a=o.targetFlow,s=o.position;a&&i(r,a,s)},!0)}Ae(ad,de),ad.$inject=["eventBus","bpmnRules","modeling"];function qv(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 Yv(e){return U({},e)}function sd(e,t){de.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Sa(o)){var c=[];M(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Sa(l)):c=a.incoming.filter(l=>l!==o&&Sa(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(M(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Sa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Sa).forEach(function(s){const c=a.incoming.filter(Sa).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}sd.$inject=["eventBus","modeling"],Ae(sd,de);function Sa(e){return M(e,"bpmn:SequenceFlow")}var kl=1500,Kv=2e3;function Xv(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"],kl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!ot(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||ot(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],kl,function(i){var o=i.hover;M(o,"bpmn:Lane")&&(i.hover=Ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],kl,function(i){var o=i.context,r=i.hover,a=o.type;M(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],kl,function(i){var o=i.context,r=o.start;M(r,"bpmn:Lane")&&(o.start=Ei(r)||r)}),t.on("shape.move.start",Kv,function(i){var o=i.shape;M(o,"bpmn:Lane")&&(i.shape=Ei(o)||o)}),t.on("spaceTool.move",Kv,function(i){var o=i.hover;o&&M(o,"bpmn:Lane")&&(i.hover=Ei(o))})}Xv.$inject=["elementRegistry","eventBus","canvas"];var Zv=770;function cd(e,t,n,i){n.invoke(de,this);function o(s,c){var l=ge(s),u=c.categoryValue||l.categoryValueRef;u||(u=Nv(e,l));var p=c.category||u.$parent||Bv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=ge(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ge(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=ge(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&&!ge(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ge(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||ge(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Zv,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=ge(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",Zv,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})}cd.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ae(cd,de);function ld(e,t,n,i){var o,r,a,s,c;return o=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),o==0?null:(r=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*r-(i.y-n.y)*a,s=c/o,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Qv(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=ld(i,o,r,a),l=ld(i,o,r,s),u;c&&l?Jv(c,r)>Jv(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],We(i.source)),t(o[o.length-1],o[o.length-2],We(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Qv.$inject=["eventBus"];function Jv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ud(e){de.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=ge(i),r=dt(i);if(ot(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}ud.$inject=["eventBus"],Ae(ud,de);function eb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function tb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function lk(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 uk(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],o=i[0].n*t[0]+i[1].n*t[1],r=i[0].lambda*t[0]+i[1].lambda*t[1];return-o/r}function pd(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=uk([n.x,n.y],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function nb(e,t){var n=pd(e,t),i={x:n.x-e.x,y:n.y-e.y};return eb(i)}function Os(e,t){return eb({x:e.x-t.x,y:e.y-t.y})}var ib=Math.sqrt,ob=Math.min,pk=Math.max,rb=Math.abs;function ab(e){return Math.pow(e,2)}function Ds(e,t){return ib(ab(e.x-t.x)+ab(e.y-t.y))}function fk(e,t){var n=0,i,o,r,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],cb(i,o)?l=[i]:(r=Ds(e,i),a=Ds(e,o),c=ob(r,a),l=dk(i,o,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:cb(i,l[0])?n:n+1}),l.length===2&&(s=gk(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ds(i,s)/Ds(i,o)}),p=Ds(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function dk(e,t,n,i){var o=t.x-e.x,r=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=o*o+r*r,l=o*a+r*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=ib(d),h=-p+g,m=-p-g,_={x:e.x-o*h,y:e.y-r*h};if(d===0)return[_];var v={x:e.x-o*m,y:e.y-r*m};return[_,v].filter(function(y){return hk(y,e,t)})}function hk(e,t,n){return sb(e.x,t.x,n.x)&&sb(e.y,t.y,n.y)}function sb(e,t,n){return e>=ob(t,n)-Ol&&e<=pk(t,n)+Ol}function gk(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ol=.1;function cb(e,t){return rb(e.x-t.x)<=Ol&&rb(e.y-t.y)<=Ol}function mk(e,t,n,i){var o=n.segmentIndex,r=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return o===a?s:o>=s?o+r<s?s:o+r:o}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(r===0)return o;if(o>=l&&(u=c?o+1:o-1),o<l&&(u=o,c&&n.type!=="bendpoint"&&l-1===o)){var p=ub(t,l);p<n.relativeLocation&&u++}return u}return r===0?o:i.connectionStart&&o===0?0:i.connectionEnd&&o===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function lb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=fk(e,n),c=s.segmentIndex,l=mk(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=pb(n,c),p=pb(t,l),f=s.position,d=vk(u,f),g=yk(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-1)return a;if(h===0){var v=t[m];return o=v.x-s.position.x,r=v.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&m!==0&&m<n.length-1&&(d=ub(n,m))}var y={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},b=lk({x:e.x-f.x,y:e.y-f.y},g);return o=y.x+b.x-e.x,r=y.y+b.y-e.y,{point:yo(y),delta:yo({x:o,y:r})}}function ub(e,t){var n=Os(e[t-1],e[t]),i=Os(e[t],e[t+1]),o=n/(n+i);return o}function yk(e,t){var n=tb(e),i=tb(t);return i-n}function pb(e,t){return[e[t],e[t+1]]}function vk(e,t){var n=Os(e[0],e[1]),i=Os(e[0],t);return n===0?0:i/n}function bk(e,t,n,i){var o=We(e);return lb(o,t,n,i).delta}function Ls(e,t,n){var i=Ps(t),o=Ps(n),r=Fi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return yo({x:o.x+a.x,y:o.y+a.y})}function fb(e,t,n){var i=Ps(e),o=Ps(t),r=Ps(n),a=Fi(e,i),s=Fi(i,o),c=xk(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:r.x+l.x,y:r.y+l.y};return yo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function xk(e,t,n){var i=je(t),o=je(n);if(_k(i,o))return null;var r=kn(t,e),a,s,c;if(r==="top")a={x:0,y:o.bottom-i.bottom};else if(r==="bottom")a={x:0,y:o.top-i.top};else if(r==="right")a={x:o.left-i.left,y:0};else if(r==="left")a={x:o.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=kn(n,s),c!==r?null:a}function _k(e,t){return wk(e,t)||Ek(e,t)}function wk(e,t){return e.right!==t.right&&e.left!==t.left}function Ek(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var db="name",hb="text";function fd(e,t,n,i){de.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{ge(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(db in l&&t.updateLabel(c,l[db]),hb in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[hb]||"");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;it(l)||!Yo(l)||yi(l)&&t.updateLabel(l,yi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function r(a){var s=a.context,c=s.connection,l=c.label,u=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),bk(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ge(c);u&&Yo(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(!(!it(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(yi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(gl(c)){var p=c.label,f=We(p),d=Ck(u),g=Rk(f,d),h=Sk(g,u,l);t.moveShape(p,h)}})}Ae(fd,de),fd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function Sk(e,t,n){var i=Ls(e,t,n);return yo(Fi(i,e))}function Rk(e,t){if(t.length){var n=Mk(e,t);return pd(e,n)}}function Ck(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 Mk(e,t){var n=t.map(function(o){return{line:o,distance:nb(e,o)}}),i=Vi(n,"distance");return i[0].line}function Ak(e,t,n,i){return lb(e,t,n,i).point}function dd(e,t){de.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=U({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),Ak(o,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming,c=o.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ae(dd,de),dd.$inject=["eventBus","modeling"];function Dl(e,t,n){var i=Il(e),o=mb(i,t),r=i[0];return o.length?o[o.length-1]:Ls(r.original||r,n,t)}function Ll(e,t,n){var i=Il(e),o=mb(i,t),r=i[i.length-1];return o.length?o[0]:Ls(r.original||r,n,t)}function hd(e,t,n){var i=Il(e),o=gb(t,n),r=i[0];return Ls(r.original||r,o,t)}function gd(e,t,n){var i=Il(e),o=gb(t,n),r=i[i.length-1];return Ls(r.original||r,o,t)}function gb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Il(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function mb(e,t){var n=Bn(e,Tk);return rt(n,function(i){return Pk(i,t)})}function Pk(e,t){return kn(t,e,1)==="intersect"}function Tk(e){return e.original||e}function md(e,t){de.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(kk(i,o)){var r=Ok(i);r.incoming.forEach(function(a){var s=Ll(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Dl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}md.$inject=["eventBus","modeling"],Ae(md,de);function kk(e,t){return M(e,"bpmn:Participant")&&ut(e)&&M(t,"bpmn:Participant")&&!ut(t)}function Ok(e){var t=bs([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){M(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){M(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const Dk=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function yb(e){const t=ge(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&jn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:Dk.some(i=>M(n[0],i))}function vb(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function yd(e,t){e.invoke(de,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!yb(o))return;const a=vb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=ge(i).get(a),l=ge(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}yd.$inject=["injector","modeling"],Ae(yd,de);function vd(e,t){de.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=dt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ae(vd,de),vd.$inject=["eventBus","modeling"];function bd(e,t,n){de.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!M(r,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=Lk(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ae(bd,de),bd.$inject=["eventBus","bpmnRules","modeling"];function Ra(e){return e.original||e}function Lk(e,t){var n=ld(Ra(e[e.length-2]),Ra(e[e.length-1]),Ra(t[1]),Ra(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ra(e[0]),Ra(t[t.length-1])]}function xd(e,t){de.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;M(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}xd.$inject=["eventBus","modeling"],Ae(xd,de);function _d(e,t,n,i){de.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,o&&s(u,g))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Lt(p.outgoing,ta({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})})}Ae(_d,de),_d.$inject=["eventBus","modeling","bpmnRules","injector"];function Bl(e,t,n,i,o,r){i.invoke(de,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=ei(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){jn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Ae(Bl,de),Bl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;z(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},Bl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Ik=1500,Bk={width:140,height:120},wd={width:300,height:60},Ed={width:60,height:300},Nl={width:300,height:150},$l={width:150,height:300},bb={width:140,height:120},xb={width:100,height:40};function _b(e){e.on("resize.start",Ik,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=Hk(i,o,r)),M(i,"bpmn:SubProcess")&&ut(i)&&(n.minDimensions=bb),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=xb)})}_b.$inject=["eventBus"];var Zo=Math.abs,Nk=Math.min,$k=Math.max;function wb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ca(e,t,n){return wb(e,t,n,Nk)}function Ma(e,t,n){return wb(e,t,n,$k)}var Fk={top:20,left:50,right:20,bottom:20},jk={top:50,left:20,right:20,bottom:20};function Hk(e,t,n){var i=Ei(e),o=!0,r=!0,a=Al(i,[i]),s=je(e),c={},l={},u=xn(e),p=u?wd:Ed;/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=je(g);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&Zo(s.top-h.bottom)<10&&Ma(c,"top",h.top+p.height),Zo(s.top-h.top)<5&&Ca(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Zo(s.right-h.left)<10&&Ca(c,"right",h.right-p.width),Zo(s.right-h.right)<5&&Ma(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Zo(s.bottom-h.top)<10&&Ca(c,"bottom",h.bottom-p.height),Zo(s.bottom-h.bottom)<5&&Ma(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Zo(s.left-h.right)<10&&Ma(c,"left",h.left+p.width),Zo(s.left-h.left)<5&&Ca(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?Fk:jk;return f.forEach(function(g){var h=je(g);/n/.test(t)&&(!u||o)&&Ca(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Ma(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Ma(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Ca(l,"left",h.left-d.left)}),{min:l,max:c}}function Eb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Aa(e){return e.originalEvent||e.srcEvent}function Sd(e){Eb(e),Eb(Aa(e))}function Tr(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 Sb(){return/mac/i.test(navigator.platform)}function Rb(e,t){return(Aa(e)||e).button===t}function Qo(e){return Rb(e,0)}function zk(e){return Rb(e,1)}function Is(e){var t=Aa(e)||e;return Qo(e)?Sb()?t.metaKey:t.ctrlKey:!1}function Fl(e){var t=Aa(e)||e;return Qo(e)&&t.shiftKey}var Cb=1001;function Mb(e,t){e.on("resize.start",Cb+500,function(n){var i=n.context,o=i.shape;(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))&&(i.balanced=!Is(n))}),e.on("resize.end",Cb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))return r&&(a=nv(a),t.resizeLane(o,a,i.balanced)),!1})}Mb.$inject=["eventBus","modeling"];var Gk=500;function Rd(e,t,n,i,o){n.invoke(de,this);function r(u){return ot(u,["bpmn:ReceiveTask","bpmn:SendTask"])||Vk(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Lt(f,ta({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(ot(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(ot(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var f=ge(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),tn(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Zt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=ge(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",Gk,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,o.create(d.$type))),l(f,d),delete p.referencedRootElement)})}Rd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ae(Rd,de);function Vk(e,t){return ze(t)||(t=[t]),Do(t,function(n){return ba(e,n)})}var Ab=Math.max;function Pb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(r[s]=Uk(a,i,o)),M(a,"bpmn:Lane")&&(r[s]=xn(a)?wd:Ed),M(a,"bpmn:SubProcess")&&ut(a)&&(r[s]=bb),M(a,"bpmn:TextAnnotation")&&(r[s]=xb),M(a,"bpmn:Group")&&(r[s]=Bk)}),r})}Pb.$inject=["eventBus"];function Wk(e){return e==="x"}function Uk(e,t,n){var i=xn(e);if(!Kk(e))return i?Nl:$l;var o=Wk(t),r={};return o?i?r=Nl:r={width:Yk(e,n,o),height:$l.height}:i?r={width:Nl.width,height:qk(e,n,o)}:r=$l,r}function qk(e,t,n){var i;return i=Xk(e,t,n),Ab(Nl.height,i)}function Yk(e,t,n){var i;return i=Zk(e,t,n),Ab($l.width,i)}function Kk(e){return!!Xo(e).length}function Xk(e,t,n){var i=Xo(e),o;return o=Cd(i,t,n),e.height-o.height+wd.height}function Zk(e,t,n){var i=Xo(e),o;return o=Cd(i,t,n),e.width-o.width+Ed.width}function Cd(e,t,n){var i,o,r;for(i=0;i<e.length;i++)if(o=e[i],!n&&t>=o.y&&t<=o.y+o.height||n&&t>=o.x&&t<=o.x+o.width)return r=Xo(o),r.length?Cd(r,t,n):o}var Tb="_plane";function kb(e){var t=e.id;return Qk(t)}function to(e){var t=e.id;return M(e,"bpmn:SubProcess")?Ob(t):t}function kr(e){return Ob(e)}function jl(e){var t=dt(e);return M(t,"bpmndi:BPMNPlane")}function Ob(e){return e+Tb}function Qk(e){return e.replace(new RegExp(Tb+"$"),"")}var Db=400,Jk=600,Lb={x:180,y:160};function _o(e,t,n,i,o,r,a){de.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return M(p,"bpmn:SubProcess")&&!ut(p)}function l(p){var f=p.shape,d=p.newRootElement,g=ge(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=ge(f);s._removeDiagram(d);var g=p.newRootElement=a.get(to(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(to(d));if(!(!g||!d.children||!d.children.length)){var h=Ib(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")||!ut(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(to(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(to(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(to(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,m=d.id;if(h!==m){if(jl(f)){a.updateId(f,kr(m)),a.updateId(h,m);return}var _=a.get(kr(h));_&&a.updateId(kr(h),kr(m))}}},!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,m=d.id;if(h!==m){if(jl(f)){a.updateId(f,kr(h)),a.updateId(m,h);return}var _=a.get(kr(m));_&&a.updateId(_,kr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(jl(f)){var d=f,g=a.get(kb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Db,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ut(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Db,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ut(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",Jk,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(ut(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,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Ib(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=to(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,m=M(dt(h),"bpmndi:BPMNPlane");if(m){var _=kb(h),v=Lt(g,function(y){return y.id===_});v&&(f.parent=v.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ae(_o,de),_o.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var o=an(i),r;if(!t.x)r={x:Lb.x-o.x,y:Lb.y-o.y};else{var a=We(t),s=We(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},_o.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Rv(e).map(i=>i.annotation));n.size&&z(Rs(e.children),i=>{n.has(i.annotation)&&z(i.associations,o=>{t.removeConnection(o)})})},_o.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(o){o.hidden=!!t,i=i.concat(o),o.children&&(i=i.concat(n._showRecursively(o.children,o.collapsed||t)))}),i},_o.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},_o.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:to(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},_o.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Lt(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},_o.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function e2(e){var t=[];return z(Rs(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Ib(e){return e.children.slice().concat(e2(e.children)).concat(t2(e))}function t2(e){return kf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Md(e,t){e.invoke(de,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!M(o,"bpmn:SubProcess")||M(o,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!ut(o))){var r=n2(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Md.$inject=["injector","modeling"],Ae(Md,de);function n2(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Ad(e,t){de.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&M(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!M(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,yi(o)||""),c=a.y!==o.y&&Math.abs(a.y+a.height-(o.y+o.height))<=1,l=o.y+o.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ae(Ad,de),Ad.$inject=["eventBus","textRenderer"];function Pd(e,t){de.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ut(i))return;var o=bs(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){r(l,!0)}),z(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,We(i)):t.reconnectStart(a,i,We(i)))}},!0)}Ae(Pd,de),Pd.$inject=["eventBus","modeling"];var Td=500;function kd(e,t,n){de.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=i2(c).concat([a]),p=Gv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function r(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Td,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?dt(c).isExpanded=!1:(i(c.children),dt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Td,function(a){var s=a.context,c=s.shape;c.collapsed?dt(c).isExpanded=!1:dt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Td,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=r(s,c):l=o(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ae(kd,de),kd.$inject=["eventBus","elementFactory","modeling"];function i2(e){return e.filter(function(t){return!t.hidden})}function Od(e,t,n,i){t.invoke(de,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;it(a)||(M(a,"bpmn:Participant")&&ut(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;M(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ae(Od,de),Od.$inject=["canvas","injector","moddle","modeling"];function Dd(e,t){de.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;o2(o,r)&&t.updateProperties(r,{default:null})})}Ae(Dd,de),Dd.$inject=["eventBus","modeling"];function o2(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=ge(t),i=ge(e);return n.get("default")===i}var r2=500,a2=5e3,Bb=["shape.create","shape.delete","shape.move","shape.resize"],Nb=[...Bb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Ld(e,t){de.call(this,e);var n;function i(){return n=n||new s2,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(Nb,a2,function(){i()}),this.postExecuted(Nb,r2,function(){r()}),this.preExecute(Bb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Ld.$inject=["eventBus","modeling"],Ae(Ld,de);function s2(){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 c2=500,l2=5e3,$b=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Fb=[...$b,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Id(e,t){de.call(this,e);var n;function i(){return n=n||new u2,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Fb,l2,function(){i()}),this.postExecuted(Fb,c2,function(){r()}),this.preExecute($b,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&o().addGroup(s)})}Id.$inject=["eventBus","modeling"],Ae(Id,de);function u2(){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 Bd(e,t){de.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)p2(r)&&!d2(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ae(Bd,de),Bd.$inject=["eventBus","modeling"];function p2(e){const t=ge(e);return t&&t.isForCompensation}function f2(e){return e&&M(e,"bpmn:BoundaryEvent")&&ba(e,"bpmn:CompensateEventDefinition")}function d2(e){return e.incoming.filter(n=>f2(n.source)).length>0}const h2={__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",Vf],appendBehavior:["type",Wf],associationBehavior:["type",qf],attachEventBehavior:["type",_l],artifactBehavior:["type",Uf],boundaryEventBehavior:["type",Yf],categoryRootElementReferenceBehavior:["type",Kf],compensateBoundaryEventBehaviour:["type",Xf],createBehavior:["type",Zf],createDataObjectBehavior:["type",Qf],createParticipantBehavior:["type",td],dataInputAssociationBehavior:["type",nd],dataStoreBehavior:["type",id],deleteLaneBehavior:["type",od],detachEventBehavior:["type",Pl],dropOnFlowBehavior:["type",ad],eventBasedGatewayBehavior:["type",sd],fixHoverBehavior:["type",Xv],groupBehavior:["type",cd],importDockingFix:["type",Qv],isHorizontalFix:["type",ud],labelBehavior:["type",fd],layoutConnectionBehavior:["type",dd],messageFlowBehavior:["type",md],nonInterruptingBehavior:["type",yd],removeElementBehavior:["type",bd],removeEmbeddedLabelBoundsBehavior:["type",vd],removeParticipantBehavior:["type",xd],replaceConnectionBehavior:["type",_d],replaceElementBehaviour:["type",Bl],resizeBehavior:["type",_b],resizeLaneBehavior:["type",Mb],rootElementReferenceBehavior:["type",Rd],spaceToolBehavior:["type",Pb],subProcessPlaneBehavior:["type",_o],subProcessStartEventBehavior:["type",Md],textAnnotationBehavior:["type",Ad],toggleCollapseConnectionBehaviour:["type",Pd],toggleElementCollapseBehaviour:["type",kd],unclaimIdBehavior:["type",Od],unsetDefaultFlowBehavior:["type",Dd],updateFlowNodeRefsBehavior:["type",Ld],updateCategoryValueRefsBehavior:["type",Id],setCompensationActivityAfterPasteBehavior:["type",Bd]};function Nd(e){this._commandStack=e.get("commandStack",!1)}Nd.$inject=["injector"],Nd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const no={__init__:["rules"],rules:["type",Nd]};function Si(e){de.call(this,e),this.init()}Si.$inject=["eventBus"],Ae(Si,de),Si.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(o){i.canExecute(o,t,function(r,a,s){return n(r)},!0)})},Si.prototype.init=function(){};function jb(e,t){var n=kn(e,t,-15);return n!=="intersect"?n:null}function Dn(e){Si.call(this,e)}Ae(Dn,Si),Dn.$inject=["eventBus"],Dn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return g2(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},o=i.targetParent,r=i.targetAttach;if(r)return!1;o&&(n.parent=o);try{return zl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return zl(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 Jb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return kt(i)&&!Gl(t,i)?!1:Oo(t,function(o){return kt(o)?zl(o.source,o.target,o):o.host?Bs(o,o.host,null,n):Hd(o,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,o=e.hints;return o!=null&&o.keyboardMove&&n.some(function(a){return qb(a)&&!n.includes(a.host)})?!1:Bs(n,t,null,i)||Zb(n,t,i)||Qb(n,t)||Gl(n,t)}),this.addRule("shape.create",function(e){return Hd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Bs(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return ox(n,t)})},Dn.prototype.canConnectMessageFlow=nx,Dn.prototype.canConnectSequenceFlow=ix,Dn.prototype.canConnectDataAssociation=zd,Dn.prototype.canConnectAssociation=ex,Dn.prototype.canConnectCompensationAssociation=tx,Dn.prototype.canMove=Qb,Dn.prototype.canAttach=Bs,Dn.prototype.canReplace=Zb,Dn.prototype.canDrop=Pa,Dn.prototype.canInsert=Gl,Dn.prototype.canCreate=Hd,Dn.prototype.canConnect=zl,Dn.prototype.canResize=Jb,Dn.prototype.canCopy=ox;function g2(e){return $d(e)?null:ot(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function $d(e){return!e||it(e)}function Hb(e){do{if(M(e,"bpmn:Process"))return ge(e);if(M(e,"bpmn:Participant"))return ge(e).processRef||ge(e)}while(e=e.parent)}function Fd(e){return M(e,"bpmn:TextAnnotation")}function jd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function zb(e){return M(e,"bpmn:BoundaryEvent")&&io(e,"bpmn:CompensateEventDefinition")}function Hl(e){return ge(e).isForCompensation}function m2(e,t){var n=Hb(e),i=Hb(t);return n===i}function y2(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&Wb(e,"bpmn:MessageEventDefinition"))}function v2(e){return M(e,"bpmn:InteractionNode")&&!Hl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&Wb(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!io(e,"bpmn:MessageEventDefinition"))}function Gb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return ge(t);if(M(t,"bpmn:Participant"))return ge(t).processRef}return null}function Vb(e,t){var n=Gb(e),i=Gb(t);return n===i}function io(e,t){var n=ge(e);return!!Lt(n.eventDefinitions||[],function(i){return M(i,t)})}function Wb(e,t){var n=ge(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function b2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!zb(e)&&!Hl(e)}function x2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&io(e,"bpmn:LinkEventDefinition"))&&!Hl(e)}function _2(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(io(e,"bpmn:MessageEventDefinition")||io(e,"bpmn:TimerEventDefinition")||io(e,"bpmn:ConditionalEventDefinition")||io(e,"bpmn:SignalEventDefinition"))}function w2(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ub(e,t){var n=w2(t);return n.indexOf(e)!==-1}function zl(e,t,n){if($d(e)||$d(t))return null;if(!M(n,"bpmn:DataAssociation")){if(nx(e,t))return{type:"bpmn:MessageFlow"};if(ix(e,t))return{type:"bpmn:SequenceFlow"}}var i=zd(e,t);return i||(tx(e,t)?{type:"bpmn:Association",associationDirection:"One"}:ex(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Pa(e,t){return it(e)||jd(e)?!0:M(t,"bpmn:Participant")&&!ut(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):ot(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")&&!E2(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?ut(t):ot(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?Do(ge(t).get("participants"),function(n){return!!n.get("processRef")}):ot(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ot(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 E2(e){return ge(e).cancelActivity&&(Yb(e)||Kb(e))}function qb(e){return!it(e)&&M(e,"bpmn:BoundaryEvent")}function S2(e){return M(e,"bpmn:Lane")}function R2(e){return qb(e)||M(e,"bpmn:IntermediateThrowEvent")&&Yb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&Kb(e)}function Yb(e){var t=ge(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Kb(e){return Xb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Xb(e,t){return t.some(function(n){return io(e,n)})}function C2(e){return M(e,"bpmn:ReceiveTask")&&Lt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function Bs(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return it(o)||!R2(o)||jn(t)||!M(t,"bpmn:Activity")||Hl(t)||i&&!jb(i,t)||C2(t)?!1:"attach"}function Zb(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(o){jn(t)||M(o,"bpmn:StartEvent")&&o.type!=="label"&&Pa(o,t)&&(IP(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(BP(o)||NP(o)||$P(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),Xb(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||io(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(M(o,"bpmn:EndEvent")&&Pa(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),M(o,"bpmn:BoundaryEvent")&&Bs(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Qb(e,t){return Do(e,S2)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Pa(n,t)})}function Hd(e,t,n,i){return t?it(e)||jd(e)?!0:Pa(e,t)||Gl(e,t):!1}function Jb(e,t,n){return M(e,"bpmn:SubProcess")?ut(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:Fd(e)?n?n==="e"||n==="w":!0:jd(e)?!0:it(e)?n?n==="e"||n==="w":!0:!1}function M2(e,t){var n=Fd(e),i=Fd(t);return(n||i)&&n!==i}function ex(e,t){return Ub(t,e)||Ub(e,t)?!1:M2(e,t)?!0:!!zd(e,t)}function tx(e,t){return Vb(e,t)&&zb(e)&&M(t,"bpmn:Activity")&&!P2(t,e)&&!jn(t)}function nx(e,t){return ax(e)&&!ax(t)?!1:y2(e)&&v2(t)&&!m2(e,t)}function ix(e,t){return b2(e)&&x2(t)&&Vb(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!_2(t))}function zd(e,t){return ot(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ot(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ot(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ot(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Gl(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:ot(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!it(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&Pa(e,t.parent)}function Gd(e,t){return e&&t&&e.indexOf(t)!==-1}function ox(e,t){return it(t)?!0:!(M(t,"bpmn:Lane")&&!Gd(e,t.parent)||M(t,"bpmn:MessageFlow")&&!A2(e,t))}function A2(e,t){var n=rx(t.source),i=rx(t.target);return Gd(e,n)&&Gd(e,i)}function rx(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function ax(e){return wa(e,"bpmn:Process")||wa(e,"bpmn:Collaboration")}function P2(e,t){return e.attachers.includes(t)}const T2={__depends__:[no],__init__:["bpmnRules"],bpmnRules:["type",Dn]};var k2=2e3;function sx(e,t){e.on("saveXML.start",k2,n);function n(){var i=t.getRootElements();z(i,function(o){var r=dt(o),a,s;a=bs([o]),a=rt(a,function(c){return c!==o&&!c.labelTarget}),s=Bn(a,dt),r.set("planeElement",s)})}}sx.$inject=["eventBus","canvas"];const O2={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",sx]};function Vl(e){de.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Vl.prototype.getOrdering=function(e,t){return null},Ae(Vl,de);function Vd(e,t){Vl.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=Lt(n,function(c){return ot(a,[c.type])});return s&&s.order||{level:1}}function o(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function r(a,s,c){for(var l=s;l&&!ot(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=Dg(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<o(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Vd.$inject=["eventBus","canvas"],Ae(Vd,Vl);const D2={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Vd]};function Ns(){}Ns.prototype.get=function(){return this._data},Ns.prototype.set=function(e){this._data=e},Ns.prototype.clear=function(){var e=this._data;return delete this._data,e},Ns.prototype.isEmpty=function(){return!this._data};const L2={clipboard:["type",Ns]};var cx=1500;function lx(e,t,n){var i=this,o=n.get("dragging",!1);function r(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),o.hover({element:l,gfx:c}),o.move(s))}}o&&t.on("drag.start",function(a){t.once("drag.move",cx,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",cx,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=Tr(a),c=document.elementFromPoint(s.x,s.y),I2(c)}}lx.$inject=["elementRegistry","eventBus","injector"];function I2(e){return Rr(e,"svg, .djs-element",!0)}const B2={__init__:["hoverFix"],hoverFix:["type",lx]};function N2(e){return!0}function Wl(e){return Qo(e)||zk(e)}var ux=500;function px(e,t,n){var i=this;function o(T,O,N){if(!s(T,O)){var $,H,Q;N?H=t.getGraphics(N):($=O.delegateTarget||O.target,$&&(H=$,N=t.get(H))),!(!H||!N)&&(Q=e.fire(T,{element:N,gfx:H,originalEvent:O}),Q===!1&&(O.stopPropagation(),O.preventDefault()))}}var r={};function a(T){return r[T]}function s(T,O){var N=l[T]||Qo;return!N(O)}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":N2,"element.mousedown":Wl,"element.mouseup":Wl,"element.click":Wl,"element.dblclick":Wl};function u(T,O,N){var $=c[T];if(!$)throw new Error("unmapped DOM event name <"+T+">");return o($,O,N)}var p="svg, .djs-element";function f(T,O,N,$){var H=r[N]=function(Q){o(N,Q)};$&&(l[N]=$),H.$delegate=ti.bind(T,p,O,H)}function d(T,O,N){var $=a(N);$&&ti.unbind(T,O,$.$delegate)}function g(T){z(c,function(O,N){f(T,N,O)})}function h(T){z(c,function(O,N){d(T,N,O)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var O=T.element,N=T.gfx;e.fire("interactionEvents.createHit",{element:O,gfx:N})}),e.on(["shape.changed","connection.changed"],ux,function(T){var O=T.element,N=T.gfx;e.fire("interactionEvents.updateHit",{element:O,gfx:N})}),e.on("interactionEvents.createHit",ux,function(T){var O=T.element,N=T.gfx;i.createDefaultHit(O,N)}),e.on("interactionEvents.updateHit",function(T){var O=T.element,N=T.gfx;i.updateDefaultHit(O,N)});var m=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),v=E("djs-hit djs-hit-all"),y=E("djs-hit djs-hit-no-move"),b={all:v,"click-stroke":_,stroke:m,"no-move":y};function E(T,O){return O=U({stroke:"white",strokeWidth:15},O||{}),n.cls(T,["no-fill","no-border"],O)}function w(T,O){var N=b[O];if(!N)throw new Error("invalid hit type <"+O+">");return Se(T,N),T}function P(T,O){qe(T,O)}this.removeHits=function(T){var O=hs(".djs-hit",T);z(O,rn)},this.createDefaultHit=function(T,O){var N=T.waypoints,$=T.isFrame,H;return N?this.createWaypointsHit(O,N):(H=$?"stroke":"all",this.createBoxHit(O,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,O){var N=vs(O);return w(N,"stroke"),P(T,N),N},this.createBoxHit=function(T,O,N){N=U({x:0,y:0},N);var $=Le("rect");return w($,O),Se($,N),P(T,$),$},this.updateDefaultHit=function(T,O){var N=Et(".djs-hit",O);if(N)return T.waypoints?Tf(N,T.waypoints):Se(N,{width:T.width,height:T.height}),N},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}px.$inject=["eventBus","elementRegistry","styles"];const Ul={__init__:["interactionEvents"],interactionEvents:["type",px]};function Ta(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var o=i.element;n.deselect(o)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ta.$inject=["eventBus","canvas"],Ta.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()})}},Ta.prototype.get=function(){return Array.from(this._selectedElements)},Ta.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ta.prototype.select=function(e,t){var n=this.get();ze(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?z(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var fx="hover",dx="selected";function hx(e,t){this._canvas=e;function n(o,r){e.addMarker(o,r)}function i(o,r){e.removeMarker(o,r)}t.on("element.hover",function(o){n(o.element,fx)}),t.on("element.out",function(o){i(o.element,fx)}),t.on("selection.changed",function(o){function r(l){i(l,dx)}function a(l){n(l,dx)}var s=new Set(o.oldSelection),c=new Set(o.newSelection);for(let l of s)c.has(l)||r(l);for(let l of c)s.has(l)||a(l)})}hx.$inject=["canvas","eventBus"];function gx(e,t,n,i){e.on("create.end",500,function(o){var r=o.context,a=r.canExecute,s=r.elements,c=r.hints||{},l=c.autoSelect;if(a){if(l===!1)return;ze(l)?t.select(l):t.select(s.filter($2))}}),e.on("connect.end",500,function(o){var r=o.context,a=r.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(o){var r=o.previousSelection||[],a=i.get(o.context.shape.id),s=Lt(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(Qo(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Fl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}gx.$inject=["eventBus","selection","canvas","elementRegistry"];function $2(e){return!e.hidden}const Ri={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ul],selection:["type",Ta],selectionVisuals:["type",hx],selectionBehavior:["type",gx]};var F2=/^djs-cursor-.*$/;function ql(e){var t=Rt(document.body);t.removeMatching(F2),e&&t.add("djs-cursor-"+e)}function mx(){ql(null)}var j2=5e3;function yx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,j2,n),function(){e.off(t,n)}}var H2=["c","C"],z2=["v","V"],G2=["d","D"],V2=["x","X"],W2=["y","Y"],vx=["z","Z"];function U2(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function oi(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function mn(e,t){return e=ze(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Wd(e){return e.shiftKey}function q2(e){return oi(e)&&mn(H2,e)}function Y2(e){return oi(e)&&mn(z2,e)}function K2(e){return oi(e)&&mn(G2,e)}function X2(e){return oi(e)&&mn(V2,e)}function Z2(e){return oi(e)&&!Wd(e)&&mn(vx,e)}function Q2(e){return oi(e)&&(mn(W2,e)||mn(vx,e)&&Wd(e))}var ka=Math.round,bx="djs-drag-active";function Or(e){e.preventDefault()}function J2(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function eO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function xx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(y){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(y.x-E.left)/b.scale,y:b.y+(y.y-E.top)/b.scale}}function s(y,b){b=b||r;var E=e.createEvent(U({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+y,E)===!1?!1:e.fire(b.prefix+"."+y,E)}function c(y){var b=y.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function l(y,b){var E=r.payload,w=r.displacement,P=r.globalStart,T=Tr(y),O=Fi(T,P),N=r.localStart,$=a(T),H=Fi($,N);if(!r.active&&(b||eO(O)>r.threshold)){if(U(E,{x:ka(N.x+w.x),y:ka(N.y+w.y),dx:0,dy:0},{originalEvent:y}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&ql(r.cursor),t.addMarker(t.getRootElement(),bx)}Sd(y),r.active&&(U(E,{x:ka($.x+w.x),y:ka($.y+w.y),dx:ka(H.x),dy:ka(H.y)},{originalEvent:y}),s("move"))}function u(y){var b,E=!0;r.active&&(y&&(r.payload.originalEvent=y,Sd(y)),E=s("end")),E===!1&&s("rejected"),b=_(E!==!0),s("ended",b)}function p(y){mn("Escape",y)&&(Or(y),m())}function f(y){var b;r.active&&(b=yx(e),setTimeout(b,400),Or(y)),u(y)}function d(y){l(y)}function g(y){var b=r.payload;b.hoverGfx=y.gfx,b.hover=y.element,s("hover")}function h(y){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function m(y){var b;if(r){var E=r.active;E&&s("cancel"),b=_(y),E&&s("canceled",b)}}function _(y){var b,E;s("cleanup"),mx(),r.trapClick?E=f:E=u,$e.unbind(document,"mousemove",l),$e.unbind(document,"dragstart",Or),$e.unbind(document,"selectstart",Or),$e.unbind(document,"mousedown",E,!0),$e.unbind(document,"mouseup",E,!0),$e.unbind(document,"keyup",p),$e.unbind(document,"touchstart",d,!0),$e.unbind(document,"touchcancel",m,!0),$e.unbind(document,"touchmove",l,!0),$e.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),bx);var w=r.payload.previousSelection;return y!==!1&&w&&!n.get().length&&c(w),b=r,r=null,b}function v(y,b,E,w){r&&m(!1),typeof b=="string"&&(w=E,E=b,b=null),w=U({},o,w||{});var P=w.data||{},T,O,N,$,H;if(w.trapClick?$=f:$=u,y?(T=Aa(y)||y,O=Tr(y),Sd(y),T.type==="dragstart"&&Or(T)):(T=null,O={x:0,y:0}),N=a(O),b||(b=N),H=J2(T),r=U({prefix:E,data:P,payload:{},globalStart:O,displacement:Fi(b,N),localStart:N,isTouch:H},w),w.manual||(H?($e.bind(document,"touchstart",d,!0),$e.bind(document,"touchcancel",m,!0),$e.bind(document,"touchmove",l,!0),$e.bind(document,"touchend",u,!0)):($e.bind(document,"mousemove",l),$e.bind(document,"dragstart",Or),$e.bind(document,"selectstart",Or),$e.bind(document,"mousedown",$,!0),$e.bind(document,"mouseup",$,!0)),$e.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;w.autoActivate&&l(y,!0)}e.on("diagram.destroy",m),this.init=v,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(y){U(o,y)}}xx.$inject=["eventBus","canvas","selection","elementRegistry"];const wo={__depends__:[B2,Ri],dragging:["type",xx]};function Dr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Dr.prototype.next=function(){return this._prefix+ ++this._counter};const tO=new Dr("ps");var nO=["marker-start","marker-mid","marker-end"],iO=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Jo(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Jo.$inject=["elementRegistry","eventBus","canvas","styles"],Jo.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")},Jo.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Jo.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=wf(n);return this._cloneMarkers(Uo(o),i),Se(o,this._styles.cls(i,[])),qe(t,o),Se(o,"data-preview-support-element-id",e.id),o},Jo.prototype.addFrame=function(e,t){var n=Le("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return qe(t,n),Se(n,"data-preview-support-element-id",e.id),n},Jo.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),sO(e)&&nO.forEach(function(o){if(Se(e,o)){var r=oO(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},Jo.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,tO.next()].join("-"),a=Et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||wf(n);s.id=r,lt(s).add(o);var c=Et(":scope > defs",e);c||(c=Le("defs"),qe(e,c)),qe(c,s);var l=aO(s.id);Se(t,i,l)};function oO(e,t,n){var i=rO(Se(e,t));return Et("marker#"+i,n||document)}function rO(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function aO(e){return"url(#"+e+")"}function sO(e){return iO.indexOf(e.nodeName)!==-1}const Oa={__init__:["previewSupport"],previewSupport:["type",Jo]};var cO="drop-ok",_x="drop-not-ok",wx="attach-ok",Ex="new-parent",Sx="create",lO=2e3;function Rx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=rt(c,function(v){var y=v.labelTarget;return!v.parent&&!(it(v)&&c.indexOf(y)!==-1)});var d=Lt(c,function(v){return!kt(v)}),g=!1,h=!1,m=!1;Mx(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(Mx(c)?m=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:_===p?d:p,target:_===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[wx,cO,_x,Ex].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}Cx(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,wx):a(p,h?Ex:_x))}),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,m=g&&g.connect,_=l.hints||{};if(g===!1||!d)return!1;Cx(c);var v={x:c.x,y:c.y};m?p=i.appendShape(u,p,v,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(f=i.createElements(f,v,d,U({},_,{attach:h})),p=Lt(f,function(y){return!kt(y)})),U(l,{elements:f,shape:p}),U(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Sx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],lO,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){ze(l)||(l=[l]);var p=Lt(l,function(g){return!kt(g)});if(p){u=U({elements:l,hints:{},shape:p},u||{}),z(l,function(g){Ge(g.x)||(g.x=0),Ge(g.y)||(g.y=0)});var f=rt(l,function(g){return!g.hidden}),d=an(f);z(l,function(g){kt(g)&&(g.waypoints=Bn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),U(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Sx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Rx.$inject=["canvas","dragging","eventBus","modeling","rules"];function Cx(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function Mx(e){return e&&e.length===1&&!kt(e[0])}var uO=750;function Ax(e,t,n,i,o){function r(a){var s=Le("g");Se(s,o.cls("djs-drag-group",["no-events"]));var c=Le("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Uo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Uo(u),l),On(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",uO,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),qe(p,u)),On(u,a.x,a.y)):rn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&rn(c)})}Ax.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Yl={__depends__:[wo,Oa,no,Ri],__init__:["create","createPreview"],create:["type",Rx],createPreview:["type",Ax]};function Ud(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var o=t._svg=i.svg;o.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Ud.$inject=["eventBus"],Ud.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||pO(0,0)};function pO(e,t){var n=document.createEvent("MouseEvent"),i=e,o=t,r=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,o,r,a,!1,!1,!1,!1,0,null),n}const $s={__init__:["mouse"],mouse:["type",Ud]};var Px=2e3;function ri(e,t,n,i,o,r,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=o,this._modeling=r,this._mouse=a,this._rules=s,o.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),fO(u)&&(l.priority=2,l.host=u.host.id),kt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=dO(u)),it(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){Ge(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Px,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Px,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;U(l,{createElementsBehavior:!1})})}ri.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ri.prototype.copy=function(e,t={}){var n,i;return ze(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ze(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ri.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var o=t.hints,r=this._createElements(i);if(t.element&&t.point)return this._paste(r,t.element,t.point,o);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:o})}}},ri.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ri.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(o){return n[o.id]});return i.length>0&&this._modeling.removeElements(i),t},ri.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},ri.prototype._paste=function(e,t,n,i){z(e,function(r){Ge(r.x)||(r.x=0),Ge(r.y)||(r.y=0)});var o=an(e);return z(e,function(r){kt(r)&&(r.waypoints=Bn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),U(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,U({},i))},ri.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return z(e,function(r,a){r=Vi(r,"priority"),z(r,function(s){var c=U({},Wi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(kt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(it(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),o.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),o.push(l)})}),o},ri.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Wi(e,["id"]));return t},ri.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Wi(e,["id"]));return t},ri.prototype.createShape=function(e){var t=this._elementFactory.createShape(Wi(e,["id"]));return t},ri.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(kt(e)&&(!n.has(e.source)||!n.has(e.target))||it(e)&&!n.has(e.labelTarget))},ri.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=al(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=r.get(p);if(!d){var g={element:p,depth:f};o.push(g),r.set(p,g);return}if(d.depth<f){o=l(d,o);var h={element:d.element,depth:f};o.push(h),r.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Mr(a,function(p,f,d){if(it(p))return;z(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&z(m,function(_){z(_.labels,function(v){c(v,d)}),c(_,d)})}z([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Bn(o,function(p){return p.element});var u=new Set(e);return o=Bn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Vi(o,function(p){return p.descriptor.priority}),e=Bn(o,function(p){return p.element}),z(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){kx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){kx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function fO(e){return!!e.host}function dO(e){return Bn(e.waypoints,function(t){return t=Tx(t),t.original&&(t.original=Tx(t.original)),t})}function Tx(e){return U({},e)}function kx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const hO={__depends__:[L2,Yl,$s,no],__init__:["copyPaste"],copyPaste:["type",ri]};function qd(e,t,n){ze(n)||(n=[n]),z(n,function(i){br(e[i])||(t[i]=e[i])})}var Yd=750;function Ox(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=ge(u);if(it(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(dt(u),!0);d.bpmnElement=f,qd(f,l,"name"),qd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=ge(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(ge(c).attachedToRef=ge(l[c.host])),Wi(u,ei(u,function(f,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,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(it(u)){u.businessObject=ge(l[u.labelTarget]),u.di=dt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,qd(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=ge(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",Yd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Ox.$inject=["bpmnFactory","eventBus","moddleCopy"];const gO=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],mO=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Fs(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return Vi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=hn(o)&&o.$descriptor;if(a&&mO.includes(a))return r;if(a&&gO.includes(a)||a&&s&&!Lt(s.properties,ta({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(M(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Fs.$inject=["eventBus","bpmnFactory","moddle"],Fs.prototype.copyElement=function(e,t,n,i=!1){n&&!ze(n)&&(n=[n]),n=n||Kd(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(ze(o)&&(n=o),z(n,r=>{let a;Jn(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!dn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Fs.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return hn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):ze(e)?ei(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:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},Fs.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 Kd(e,t){return ei(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Dx={__depends__:[hO],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ox],moddleCopy:["type",Fs]};var Lx=Math.round;function Xd(e,t){this._modeling=e,this._eventBus=t}Xd.$inject=["modeling","eventBus"],Xd.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,o=this._eventBus;o.fire("replace.start",{element:e,attrs:t,hints:n});var r=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Lx(s+r/2),u=Lx(c+a/2),p=i.replaceShape(e,U({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Ix(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Ix.$inject=["selection","eventBus"];const yO={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ix],replace:["type",Xd]};function vO(e,t,n){ze(n)||(n=[n]),z(n,function(i){br(e[i])||(t[i]=e[i])})}var bO=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function xO(e,t){var n=e&&Jn(e,"collapsed")?e.collapsed:!ut(e),i;return t&&(Jn(t,"collapsed")||Jn(t,"isExpanded"))?i=Jn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Bx(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Kl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&xO(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),vO(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Kd(p.$descriptor),h=Kd(f.$descriptor,!0),m=_O(g,h);U(f,Ii(c,bO));var _=rt(m,function(b){return b==="eventDefinitions"?Nx(s,c.eventDefinitionType):b==="loopCharacteristics"?!jn(f):Jn(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!jn(f):!0});if(f=n.copyElement(p,f,_),c.eventDefinitionType&&(Nx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(Kl(p))d.isExpanded=ut(s);else if(c&&Jn(c,"isExpanded")){d.isExpanded=c.isExpanded;var v=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=v.width,d.height=v.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ut(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 y=xn(s);dt(s).isHorizontal||(dt(d).isHorizontal=y),d.width=y?s.width:t.getDefaultSize(d).width,d.height=y?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ot(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ot(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),o.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}Bx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Kl(e){return M(e,"bpmn:SubProcess")}function Nx(e,t){var n=ge(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function _O(e,t){return e.filter(function(n){return t.includes(n)})}const $x={__depends__:[Dx,yO,Ri],bpmnReplace:["type",Bx]};var wO=250;function Lr(e){this._eventBus=e,this._tools=[],this._active=null}Lr.$inject=["eventBus"],Lr.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)},Lr.prototype.isActive=function(e){return e&&this._active===e},Lr.prototype.length=function(e){return this._tools.length},Lr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Lr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),z(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,wO,function(o){this._active&&(EO(o)||this.setActive(null))},this)};function EO(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Rr(t,'.group[data-group="tools"]')}const Xl={__depends__:[wo],__init__:["toolManager"],toolManager:["type",Lr]};function SO(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 RO(e,t){var n=[],i=new Set(e);z(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;z(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function CO(e,t,n){var i=e.x,o=e.y,r=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:o+c,width:r,height:a-c};case"s":return{x:i,y:o,width:r,height:a+c};case"w":return{x:i+s,y:o,width:r-s,height:a};case"e":return{x:i,y:o,width:r+s,height:a};default:throw new Error("unknown direction: "+t)}}var Zd=Math.abs,MO=Math.round,Eo={x:"width",y:"height"},Fx="crosshair",er={n:"top",w:"left",s:"bottom",e:"right"},AO=1500,Zl={n:"s",w:"e",s:"n",e:"w"},Ql=20;function Ci(e,t,n,i,o,r,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=o,this._toolManager=r,this._mouse=a;var s=this;r.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",AO,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Hx(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){Hx(c);var h={x:0,y:0};h[u]=MO(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Ci.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ci.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Fx,data:{context:{reactivate:n}},trapClick:!1})},Ci.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Fx,data:{context:{}}})},Ci.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ci.prototype.init=function(e,t){var n=Zd(e.dx)>Zd(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Zd(i)<5)return!1;i<0&&(i*=-1),Is(e)&&(i*=-1);var r=SO(n,i),a=this._canvas.getRootElement();!Fl(e)&&e.hover&&(a=e.hover);var s=[...bs(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,o),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:r,shapes:c.resizingShapes,start:o}),u=PO(c,n,r,o,l);return U(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),ql("resize-"+(n==="x"?"ew":"ns")),!0},Ci.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),r.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||it(d))){if(kt(d)){u.push(d);return}var g=d[t],h=g+d[Eo[t]];if(TO(d)&&(n>0&&We(d)[t]>i||n<0&&We(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&o.allowed("shape.resize",{shape:d})){f(d);return}}}),z(r,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:r,resizingShapes:a}},Ci.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ci.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function jx(e){return{top:e.top-Ql,right:e.right+Ql,bottom:e.bottom+Ql,left:e.left-Ql}}function Hx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Ge(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ge(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ge(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Ge(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function PO(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return z(a,function(f){var d=f.attachers,g=f.children,h=je(f),m=rt(g,function(H){return!kt(H)&&!it(H)&&!u.has(H)&&!p.has(H)}),_=rt(g,function(H){return!kt(H)&&!it(H)&&u.has(H)}),v,y,b,E=[],w=[],P,T,O,N;m.length&&(y=jx(je(an(m))),v=i-h[er[n]]+y[er[n]],n==="n"?s.bottom=l=Ge(l)?Math.min(l,v):v:n==="w"?s.right=l=Ge(l)?Math.min(l,v):v:n==="s"?s.top=c=Ge(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Ge(c)?Math.max(c,v):v)),_.length&&(b=jx(je(an(_))),v=i-b[er[Zl[n]]]+h[er[Zl[n]]],n==="n"?s.bottom=l=Ge(l)?Math.min(l,v):v:n==="w"?s.right=l=Ge(l)?Math.min(l,v):v:n==="s"?s.top=c=Ge(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Ge(c)?Math.max(c,v):v)),d&&d.length&&(d.forEach(function(H){u.has(H)?E.push(H):w.push(H)}),E.length&&(P=je(an(E.map(We))),T=h[er[Zl[n]]]-(P[er[Zl[n]]]-i)),w.length&&(O=je(an(w.map(We))),N=O[er[n]]-(h[er[n]]-i)),n==="n"?(v=Math.min(T||1/0,N||1/0),s.bottom=l=Ge(l)?Math.min(l,v):v):n==="w"?(v=Math.min(T||1/0,N||1/0),s.right=l=Ge(l)?Math.min(l,v):v):n==="s"?(v=Math.max(T||-1/0,N||-1/0),s.top=c=Ge(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(T||-1/0,N||-1/0),s.left=c=Ge(c)?Math.max(c,v):v));var $=o&&o[f.id];$&&(n==="n"?(v=i+f[Eo[t]]-$[Eo[t]],s.bottom=l=Ge(l)?Math.min(l,v):v):n==="w"?(v=i+f[Eo[t]]-$[Eo[t]],s.right=l=Ge(l)?Math.min(l,v):v):n==="s"?(v=i-f[Eo[t]]+$[Eo[t]],s.top=c=Ge(c)?Math.max(c,v):v):n==="e"&&(v=i-f[Eo[t]]+$[Eo[t]],s.left=c=Ge(c)?Math.max(c,v):v))}),s}}function TO(e){return!!e.host}var Qd="djs-dragging",zx="djs-resizing",kO=250,Jl=Math.max;function Gx(e,t,n,i,o){function r(a,s){z(a,function(c){o.addDragger(c,s),n.addMarker(c,Qd)})}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=Le("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),qe(s,u);var p=Le("path");Se(p,"d",l.x),lt(p).add("djs-crosshair"),qe(u,p);var f=Le("path");Se(f,"d",l.y),lt(f).add("djs-crosshair"),qe(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;On(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&rn(c)}),e.on("spaceTool.move",kO,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=Le("path"),Se(c,"d","M0,0 L0,0"),lt(c).add("djs-crosshair"),qe(f,c),s.line=c;var d=Le("g");Se(d,i.cls("djs-drag-group",["no-events"])),qe(n.getActiveLayer(),d),r(u,d);var g=new Set(u);z(p,function(w){g.add(w)});var h=new Set,m=s.movingConnections=[];g.forEach(function(w){z(w.outgoing,function(P){h.has(P)||!kt(P)||!g.has(P.target)||(h.add(P),m.push(P))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Le("g");Se(_,i.cls("djs-frame-group",["no-events"])),qe(n.getActiveLayer(),_);var v=[];z(p,function(w){var P=o.addFrame(w,_),T=P.getBBox();v.push({element:P,initialBounds:T}),n.addMarker(w,zx)}),s.frameGroup=_,s.frames=v}var y={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:y[l]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[s.axis]]=0,On(s.dragGroup,E.x,E.y),z(s.frames,function(w){var P=w.element,T=w.initialBounds,O,N;s.direction==="e"?Se(P,{width:Jl(T.width+E.x,5)}):(O=Jl(T.width-E.x,5),Se(P,{width:O,x:T.x+T.width-O})),s.direction==="s"?Se(P,{height:Jl(T.height+E.y,5)}):(N=Jl(T.height-E.y,5),Se(P,{height:N,y:T.y+T.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,Qd)}),z(l,function(g){n.removeMarker(g,Qd)}),f&&(rn(p),rn(f)),z(u,function(g){n.removeMarker(g,zx)}),d&&rn(d)})}Gx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const OO={__init__:["spaceToolPreview"],__depends__:[wo,no,Xl,Oa,$s],spaceTool:["type",Ci],spaceToolPreview:["type",Gx]};function eu(e,t){e.invoke(Ci,this),this._canvas=t}eu.$inject=["injector","canvas"],Ae(eu,Ci),eu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=Jr(ga(o.children.filter(l=>M(l,"bpmn:Artifact")),an(r))));const s=[...e,...a];var c=Ci.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||DO(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function DO(e){return M(e,"bpmn:Participant")&&!ge(e).processRef}const Vx={__depends__:[OO],spaceTool:["type",eu]};function Vt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Vt.$inject=["eventBus","injector"],Vt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Vt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Vt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.register=function(e,t){this._setHandler(e,t)},Vt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Vt.prototype.canUndo=function(){return!!this._getUndoAction()},Vt.prototype.canRedo=function(){return!!this._getRedoAction()},Vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Vt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Vt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Vt.prototype._createId=function(){return this._uid++},Vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Vt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Vt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Vt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Lg("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ze(e)?e:[e],t.dirty=t.dirty.concat(e))},Vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Vt.prototype._revertedAction=function(e){this._stackIdx--},Vt.prototype._getHandler=function(e){return this._handlerMap[e]},Vt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const LO={commandStack:["type",Vt]};function tr(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 IO=250,Wx=1400;function Jd(e,t,n){de.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Wx,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=Ux(a),r.validatedShapes=Ux(s)}),i&&t.on("shape.move.start",IO,function(o){var r=o.context,a=new Set(r.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(r,c,!0)}),this.preExecuted("elements.move",Wx,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;tr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.labelTarget;s&&(r.labelTargetIndex=Of(s.labels,a),r.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(o){var r=o.context,a=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(tn(s.labels,a,c),a.labelTarget=s)})}Ae(Jd,de),Jd.$inject=["injector","eventBus","modeling"];function Ux(e){var t=new Set(e);return rt(e,function(n){return!t.has(n.labelTarget)})}const BO={__init__:["labelSupport"],labelSupport:["type",Jd]};var NO=251,qx=1401,Yx="attach-ok";function eh(e,t,n,i,o){de.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",qx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=$O(c),s.validatedShapes=FO(l)}),r&&t.on("shape.move.start",NO,function(a){var s=a.context,c=s.shapes,l=th(c);z(l,function(u){r.makeDraggable(s,u,!0),z(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Yx),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Yx)}))}}),this.preExecuted("elements.move",qx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=th(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=rt(c,function(p){var f=p.host;return jO(p)&&!HO(c,f)}),z(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),z(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;tr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&z(l.attachers,function(u){var p=fb(u,c,l);o.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=fb(d,l,u);o.moveShape(d,g,d.parent),z(d.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;tr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ae(eh,de),eh.$inject=["injector","eventBus","canvas","rules","modeling"];function th(e){return xp(Bn(e,function(t){return t.attachers||[]}))}function $O(e){var t=th(e);return K1("id",e,t)}function FO(e){var t=ea(e,"id");return rt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function jO(e){return!!e.host}function HO(e,t){return e.indexOf(t)!==-1}const zO={__depends__:[no],__init__:["attachSupport"],attachSupport:["type",eh]};function Kx(e,t,n,i){e.on("element.changed",function(o){var r=o.element;(r.parent||r===t.getRootElement())&&(o.gfx=n.getGraphics(r)),o.gfx&&e.fire(Hy(r)+".changed",o)}),e.on("elements.changed",function(o){var r=o.elements;r.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(r)}),e.on("shape.changed",function(o){i.update("shape",o.element,o.gfx)}),e.on("connection.changed",function(o){i.update("connection",o.element,o.gfx)})}Kx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const nh={__init__:["changeSupport"],changeSupport:["type",Kx]};function Mi(e){this._model=e}Mi.$inject=["moddle"],Mi.prototype._needsId=function(e){return ot(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Mi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":ot(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",U({bpmnElement:e,bounds:this.createDiBounds()},t))},Mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Mi.prototype.createDiWaypoints=function(e){var t=this;return Bn(e,function(n){return t.createDiWaypoint(n)})},Mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Ii(e,["x","y"]))},Mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",U({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",U({bpmnElement:e},t))};function ai(e,t,n){de.call(this,e),this._bpmnFactory=t;var i=this;function o(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function r(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],si(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],si(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;z(m,function(_){M(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],si(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],si(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"],si(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],si(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],si(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],si(u)),this.executed("connection.reconnect",si(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,v=ge(h),y=ge(m),b=ge(_);v.conditionExpression&&!ot(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=v.conditionExpression,delete v.conditionExpression),m!==_&&y.default===v&&(g.oldDefault=y.default,delete y.default)})),this.reverted("connection.reconnect",si(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,v=ge(h),y=ge(m),b=ge(_);g.oldConditionExpression&&(v.conditionExpression=g.oldConditionExpression),g.oldDefault&&(y.default=g.oldDefault,delete b.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],si(p)),this.reverted(["element.updateAttachment"],si(p)),this.executed("element.updateLabel",si(f)),this.reverted("element.updateLabel",si(f));function f(d){const{element:g}=d.context,h=yi(g),m=dt(g),_=m&&m.get("label");Yo(g)||jl(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&m.set("label",void 0))}}Ae(ai,de),ai.$inject=["eventBus","bpmnFactory","connectionDocking"],ai.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ai.prototype.updateParent=function(e,t){if(!it(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=dt(e),r=n&&n.businessObject,a=dt(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),M(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},ai.prototype.updateBounds=function(e){var t=dt(e),n=VO(e);if(n){var i=Fi(n,t.get("bounds"));U(n,{x:e.x+i.x,y:e.y+i.y})}var o=it(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),U(r,{x:e.x,y:e.y,width:e.width,height:e.height})},ai.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Zt(i,e)),M(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),tn(o,e))}},ai.prototype.updateDiConnection=function(e,t,n){var i=dt(e),o=dt(t),r=dt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ge(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==ge(n)&&(i.targetElement=n&&r)},ai.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Zt(n,e),e.$parent=null)}};function GO(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ai.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)},ai.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=GO(e.$parent||t),e.$parent&&(Zt(r.get("rootElements"),o),o.$parent=null),t&&(tn(r.get("rootElements"),o),o.$parent=r))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Zt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Zt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ai.prototype.updateConnectionWaypoints=function(e){var t=dt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ai.prototype.updateConnection=function(e){var t=e.connection,n=ge(t),i=t.source,o=ge(i),r=t.target,a=ge(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(Zt(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(Zt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,r)},ai.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function si(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function VO(e){if(M(e,"bpmn:Activity")){var t=dt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function nr(e,t){vo.call(this),this._bpmnFactory=e,this._moddle=t}Ae(nr,vo),nr.$inject=["bpmnFactory","moddle"],nr.prototype._baseCreate=vo.prototype.create,nr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,U({type:"label",di:n},Ar,t))}return this.createElement(e,t)},nr.prototype.createElement=function(e,t){t=U({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!UO(o)){var r=U({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}M(i,"bpmn:Group")&&(t=U({isFrame:!0},t)),t=WO(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=ih(o,t,"isExpanded")),ot(i,["bpmn:Lane","bpmn:Participant"])&&(t=ih(o,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!ut(i,o)),M(i,"bpmn:ExclusiveGateway")&&(Jn(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),dn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),dn(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,o),t=U({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},nr.prototype.getDefaultSize=function(e,t){var n=ge(e);if(t=t||dt(e),M(n,"bpmn:SubProcess"))return ut(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 ut(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}},nr.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 WO(e,t,n){return z(n,function(i){t=ih(e,t,i)}),t}function ih(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Wi(t,[n]))}function UO(e){return ot(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function tu(e,t){this._modeling=e,this._canvas=t}tu.$inject=["modeling","canvas"],tu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(o){var r={x:0,y:0};dn(i.left)?r.x=i.left-o.x:dn(i.right)?r.x=i.right-o.width-o.x:dn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:dn(i.top)?r.y=i.top-o.y:dn(i.bottom)?r.y=i.bottom-o.height-o.y:dn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},tu.prototype.postExecute=function(e){};function nu(e){this._modeling=e}nu.$inject=["modeling"],nu.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,o=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:o.attach}),e.shape=i},nu.prototype.postExecute=function(e){var t=e.hints||{};qO(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 qO(e,t){return Do(e.outgoing,function(n){return n.target===t})}function iu(e,t){this._canvas=e,this._layouter=t}iu.$inject=["canvas","layouter"],iu.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,o=e.parent,r=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!o)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,o,r),t},iu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ou=Math.round;function oh(e){this._modeling=e}oh.$inject=["modeling"],oh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;z(t,function(p){Ge(p.x)||(p.x=0),Ge(p.y)||(p.y=0)});var s=rt(t,function(p){return!p.hidden}),c=an(s);z(t,function(p){kt(p)&&(p.waypoints=Bn(p.waypoints,function(f){return{x:ou(f.x-c.x-c.width/2+o.x),y:ou(f.y-c.y-c.height/2+o.y)}})),U(p,{x:ou(p.x-c.x-c.width/2+o.x),y:ou(p.y-c.y-c.height/2+o.y)})});var l=new Set(al(t)),u={};z(t,function(p){if(kt(p)){u[p.id]=Ge(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var f=U({},r);l.has(p)||(f.autoResize=!1),it(p)&&(f=Wi(f,["attach"])),u[p.id]=Ge(i)?a.createShape(p,Ii(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Ii(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Jr(u)};var Xx=Math.round;function ir(e){this._canvas=e}ir.$inject=["canvas"],ir.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?U(t,n):U(t,{x:n.x-Xx(t.width/2),y:n.y-Xx(t.height/2)}),this._canvas.addShape(t,i,o),t},ir.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function js(e){ir.call(this,e)}Ae(js,ir),js.$inject=["canvas"];var YO=ir.prototype.execute;js.prototype.execute=function(e){var t=e.shape;return XO(t),t.labelTarget=e.labelTarget,YO.call(this,e)};var KO=ir.prototype.revert;js.prototype.revert=function(e){return e.shape.labelTarget=null,KO.call(this,e)};function XO(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Hs(e,t){this._canvas=e,this._modeling=t}Hs.$inject=["canvas","modeling"],Hs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;tr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),tr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Hs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Of(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Hs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t};function rh(e,t){this._modeling=e,this._elementRegistry=t}rh.$inject=["modeling","elementRegistry"],rh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function zs(e,t){this._canvas=e,this._modeling=t}zs.$inject=["canvas","modeling"],zs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;tr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),tr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),tr(n.children,function(i){kt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},zs.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Of(i.children,n),t.removeShape(n),n},zs.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return tn(i.children,n,o),t.addShape(n,i),n};function ru(e){this._modeling=e}ru.$inject=["modeling"];var Zx={x:"y",y:"x"};ru.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,_){var v={y:0};v[i]=m-a(_),v[i]&&(v[Zx[i]]=0,t.moveElements([_],v,_.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(m,_){var v,y,b;if(m.elements.length<2){_&&_!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}v=Vi(m.elements,i),y=v[0],_===p&&(y=v[s(v)]),b=a(y),m.range=null,z(v,function(E){if(l(b,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),_&&_!==n.length-1&&(h+=c(m.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(m,_){var v={},y;m===u||m===f||(y=n[_-1],m.range.max=0,z(m.elements,function(b,E){v[Zx[i]]=0,v[i]=y.range.max-b[i]+d,m.range.min!==b[i]&&(v[i]+=b[i]-m.range.min),v[i]&&t.moveElements([b],v,b.parent),m.range.max=Math.max(b[i]+b[o],E?m.range.max:0)}))})},ru.prototype.postExecute=function(e){};function au(e,t){this._layouter=e,this._canvas=t}au.$inject=["layouter","canvas"],au.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},au.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function ah(){}ah.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=Zt(r.children,t),tn(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},ah.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return Zt(n.children,t),tn(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function sh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}sh.prototype.add=function(e,t){return this.addAll([e],t)},sh.prototype.addAll=function(e,t){var n=CA(e,!!t,this);return U(this,n),this};function Gs(e){this._modeling=e}Gs.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Gs.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),z(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&hd(p,p.source,t),connectionEnd:d&&gd(p,p.target,t)})})},Gs.prototype.getClosure=function(e){return new sh().addAll(e,!0)};function su(e){this._helper=new Gs(e)}su.$inject=["modeling"],su.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},su.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Ir(e){this._modeling=e,this._helper=new Gs(e)}Ir.$inject=["modeling"],Ir.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=Ii(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Zt(r.children,t),tn(i.children,t,o),U(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Ir.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(z(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:gd(r,t,n)})}),z(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:hd(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Ir.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return tn(n.children,t,i),U(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Ir.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Ir.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Vs(e){this._modeling=e}Vs.$inject=["modeling"],Vs.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,o=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return ze(o)&&(e.oldWaypoints=i.waypoints,i.waypoints=o),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Vs.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,o=e.dockingOrPoints,r=e.hints||{},a={};r.connectionStart&&(a.connectionStart=r.connectionStart),r.connectionEnd&&(a.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!i||r.docking==="source")&&(a.connectionStart=a.connectionStart||Qx(ze(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||Qx(ze(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Vs.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,o=e.connection;return t&&(o.source=t),n&&(o.target=n),i&&(o.waypoints=i),o};function Qx(e){return e.original||e}function So(e,t){this._modeling=e,this._rules=t}So.$inject=["modeling","rules"],So.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=o.incoming.slice(),d=o.outgoing.slice();z(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,Ll(g,s,u),a)}),z(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Dl(g,s,u),a)})},So.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},So.prototype.execute=function(e){},So.prototype.revert=function(e){},So.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},So.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},So.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ws(e){this._modeling=e}Ws.$inject=["modeling"],Ws.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},Ws.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(z(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Ll(r,n,i)})}),z(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Dl(r,n,i)})}))},Ws.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 or(e){this._modeling=e}or.$inject=["modeling"],or.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),z(o,function(s){a[s.id]=QO(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(RO(i,o),t,n,r,i,o,a)},or.prototype.execute=function(){},or.prototype.revert=function(){},or.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},or.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(o){var r=CO(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},or.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);z(e,function(u){var p=u.source,f=u.target,d=ZO(u),g=e_(n),h={},m=c.has(p)||l.has(p),_=c.has(f)||l.has(f);m&&_?(d=Bn(d,function(v){return t_(v,i,n)&&(v[g]=v[g]+t[g]),v.original&&t_(v.original,i,n)&&(v.original[g]=v.original[g]+t[g]),v}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||_)&&(c.has(p)?h.connectionStart=hd(u,p,t):c.has(f)?h.connectionEnd=gd(u,f,t):l.has(p)?h.connectionStart=Dl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Ll(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function Jx(e){return U({},e)}function ZO(e){return Bn(e.waypoints,function(t){return t=Jx(t),t.original&&(t.original=Jx(t.original)),t})}function e_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function t_(e,t,n){var i=e_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function QO(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function cu(e){this._modeling=e}cu.$inject=["modeling"],cu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=n_(n),t.collapsed=!t.collapsed;var i=i_(n,t.collapsed);return[t].concat(i)},cu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=o_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function n_(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=U({},t,n_(n.children)))}),t}function i_(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(i_(i.children,i.collapsed||t)))}),n}function o_(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(o_(i.children,t)))}),n}function lu(e){this._modeling=e}lu.$inject=["modeling"],lu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=r_(i,t),a_(n,t),t.host=n,t},lu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,r_(n,t),a_(i,t,o),t};function r_(e,t){return Zt(e&&e.attachers,t)}function a_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),tn(i,t,n)}}function ch(){}ch.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ch.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ot(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ot.$inject=["eventBus","elementFactory","commandStack"],Ot.prototype.getHandlers=function(){return{"shape.append":nu,"shape.create":ir,"shape.delete":zs,"shape.move":Ir,"shape.resize":Ws,"shape.replace":So,"shape.toggleCollapse":cu,spaceTool:or,"label.create":js,"connection.create":iu,"connection.delete":Hs,"connection.move":ah,"connection.layout":au,"connection.updateWaypoints":ch,"connection.reconnect":Vs,"elements.create":oh,"elements.move":su,"elements.delete":rh,"elements.distribute":ru,"elements.align":tu,"element.updateAttachment":lu}},Ot.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ot.prototype.moveShape=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},Ot.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ot.prototype.moveElements=function(e,t,n,i){i=i||{};var o=i.attach,r=n,a;o===!0?(a=n,r=n.parent):o===!1&&(a=null);var s={shapes:e,delta:t,newParent:r,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Ot.prototype.moveConnection=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},Ot.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ot.prototype.createConnection=function(e,t,n,i,o,r){typeof n=="object"&&(r=o,o=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:o,parentIndex:n,connection:i,hints:r};return this._commandStack.execute("connection.create",a),a.connection},Ot.prototype.createShape=function(e,t,n,i,o){typeof i!="number"&&(o=i,i=void 0),o=o||{};var r=o.attach,a,s;e=this._create("shape",e),r?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",c),c.shape},Ot.prototype.createElements=function(e,t,n,i,o){ze(e)||(e=[e]),typeof i!="number"&&(o=i,i=void 0),o=o||{};var r={position:t,elements:e,parent:n,parentIndex:i,hints:o};return this._commandStack.execute("elements.create",r),r.elements},Ot.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},Ot.prototype.appendShape=function(e,t,n,i,o){o=o||{},t=this._create("shape",t);var r={source:e,position:n,target:i,shape:t,connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},Ot.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ot.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ot.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ot.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ot.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ot.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ot.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Ot.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},Ot.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ot.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},Ot.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,U(i,{docking:"source"}))},Ot.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,U(i,{docking:"target"}))},Ot.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ot.prototype._create=function(e,t){return pP(t)?t:this._elementFactory.create(e,t)},Ot.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Us(e){this._elementRegistry=e}Us.$inject=["elementRegistry"],Us.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var o=e.changed||this._getVisualReferences(n).concat(t),r=e.oldProperties||JO(n,Mc(i));return s_(n,i),e.oldProperties=r,e.changed=o,o},Us.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return s_(n,t),i},Us.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?eD(e,t):[]};function JO(e,t){return ei(t,function(n,i){return n[i]=e.get(i),n},{})}function s_(e,t){z(t,function(n,i){e.set(i,n)})}function eD(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&ge(n).dataObjectRef===e})}var qs="default",Ro="id",c_="di",tD={width:0,height:0};function Ys(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ys.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ys.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,o=this._moddle.ids,r=t.businessObject,a=aD(e.properties),s=e.oldProperties||nD(t,a);return l_(a,r)&&(o.unclaim(r[Ro]),i.updateId(t,a[Ro]),o.claim(a[Ro],r)),qs in a&&(a[qs]&&n.push(i.get(a[qs].id)),r[qs]&&n.push(i.get(r[qs].id))),u_(t,a),e.oldProperties=s,e.changed=n,n},Ys.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ge(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,tD)}},Ys.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return u_(t,i),l_(n,o)&&(a.unclaim(n[Ro]),r.updateId(t,i[Ro]),a.claim(i[Ro],o)),e.changed};function l_(e,t){return Ro in e&&e[Ro]!==t[Ro]}function nD(e,t){var n=Mc(t),i=e.businessObject,o=dt(e);return ei(n,function(r,a){return a!==c_?r[a]=i.get(a):r[a]=iD(o,Mc(t.di)),r},{})}function iD(e,t){return ei(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function u_(e,t){var n=e.businessObject,i=dt(e);z(t,function(o,r){r!==c_?n.set(r,o):i&&oD(i,o)})}function oD(e,t){z(t,function(n,i){e.set(i,n)})}var rD=["default"];function aD(e){var t=U({},e);return rD.forEach(function(n){n in e&&(t[n]=ge(t[n]))}),t}function uu(e,t){this._canvas=e,this._modeling=t}uu.$inject=["canvas","modeling"],uu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=dt(o);return t.setRootElement(n),t.removeRootElement(o),tn(a.rootElements,i),i.$parent=a,Zt(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},uu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=dt(n);return t.setRootElement(o),t.removeRootElement(n),Zt(a.rootElements,i),i.$parent=null,tn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function lh(e,t){this._modeling=e,this._spaceTool=t}lh.$inject=["modeling","spaceTool"],lh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ei(i),a=r===i,s=a?i:i.parent,c=Xo(s),l=xn(i);if(l?o==="left"?o="top":o==="right"&&(o="bottom"):o==="top"?o="left":o==="bottom"&&(o="right"),!c.length){var u=l?{x:i.x+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Mr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:rt(b.children,function(E){return E!==i})});var f,d,g,h,m;o==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):o==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):o==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):o==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(p,m,f,g),v=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,v,h,g);var y=l?{x:i.x+(a?wi:0),y:d-(o==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},y,s)};function uh(e){this._modeling=e}uh.$inject=["modeling"],uh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=Xo(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Ks(e,t){this._modeling=e,this._spaceTool=t}Ks.$inject=["modeling","spaceTool"],Ks.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ks.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=ek(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Ks.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=je(e),o=je(t),r=zv(o,i),a=Ei(e),s=[],c=[];Mr(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",f=r.top>0||r.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",f=r.left>0||r.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Xs="flowNodeRef",ph="lanes";function pu(){}pu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=je(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ei(u);return o[p.id]||(o[p.id]=Al(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ei(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,f=p.get(ph),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(Xs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},pu.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,o=i.get(ph);n.remove.forEach(function(r){Zt(o,r),Zt(r.get(Xs),i)}),n.add.forEach(function(r){tn(o,r),tn(r.get(Xs),i)})}),[]},pu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(ph);n.add.forEach(function(r){Zt(o,r),Zt(r.get(Xs),i)}),n.remove.forEach(function(r){tn(o,r),tn(r.get(Xs),i)})}),[]};var fh="categoryValueRef";function Zs(e,t){this._bpmnFactory=e,this._elementRegistry=t}Zs.$inject=["bpmnFactory","elementRegistry"],Zs.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(v,y,b){if(y){var E=a.get(v);E||(E={},a.set(v,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:y,root:dh(v)}:E.past={categoryValue:y}))}}function c(v){o.set(v,ge(v))}function l(){n.filter(function(v){return M(v,"bpmn:FlowElement")&&!it(v)&&v.parent}).forEach(c)}function u(v){var y=ge(v),b=y.get("categoryValueRef");return b||(b=Nv(i,y),r.push(sD(v,b))),b}function p(v){return v.reduce(function(y,b){var E=dh(b),w=y.get(E);return w||(w=[],y.set(E,w)),w.push(b),y},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(v){return M(v,"bpmn:Group")&&!it(v)&&v.parent}).forEach(function(v){var y=ge(v).get("categoryValueRef");if(!y){var b=dh(v),E=f.get(b)||[],w=ga(E,v),P=Object.keys(w).length>0;P&&(y=u(v))}s(v,y,!0)}),t.forEach(function(v){s(v.groupShape,v.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(v,y){return y.present&&v.add(y.present.categoryValue),y.past&&v.add(y.past.categoryValue),v},new Set),h=new Map,m=p(d);a.forEach(function(v,y){var b=v.present;if(b){var E=m.get(b.root)||[],w=ga(E,y);E.forEach(function(P){if(w[P.id]){var T=h.get(P);T||(T=new Set,h.set(P,T)),T.add(b.categoryValue)}})}});var _=d.reduce(function(v,y){var b=o.get(y),E=b.get(fh),w=new Set(E),P=h.get(y)||new Set,T=Array.from(P).filter(function(N){return!w.has(N)}),O=E.filter(function(N){return g.has(N)&&!P.has(N)});return(T.length||O.length)&&v.push({businessObject:b,categoryValuesToAdd:T,categoryValuesToRemove:O}),v},[]);return{flowElements:_,groups:r}},Zs.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),cD(t.groups),uD(t.flowElements),[]},Zs.prototype.revert=function(e){var t=e.updates;return pD(t.flowElements),lD(t.groups),[]};function sD(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function cD(e){e.forEach(function(t){ge(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function lD(e){e.forEach(function(t){ge(t.groupShape).categoryValueRef=null})}function uD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(fh);t.categoryValuesToRemove.forEach(function(o){Zt(i,o)}),t.categoryValuesToAdd.forEach(function(o){tn(i,o,!0)})})}function pD(e){e.forEach(function(t){var n=t.businessObject,i=n.get(fh);t.categoryValuesToAdd.forEach(function(o){Zt(i,o)}),t.categoryValuesToRemove.forEach(function(o){tn(i,o,!0)})})}function dh(e){for(;e.parent;)e=e.parent;return e}function fu(e){this._moddle=e}fu.$inject=["moddle"],fu.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},fu.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.unclaim(n):t.claim(n,i),[]};var fD={fill:void 0,stroke:void 0};function hh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Qn(t)){var n=dD(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}hh.$inject=["commandStack"],hh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||fD,i=this,o={};"fill"in n&&U(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&U(o,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(r){var a=kt(r)?Ii(o,["border-color"]):o,s=dt(r);if(hD(a),it(r)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!ot(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function dD(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 hD(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var gD={width:0,height:0};function p_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return GP(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!it(l)&&Yo(l)&&!gl(l)&&!f_(p)){var f=7,d=$f(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=yi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!it(u)&&!M(u,"bpmn:TextAnnotation"))){if(it(u)&&f_(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=yi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,gD)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}p_.$inject=["modeling","textRenderer","bpmnFactory"];function f_(e){return!e||!e.trim()}function Ln(e,t,n,i){Ot.call(this,e,t,n),this._bpmnRules=i}Ae(Ln,Ot),Ln.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Ln.prototype.getHandlers=function(){var e=Ot.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Us,e["element.updateProperties"]=Ys,e["canvas.updateRoot"]=uu,e["lane.add"]=lh,e["lane.resize"]=Ks,e["lane.split"]=uh,e["lane.updateRefs"]=pu,e["group.updateRefs"]=Zs,e["id.updateClaim"]=fu,e["element.setColor"]=hh,e["element.updateLabel"]=p_,e},Ln.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Ln.prototype.connect=function(e,t,n,i){var o=this._bpmnRules;if(n||(n=o.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Ln.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Ln.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ln.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ln.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ln.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ln.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ln.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Ln.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ln.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ln.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function d_(){}d_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||We(t.source||e.source),t.connectionEnd||We(t.target||e.target)]};var du=20,mD=5,hu=Math.round,h_=20,yD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function vD(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function bD(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function g_(e,t,n){var i=kn(t,e,mD),o=n.split(":")[0],r=hu((t.x-e.x)/2+e.x),a=hu((t.y-e.y)/2+e.y),s,c,l=bD(o,i),u=/h|r|l/.test(o),p=!1,f=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=vD(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+du*(/l/.test(o)?-1:1),y:f?a+du:a}):(f=r===e.x,s={x:f?r+du:r,y:e.y+du*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:gh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function xD(e,t,n){return g_(e,t,n)}function _D(e,t,n){var i=g_(t,e,m_(n));return{waypoints:i.waypoints.slice().reverse(),directions:m_(i.directions),turnNextDirections:i.turnNextDirections}}function wD(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var o=n+":"+i,r=gh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function m_(e){return e.split(":").reverse().join(":")}function ED(e,t,n){var i=hu((t.x-e.x)/2+e.x),o=hu((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:o},{x:t.x,y:o}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function gh(e,t,n){if(n=n||"h:h",!OD(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(v_(n)){var i=xD(e,t,n),o=_D(e,t,n),r=wD(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return ED(e,t,n)}function SD(e,t,n){var i=gh(e,t,n);return i.unshift(e),i.push(t),x_(i)}function RD(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=q1(r,"straight")[0]||"h:h",s=yD[a]||0,c=kn(e,t,s),l=kD(c,a);n=n||We(e),i=i||We(t);var u=l.split(":"),p=b_(n,e,u[0],DD(c)),f=b_(i,t,u[1],c);return SD(p,f,l)}function CD(e,t,n,i,o,r){ze(n)&&(o=n,r=i,n=We(e),i=We(t)),r=U({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&AD(e,t,n,i,r),c||(c=r.connectionEnd&&TD(t,e,i,o),c)||(c=r.connectionStart&&PD(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:RD(e,t,n,i,r)}function MD(e,t,n){return e>=t&&e<=n}function y_(e,t,n){var i={x:"width",y:"height"};return MD(t[e],n[e],n[e]+n[i[e]])}function AD(e,t,n,i,o){var r={},a,s;return s=kn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?y_(a,i,e)?(r[a]=i[a],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:i.x,y:i.y}]):null:y_(a,n,t)?(r[a]=n[a],[{x:n.x,y:n.y},{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y,original:{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y}}]):null):null}function PD(e,t,n,i){return mh(e,t,n,i)}function TD(e,t,n,i){var o=i.slice().reverse();return o=mh(e,t,n,o),o?o.reverse():null}function mh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Lt(u,function(p,f){var d=u[f-1];return d&&_s(p,d)<3})}function r(u,p,f){var d=mo(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(Gy(u[d],p,h_)||Gy(u[d],f,h_))return u.slice(d);return u}if(o(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=r(c[1],s,n),l=a(c,e,t),l!==c&&(c=mh(e,t,n,l)),c&&mo(c)?null:c}function kD(e,t){if(v_(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 OD(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function v_(e){return e&&/t|r|b|l/.test(e)}function DD(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function b_(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function x_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return Df(o,r,n,0)||t.push(n),t},[])}var LD=-10,ID=40,BD={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},ND={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},yh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Qs={top:"t",right:"r",bottom:"b",left:"l"};function gu(e){this._elementRegistry=e}Ae(gu,d_),gu.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,o=t.waypoints||e.waypoints,r=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(r||(r=__(o&&o[0],n)),a||(a=__(o&&o[o.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&o&&!w_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Dv(n,s)?BD:ND;return M(e,"bpmn:MessageFlow")?c=FD(n,i,u):(M(e,"bpmn:SequenceFlow")||w_(n,i))&&(n===i?c={preferredLayouts:WD(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:UD(n,i,a,u)}:Js(n)||Js(i)?c={preferredLayouts:u.subProcess,preserveDocking:HD(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=x_(CD(n,i,r,a,o,c))),l||[r,a]};function $D(e){var t=e.host;return kn(We(e),t,LD)}function FD(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:jD(e,t)}}function jD(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Js(t)?"source":Js(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function HD(e){return Js(e)?"target":"source"}function __(e,t){return e?e.original||e:We(t)}function w_(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Js(e){return M(e,"bpmn:SubProcess")&&ut(e)}function Br(e,t){return e===t}function zD(e,t){return t.indexOf(e)!==-1}function Da(e){var t=/right|left/.exec(e);return t&&t[0]}function La(e){var t=/top|bottom/.exec(e);return t&&t[0]}function E_(e,t){return yh[e]===t}function GD(e,t){var n=Da(e),i=yh[n];return t.indexOf(i)!==-1}function VD(e,t){var n=La(e),i=yh[n];return t.indexOf(i)!==-1}function S_(e){return e==="right"||e==="left"}function WD(e,t,n){var i=t.waypoints,o=i&&i.length&&kn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function UD(e,t,n,i){var o=We(e),r=We(t),a=$D(e),s,c,l=Br(e.host,t),u=zD(a,["top","right","bottom","left"]),p=kn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?qD(a,u,e,t,n,i):(s=YD(a,p,u,i.isHorizontal),c=KD(a,p,u,i.isHorizontal),[s+":"+c])}function qD(e,t,n,i,o,r){var a=t?e:r.isHorizontal?La(e):Da(e),s=Qs[a],c;return t?S_(e)?c=R_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=R_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function R_(e,t,n,i){var o=ID;return!(vh(e,i,n,o)||vh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||vh(e,i,We(t),o))}function vh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function YD(e,t,n,i){if(n)return Qs[e];var o=La(e),r=Da(e),a=La(t),s=Da(t);if(i){if(Br(o,a)||E_(r,s))return Qs[o]}else if(Br(r,s)||E_(o,a))return Qs[r];return Qs[i?r:o]}function KD(e,t,n,i){if(n)return S_(e)?GD(e,t)||Br(e,t)?"h":"v":VD(e,t)||Br(e,t)?"v":"h";var o=La(e),r=Da(e),a=La(t),s=Da(t);return a&&!s?"v":s&&!a?"h":i?Br(o,a)?"h":"v":Br(r,s)?"v":"h"}gu.$inject=["elementRegistry"];function C_(e){return U({original:e.point.original||e.point},e.actual)}function rr(e,t){this._elementRegistry=e,this._graphicsFactory=t}rr.$inject=["elementRegistry","graphicsFactory"],rr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(C_(i)),r.push(C_(o)),r},rr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},rr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return ws(i,o,n)},rr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},rr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},rr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const bh={__init__:["modeling","bpmnUpdater"],__depends__:[h2,T2,O2,D2,$x,LO,BO,zO,Ri,nh,Vx],bpmnFactory:["type",Mi],bpmnUpdater:["type",ai],elementFactory:["type",nr],modeling:["type",Ln],layouter:["type",gu],connectionDocking:["type",rr]};var XD=10,M_=50,ZD=250;function xh(e,t,n,i){for(var o;o=QD(e,n,t);)n=i(t,n,o);return n}function _h(e){return function(t,n,i){var o={x:n.x,y:n.y};return["x","y"].forEach(function(r){var a=e[r];if(a){var s=r==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?o[r]=Math.min(i[r]+c-t[s]/2,n[r]-l+c):o[r]=Math.max(i[r]+i[s]+c+t[s]/2,n[r]+l+c)}}),o}}function QD(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=eL(e);return Lt(o,function(r){if(r===n)return!1;var a=kn(r,i,XD);return a==="intersect"})}function JD(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||M_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||ZD,c=t.reference||"start";r||(r=iL);function l(g,h){return o==="n"?c==="start"?je(g).top-je(h).bottom:c==="center"?je(g).top-We(h).y:je(g).top-je(h).top:o==="w"?c==="start"?je(g).left-je(h).right:c==="center"?je(g).left-We(h).x:je(g).left-je(h).left:o==="s"?c==="start"?je(h).top-je(g).bottom:c==="center"?We(h).y-je(g).bottom:je(h).bottom-je(g).bottom:c==="start"?je(h).left-je(g).right:c==="center"?We(h).x-je(g).right:je(h).right-je(g).right}var u=e.incoming.filter(r).map(function(g){var h=a(g),m=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:m,weight:h}}),p=e.outgoing.filter(r).map(function(g){var h=a(g),m=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:m,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=ei(f,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function eL(e){var t=wh(e);return e.host&&(t=t.concat(wh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(wh(i))},[]))),t}function wh(e){return nL(e).concat(tL(e))}function tL(e){return e.incoming.map(function(t){return t.source})}function nL(e){return e.outgoing.map(function(t){return t.target})}function iL(){return!0}var oL=100;function A_(e,t,n){e.on("autoPlace",oL,function(i){var o=i.shape,r=i.source;return rL(r,o)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,o,r){e.fire("autoPlace.start",{source:i,shape:o});var a=e.fire("autoPlace",{source:i,shape:o}),s=t.appendShape(i,o,a,i.parent,r);return e.fire("autoPlace.end",{source:i,shape:s}),s}}A_.$inject=["eventBus","modeling","canvas"];function rL(e,t,n){n||(n={});var i=n.defaultDistance||M_,o=We(e),r=je(e);return{x:r.right+i+t.width/2,y:o.y}}function P_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}P_.$inject=["eventBus","selection"];const aL={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",A_],autoPlaceSelectionBehavior:["type",P_]};function T_(e,t,n){var i=Dv(e,n);if(M(t,"bpmn:TextAnnotation"))return cL(e,t,i);if(ot(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return lL(e,t,i);if(M(t,"bpmn:FlowNode"))return sL(e,t,i)}function sL(e,t,n){var i=je(e),o=We(e),r=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=JD(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=kn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+k_(l,c,r)}:{x:o.x+k_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return xh(e,t,u,_h(f))}function k_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function cL(e,t,n){var i=je(e),o=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};kt(e)&&(o=We(e),n?(o.x+=100,o.y-=50):(o.x+=100,o.y+=50));var r={margin:n?-30:30,minDistance:20},a=n?{y:r}:{x:r};return xh(e,t,o,_h(a))}function lL(e,t,n){var i=je(e),o=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},r={margin:30,minDistance:30},a=n?{x:r}:{y:r};return xh(e,t,o,_h(a))}function O_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return T_(o,i,t)})}O_.$inject=["eventBus","elementRegistry"];const mu={__depends__:[aL],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",O_]},D_=[kv,As,bh,mu,Tp];function uL(e={}){om(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new va({container:t,moddleExtensions:e.moddleExtensions??Ic,additionalModules:[...D_,...e.additionalModules??[]]})}const L_={"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":"풀"},pL={이:["이","가"],을:["을","를"],와:["과","와"]};function fL(e,t){const[n,i]=pL[t],o=e.at(-1)??"",r=o.charCodeAt(0);return r>=44032&&r<=55203?e+((r-44032)%28===0?i:n):o>="0"&&o<="9"?e+("013678".includes(o)?n:i):e+`${n}(${i})`}const dL={"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":"연관선"},hL="요소";function Eh(e){return(e&&dL[e.type])??hL}const I_=20;function gL(e){const t=e.replace(/\s+/g," ").trim();return t.length>I_?`${t.slice(0,I_)}…`:t}function yu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:gL(o.name),a=r===void 0?i+Eh(o):r,s=r===void 0?a:`「${r}」`;return n?s+fL(a,n).slice(a.length):s}function mL(e,t,n,i,o){const[r,a]=[e(t),e(n)],s=(r==null?void 0:r.name)===void 0&&(a==null?void 0:a.name)===void 0&&Eh(r)===Eh(a);return[yu(e,t,i),yu(e,n,o,s?"다른 ":"")]}function yL(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 vL(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 vu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function bL(e,t){const n=(o,r)=>yu(t,o,r),i=(o,r,a,s)=>mL(t,o,r,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[o,r]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${o} ${r} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${o} ${r} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[o,r]=i(e.edge,e.other,void 0,"와");return`${o}의 라벨이 ${r} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[o,r]=i(e.groups[0],e.groups[1],"와","이");return`${o} ${r} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${vu[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${vu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${vu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${vu[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[o,r]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${o} ${r} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${o} ${r} 겹칩니다.`}}}function xL(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${yu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const B_="기타",Sh={error:0,warning:1,info:2};function N_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:yL(i),targetRefs:vL(i),category:L_[i.kind]??B_,message:bL(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:L_[i.ruleId]??B_,message:xL(i,t)});return n}function $_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ia(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Rh(e,t){if(t===void 0||e.length===0)return!1;const n=Ia(e[0],t);return e.some(i=>Ia(i,t)!==n)}function F_(e,t){const n=Rh(e,t);return e.slice().sort((i,o)=>(n?Number(Ia(o,t))-Number(Ia(i,t)):0)||Sh[i.severity]-Sh[o.severity])}const j_="i18n-untranslated",H_="i18n-review-requested",Ch="i18nDisplay.redrawn",z_=[["untranslated",j_],["reviewRequested",H_]];class Mh{constructor(t,n,i,o,r,a,s,c){pi(this,"config");pi(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=o.drawShape.bind(o);o.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=r.activate.bind(r);r.activate=f=>this.withDisplayText(f,()=>u(f));const p=r.update.bind(r);r.update=(f,d,g,h)=>{const m=this.resolve(f);if(!m||m.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(Pc,{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(Pc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=xr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=ia(n).filter(f=>Nn(f)),s=f=>f.body??"",c=a.find(f=>Nn(f)===o&&s(f)),l=Lo(n).some(f=>f.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===r).map(Nn);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var r;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let o=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((r=this.resolve(a))==null?void 0:r.status)===n&&o++}finally{this.displayLocale=i}return o}withDisplayText(t,n,i){var f;if(!this.config)return n();const o=this.resolve(t),r=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(r)for(const[d,g]of z_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=xr((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===o.text)return n();a[s]=o.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,o.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,o]of z_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(Ch)}}pi(Mh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const G_={__depends__:[Tp],__init__:["i18nDisplay"],i18nDisplay:["type",Mh]};var _L=new Dr("ov"),wL=500;function Sn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=_L,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=EL(n.getContainer()),this._init()}Sn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Sn.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?rt(t.overlays,ta({type:e.type})):t.overlays.slice():[]}else return e.type?rt(this._overlays,ta({type:e.type})):e.id?this._overlays[e.id]:null},Sn.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},Sn.prototype.remove=function(e){var t=this.get(e)||[];ze(t)||(t=[t]);var n=this;z(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(Xi(i.html),Xi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Sn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Sn.prototype.show=function(){bu(this._overlayRoot)},Sn.prototype.hide=function(){bu(this._overlayRoot,!1)},Sn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],nl(this._overlayRoot)},Sn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=an(t);i=r.x,o=r.y}V_(n,i,o),En(e.html,"data-container-id",t.id)},Sn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=an(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=an(i).height:s=i.height,r=t.bottom*-1+s}V_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._createOverlayContainer=function(e){var t=$t('<div class="djs-overlays" />');Vn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Sn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";W_(this._overlayRoot,n)},Sn.prototype._getOverlayContainer=function(e,t){var n=Lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Sn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Qn(i)&&(i=$t(i)),r=this._getOverlayContainer(n),o=$t('<div class="djs-overlay" data-overlay-id="'+t+'">'),Vn(o,{position:"absolute"}),o.appendChild(i),e.type&&Rt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();bu(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(dn(o)&&o>t.scale||dn(r)&&r<t.scale))&&(c=!1),bu(a,c),this._updateOverlayScale(e,t)},Sn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),dn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),dn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),dn(a)&&(s="scale("+a+","+a+")"),W_(r,s)},Sn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Sn.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var o=i.element,r=t.get({element:o});z(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){Xi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",wL,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(z(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&Rt(o.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function EL(e){var t=$t('<div class="djs-overlay-container" />');return Vn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function V_(e,t,n){Vn(e,{left:t+"px",top:n+"px"})}function bu(e,t){e.style.display=t===!1?"none":""}function W_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const xu={__init__:["overlays"],overlays:["type",Sn]};function Ah(e,t){t.invoke(de,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)})}Ae(Ah,de),Ah.$inject=["canvas","injector"];const SL={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Ah]};function Nr(e){return CSS.escape(e)}var RL={"&":"&","<":"<",">":">",'"':""","'":"'"};function U_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return RL[t]})}var CL="bjs-breadcrumbs-shown";function q_(e,t,n){var i=$t('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Rt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ge(l),p=Lt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=ML(c));var l=a.flatMap(function(p){var f=n.findRoot(to(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(m){var _=ge(m);return _&&_.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=U_(p.name||p.id),h=$t('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;r.toggle(CL,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}q_.$inject=["eventBus","elementRegistry","canvas"];function ML(e){for(var t=ge(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Y_(e,t){var n=null,i=new AL;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!M(r,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Y_.$inject=["eventBus","canvas"];function AL(){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 K_={x:180,y:160};function $r(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}$r.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)})}},$r.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;M(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),TL(a,e)&&i.push({diElement:r,parent:s})}});var o=[];return n.forEach(function(r){if(!t._processToDiagramMap[r.id]){var a=t._createDiagram(r);t._processToDiagramMap[r.id]=a,o.push(a)}}),i.forEach(function(r){for(var a=r.diElement,s=r.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),o},$r.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=PL(e),i={x:n.x-K_.x,y:n.y-K_.y};t.forEach(function(o){o.waypoint?o.waypoint.forEach(function(r){r.x=r.x-i.x,r.y=r.y-i.y}):o.bounds&&(o.bounds.x=o.bounds.x-i.x,o.bounds.y=o.bounds.y-i.y)})},$r.prototype._moveToDiPlane=function(e,t){var n=X_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},$r.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},$r.$inject=["eventBus","moddle"];function X_(e){return M(e,"bpmndi:BPMNDiagram")?e:X_(e.$parent)}function PL(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=je(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ll(t)}function TL(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||ot(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var _u=250,kL='<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>',OL="bjs-drilldown-empty";function ar(e,t,n,i,o){de.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",_u,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",_u,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],_u,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],_u,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return r._canDrillDown(a)}).map(function(a){r._addOverlay(a)})})}Ae(ar,de),ar.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},ar.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(to(e))},ar.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ge(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Rt(i.html).toggle(OL,!o)}},ar.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ge(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=$t('<button type="button" class="bjs-drilldown">'+kL+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});r.setAttribute("title",s),r.addEventListener("click",function(){t.setRootElement(t.findRoot(to(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},ar.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},ar.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const DL={__depends__:[xu,nh,SL],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",q_],drilldownCentering:["type",Y_],drilldownOverlayBehavior:["type",ar],subprocessCompatibility:["type",$r]};function sr(e){Gt.call(this,e)}Ae(sr,Gt),sr.prototype._modules=[kv,DL,xu,Ri,As],sr.prototype._moddleExtensions={};var wu="keyboard.keydown",LL="keyboard.keyup",IL=1e3,Z_="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 Wn(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(Z_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Wn.$inject=["config.keyboard","eventBus"],Wn.prototype._keydownHandler=function(e){this._keyHandler(e,wu)},Wn.prototype._keyupHandler=function(e){this._keyHandler(e,LL)},Wn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||wu,i),n&&e.preventDefault()}},Wn.prototype._isEventIgnored=function(e){return!1},Wn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Z_)),this.unbind(),e=this._node=this._target,$e.bind(e,"keydown",this._keydownHandler),$e.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Wn.prototype.getBinding=function(){return this._node},Wn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),$e.unbind(e,"keydown",this._keydownHandler),$e.unbind(e,"keyup",this._keyupHandler)),this._node=null},Wn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Wn.prototype.addListener=function(e,t,n){bn(e)&&(n=t,t=e,e=IL),this._eventBus.on(n||wu,e,t)},Wn.prototype.removeListener=function(e,t){this._eventBus.off(t||wu,e)},Wn.prototype.hasModifier=U2,Wn.prototype.isCmd=oi,Wn.prototype.isShift=Wd,Wn.prototype.isKey=mn;var BL=500;function Ba(e,t){var n=this;e.on("editorActions.init",BL,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ba.$inject=["eventBus","keyboard"],Ba.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(Z2(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(Q2(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(q2(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(Y2(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(K2(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(X2(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(mn(["+","Add","="],o)&&oi(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(mn(["-","Subtract"],o)&&oi(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(mn("0",o)&&oi(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(mn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const Ph={__init__:["keyboard","keyboardBindings"],keyboard:["type",Wn],keyboardBindings:["type",Ba]};var NL={moveSpeed:50,moveSpeedAccelerated:200};function Q_(e,t,n){var i=this;this._config=U({},NL,e||{}),t.addListener(o);function o(r){var a=r.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(r){var a=0,s=0,c=r.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(r.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}Q_.$inject=["config.keyboardMove","keyboard","canvas"];const J_={__depends__:[Ph],__init__:["keyboardMove"],keyboardMove:["type",Q_]};var $L=15;function ew(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function o(s){var c=n.start,l=n.button,u=Tr(s),p=Fi(u,c);if(!n.dragging&&FL(p)>$L&&(n.dragging=!0,l===0&&yx(e),ql("grab")),n.dragging){var f=n.last||n.start;p=Fi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){$e.unbind(document,"mousemove",o),$e.unbind(document,"mouseup",r),n=null,mx()}function a(s){if(!Rr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Tr(s)},$e.bind(document,"mousemove",o),$e.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}ew.$inject=["eventBus","canvas"];function FL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const tw={__init__:["moveCanvas"],moveCanvas:["type",ew]};function nw(e,t){var n=zf(e.min),i=zf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function jL(e,t){return Math.max(e.min,Math.min(e.max,t))}var HL=Math.sign||function(e){return e>=0?1:-1},Th={min:.2,max:4},iw=10,zL=.1,GL=.75;function oo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Kn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||GL;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}oo.$inject=["config.zoomScroll","eventBus","canvas"],oo.prototype.scroll=function(t){this._canvas.scroll(t)},oo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},oo.prototype.zoom=function(t,n){var i=nw(Th,iw*2);this._totalDelta+=t,Math.abs(this._totalDelta)>zL&&(this._zoom(t,n,i),this._totalDelta=0)},oo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Sb()&&t.metaKey,o=t.shiftKey,r=-1*this._scale,a;if(i?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*HL(t.deltaY)*r,this.zoom(a,c)}else o?a={dx:r*t.deltaY,dy:0}:a={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(a)}},oo.prototype.stepZoom=function(t,n){var i=nw(Th,iw);this._zoom(t,n,i)},oo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=zf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(jL(Th,s),t)},oo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&$e[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},oo.prototype._init=function(e){this.toggle(e)};const ow={__init__:["zoomScroll"],zoomScroll:["type",oo]};function ec(e){sr.call(this,e)}Ae(ec,sr),ec.prototype._navigationModules=[J_,tw,ow],ec.prototype._modules=[].concat(sr.prototype._modules,ec.prototype._navigationModules);function kh(e){return e&&e[e.length-1]}function rw(e){return e.y}function aw(e){return e.x}var VL={left:aw,center:aw,right:function(e){return e.x+e.width},top:rw,middle:rw,bottom:function(e){return e.y+e.height}};function Na(e,t){this._modeling=e,this._rules=t}Na.$inject=["modeling","rules"],Na.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}},Na.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Na.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(f,d){return Math.round((f[i]+d[i]+d[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=kh(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(z(t,function(f){var d=f[i]+Math.round(f[o]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Vi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=kh(c).center,r;l=t[0],t=Vi(t,function(f){return f[i]+f[o]}),u=kh(t),r[e]=p(l,u)}return r},Na.prototype.trigger=function(e,t){var n=this._modeling,i,o=rt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),ze(i)&&(o=i),!(o.length<2||!i)){var r=VL[t],a=Vi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const WL={__init__:["alignElements"],alignElements:["type",Na]},UL=new Dr;function $a(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}$a.$inject=["eventBus"],$a.prototype.schedule=function(e,t=UL.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},$a.prototype._schedule=function(e,t){const n=qL();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(o){n.reject(o)}}catch(o){console.error("Scheduler#_schedule execution failed",o)}}),promise:n.promise}},$a.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},$a.prototype._cancel=function(e){clearTimeout(e.executionId)};function qL(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const YL={scheduler:["type",$a]};var KL="djs-element-hidden",Eu=".entry",XL=1e3,sw=8,ZL=300;function cn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}cn.$inject=["canvas","elementRegistry","eventBus","scheduler"],cn.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var o=i.target,r=ze(o)?o:[o],a=r.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=r.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,o=ze(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},cn.prototype._createContainer=function(){var e=$t('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},cn.prototype.registerProvider=function(e,t){t||(t=e,e=XL),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},cn.prototype.getEntries=function(e){var t=this._getProviders(),n=ze(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(o){if(bn(o[n])){var r=o[n](e);bn(r)?i=r(i):z(r,function(a,s){i[s]=a})}}),i},cn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=En(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},ZL);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},cn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(bn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},cn.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))}},cn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},cn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(o,r){var a=o.group||"default",s=$t(o.html||'<div class="entry" draggable="true"></div>'),c;En(s,"data-action",r),c=Et("[data-group="+Nr(a)+"]",n),c||(c=$t('<div class="group"></div>'),En(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&QL(s,o.className),o.title&&En(s,"title",o.title),o.imageUrl&&(i=$t("<img>"),En(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Rt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},cn.prototype._createHtml=function(e){var t=this,n=$t('<div class="djs-context-pad"></div>');return ti.bind(n,Eu,"click",function(i){t.trigger("click",i)}),ti.bind(n,Eu,"dragstart",function(i){t.trigger("dragstart",i)}),ti.bind(n,Eu,"mouseover",function(i){t.trigger("mouseover",i)}),ti.bind(n,Eu,"mouseout",function(i){t.trigger("mouseout",i)}),$e.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},cn.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()&&eI(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},cn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},cn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ze(e)!==ze(n)?!1:ze(e)?e.length===n.length&&Oo(e,function(i){return n.includes(i)}):n===e},cn.prototype.isShown=function(){return this.isOpen()&&Rt(this._current.html).has("open")},cn.prototype.show=function(){this.isOpen()&&(Rt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},cn.prototype.hide=function(){this.isOpen()&&(Rt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},cn.prototype._getPosition=function(e){if(!ze(e)&&kt(e)){var t=this._canvas.viewbox(),n=JL(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+sw*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+sw*this._canvas.zoom(),top:s.top-a.top}},cn.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")},cn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ze(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,KL)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},cn.prototype._getTargetBounds=function(e){var t=this,n=ze(e)?e:[e],i=n.map(function(o){return t._canvas.getGraphics(o)});return i.reduce(function(o,r){const a=r.getBoundingClientRect();return o.top=Math.min(o.top,a.top),o.right=Math.max(o.right,a.right),o.bottom=Math.max(o.bottom,a.bottom),o.left=Math.min(o.left,a.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function QL(e,t){var n=Rt(e);t=ze(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function JL(e){return e.waypoints[e.waypoints.length-1]}function eI(e,t){return e=ze(e)?e:[e],t=ze(t)?t:[t],e.length===t.length&&Oo(e,function(n){return t.includes(n)})}const cw={__depends__:[Ul,YL,xu],contextPad:["type",cn]};var Su,Wt,lw,cr,uw,pw,fw,Oh,Ru,tc,dw,Dh,Lh,Ih,Cu={},Mu=[],tI=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Au=Array.isArray;function Co(e,t){for(var n in t)e[n]=t[n];return e}function Bh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hw(e,t,n){var i,o,r,a={};for(r in t)r=="key"?i=t[r]:r=="ref"?o=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?Su.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)a[r]===void 0&&(a[r]=e.defaultProps[r]);return Pu(e,a,i,o,null)}function Pu(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++lw,__i:-1,__u:0};return o==null&&Wt.vnode!=null&&Wt.vnode(r),r}function Tu(e){return e.children}function ku(e,t){this.props=e,this.context=t}function Fr(e,t){if(t==null)return e.__?Fr(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"?Fr(e):null}function nI(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Co({},t);r.__v=t.__v+1,Wt.vnode&&Wt.vnode(r),Nh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Fr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,ww(i,r,o),t.__e=t.__=null,r.__e!=n&&gw(r)}}function gw(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}),gw(e)}function mw(e){(!e.__d&&(e.__d=!0)&&cr.push(e)&&!Ou.__r++||uw!=Wt.debounceRendering)&&((uw=Wt.debounceRendering)||pw)(Ou)}function Ou(){try{for(var e,t=1;cr.length;)cr.length>t&&cr.sort(fw),e=cr.shift(),t=cr.length,nI(e)}finally{cr.length=Ou.__r=0}}function yw(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,_=i&&i.__k||Mu,v=t.length;for(c=iI(n,t,_,c,v),p=0;p<v;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&_[d.__i]||Cu,d.__i=p,m=Nh(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&$h(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=vw(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function iI(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,f=0;for(e.__k=new Array(o),r=0;r<o;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=Pu(null,a,null,null,null):Au(a)?a=e.__k[r]=Pu(Tu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Pu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+f,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=oI(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?f--:o<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Fr(s)),Sw(s,s));return i}function vw(e,t,n){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=vw(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Fr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function oI(e,t,n,i){var o,r,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(o=n-1,r=n+1;o>=0||r<t.length;)if((l=t[a=o>=0?o--:r++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function bw(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||tI.test(t)?n:n+"px"}function Du(e,t,n,i,o){var r,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||bw(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||bw(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(dw,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?i?n[tc]=i[tc]:(n[tc]=Dh,e.addEventListener(t,r?Ih:Lh,r)):e.removeEventListener(t,r?Ih:Lh,r);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function xw(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ru]==null)t[Ru]=Dh++;else if(t[Ru]<n[tc])return;return n(Wt.event?Wt.event(t):t)}}}function Nh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,_,v,y,b,E,w,P,T,O,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Wt.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(v=t.props,y=N.prototype&&N.prototype.render,b=(u=N.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new N(v,E):(t.__c=f=new ku(v,E),f.constructor=N,f.render=aI),b&&b.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Co({},f.__s)),Co(f.__s,N.getDerivedStateFromProps(v,f.__s))),g=f.props,h=f.state,f.__v=t,d)y&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&N.getDerivedStateFromProps==null&&v!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(v,f.__s,E)===!1){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function($){$&&($.__=t)}),Mu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Fr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,E),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=v,f.__P=e,f.__e=!1,w=Wt.__r,P=0,y)f.state=f.__s,f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),Mu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(i=Co(Co({},i),f.getChildContext())),y&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),T=u!=null&&u.type===Tu&&u.key==null?Ew(u.props.children):u,s=yw(e,Au(T)?T:[T],t,n,i,o,r,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),_&&(f.__E=f.__=null)}catch($){if(a.length=p,t.__v=null,c||r!=null){if($.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r!=null&&(r[r.indexOf(s)]=null),t.__e=s}else if(r!=null)for(O=r.length;O--;)Bh(r[O])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),$.then||_w(t),Wt.__e($,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=rI(n.__e,t,n,i,o,r,a,c,l);return(u=Wt.diffed)&&u(t),128&t.__u?void 0:s}function _w(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(_w))}function ww(e,t,n){for(var i=0;i<n.length;i++)$h(n[i],n[++i],n[++i]);Wt.__c&&Wt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Wt.__e(r,o.__v)}})}function Ew(e){return typeof e!="object"||e==null||e.__b>0?e:Au(e)?e.map(Ew):e.constructor!==void 0?null:Co({},e)}function rI(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||Cu,_=t.props,v=t.type;if(v=="svg"?o="http://www.w3.org/2000/svg":v=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((d=r[l])&&"setAttribute"in d==!!v&&(v?d.localName==v:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(o,v,_.is&&_),s&&(Wt.__m&&Wt.__m(t,r),s=!1),r=null}if(v==null)m===_||s&&e.data==_||(e.data=_);else{if(r=v=="textarea"&&_.defaultValue!=null?null:r&&Su.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(d=e.attributes[l]).name]=d.value;for(l in m)d=m[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||Du(e,l,null,d,o);for(l in _)d=_[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||Du(e,l,d,m[l],o);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),yw(t.type=="template"?e.content:e,Au(f)?f:[f],t,n,i,v=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Fr(n,0),s,c),r!=null)for(l=r.length;l--;)Bh(r[l]);s&&v!="textarea"||(l="value",v=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||v=="progress"&&!g||v=="option"&&g!=m[l])&&Du(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&Du(e,l,h,m[l],o))}return e}function $h(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(o){Wt.__e(o,n)}}function Sw(e,t,n){var i,o;if(Wt.unmount&&Wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||$h(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Wt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&Sw(i[o],t,n||typeof e.type!="function");n||Bh(e.__e),e.__c=e.__=e.__e=void 0}function aI(e,t,n){return this.constructor(e,n)}function Rw(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Wt.__&&Wt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Nh(t,e=t.__k=hw(Tu,null,[e]),o||Cu,Cu,t.namespaceURI,o?null:t.firstChild?Su.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),ww(r,e,a),e.props.children=null}Su=Mu.slice,Wt={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},lw=0,ku.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Co({},this.state),typeof e=="function"&&(e=e(Co({},n),this.props)),e&&Co(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),mw(this))},ku.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),mw(this))},ku.prototype.render=Tu,cr=[],pw=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fw=function(e,t){return e.__v.__b-t.__v.__b},Ou.__r=0,Oh=Math.random().toString(8),Ru="__d"+Oh,tc="__a"+Oh,dw=/(PointerCapture)$|Capture$/i,Dh=0,Lh=xw(!1),Ih=xw(!0);var Cw=function(e,t,n,i){var o;t[0]=0;for(var r=1;r<t.length;r++){var a=t[r++],s=t[r]?(t[0]|=a?1:2,n[t[r++]]):t[++r];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++r]]=s:a===6?i[1][t[++r]]+=s+"":a?(o=e.apply(s,Cw(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},Mw=new Map;function sI(e){var t=Mw.get(this);return t||(t=new Map,Mw.set(this,t)),(t=Cw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(f){r===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):r===3&&(f||a)?(c.push(3,f,a),r=2):r===2&&a==="..."&&f?c.push(4,f,0):r===2&&a&&!f?c.push(5,0,!0,a):r>=5&&((a||!f&&r===5)&&(c.push(r,0,a,o),r=6),f&&(c.push(r,f,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Dt=sI.bind(hw),Fa,ln,Fh,Aw,nc=0,Pw=[],yn=Wt,Tw=yn.__b,kw=yn.__r,Ow=yn.diffed,Dw=yn.__c,Lw=yn.unmount,Iw=yn.__;function Lu(e,t){yn.__h&&yn.__h(ln,e,nc||t),nc=0;var n=ln.__H||(ln.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function jh(e){return nc=1,cI(Nw,e)}function cI(e,t,n){var i=Lu(Fa++,2);if(i.t=e,!i.__c&&(i.__=[Nw(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=ln,!ln.__f)){var o=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),r){var f=r.call(this,s,c,l);return u?f||p:f}return!u||p};ln.__f=!0;var r=ln.shouldComponentUpdate,a=ln.componentWillUpdate;ln.componentWillUpdate=function(s,c,l){if(this.__e){var u=r;r=void 0,o(s,c,l),r=u}a&&a.call(this,s,c,l)},ln.shouldComponentUpdate=o}return i.__N||i.__}function Iu(e,t){var n=Lu(Fa++,3);!yn.__s&&Gh(n.__H,t)&&(n.__=e,n.u=t,ln.__H.__h.push(n))}function Hh(e,t){var n=Lu(Fa++,4);!yn.__s&&Gh(n.__H,t)&&(n.__=e,n.u=t,ln.__h.push(n))}function Bu(e){return nc=5,Mo(function(){return{current:e}},[])}function Mo(e,t){var n=Lu(Fa++,7);return Gh(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ic(e,t){return nc=8,Mo(function(){return e},t)}function lI(){for(var e;e=Pw.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Nu),t.__h.some(zh),t.__h=[]}catch(n){t.__h=[],yn.__e(n,e.__v)}}}yn.__b=function(e){ln=null,Tw&&Tw(e)},yn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Iw&&Iw(e,t)},yn.__r=function(e){kw&&kw(e),Fa=0;var t=(ln=e.__c).__H;t&&(Fh===ln?(t.__h=[],ln.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Nu),t.__h.some(zh),t.__h=[],Fa=0)),Fh=ln},yn.diffed=function(e){Ow&&Ow(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pw.push(t)!==1&&Aw===yn.requestAnimationFrame||((Aw=yn.requestAnimationFrame)||uI)(lI)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Fh=ln=null},yn.__c=function(e,t){t.some(function(n){try{n.__h.some(Nu),n.__h=n.__h.filter(function(i){return!i.__||zh(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],yn.__e(i,n.__v)}}),Dw&&Dw(e,t)},yn.unmount=function(e){Lw&&Lw(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Nu(i)}catch(o){t=o}}),n.__H=void 0,t&&yn.__e(t,n.__v))};var Bw=typeof requestAnimationFrame=="function";function uI(e){var t,n=function(){clearTimeout(i),Bw&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Bw&&(t=requestAnimationFrame(n))}function Nu(e){var t=ln,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ln=t}function zh(e){var t=ln;e.__c=e.__(),ln=t}function Gh(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Nw(e,t){return typeof t=="function"?t(e):t}function pI(e){const{navigationStack:t,setNavigationStack:n}=e,i=Mo(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),o=t.length>0?()=>n([]):null,r=t.length>0?t[t.length-1].label:null;return Dt`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
13
|
${o&&Dt`
|
|
14
14
|
<button
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function $w(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=$w(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function
|
|
44
|
+
`}function $w(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=$w(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function $u(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=$w(e))&&(i&&(i+=" "),i+=t);return i}function fI(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Mo(()=>dI(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Dt`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${r}>${r}</h3>
|
|
47
47
|
${a.map(l=>Dt`
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function dI(e){return e.reduce((t,n)=>{const i=n.group||"default",o=t.find(r=>r.id===i);return o?o.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function hI(e,t){return
|
|
73
|
+
`}function dI(e){return e.reduce((t,n)=>{const i=n.group||"default",o=t.find(r=>r.id===i);return o?o.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function hI(e,t){return $u("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Fw(e,t){return`${e}-entry-${t.id}`}function gI(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:o,onMouseLeave:r,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return Dt`
|
|
74
74
|
<li
|
|
75
|
-
class=${
|
|
75
|
+
class=${$u("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
77
|
id=${Fw(t,n)}
|
|
78
78
|
role="option"
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
91
|
-
class=${
|
|
91
|
+
class=${$u("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
93
|
${n.imageUrl&&Dt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Dt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
94
94
|
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function mI(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=
|
|
134
|
+
`}function mI(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Bu();Hh(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&yI(m)},[t]);const f=()=>{o.current=!1},d=h=>{o.current||n(h)},g=()=>{o.current||n(null)};return Dt`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function jw(e,t){return`${e}-group-${t.id}`}function yI(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const vI=new Dr("djs-popup");function bI(e){const{onClose:t,onSelect:n,className:i,headerEntries:o,position:r,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,m]=jh([]);
|
|
171
|
+
`}function jw(e,t){return`${e}-group-${t.id}`}function yI(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const vI=new Dr("djs-popup");function bI(e){const{onClose:t,onSelect:n,className:i,headerEntries:o,position:r,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,m]=jh([]);Iu(()=>{m([])},[f]);const[_,v]=jh(""),y=_.trim().length>0,b=Mo(()=>wI(f),[f]),E=Mo(()=>dn(l)?b.length>5:!1,[l,b]),w=Mo(()=>{const W=h.length?h[h.length-1].entries:f;return E?y?p(b.filter(({searchable:Z})=>Z!==!1),_,{keys:["label","search","description"]}).map(({item:Z})=>Z):W.filter(({rank:Z=0})=>Z>=0):W},[E,y,b,_,p,h,f]),P=Mo(()=>y?w.length?[{id:"default",entries:w}]:[]:EI(w),[w,y]),[T,O]=jh(w[0]),N=Bu(null),$=Bu(!1),H=Mo(()=>vI.next(),[]),Q=`${H}-results`,J=T&&Fw(H,T);Iu(()=>{const W=N.current;W&&w.includes(W)?O(W):O(w[0]),N.current=null},[w]);const V=ic(W=>{const Z=_I(P);let he=Z.indexOf(T)+W;he<0&&(he=Z.length-1),he>=Z.length&&(he=0),$.current=!0,O(Z[he])},[P,T]),we=ic(W=>{W>0&&T&&T.entries&&($.current=!0,m(Z=>[...Z,T])),W<0&&h.length>0&&($.current=!0,N.current=h[h.length+W],m(Z=>Z.slice(0,W)))},[T,h]),Ce=ic((W,Z,oe)=>{if(!(!Z||Z.disabled))return Z.entries?(W.preventDefault(),we(1)):n(W,Z,oe)},[n,we]),ke=ic(W=>{if(W.key==="Enter"&&T){const Z=W.target;return!!Rr(Z,"a, button",!0)||T.disabled?void 0:Ce(W,T)}if(W.key==="Backspace"){const Z=W.target;if(!(xf(Z,"input")&&Z.value!==""))return we(-1),W.preventDefault()}if(W.key==="ArrowUp")return V(-1),W.preventDefault();if(W.key==="ArrowDown")return V(1),W.preventDefault();if(W.key==="ArrowRight")return we(1),W.preventDefault();if(W.key==="ArrowLeft")return we(-1),W.preventDefault()},[T,V,we,Ce]),Ee=ic(W=>{xf(W.target,"input")&&v(()=>W.target.value)},[v]);Iu(()=>(d(),()=>{g()}),[]);const Y=!y&&h.length>0,ne=(a||o.length>0)&&!Y;return Dt`
|
|
172
172
|
<${Hw}
|
|
173
173
|
onClose=${t}
|
|
174
174
|
onKeyup=${Ee}
|
|
@@ -184,11 +184,11 @@
|
|
|
184
184
|
headerEntries=${o}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${T}
|
|
187
|
-
setSelectedEntry=${
|
|
187
|
+
setSelectedEntry=${O}
|
|
188
188
|
title=${a}
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
|
-
${
|
|
191
|
+
${Y&&Dt`
|
|
192
192
|
<${pI}
|
|
193
193
|
navigationStack=${h}
|
|
194
194
|
setNavigationStack=${m}
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
role="combobox"
|
|
209
209
|
aria-label="${a||"Search"}"
|
|
210
210
|
aria-expanded="true"
|
|
211
|
-
aria-controls=${
|
|
211
|
+
aria-controls=${Q}
|
|
212
212
|
aria-activedescendant=${J||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
@@ -224,11 +224,11 @@
|
|
|
224
224
|
<${mI}
|
|
225
225
|
groupedEntries=${P}
|
|
226
226
|
selectedEntry=${T}
|
|
227
|
-
setSelectedEntry=${
|
|
227
|
+
setSelectedEntry=${O}
|
|
228
228
|
keyboardSelection=${$}
|
|
229
229
|
onAction=${Ce}
|
|
230
230
|
idPrefix=${H}
|
|
231
|
-
id=${
|
|
231
|
+
id=${Q}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
233
|
tabIndex=${E?-1:0}
|
|
234
234
|
ariaActivedescendant=${E?void 0:J||void 0}
|
|
@@ -258,9 +258,9 @@
|
|
|
258
258
|
<div class="djs-popup-no-results">${bn(u)?u(_):u}</div>
|
|
259
259
|
`}
|
|
260
260
|
</${Hw}>
|
|
261
|
-
`}function Hw(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=
|
|
261
|
+
`}function Hw(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=Bu();return Hh(()=>{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]),Hh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Iu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Rr(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)}},[]),Dt`
|
|
262
262
|
<div
|
|
263
|
-
class=${
|
|
263
|
+
class=${$u("djs-popup",o)}
|
|
264
264
|
style=${xI(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
@@ -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>`},OI=900;function Ha(e,t,n,i){e.registerProvider(OI,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ha.$inject=["contextPad","popupMenu","translate","canvas"],Ha.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Ha.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ha.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Zw.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)}}}}},Ha.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),o={x:i.left,y:i.bottom+t};return o};var DI=["left","center","right","top","middle","bottom"];function ic(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ic.$inject=["popupMenu","alignElements","translate","rules"],ic.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},ic.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ic.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return z(DI,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:Zw[r],action:function(){t.trigger(e,r),i.close()}}}),o};function $u(e){Si.call(this,e)}$u.$inject=["eventBus"],Ae($u,Si),$u.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=rt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=rl(n),n.length<2?!1:n})};const LI={__depends__:[WL,cw,Vh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ha],alignElementsMenuProvider:["type",ic],bpmnAlignElements:["type",$u]};function Ao(e,t,n,i){de.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=xp(Jr(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ea(s,function(p){return p.parent.id});z(u,function(p,f){ze(l)&&(p=p.filter(function(d){return Lt(l,ta({id:d.id}))})),o._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}Ao.$inject=["eventBus","elementRegistry","modeling","rules"],Ae(Ao,de),Ao.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=je(an(e)),r=je(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),cl(U({},r,a))},Ao.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(II(i,t)){var o=BI(Ii(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Ao.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Ao.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Ao.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function II(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function BI(e,t){var n="";return e=je(e),t=je(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 Fu(e){e.invoke(Ao,this)}Fu.$inject=["injector"],Ae(Fu,Ao),Fu.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 oc(e){Si.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}oc.$inject=["eventBus"],Ae(oc,Si),oc.prototype.canResize=function(e,t){return!1};function ju(e,t){oc.call(this,e),this._modeling=t}Ae(ju,oc),ju.$inject=["eventBus","modeling"],ju.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")||it(i)){n=!1;return}}),n};const NI={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Fu],bpmnAutoResizeProvider:["type",ju]};function za(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(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}za.$inject=["config.autoScroll","eventBus","canvas"],za.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)$I(r[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function $I(e,t,n){return t<e&&e<n}za.prototype.stopScroll=function(){clearTimeout(this._scrolling)},za.prototype.setOptions=function(e){this._opts=U({},this._opts,e)},za.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Tr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const FI={__depends__:[wo],__init__:["autoScroll"],autoScroll:["type",za]};var Qw="djs-bendpoint",Jw="djs-segment-dragger";function jI(e,t){var n=Tr(t),i=e._container.getBoundingClientRect(),o;o={x:i.left,y:i.top};var r=e.viewbox();return{x:r.x+(n.x-o.x)/r.scale,y:r.y+(n.y-o.y)/r.scale}}function Wh(e,t,n){var i=jI(e,n),o=rd(t,i);return o}function Uh(e,t){var n=Le("g");lt(n).add(Qw),qe(e,n);var i=Le("circle");Se(i,{cx:0,cy:0,r:4}),lt(i).add("djs-visual"),qe(n,i);var o=Le("circle");return Se(o,{cx:0,cy:0,r:10}),lt(o).add("djs-hit"),qe(n,o),t&<(n).add(t),n}function HI(e,t,n,i){var o=Le("g");qe(e,o);var r=18,a=6,s=11,c=GI(t,n,i),l=a+s,u=Le("rect");Se(u,{x:-r/2,y:-a/2,width:r,height:a}),lt(u).add("djs-visual"),qe(o,u);var p=Le("rect");return Se(p,{x:-c/2,y:-l/2,width:c,height:l}),lt(p).add("djs-hit"),qe(o,p),mv(o,i==="v"?90:0),o}function e0(e,t,n){var i=Le("g"),o=Lf(t,n),r=mo(t,n);return qe(e,i),HI(i,t,n,r),lt(i).add(Jw),lt(i).add(r==="h"?"horizontal":"vertical"),On(i,o.x,o.y),i}function qh(e){return Math.abs(Math.round(e*2/3))}function zI(e,t){var n=VI(e,t);return pd(e,n)}function GI(e,t,n){var i=t.x-e.x,o=t.y-e.y;return qh(n==="h"?i:o)}function VI(e,t){for(var n=t.waypoints,i=1/0,o,r=0;r<n.length-1;r++){var a=n[r],s=n[r+1],c=nb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function t0(e,t,n,i,o){function r(y,b,E){var w=y.index,P=y.point,T,D,N,$,H,Z;return w<=0||y.bendpoint?!1:(T=b[w-1],D=b[w],N=Lf(T,D),$=mo(T,D),H=Math.abs(P.x-N.x),Z=Math.abs(P.y-N.y),$&&H<=E&&Z<=E)}function a(y,b){var E=y.waypoints,w,P,T,D;return b.index<=0||b.bendpoint||(w={start:E[b.index-1],end:E[b.index]},P=mo(w.start,w.end),!P)?null:(P==="h"?T=w.end.x-w.start.x:T=w.end.y-w.start.y,D=qh(T)/2,D)}function s(y,b){var E=b.waypoints,w=Wh(t,E,y),P;if(w){P=a(b,w);var T;if(r(w,E,P)?T=o.start(y,b,w.index):T=i.start(y,b,w.index,!w.bendpoint),T!==!1)return!0}}function c(y,b,E){$e.bind(y,b,function(w){n.triggerMouseEvent(b,w,E),w.stopPropagation()})}function l(y,b){var E=t.getLayer("overlays"),w=Et('.djs-bendpoints[data-element-id="'+Nr(y.id)+'"]',E);return!w&&b&&(w=Le("g"),Se(w,{"data-element-id":y.id}),lt(w).add("djs-bendpoints"),qe(E,w),c(w,"mousedown",y),c(w,"click",y),c(w,"dblclick",y)),w}function u(y,b){return Et('.djs-segment-dragger[data-segment-idx="'+y+'"]',b)}function p(y,b){b.waypoints.forEach(function(E,w){var P=Uh(y);qe(y,P),On(P,E.x,E.y)}),Uh(y,"floating")}function f(y,b){for(var E=b.waypoints,w,P,T,D=1;D<E.length;D++)w=E[D-1],P=E[D],mo(w,P)&&(T=e0(y,w,P),Se(T,{"data-segment-idx":D}),c(T,"mousemove",b))}function d(y){z(ds("."+Qw,y),function(b){rn(b)})}function g(y){z(ds("."+Jw,y),function(b){rn(b)})}function h(y){var b=l(y);return b||(b=l(y,!0),p(b,y),f(b,y)),b}function m(y){var b=l(y);b&&(g(b),d(b),f(b,y),p(b,y))}function _(y,b){var E=Et(".floating",y),w=b.point;E&&(On(E,w.x,w.y),lt(E).add("positioned"))}function v(y,b,E){var w=u(b.index,y),P=E[b.index-1],T=E[b.index],D=b.point,N=Lf(P,T),$=mo(P,T),H,Z;w&&(H=WI(w),Z={x:D.x-N.x,y:D.y-N.y},$==="v"&&(Z={x:Z.y,y:Z.x}),On(H,Z.x,Z.y))}e.on("connection.changed",function(y){m(y.element)}),e.on("connection.remove",function(y){var b=l(y.element);b&&rn(b)}),e.on("element.marker.update",function(y){var b=y.element,E;b.waypoints&&(E=h(b),y.add?lt(E).add(y.marker):lt(E).remove(y.marker))}),e.on("element.mousemove",function(y){var b=y.element,E=b.waypoints,w,P;if(E){if(w=l(b,!0),P=Wh(t,E,y.originalEvent),!P)return;_(w,P),P.bendpoint||v(w,P,E)}}),e.on("element.mousedown",function(y){if(Qo(y)){var b=y.originalEvent,E=y.element;if(E.waypoints)return s(b,E)}}),e.on("selection.changed",function(y){var b=y.newSelection,E=b[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(y){var b=y.element;b.waypoints&&h(b)}),e.on("element.out",function(y){var b=y.element;if(b.waypoints){var E=l(b);if(E){var w=Et(".floating",E);w&<(w).remove("positioned")}}}),e.on("element.updateId",function(y){var b=y.element,E=y.newId;if(b.waypoints){var w=l(b);w&&Se(w,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}t0.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function WI(e){return Et(".djs-visual",e)}var n0=Math.round,jr="reconnectStart",Hr="reconnectEnd",rc="updateWaypoints";function Yh(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=jr:!l&&c===d.length-1?g=Hr:g=rc;var h=g===rc?"connection.updateWaypoints":"connection.reconnect",m=o.allowed(h,{connection:s,source:p,target:f});if(m===!1&&(m=o.allowed(h,{connection:s,source:f,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target: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===rc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===jr?p:l,target:f===Hr?p:u}),d){s.source=f===jr?p:l,s.target=f===Hr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===Hr?p:u,target:f===jr?p:l})),d&&(s.source=f===Hr?p:u,s.target=f===jr?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!==rc&&(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,m=s.hints||{},_={x:n0(a.x),y:n0(a.y)};if(!c)return!1;h===rc?(p?f.splice(l,0,_):f[l]=_,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,QA(f),m)):(h===jr?(m.docking="source",Hu(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Hr&&(m.docking="target",Hu(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,_,m))},this)}Yh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Yh.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 Hu(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===jr)return t&&i&&t===i&&n!==i;if(o===Hr)return t&&n&&t===n&&n!==i}var UI="reconnectStart",qI="reconnectEnd",i0="updateWaypoints",ac="connect-ok",zu="connect-not-ok",o0="connect-hover",r0="djs-updating",a0="djs-dragging",s0=1100;function c0(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var a=r.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p;var f=a.draggerGfx=Uh(i.getLayer("overlays"));lt(f).add("djs-dragging"),i.addMarker(c,a0),i.addMarker(c,r0)}),n.on("bendpoint.move.hover",function(r){var a=r.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,o0),l===i0)return;s?(i.removeMarker(c,zu),i.addMarker(c,ac)):s===!1&&(i.removeMarker(c,ac),i.addMarker(c,zu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],s0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,o0),i.removeMarker(s,c?ac:zu))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:r.x,y:r.y},_=a.hints||{},v={};o&&(_.connectionStart&&(v.connectionStart=_.connectionStart),_.connectionEnd&&(v.connectionEnd=_.connectionEnd),p===UI?Hu(a)?(v.connectionEnd=v.connectionEnd||m,v.source=g,v.target=u||d,h=h.reverse()):(v.connectionStart=v.connectionStart||m,v.source=u||d,v.target=g):p===qI?Hu(a)?(v.connectionStart=v.connectionStart||m,v.source=u||g,v.target=d,h=h.reverse()):(v.connectionEnd=v.connectionEnd||m,v.source=d,v.target=u||g):(v.noCropping=!0,v.noLayout=!0,h[c]=m),p===i0&&(h=e.cropWaypoints(f,h)),v.waypoints=h,o.drawPreview(a,s,v)),On(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],s0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,rn(c),i.removeMarker(s,r0),i.removeMarker(s,a0),l&&(i.removeMarker(l,ac),i.removeMarker(l,u?ac:zu)),o&&o.cleanUp(a)})}c0.$inject=["bendpointMove","injector","eventBus","canvas"];var l0="connect-hover",u0="djs-updating";function p0(e,t,n){return Kh(e,t,e[t]+n)}function Kh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function YI(e,t,n,i){var o=Math.max(t[i],n[i]),r=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(r+a,e[i]),o-a);return Kh(t,i,s)}function f0(e){return e==="x"?"y":"x"}function d0(e,t,n){var i,o;return e.original?e.original:(i=We(t),o=f0(n),Kh(e,o,i[o]))}function h0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,_=d,v=f.waypoints,y=v[m],b=v[_],E=Wh(n,v,p),w,P,T;if(w=mo(y,b),!!w)return P=w==="v"?"x":"y",m===0&&(y=d0(y,f.source,P)),_===v.length-1&&(b=d0(b,f.target,P)),E?T=E.point:T={x:(y.x+b.x)/2,y:(y.y+b.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:_,segmentStart:y,segmentEnd:b,axis:P,dragPosition:T},i.init(p,T,"connectionSegment.move",{cursor:P==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],_=p.segmentEndIndex+f,v=g[_],y=f0(p.axis),b=YI(d,m,v,y);On(p.draggerGfx,b.x,b.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return Df(p[m-1],p[m+1],h)?(d=m<=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=e0(g,f.segmentStart,f.segmentEnd),lt(f.draggerGfx).add("djs-dragging"),n.addMarker(d,u0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,_=f.segmentEnd,v=f.axis,y=f.originalWaypoints.slice(),b=p0(m,v,p["d"+v]),E=p0(_,v,p["d"+v]),w=y.length,P=0;y[g]=b,y[h]=E;var T,D;g<2&&(T=kn(d.source,b),g===1?T==="intersect"&&(y.shift(),y[0]=b,P--):T!=="intersect"&&(y.unshift(m),P++)),h>w-3&&(D=kn(d.target,E),h===w-2?D==="intersect"&&(y.pop(),y[y.length-1]=E):D!=="intersect"&&y.push(_)),f.newWaypoints=d.waypoints=s(d,y),l(f,P,p),f.newSegmentStartIndex=g+P,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,l0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,l0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&rn(f.draggerGfx),n.removeMarker(d,u0)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(g,h),_=m.waypoints,v=s(d,_),y=m.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+y}};r.updateWaypoints(d,v,b)})}h0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var KI=Math.abs,g0=Math.round;function XI(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],KI(o-e)<=n)return o}function m0(e){return{x:e.x,y:e.y}}function y0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ai(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:g0(e.x+e.width/2),y:g0(e.y+e.height/2)}}function Ga(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function un(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,o=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function v0(e){return e.children||[]}var ZI=Math.abs,b0=Math.round,Xh=10;function x0(e){function t(r,a){if(ze(r)){for(var s=r.length;s--;)if(ZI(r[s]-a)<=Xh)return r[s]}else{r=+r;var c=a%r;if(c<Xh)return a-c;if(c>r-Xh)return a-c+r}return a}function n(r,a){if(r.waypoints)return zI(a,r);if(r.width)return{x:b0(r.width/2+r.x),y:b0(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,r)),d>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;U(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&un(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&un(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!kt(s)||!c||!c.x||!c.y||(un(r,"x",c.x),un(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;U(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&un(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&un(r,"y",d)}})}x0.$inject=["eventBus"];const QI={__depends__:[wo,no],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",t0],bendpointMove:["type",Yh],bendpointMovePreview:["type",c0],connectionSegmentMove:["type",h0],bendpointSnapping:["type",x0]};function _0(e,t,n,i){function o(a,s){return i.allowed("connection.create",{source:a,target:s})}function r(a,s){return o(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,l=a.hover,u;if(s.hover=l,u=s.canExecute=o(c,l),!Qr(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!Qr(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Zh(s)?u:l,connectionEnd:Zh(s)?l:u};hn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){hn(c)||(l=c,c=We(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}_0.$inject=["eventBus","dragging","modeling","rules"];function Zh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var JI=1100,eB=900,w0="connect-ok",E0="connect-not-ok";function S0(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(o){var r=o.context,a=r.canExecute,s=r.hover,c=r.source,l=r.start,u=r.startPosition,p=r.target,f=r.connectionStart||u,d=r.connectionEnd||{x:o.x,y:o.y},g=f,h=d;Zh(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",eB,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?w0:E0)}),t.on(["connect.out","connect.cleanup"],JI,function(o){var r=o.hover;r&&(n.removeMarker(r,w0),n.removeMarker(r,E0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}S0.$inject=["injector","eventBus","canvas"];const Qh={__depends__:[Ri,no,wo],__init__:["connectPreview"],connect:["type",_0],connectPreview:["type",S0]};var tB="djs-dragger";function Po(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)}Po.$inject=["injector","canvas","graphicsFactory","elementFactory"],Po.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),hs(i),o||(o=e.getConnection=nB(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=o(t,r,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[r?We(r):c,a?We(a):l]),this._connectionDocking&&(r||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,r,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Po.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||We(n),r=t.connectionEnd||We(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);qe(e,s)},Po.prototype.cropWaypoints=function(e,t,n,i){var o=this._graphicsFactory,r=n&&o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return e=n&&_s(r,s,!0)||e,t=i&&_s(a,s,!1)||t,[e,t]},Po.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&rn(e.connectionPreviewGfx)},Po.prototype.getConnection=function(e){var t=iB(e);return this._elementFactory.createConnection(t)},Po.prototype.createConnectionPreviewGfx=function(){var e=Le("g");return Se(e,{pointerEvents:"none"}),lt(e).add(tB),qe(this._canvas.getActiveLayer(),e),e},Po.prototype.createNoopConnection=function(e,t){return ys([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function nB(e){var t={};return function(n){var i=JSON.stringify(n),o=t[i];return o||(o=t[i]=e.apply(null,arguments)),o}}function iB(e){return hn(e)?e:{}}const oB={__init__:["connectionPreview"],connectionPreview:["type",Po]},Gu="complex-preview";class R0{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:o=[],resized:r=[]}=t,a=this._canvas.getLayer(Gu);n.filter(s=>!rB(s)).forEach(s=>{let c;kt(s)?(c=this._graphicsFactory._createContainer("connection",Le("g")),this._graphicsFactory.drawConnection(Uo(c),s)):(c=this._graphicsFactory._createContainer("shape",Le("g")),this._graphicsFactory.drawShape(Uo(c),s),On(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const l=this._previewSupport.addDragger(s,a);kt(s)?On(l,c.x,c.y):On(l,s.x+c.x,s.y+c.y)}),o.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),r.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const l=this._graphicsFactory._createContainer("shape",Le("g"));this._graphicsFactory.drawShape(Uo(l),s,{width:c.width,height:c.height}),On(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){hs(this._canvas.getLayer(Gu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Gu)}hide(){this._canvas.hideLayer(Gu)}}R0.$inject=["canvas","graphicsFactory","previewSupport"];function rB(e){return e.hidden}const aB={__depends__:[Oa],__init__:["complexPreview"],complexPreview:["type",R0]},C0=Math.round;function Vu(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Vu.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(U({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;U(l,{x:u.x-C0(l.width/2),y:u.y-C0(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=r.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=o.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Qr(d))})},Vu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Vu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const sB={__depends__:[gu,aB,bh],__init__:["appendPreview"],appendPreview:["type",Vu]};var M0=Math.min,A0=Math.max;function Jh(e){e.preventDefault()}function sc(e){e.stopPropagation()}function cB(e){return e.nodeType===Node.TEXT_NODE}function lB(e){return[].slice.call(e)}function ji(e){this.container=e.container,this.parent=$t('<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=Kn(this.autoResize,this),this.handlePaste=Kn(this.handlePaste,this)}ji.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);U(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=Ii(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,$e.bind(a,"keydown",this.keyHandler),$e.bind(a,"mousedown",sc),$e.bind(a,"paste",o.handlePaste),$e.bind(a,"focusout",this.focusoutHandler),i.autoResize&&$e.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},ji.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var o=this.autoResize(n);o&&this.resizeHandler(o)}},ji.prototype.insertText=function(e){e=uB(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ji.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=lB(a.childNodes),c,l;if(cB(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&Xi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},ji.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},ji.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=$t('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Jh(g),sc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,$e.bind(document,"mousemove",f),$e.bind(document,"mouseup",d)},f=function(g){Jh(g),sc(g);var h=M0(A0(l+g.clientX-s,i),r),m=M0(A0(u+g.clientY-c,o),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Jh(g),sc(g),$e.unbind(document,"mousemove",f,!1),$e.unbind(document,"mouseup",d,!1)};$e.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)},ji.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),$e.unbind(t,"keydown",this.keyHandler),$e.unbind(t,"mousedown",sc),$e.unbind(t,"input",this.autoResize),$e.unbind(t,"paste",this.handlePaste),$e.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Xi(n)),Xi(e)},ji.prototype.getValue=function(){return this.content.innerText.trim()},ji.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ji.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function uB(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function ci(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ji({container:t.getContainer(),keyHandler:Kn(this._handleKey,this),resizeHandler:Kn(this._handleResize,this),focusoutHandler:Kn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ci.$inject=["eventBus","canvas"],ci.prototype.registerProvider=function(e){this._providers.push(e)},ci.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ci.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ci.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ci.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ci.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ci.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),o=this.getValue(),r=e.context.text;(o!==r||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,o,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},ci.prototype.getValue=function(){return this._textbox.getValue()},ci.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()},ci.prototype._handleResize=function(e){this._fire("resize",e)},ci.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ci.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Lt(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 P0={__depends__:[Wl],__init__:["directEditing"],directEditing:["type",ci]};function pB(e){return function(t){var n=t.target,i=ge(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===ut(e);return!r||!a||!s||!c}}const fB={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 pe(e,t={}){var n=fB[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var dB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing"),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-start"),pe("timer-start"),pe("conditional-start"),pe("signal-start")],hB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing"),pe("none-end-event",{actionName:"replace-with-none-end"})],gB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-intermediate-catch"),pe("message-intermediate-throw"),pe("timer-intermediate-catch"),pe("escalation-intermediate-throw"),pe("conditional-intermediate-catch"),pe("link-intermediate-catch"),pe("link-intermediate-throw"),pe("compensation-intermediate-throw"),pe("signal-intermediate-catch"),pe("signal-intermediate-throw")],mB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-end"),pe("escalation-end"),pe("error-end"),pe("cancel-end"),pe("compensation-end"),pe("signal-end"),pe("terminate-end")],yB=[pe("exclusive-gateway"),pe("parallel-gateway"),pe("inclusive-gateway"),pe("complex-gateway"),pe("event-based-gateway")],vB=[pe("transaction"),pe("event-subprocess"),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),pe("collapsed-subprocess")],bB=[pe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),pe("transaction"),pe("event-subprocess"),pe("collapsed-ad-hoc-subprocess")],T0=[pe("transaction"),pe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),pe("event-subprocess")],xB=T0,k0=[pe("task"),pe("user-task"),pe("service-task"),pe("send-task"),pe("receive-task"),pe("manual-task"),pe("rule-task"),pe("script-task"),pe("call-activity"),pe("collapsed-subprocess"),pe("expanded-subprocess"),pe("collapsed-ad-hoc-subprocess"),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],_B=[pe("data-store-reference")],wB=[pe("data-object-reference")],EB=[pe("message-boundary"),pe("timer-boundary"),pe("escalation-boundary"),pe("conditional-boundary"),pe("error-boundary"),pe("cancel-boundary"),pe("signal-boundary"),pe("compensation-boundary"),pe("non-interrupting-message-boundary"),pe("non-interrupting-timer-boundary"),pe("non-interrupting-escalation-boundary"),pe("non-interrupting-conditional-boundary"),pe("non-interrupting-signal-boundary")],SB=[pe("message-start"),pe("timer-start"),pe("conditional-start"),pe("signal-start"),pe("error-start"),pe("escalation-start"),pe("compensation-start"),pe("non-interrupting-message-start"),pe("non-interrupting-timer-start"),pe("non-interrupting-conditional-start"),pe("non-interrupting-signal-start"),pe("non-interrupting-escalation-start")],RB=[{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"}],CB=[pe("expanded-pool"),pe("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],MB={"bpmn:MessageEventDefinition":[pe("message-start"),pe("message-intermediate-catch"),pe("message-intermediate-throw"),pe("message-end")],"bpmn:TimerEventDefinition":[pe("timer-start"),pe("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[pe("conditional-start"),pe("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[pe("signal-start"),pe("signal-intermediate-catch"),pe("signal-intermediate-throw"),pe("signal-end")],"bpmn:ErrorEventDefinition":[pe("error-start"),pe("error-end")],"bpmn:EscalationEventDefinition":[pe("escalation-start"),pe("escalation-intermediate-throw"),pe("escalation-end")],"bpmn:CompensateEventDefinition":[pe("compensation-start"),pe("compensation-intermediate-throw"),pe("compensation-end")]};const O0={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},OI=900;function Ha(e,t,n,i){e.registerProvider(OI,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ha.$inject=["contextPad","popupMenu","translate","canvas"],Ha.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Ha.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ha.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Zw.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)}}}}},Ha.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),o={x:i.left,y:i.bottom+t};return o};var DI=["left","center","right","top","middle","bottom"];function oc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}oc.$inject=["popupMenu","alignElements","translate","rules"],oc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},oc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},oc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return z(DI,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:Zw[r],action:function(){t.trigger(e,r),i.close()}}}),o};function Fu(e){Si.call(this,e)}Fu.$inject=["eventBus"],Ae(Fu,Si),Fu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=rt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=al(n),n.length<2?!1:n})};const LI={__depends__:[WL,cw,Vh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ha],alignElementsMenuProvider:["type",oc],bpmnAlignElements:["type",Fu]};function Ao(e,t,n,i){de.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=xp(Jr(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ea(s,function(p){return p.parent.id});z(u,function(p,f){ze(l)&&(p=p.filter(function(d){return Lt(l,ta({id:d.id}))})),o._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}Ao.$inject=["eventBus","elementRegistry","modeling","rules"],Ae(Ao,de),Ao.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=je(an(e)),r=je(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),ll(U({},r,a))},Ao.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(II(i,t)){var o=BI(Ii(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Ao.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Ao.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Ao.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function II(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function BI(e,t){var n="";return e=je(e),t=je(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 ju(e){e.invoke(Ao,this)}ju.$inject=["injector"],Ae(ju,Ao),ju.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 rc(e){Si.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}rc.$inject=["eventBus"],Ae(rc,Si),rc.prototype.canResize=function(e,t){return!1};function Hu(e,t){rc.call(this,e),this._modeling=t}Ae(Hu,rc),Hu.$inject=["eventBus","modeling"],Hu.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")||it(i)){n=!1;return}}),n};const NI={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ju],bpmnAutoResizeProvider:["type",Hu]};function za(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(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}za.$inject=["config.autoScroll","eventBus","canvas"],za.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)$I(r[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function $I(e,t,n){return t<e&&e<n}za.prototype.stopScroll=function(){clearTimeout(this._scrolling)},za.prototype.setOptions=function(e){this._opts=U({},this._opts,e)},za.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Tr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const FI={__depends__:[wo],__init__:["autoScroll"],autoScroll:["type",za]};var Qw="djs-bendpoint",Jw="djs-segment-dragger";function jI(e,t){var n=Tr(t),i=e._container.getBoundingClientRect(),o;o={x:i.left,y:i.top};var r=e.viewbox();return{x:r.x+(n.x-o.x)/r.scale,y:r.y+(n.y-o.y)/r.scale}}function Wh(e,t,n){var i=jI(e,n),o=rd(t,i);return o}function Uh(e,t){var n=Le("g");lt(n).add(Qw),qe(e,n);var i=Le("circle");Se(i,{cx:0,cy:0,r:4}),lt(i).add("djs-visual"),qe(n,i);var o=Le("circle");return Se(o,{cx:0,cy:0,r:10}),lt(o).add("djs-hit"),qe(n,o),t&<(n).add(t),n}function HI(e,t,n,i){var o=Le("g");qe(e,o);var r=18,a=6,s=11,c=GI(t,n,i),l=a+s,u=Le("rect");Se(u,{x:-r/2,y:-a/2,width:r,height:a}),lt(u).add("djs-visual"),qe(o,u);var p=Le("rect");return Se(p,{x:-c/2,y:-l/2,width:c,height:l}),lt(p).add("djs-hit"),qe(o,p),mv(o,i==="v"?90:0),o}function e0(e,t,n){var i=Le("g"),o=Lf(t,n),r=mo(t,n);return qe(e,i),HI(i,t,n,r),lt(i).add(Jw),lt(i).add(r==="h"?"horizontal":"vertical"),On(i,o.x,o.y),i}function qh(e){return Math.abs(Math.round(e*2/3))}function zI(e,t){var n=VI(e,t);return pd(e,n)}function GI(e,t,n){var i=t.x-e.x,o=t.y-e.y;return qh(n==="h"?i:o)}function VI(e,t){for(var n=t.waypoints,i=1/0,o,r=0;r<n.length-1;r++){var a=n[r],s=n[r+1],c=nb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function t0(e,t,n,i,o){function r(y,b,E){var w=y.index,P=y.point,T,O,N,$,H,Q;return w<=0||y.bendpoint?!1:(T=b[w-1],O=b[w],N=Lf(T,O),$=mo(T,O),H=Math.abs(P.x-N.x),Q=Math.abs(P.y-N.y),$&&H<=E&&Q<=E)}function a(y,b){var E=y.waypoints,w,P,T,O;return b.index<=0||b.bendpoint||(w={start:E[b.index-1],end:E[b.index]},P=mo(w.start,w.end),!P)?null:(P==="h"?T=w.end.x-w.start.x:T=w.end.y-w.start.y,O=qh(T)/2,O)}function s(y,b){var E=b.waypoints,w=Wh(t,E,y),P;if(w){P=a(b,w);var T;if(r(w,E,P)?T=o.start(y,b,w.index):T=i.start(y,b,w.index,!w.bendpoint),T!==!1)return!0}}function c(y,b,E){$e.bind(y,b,function(w){n.triggerMouseEvent(b,w,E),w.stopPropagation()})}function l(y,b){var E=t.getLayer("overlays"),w=Et('.djs-bendpoints[data-element-id="'+Nr(y.id)+'"]',E);return!w&&b&&(w=Le("g"),Se(w,{"data-element-id":y.id}),lt(w).add("djs-bendpoints"),qe(E,w),c(w,"mousedown",y),c(w,"click",y),c(w,"dblclick",y)),w}function u(y,b){return Et('.djs-segment-dragger[data-segment-idx="'+y+'"]',b)}function p(y,b){b.waypoints.forEach(function(E,w){var P=Uh(y);qe(y,P),On(P,E.x,E.y)}),Uh(y,"floating")}function f(y,b){for(var E=b.waypoints,w,P,T,O=1;O<E.length;O++)w=E[O-1],P=E[O],mo(w,P)&&(T=e0(y,w,P),Se(T,{"data-segment-idx":O}),c(T,"mousemove",b))}function d(y){z(hs("."+Qw,y),function(b){rn(b)})}function g(y){z(hs("."+Jw,y),function(b){rn(b)})}function h(y){var b=l(y);return b||(b=l(y,!0),p(b,y),f(b,y)),b}function m(y){var b=l(y);b&&(g(b),d(b),f(b,y),p(b,y))}function _(y,b){var E=Et(".floating",y),w=b.point;E&&(On(E,w.x,w.y),lt(E).add("positioned"))}function v(y,b,E){var w=u(b.index,y),P=E[b.index-1],T=E[b.index],O=b.point,N=Lf(P,T),$=mo(P,T),H,Q;w&&(H=WI(w),Q={x:O.x-N.x,y:O.y-N.y},$==="v"&&(Q={x:Q.y,y:Q.x}),On(H,Q.x,Q.y))}e.on("connection.changed",function(y){m(y.element)}),e.on("connection.remove",function(y){var b=l(y.element);b&&rn(b)}),e.on("element.marker.update",function(y){var b=y.element,E;b.waypoints&&(E=h(b),y.add?lt(E).add(y.marker):lt(E).remove(y.marker))}),e.on("element.mousemove",function(y){var b=y.element,E=b.waypoints,w,P;if(E){if(w=l(b,!0),P=Wh(t,E,y.originalEvent),!P)return;_(w,P),P.bendpoint||v(w,P,E)}}),e.on("element.mousedown",function(y){if(Qo(y)){var b=y.originalEvent,E=y.element;if(E.waypoints)return s(b,E)}}),e.on("selection.changed",function(y){var b=y.newSelection,E=b[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(y){var b=y.element;b.waypoints&&h(b)}),e.on("element.out",function(y){var b=y.element;if(b.waypoints){var E=l(b);if(E){var w=Et(".floating",E);w&<(w).remove("positioned")}}}),e.on("element.updateId",function(y){var b=y.element,E=y.newId;if(b.waypoints){var w=l(b);w&&Se(w,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}t0.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function WI(e){return Et(".djs-visual",e)}var n0=Math.round,jr="reconnectStart",Hr="reconnectEnd",ac="updateWaypoints";function Yh(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=jr:!l&&c===d.length-1?g=Hr:g=ac;var h=g===ac?"connection.updateWaypoints":"connection.reconnect",m=o.allowed(h,{connection:s,source:p,target:f});if(m===!1&&(m=o.allowed(h,{connection:s,source:f,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target: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===ac?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===jr?p:l,target:f===Hr?p:u}),d){s.source=f===jr?p:l,s.target=f===Hr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===Hr?p:u,target:f===jr?p:l})),d&&(s.source=f===Hr?p:u,s.target=f===jr?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!==ac&&(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,m=s.hints||{},_={x:n0(a.x),y:n0(a.y)};if(!c)return!1;h===ac?(p?f.splice(l,0,_):f[l]=_,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,QA(f),m)):(h===jr?(m.docking="source",zu(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Hr&&(m.docking="target",zu(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,_,m))},this)}Yh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Yh.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 zu(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===jr)return t&&i&&t===i&&n!==i;if(o===Hr)return t&&n&&t===n&&n!==i}var UI="reconnectStart",qI="reconnectEnd",i0="updateWaypoints",sc="connect-ok",Gu="connect-not-ok",o0="connect-hover",r0="djs-updating",a0="djs-dragging",s0=1100;function c0(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var a=r.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p;var f=a.draggerGfx=Uh(i.getLayer("overlays"));lt(f).add("djs-dragging"),i.addMarker(c,a0),i.addMarker(c,r0)}),n.on("bendpoint.move.hover",function(r){var a=r.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,o0),l===i0)return;s?(i.removeMarker(c,Gu),i.addMarker(c,sc)):s===!1&&(i.removeMarker(c,sc),i.addMarker(c,Gu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],s0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,o0),i.removeMarker(s,c?sc:Gu))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:r.x,y:r.y},_=a.hints||{},v={};o&&(_.connectionStart&&(v.connectionStart=_.connectionStart),_.connectionEnd&&(v.connectionEnd=_.connectionEnd),p===UI?zu(a)?(v.connectionEnd=v.connectionEnd||m,v.source=g,v.target=u||d,h=h.reverse()):(v.connectionStart=v.connectionStart||m,v.source=u||d,v.target=g):p===qI?zu(a)?(v.connectionStart=v.connectionStart||m,v.source=u||g,v.target=d,h=h.reverse()):(v.connectionEnd=v.connectionEnd||m,v.source=d,v.target=u||g):(v.noCropping=!0,v.noLayout=!0,h[c]=m),p===i0&&(h=e.cropWaypoints(f,h)),v.waypoints=h,o.drawPreview(a,s,v)),On(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],s0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,rn(c),i.removeMarker(s,r0),i.removeMarker(s,a0),l&&(i.removeMarker(l,sc),i.removeMarker(l,u?sc:Gu)),o&&o.cleanUp(a)})}c0.$inject=["bendpointMove","injector","eventBus","canvas"];var l0="connect-hover",u0="djs-updating";function p0(e,t,n){return Kh(e,t,e[t]+n)}function Kh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function YI(e,t,n,i){var o=Math.max(t[i],n[i]),r=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(r+a,e[i]),o-a);return Kh(t,i,s)}function f0(e){return e==="x"?"y":"x"}function d0(e,t,n){var i,o;return e.original?e.original:(i=We(t),o=f0(n),Kh(e,o,i[o]))}function h0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,_=d,v=f.waypoints,y=v[m],b=v[_],E=Wh(n,v,p),w,P,T;if(w=mo(y,b),!!w)return P=w==="v"?"x":"y",m===0&&(y=d0(y,f.source,P)),_===v.length-1&&(b=d0(b,f.target,P)),E?T=E.point:T={x:(y.x+b.x)/2,y:(y.y+b.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:_,segmentStart:y,segmentEnd:b,axis:P,dragPosition:T},i.init(p,T,"connectionSegment.move",{cursor:P==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],_=p.segmentEndIndex+f,v=g[_],y=f0(p.axis),b=YI(d,m,v,y);On(p.draggerGfx,b.x,b.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return Df(p[m-1],p[m+1],h)?(d=m<=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=e0(g,f.segmentStart,f.segmentEnd),lt(f.draggerGfx).add("djs-dragging"),n.addMarker(d,u0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,_=f.segmentEnd,v=f.axis,y=f.originalWaypoints.slice(),b=p0(m,v,p["d"+v]),E=p0(_,v,p["d"+v]),w=y.length,P=0;y[g]=b,y[h]=E;var T,O;g<2&&(T=kn(d.source,b),g===1?T==="intersect"&&(y.shift(),y[0]=b,P--):T!=="intersect"&&(y.unshift(m),P++)),h>w-3&&(O=kn(d.target,E),h===w-2?O==="intersect"&&(y.pop(),y[y.length-1]=E):O!=="intersect"&&y.push(_)),f.newWaypoints=d.waypoints=s(d,y),l(f,P,p),f.newSegmentStartIndex=g+P,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,l0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,l0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&rn(f.draggerGfx),n.removeMarker(d,u0)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(g,h),_=m.waypoints,v=s(d,_),y=m.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+y}};r.updateWaypoints(d,v,b)})}h0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var KI=Math.abs,g0=Math.round;function XI(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],KI(o-e)<=n)return o}function m0(e){return{x:e.x,y:e.y}}function y0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ai(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:g0(e.x+e.width/2),y:g0(e.y+e.height/2)}}function Ga(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function un(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,o=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function v0(e){return e.children||[]}var ZI=Math.abs,b0=Math.round,Xh=10;function x0(e){function t(r,a){if(ze(r)){for(var s=r.length;s--;)if(ZI(r[s]-a)<=Xh)return r[s]}else{r=+r;var c=a%r;if(c<Xh)return a-c;if(c>r-Xh)return a-c+r}return a}function n(r,a){if(r.waypoints)return zI(a,r);if(r.width)return{x:b0(r.width/2+r.x),y:b0(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,r)),d>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;U(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&un(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&un(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!kt(s)||!c||!c.x||!c.y||(un(r,"x",c.x),un(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;U(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&un(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&un(r,"y",d)}})}x0.$inject=["eventBus"];const QI={__depends__:[wo,no],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",t0],bendpointMove:["type",Yh],bendpointMovePreview:["type",c0],connectionSegmentMove:["type",h0],bendpointSnapping:["type",x0]};function _0(e,t,n,i){function o(a,s){return i.allowed("connection.create",{source:a,target:s})}function r(a,s){return o(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,l=a.hover,u;if(s.hover=l,u=s.canExecute=o(c,l),!Qr(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!Qr(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Zh(s)?u:l,connectionEnd:Zh(s)?l:u};hn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){hn(c)||(l=c,c=We(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}_0.$inject=["eventBus","dragging","modeling","rules"];function Zh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var JI=1100,eB=900,w0="connect-ok",E0="connect-not-ok";function S0(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(o){var r=o.context,a=r.canExecute,s=r.hover,c=r.source,l=r.start,u=r.startPosition,p=r.target,f=r.connectionStart||u,d=r.connectionEnd||{x:o.x,y:o.y},g=f,h=d;Zh(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",eB,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?w0:E0)}),t.on(["connect.out","connect.cleanup"],JI,function(o){var r=o.hover;r&&(n.removeMarker(r,w0),n.removeMarker(r,E0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}S0.$inject=["injector","eventBus","canvas"];const Qh={__depends__:[Ri,no,wo],__init__:["connectPreview"],connect:["type",_0],connectPreview:["type",S0]};var tB="djs-dragger";function Po(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)}Po.$inject=["injector","canvas","graphicsFactory","elementFactory"],Po.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),gs(i),o||(o=e.getConnection=nB(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=o(t,r,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[r?We(r):c,a?We(a):l]),this._connectionDocking&&(r||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,r,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Po.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||We(n),r=t.connectionEnd||We(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);qe(e,s)},Po.prototype.cropWaypoints=function(e,t,n,i){var o=this._graphicsFactory,r=n&&o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return e=n&&ws(r,s,!0)||e,t=i&&ws(a,s,!1)||t,[e,t]},Po.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&rn(e.connectionPreviewGfx)},Po.prototype.getConnection=function(e){var t=iB(e);return this._elementFactory.createConnection(t)},Po.prototype.createConnectionPreviewGfx=function(){var e=Le("g");return Se(e,{pointerEvents:"none"}),lt(e).add(tB),qe(this._canvas.getActiveLayer(),e),e},Po.prototype.createNoopConnection=function(e,t){return vs([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function nB(e){var t={};return function(n){var i=JSON.stringify(n),o=t[i];return o||(o=t[i]=e.apply(null,arguments)),o}}function iB(e){return hn(e)?e:{}}const oB={__init__:["connectionPreview"],connectionPreview:["type",Po]},Vu="complex-preview";class R0{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:o=[],resized:r=[]}=t,a=this._canvas.getLayer(Vu);n.filter(s=>!rB(s)).forEach(s=>{let c;kt(s)?(c=this._graphicsFactory._createContainer("connection",Le("g")),this._graphicsFactory.drawConnection(Uo(c),s)):(c=this._graphicsFactory._createContainer("shape",Le("g")),this._graphicsFactory.drawShape(Uo(c),s),On(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const l=this._previewSupport.addDragger(s,a);kt(s)?On(l,c.x,c.y):On(l,s.x+c.x,s.y+c.y)}),o.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),r.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const l=this._graphicsFactory._createContainer("shape",Le("g"));this._graphicsFactory.drawShape(Uo(l),s,{width:c.width,height:c.height}),On(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){gs(this._canvas.getLayer(Vu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Vu)}hide(){this._canvas.hideLayer(Vu)}}R0.$inject=["canvas","graphicsFactory","previewSupport"];function rB(e){return e.hidden}const aB={__depends__:[Oa],__init__:["complexPreview"],complexPreview:["type",R0]},C0=Math.round;function Wu(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Wu.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(U({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;U(l,{x:u.x-C0(l.width/2),y:u.y-C0(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=r.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=o.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Qr(d))})},Wu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Wu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const sB={__depends__:[mu,aB,bh],__init__:["appendPreview"],appendPreview:["type",Wu]};var M0=Math.min,A0=Math.max;function Jh(e){e.preventDefault()}function cc(e){e.stopPropagation()}function cB(e){return e.nodeType===Node.TEXT_NODE}function lB(e){return[].slice.call(e)}function ji(e){this.container=e.container,this.parent=$t('<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=Kn(this.autoResize,this),this.handlePaste=Kn(this.handlePaste,this)}ji.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);U(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=Ii(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,$e.bind(a,"keydown",this.keyHandler),$e.bind(a,"mousedown",cc),$e.bind(a,"paste",o.handlePaste),$e.bind(a,"focusout",this.focusoutHandler),i.autoResize&&$e.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},ji.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var o=this.autoResize(n);o&&this.resizeHandler(o)}},ji.prototype.insertText=function(e){e=uB(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ji.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=lB(a.childNodes),c,l;if(cB(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&Xi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},ji.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},ji.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=$t('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Jh(g),cc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,$e.bind(document,"mousemove",f),$e.bind(document,"mouseup",d)},f=function(g){Jh(g),cc(g);var h=M0(A0(l+g.clientX-s,i),r),m=M0(A0(u+g.clientY-c,o),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Jh(g),cc(g),$e.unbind(document,"mousemove",f,!1),$e.unbind(document,"mouseup",d,!1)};$e.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)},ji.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),$e.unbind(t,"keydown",this.keyHandler),$e.unbind(t,"mousedown",cc),$e.unbind(t,"input",this.autoResize),$e.unbind(t,"paste",this.handlePaste),$e.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Xi(n)),Xi(e)},ji.prototype.getValue=function(){return this.content.innerText.trim()},ji.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ji.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function uB(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function ci(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ji({container:t.getContainer(),keyHandler:Kn(this._handleKey,this),resizeHandler:Kn(this._handleResize,this),focusoutHandler:Kn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ci.$inject=["eventBus","canvas"],ci.prototype.registerProvider=function(e){this._providers.push(e)},ci.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ci.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ci.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ci.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ci.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ci.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),o=this.getValue(),r=e.context.text;(o!==r||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,o,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},ci.prototype.getValue=function(){return this._textbox.getValue()},ci.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()},ci.prototype._handleResize=function(e){this._fire("resize",e)},ci.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ci.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Lt(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 P0={__depends__:[Ul],__init__:["directEditing"],directEditing:["type",ci]};function pB(e){return function(t){var n=t.target,i=ge(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===ut(e);return!r||!a||!s||!c}}const fB={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 pe(e,t={}){var n=fB[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var dB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing"),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-start"),pe("timer-start"),pe("conditional-start"),pe("signal-start")],hB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing"),pe("none-end-event",{actionName:"replace-with-none-end"})],gB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-intermediate-catch"),pe("message-intermediate-throw"),pe("timer-intermediate-catch"),pe("escalation-intermediate-throw"),pe("conditional-intermediate-catch"),pe("link-intermediate-catch"),pe("link-intermediate-throw"),pe("compensation-intermediate-throw"),pe("signal-intermediate-catch"),pe("signal-intermediate-throw")],mB=[pe("none-start-event",{actionName:"replace-with-none-start"}),pe("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),pe("none-end-event",{actionName:"replace-with-none-end"}),pe("message-end"),pe("escalation-end"),pe("error-end"),pe("cancel-end"),pe("compensation-end"),pe("signal-end"),pe("terminate-end")],yB=[pe("exclusive-gateway"),pe("parallel-gateway"),pe("inclusive-gateway"),pe("complex-gateway"),pe("event-based-gateway")],vB=[pe("transaction"),pe("event-subprocess"),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),pe("collapsed-subprocess")],bB=[pe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),pe("transaction"),pe("event-subprocess"),pe("collapsed-ad-hoc-subprocess")],T0=[pe("transaction"),pe("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),pe("event-subprocess")],xB=T0,k0=[pe("task"),pe("user-task"),pe("service-task"),pe("send-task"),pe("receive-task"),pe("manual-task"),pe("rule-task"),pe("script-task"),pe("call-activity"),pe("collapsed-subprocess"),pe("expanded-subprocess"),pe("collapsed-ad-hoc-subprocess"),pe("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],_B=[pe("data-store-reference")],wB=[pe("data-object-reference")],EB=[pe("message-boundary"),pe("timer-boundary"),pe("escalation-boundary"),pe("conditional-boundary"),pe("error-boundary"),pe("cancel-boundary"),pe("signal-boundary"),pe("compensation-boundary"),pe("non-interrupting-message-boundary"),pe("non-interrupting-timer-boundary"),pe("non-interrupting-escalation-boundary"),pe("non-interrupting-conditional-boundary"),pe("non-interrupting-signal-boundary")],SB=[pe("message-start"),pe("timer-start"),pe("conditional-start"),pe("signal-start"),pe("error-start"),pe("escalation-start"),pe("compensation-start"),pe("non-interrupting-message-start"),pe("non-interrupting-timer-start"),pe("non-interrupting-conditional-start"),pe("non-interrupting-signal-start"),pe("non-interrupting-escalation-start")],RB=[{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"}],CB=[pe("expanded-pool"),pe("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],MB={"bpmn:MessageEventDefinition":[pe("message-start"),pe("message-intermediate-catch"),pe("message-intermediate-throw"),pe("message-end")],"bpmn:TimerEventDefinition":[pe("timer-start"),pe("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[pe("conditional-start"),pe("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[pe("signal-start"),pe("signal-intermediate-catch"),pe("signal-intermediate-throw"),pe("signal-end")],"bpmn:ErrorEventDefinition":[pe("error-start"),pe("error-end")],"bpmn:EscalationEventDefinition":[pe("escalation-start"),pe("escalation-intermediate-throw"),pe("escalation-end")],"bpmn:CompensateEventDefinition":[pe("compensation-start"),pe("compensation-intermediate-throw"),pe("compensation-end")]};const O0={"start-event-non-interrupting":`
|
|
317
317
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
318
318
|
<g transform="translate(0 995.64)">
|
|
319
319
|
<path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
325
325
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
326
326
|
</g>
|
|
327
|
-
</svg>`};function Pi(e,t,n,i,o,r,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=o,this._rules=r,this._translate=a,this._moddleCopy=s,this._register()}Pi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Pi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Pi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(ze(e)||!n.allowed("shape.replace",{element:e}))return{};var a=pB(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,_B):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,wB):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=MB[o]||[],!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=rt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(r=rt(dB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Participant")?(r=rt(CB,function(c){return ut(e)!==c.target.isExpanded}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&jn(t.$parent)?(r=rt(SB.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(r=rt(hB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:EndEvent")?(r=rt(mB.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):M(t,"bpmn:BoundaryEvent")?(r=rt(EB,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(r=rt(gB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Gateway")?(r=rt(yB,a),this._createEntries(e,r)):M(t,"bpmn:Transaction")?(r=rt(T0,a),this._createEntries(e,r)):jn(t)&&ut(e)?(r=rt(xB,a),this._createEntries(e,r)):M(t,"bpmn:AdHocSubProcess")&&ut(e)?(r=rt(bB,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&ut(e)?(r=rt(vB,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&!ut(e)?(r=rt(k0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,RB):M(t,"bpmn:FlowNode")?(r=rt(k0,a),this._createEntries(e,r)):{})},Pi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!jn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),yb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Pi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Pi.prototype._createSequenceFlowEntries=function(e,t){var n=ge(e),i={},o=this._modeling,r=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&M(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Pi.prototype._createEntry=function(e,t,n){var i=this._translate,o=this._bpmnReplace.replaceElement,r=function(){return o(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||r,{label:i(a),className:e.className,action:n}},Pi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=ge(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Pi.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function o(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:o}}},Pi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function o(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:o}}},Pi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ge(e),i=this,o=vb(e),r=M(e,"bpmn:BoundaryEvent")?O0["intermediate-event-non-interrupting"]:O0["start-event-non-interrupting"],a=!n[o];return{"toggle-non-interrupting":{imageHtml:r,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[o]:!!a})}}}};const AB={__depends__:[Vh,$x,gu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Pi]};function cc(e,t,n,i,o,r,a,s,c,l,u,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!Ls(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}cc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],cc.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,o){t.removeElements(o.slice())}}}}),n},cc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ze(t)?Oo(e,n=>t.includes(n)):t},cc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&U(u,g()),u;var p=e.businessObject;function f(y,b){o.start(y,b)}function d(y,b){n.removeElements([b])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(y){var b=5,E=t.getPad(y).html,w=E.getBoundingClientRect(),P={x:w.left,y:w.bottom+b};return P}function m(y,b,E,w){function P(N,$){var H=i.createShape(U({type:y},w));r.start(N,H,{source:$})}var T=s?function(N,$){var H=i.createShape(U({type:y},w));s.append($,H)}:P,D=s?function(N,$){return l.create($,y,w),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:P,click:T,hover:D}}}function _(y){return function(b,E){n.splitLane(E,y),t.open(E,!0)}}if(ot(p,["bpmn:Lane","bpmn:Participant"])&&ut(e)){var v=Xo(e);U(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(y,b){n.addLane(b,"top")}}}}),v.length<2&&((xn(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:_(2)}}}),(xn(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:_(3)}}})),U(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(y,b){n.addLane(b,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?U(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):D0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?U(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!D0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!jn(p)&&U(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||U(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(y,b){var E=U(h(b),{cursor:{x:y.x,y:y.y}});a.open(b,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&U(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&U(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ot(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click: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}}}),ot(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":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&U(u,g()),u};function D0(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return z(r,function(a){a.$type===n&&(o=!0)}),i&&o}const PB={__depends__:[sB,P0,cw,Ri,Qh,ql,AB],__init__:["contextPadProvider"],contextPadProvider:["type",cc]};var TB={horizontal:["x","width"],vertical:["y","height"]},L0=5;function To(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ze(i)?i:i?n:[]})}To.$inject=["modeling","rules"],To.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},To.prototype.trigger=function(e,t){var n=this._modeling,i,o;if(!(e.length<3)&&(this._setOrientation(t),o=this._filterElements(e),i=this._createGroups(o),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},To.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(z(t,function(r){o=r(o,n,i)}),o):e},To.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,o=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var r=Vi(e,i);return z(r,function(a,s){var c=n._findRange(a,i,o),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},To.prototype._setOrientation=function(e){var t=TB[e];this._axis=t[0],this._dimension=t[1]},To.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)},To.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+L0,max:t+n-L0}};const kB={__init__:["distributeElements"],distributeElements:["type",To]};function Wu(e){Si.call(this,e)}Wu.$inject=["eventBus"],Ae(Wu,Si),Wu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=rt(t,function(n){var i=ot(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=rl(t),t.length<3?!1:t})};var I0={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Pi(e,t,n,i,o,r,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=o,this._rules=r,this._translate=a,this._moddleCopy=s,this._register()}Pi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Pi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Pi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(ze(e)||!n.allowed("shape.replace",{element:e}))return{};var a=pB(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,_B):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,wB):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=MB[o]||[],!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=rt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(r=rt(dB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Participant")?(r=rt(CB,function(c){return ut(e)!==c.target.isExpanded}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&jn(t.$parent)?(r=rt(SB.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(r=rt(hB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:EndEvent")?(r=rt(mB.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):M(t,"bpmn:BoundaryEvent")?(r=rt(EB,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(r=rt(gB.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Gateway")?(r=rt(yB,a),this._createEntries(e,r)):M(t,"bpmn:Transaction")?(r=rt(T0,a),this._createEntries(e,r)):jn(t)&&ut(e)?(r=rt(xB,a),this._createEntries(e,r)):M(t,"bpmn:AdHocSubProcess")&&ut(e)?(r=rt(bB,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&ut(e)?(r=rt(vB,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&!ut(e)?(r=rt(k0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,RB):M(t,"bpmn:FlowNode")?(r=rt(k0,a),this._createEntries(e,r)):{})},Pi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!jn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),yb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Pi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Pi.prototype._createSequenceFlowEntries=function(e,t){var n=ge(e),i={},o=this._modeling,r=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&M(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Pi.prototype._createEntry=function(e,t,n){var i=this._translate,o=this._bpmnReplace.replaceElement,r=function(){return o(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||r,{label:i(a),className:e.className,action:n}},Pi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=ge(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Pi.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function o(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:o}}},Pi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function o(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:o}}},Pi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ge(e),i=this,o=vb(e),r=M(e,"bpmn:BoundaryEvent")?O0["intermediate-event-non-interrupting"]:O0["start-event-non-interrupting"],a=!n[o];return{"toggle-non-interrupting":{imageHtml:r,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[o]:!!a})}}}};const AB={__depends__:[Vh,$x,mu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Pi]};function lc(e,t,n,i,o,r,a,s,c,l,u,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!Is(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}lc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],lc.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,o){t.removeElements(o.slice())}}}}),n},lc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ze(t)?Oo(e,n=>t.includes(n)):t},lc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&U(u,g()),u;var p=e.businessObject;function f(y,b){o.start(y,b)}function d(y,b){n.removeElements([b])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(y){var b=5,E=t.getPad(y).html,w=E.getBoundingClientRect(),P={x:w.left,y:w.bottom+b};return P}function m(y,b,E,w){function P(N,$){var H=i.createShape(U({type:y},w));r.start(N,H,{source:$})}var T=s?function(N,$){var H=i.createShape(U({type:y},w));s.append($,H)}:P,O=s?function(N,$){return l.create($,y,w),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:P,click:T,hover:O}}}function _(y){return function(b,E){n.splitLane(E,y),t.open(E,!0)}}if(ot(p,["bpmn:Lane","bpmn:Participant"])&&ut(e)){var v=Xo(e);U(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(y,b){n.addLane(b,"top")}}}}),v.length<2&&((xn(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:_(2)}}}),(xn(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:_(3)}}})),U(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(y,b){n.addLane(b,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?U(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):D0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?U(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!D0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!jn(p)&&U(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||U(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(y,b){var E=U(h(b),{cursor:{x:y.x,y:y.y}});a.open(b,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&U(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&U(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ot(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click: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}}}),ot(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":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&U(u,g()),u};function D0(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return z(r,function(a){a.$type===n&&(o=!0)}),i&&o}const PB={__depends__:[sB,P0,cw,Ri,Qh,Yl,AB],__init__:["contextPadProvider"],contextPadProvider:["type",lc]};var TB={horizontal:["x","width"],vertical:["y","height"]},L0=5;function To(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ze(i)?i:i?n:[]})}To.$inject=["modeling","rules"],To.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},To.prototype.trigger=function(e,t){var n=this._modeling,i,o;if(!(e.length<3)&&(this._setOrientation(t),o=this._filterElements(e),i=this._createGroups(o),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},To.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(z(t,function(r){o=r(o,n,i)}),o):e},To.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,o=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var r=Vi(e,i);return z(r,function(a,s){var c=n._findRange(a,i,o),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},To.prototype._setOrientation=function(e){var t=TB[e];this._axis=t[0],this._dimension=t[1]},To.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)},To.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+L0,max:t+n-L0}};const kB={__init__:["distributeElements"],distributeElements:["type",To]};function Uu(e){Si.call(this,e)}Uu.$inject=["eventBus"],Ae(Uu,Si),Uu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=rt(t,function(n){var i=ot(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=al(t),t.length<3?!1:t})};var I0={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>`},OB=900;function lc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",OB,this)}lc.$inject=["popupMenu","distributeElements","translate","rules"],lc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},lc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},lc.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,o={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:I0.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:I0.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const DB={__depends__:[Vh,kB],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Wu],distributeElementsMenuProvider:["type",lc]};var B0="is not a registered action",LB="is already registered";function Ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ti.$inject=["eventBus","injector"],Ti.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=ze(p)?p:u;return r.cut(f.slice())}}}),o&&this.register("stepZoom",function(u){o.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&(ze(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ti.prototype.trigger=function(e,t){if(!this._actions[e])throw eg(e,B0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,o){n._registerAction(o,i)})},Ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw eg(e,LB);this._actions[e]=t},Ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw eg(e,B0);this._actions[e]=void 0},Ti.prototype.getActions=function(){return Object.keys(this._actions)},Ti.prototype.isRegistered=function(e){return!!this._actions[e]};function eg(e,t){return new Error(e+" "+t)}const IB={__init__:["editorActions"],editorActions:["type",Ti]};function Uu(e){e.invoke(Ti,this)}Ae(Uu,Ti),Uu.$inject=["injector"],Uu.prototype._registerDefaultActions=function(e){Ti.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],_=g.type;h.length&&(m=rt(h,function(v){return!M(v,"bpmn:Lane")}),l.trigger(m,_))}),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,m;M(g,"bpmn:Collaboration")?m=n.filter(function(_){return M(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!M(_.parent,"bpmn:SubProcess")}),h=an(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const BB={__depends__:[IB],editorActions:["type",Uu]};function N0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ot(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}N0.$inject=["eventBus"];function zr(e,t){de.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;Qn(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}zr.$inject=["eventBus","gridSnapping","modeling"],Ae(zr,de),zr.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},zr.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},zr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),U(e,r),e},zr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),U(e,r),e};var NB=2e3;function $0(e,t){e.on(["spaceTool.move","spaceTool.end"],NB,function(n){var i=n.context;if(i.initialized){var o=i.axis,r;o==="x"?(r=t.snapValue(n.dx),n.x=n.x+r-n.dx,n.dx=r):(r=t.snapValue(n.dy),n.y=n.y+r-n.dy,n.dy=r)}})}$0.$inject=["eventBus","gridSnapping"];const $B={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",zr],gridSnappingSpaceToolBehavior:["type",$0]};var qu=10;function tg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var FB=1200,jB=800;function lr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",jB,function(){o.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],FB,function(r){var a=r.originalEvent;if(!(!o.active||a&&oi(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=zB(r,l,e);p&&(u.offset=p);var f=HB(r,l);f&&U(u,f),Ga(r,l)||o.snapEvent(r,l,u)})}})}lr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);un(e,t,i)},lr.prototype.getGridSpacing=function(){return qu},lr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=tg(e,qu);var i,o;return t&&t.min&&(i=t.min,Ge(i)&&(i=tg(i+n,qu,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Ge(o)&&(o=tg(o+n,qu,"floor"),e=Math.min(e,o))),e-=n,e},lr.prototype.isActive=function(){return this.active},lr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},lr.prototype.toggleActive=function(){this.setActive(!this.active)},lr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function HB(e,t){var n=e.context,i=n.createConstraints,o=n.resizeConstraints||{},r=n.gridSnappingContext,a=r.snapConstraints;if(a&&a[t])return a[t];a||(a=r.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Yu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=o.min,l=o.max;return c&&(Yu(t)?j0(s)?a.x.max=c.left:a.x.min=c.right:F0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Yu(t)?j0(s)?a.x.min=l.left:a.x.max=l.right:F0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function zB(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Ge(s[t])||(s||(s=r.snapOffset={}),Ge(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Yu(t)?s[t]+=o[t]+o.width/2:s[t]+=o[t]+o.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=o.width/2:/right/.test(a)&&(s[t]+=o.width/2):/top/.test(a)?s[t]-=o.height/2:/bottom/.test(a)&&(s[t]+=o.height/2)),s[t]}function Yu(e){return e==="x"}function F0(e){return e.indexOf("n")!==-1}function j0(e){return e.indexOf("w")!==-1}const GB={__depends__:[$B],__init__:["gridSnapping"],gridSnapping:["type",lr]};var VB=2e3;function H0(e,t,n){e.on("autoPlace",VB,function(i){var o=i.source,r=We(o),a=i.shape,s=T_(o,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==r[c]&&(s[c]>r[c]?l.min=s[c]:l.max=s[c],M(a,"bpmn:TextAnnotation")&&(WB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}H0.$inject=["eventBus","gridSnapping","elementRegistry"];function WB(e){return e==="x"}var UB=1750;function z0(e,t,n){t.on(["create.start","shape.move.start"],UB,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!M(r,"bpmn:Participant")||!M(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}z0.$inject=["canvas","eventBus","gridSnapping"];var qB=3e3;function Ku(e,t,n){de.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],qB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||YB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Ku.$inject=["eventBus","gridSnapping","modeling"],Ae(Ku,de),Ku.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=ZB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function YB(e){return e.length>3}function KB(e){return e==="h"}function XB(e){return e==="v"}function ZB(e,t,n){var i=mo(t,n),o={};return KB(i)&&(o.y=e.snapValue(t.y)),XB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=U({},t,o),n=U({},n,o)),[t,n]}const QB={__depends__:[GB,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",H0],gridSnappingParticipantBehavior:["type",z0],gridSnappingLayoutConnectionBehavior:["type",Ku]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",N0]};var JB=30,G0=30;function uc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(M(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(M(o,"bpmn:Participant"))return ut(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(M(o,"bpmn:SubProcess"))return ut(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}uc.$inject=["eventBus","interactionEvents"],uc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},uc.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=xn(e)?{width:JB,height:e.height}:{width:e.width,height:G0};return this._interactionEvents.createBoxHit(t,"all",n),!0},uc.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:G0}),!0};const eN={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",uc]};function Xu(e){e.invoke(Ba,this)}Ae(Xu,Ba),Xu.$inject=["injector"],Xu.prototype.registerBindings=function(e,t){Ba.prototype.registerBindings.call(this,e,t);function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("selectElements",function(i){var o=i.keyEvent;if(e.isKey(["a","A"],o)&&e.isCmd(o))return t.trigger("selectElements"),!0}),n("find",function(i){var o=i.keyEvent;if(e.isKey(["f","F"],o)&&e.isCmd(o))return t.trigger("find"),!0}),n("spaceTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["s","S"],o))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["l","L"],o))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["h","H"],o))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["c","C"],o))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["e","E"],o))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["r","R"],o))return t.trigger("replaceElement",o),!0})};const tN={__depends__:[Ph],__init__:["keyboardBindings"],keyboardBindings:["type",Xu]};var nN={moveSpeed:1,moveSpeedAccelerated:10},iN=1500,V0="left",W0="up",U0="right",q0="down",oN={ArrowLeft:V0,Left:V0,ArrowUp:W0,Up:W0,ArrowRight:U0,Right:U0,ArrowDown:q0,Down:q0},rN={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 Y0(e,t,n,i,o){var r=this;this._config=U({},nN,e||{}),t.addListener(iN,function(a){var s=a.keyEvent,c=oN[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return r.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=o.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=rN[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}Y0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const aN={__depends__:[Ph,Ri],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Y0]};var K0=10;function pc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=UT(u,p,l),c.newBounds=YT(d,f),c.canExecute=o.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=o.computeMinResizeBox(c)),c.resizeConstraints={min:je(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=nv(p),!sN(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}pc.prototype.canResize=function(e){var t=this._rules,n=Ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},pc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=U({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,X0(t,r),"resize",{autoActivate:!0,cursor:cN(r),data:{shape:t,context:o}})},pc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:K0,height:K0},o=Gv(t,e.childrenBoxPadding),KT(n,t,i,o)},pc.$inject=["eventBus","rules","modeling","dragging"];function sN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function X0(e,t){var n=We(e),i=je(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function cN(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 Z0="djs-resizing",Q0="resize-not-ok",lN=500;function J0(e,t,n){function i(r){var a=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,Z0)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),r.canExecute?lt(c).remove(Q0):lt(c).add(Q0)}function o(r){var a=r.shape,s=r.frame;s&&rn(r.frame),t.removeMarker(a,Z0)}e.on("resize.move",lN,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}J0.$inject=["eventBus","canvas","previewSupport"];var Zu=-6,Qu=8,Ju=20,fc="djs-resizer",uN=["n","w","s","e","nw","ne","se","sw"];function ur(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&z(a,Kn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}ur.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){Qo(r)&&i.activate(r,e,n)}$e.bind(t,"mousedown",o),$e.bind(t,"touchstart",o)},ur.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=pN(i),a=Le("g");lt(a).add(fc),lt(a).add(fc+"-"+e.id),lt(a).add(fc+"-"+i),qe(o,a);var s=Le("rect");Se(s,{x:-Qu/2+r.x,y:-Qu/2+r.y,width:Qu,height:Qu}),lt(s).add(fc+"-visual"),qe(a,s);var c=Le("rect");return Se(c,{x:-Ju/2+r.x,y:-Ju/2+r.y,width:Ju,height:Ju}),lt(c).add(fc+"-hit"),qe(a,c),pl(a,t,n),a},ur.prototype.createResizer=function(e,t){var n=X0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},ur.prototype.addResizer=function(e){var t=this;kt(e)||z(uN,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},ur.prototype.removeResizers=function(){var e=this._getResizersParent();hs(e)},ur.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},ur.$inject=["eventBus","canvas","selection","resize"];function pN(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Zu:e.indexOf("w")!==-1&&(t.x=Zu),e.indexOf("s")!==-1?t.y=-Zu:e.indexOf("n")!==-1&&(t.y=Zu),t}const eE={__depends__:[no,wo,Oa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",pc],resizePreview:["type",J0],resizeHandles:["type",ur]};var fN=2e3;function dc(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],fN,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||ot(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}dc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],dc.prototype.activate=function(e){var t=yi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);U(n,i);var o={},r=n.style||{};return U(r,{backgroundColor:null,border:null}),(ot(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||tE(e))&&U(o,{centerVertically:!0}),Yo(e)&&(U(o,{resizable:!0,autoResize:!0}),U(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(U(o,{resizable:!0,autoResize:!0}),U(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),U(n,{options:o,style:r}),n}},dc.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||gN(e)){var g=xn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};U(r,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(hN(e)){var m=xn(e),_=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};U(r,_),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ot(e,["bpmn:Task","bpmn:CallActivity"])||tE(e))&&(U(r,{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"})),dN(e)&&(U(r,{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 v=1,y=i.width+2*v;if(n.labelTarget&&(U(r,{width:y,height:i.height+2*v,x:i.x-v,y:i.y-v}),U(d,{fontSize:l+"px",lineHeight:u})),Yo(n)&&!hl(n)&&!it(n)){var b=$f(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),w=l,P=Ar.width*a+2*v;U(r,{width:P,height:w+2*v,x:E.x-P/2,y:E.y-w/2-v}),U(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(U(r,{width:i.width+2*v,height:i.height+2*v,x:i.x-v,y:i.y-v,minWidth:30*a,minHeight:10*a}),U(d,{textAlign:"left",paddingTop:xa*a+"px",paddingBottom:xa*a+"px",paddingLeft:xa*a+"px",paddingRight:xa*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},dc.prototype.update=function(e,t,n,i){var o,r;M(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),mN(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function tE(e){return M(e,"bpmn:SubProcess")&&!ut(e)}function dN(e){return M(e,"bpmn:SubProcess")&&ut(e)}function hN(e){return M(e,"bpmn:Participant")&&!ut(e)}function gN(e){return M(e,"bpmn:Participant")&&ut(e)}function mN(e){return!e||!e.trim()}var nE="djs-element-hidden",iE="djs-label-hidden";function oE(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,M(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=Le("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=i.path=Le("path");Se(p,{d:u,strokeWidth:2,stroke:yN(r)}),qe(s,p),qe(o,s),On(s,r.x,r.y)}M(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,nE):(M(r,"bpmn:Task")||M(r,"bpmn:CallActivity")||M(r,"bpmn:SubProcess")||M(r,"bpmn:Participant")||M(r,"bpmn:Lane"))&&t.addMarker(r,iE)}),e.on("directEditing.resize",function(c){if(M(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});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,nE),t.removeMarker(r,iE)),r=void 0,a=void 0,s&&(rn(s),s=void 0)})}oE.$inject=["eventBus","canvas","pathMap"];function yN(e,t){var n=dt(e);return n.get("stroke")||t||"black"}const vN={__depends__:[nh,eE,P0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",dc],labelEditingPreview:["type",oE]};var bN=500,xN=1e3;function ro(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function o(r){YA(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){z(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],bN,function(r){var a=r.element,s=r.gfx,c=Et(".djs-outline",s);c&&i.updateOutline(a,c)})}ro.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(),qe(t,n),this.updateOutline(e,n)),n},ro.prototype._createOutlineGfx=function(){var e=Le("rect");return Se(e,U({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},ro.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},ro.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(o){n=n||o.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},ro.prototype.updateConnectionOutline=function(e,t){var n=an(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})},ro.prototype.registerProvider=function(e,t){t||(t=e,e=xN),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},ro.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ro.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){bn(i.getOutline)&&(t=t||i.getOutline(e))}),t},ro.$inject=["eventBus","styles","elementRegistry"];var ep=6;function ng(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(o){n.isSelected(o.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(o){var r=o.newSelection;i._updateMultiSelectionOutline(r)})}ng.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");hs(t);var n=e.length>1,i=this._canvas.getContainer();if(lt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=_N(an(e)),r=Le("rect");Se(r,U({rx:3},o)),lt(r).add("djs-selection-outline"),qe(t,r)}},ng.$inject=["eventBus","canvas","selection"];function _N(e){return{x:e.x-ep,y:e.y-ep,width:e.width+ep*2,height:e.height+ep*2}}const ig={__depends__:[Ri],__init__:["outline","multiSelectionOutline"],outline:["type",ro],multiSelectionOutline:["type",ng]},rE=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],aE={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},wN=15,tp=2;function sE(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>ot(g,rE));if(f.length===1){const g=f[0];it(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(it),h=f.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!ot(p,rE)||!u(p)||(it(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=ys([We(f),We(p)],aE),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),_=_s(m,g);if(!_)return;const y=o.isSelected(f)?c(f):l(f),b=_s(y,g)||We(f);ks(b,_)<wN||(Tf(d,[b,_]),qe(r,d))}function s(){ds(`.${aE.class}`,r).forEach(rn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+pr(f,"x")-tp,y:p.y+pr(f,"y")-tp,width:pr(f,"width")+tp*2,height:pr(f,"height")+tp*2};return jf(d,pr(f,"rx"))}if(f.cx){const d=pr(f,"r"),g={x:p.x+pr(f,"cx")-d,y:p.y+pr(f,"cy")-d,width:d*2,height:d*2};return Cv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}sE.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function pr(e,t){return parseFloat(Se(e,t)||0)}const EN={__depends__:[Ri,ig],__init__:["labelLink"],labelLink:["type",sE]};var SN=new Dr("tt");function RN(e){var t=$t('<div class="djs-tooltip-container" />');return Vn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function CN(e,t,n){Vn(e,{left:t+"px",top:n+"px"})}function og(e,t){e.style.display=t===!1?"none":""}var cE="djs-tooltip",rg="."+cE;function Zn(e,t){this._eventBus=e,this._canvas=t,this._ids=SN,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=RN(t.getContainer());var n=this;ti.bind(this._tooltipRoot,rg,"mousedown",function(i){i.stopPropagation()}),ti.bind(this._tooltipRoot,rg,"mouseover",function(i){n.trigger("mouseover",i)}),ti.bind(this._tooltipRoot,rg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Zn.$inject=["eventBus","canvas"],Zn.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},Zn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(En(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Zn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Zn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Zn.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)}},Zn.prototype.remove=function(e){var t=this.get(e);t&&(Xi(t.html),Xi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Zn.prototype.show=function(){og(this._tooltipRoot)},Zn.prototype.hide=function(){og(this._tooltipRoot,!1)},Zn.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},Zn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Qn(n)&&(n=$t(n)),i=$t('<div data-tooltip-id="'+t+'" class="'+cE+'">'),Vn(i,{position:"absolute"}),i.appendChild(n),e.type&&Rt(i).add("djs-tooltip-"+e.type),e.className&&Rt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Zn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;CN(n,t.x,t.y)},Zn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),og(i,o))})},Zn.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 MN={__init__:["tooltips"],tooltips:["type",Zn]};var AN="flow elements must be children of pools/participants",PN="Data object must be placed within a pool/participant.";function lE(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(o,n(AN)):M(a,"bpmn:DataObjectReference")&&i(o,n(PN)))})}lE.$inject=["eventBus","tooltips","translate"];const TN={__depends__:[MN],__init__:["modelingFeedback"],modelingFeedback:["type",lE]};var kN=500,ON=1250,DN=1500,np=Math.round;function LN(e){return{x:e.x+np(e.width/2),y:e.y+np(e.height/2)}}function uE(e,t,n,i,o){function r(s,c,l,u){return o.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",DN,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=IN(u),U(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",ON,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",kN,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=r(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=np(l.x),l.y=np(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Qo(s)){var c=Aa(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)&&!lt(s.target).has("djs-hit-no-move")){var p=LN(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}uE.$inject=["eventBus","dragging","modeling","selection","rules"];function IN(e){var t=ea(e,"id");return rt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var pE=499,ag="djs-dragging",fE="drop-ok",dE="drop-not-ok",hE="new-parent",gE="attach-ok";function mE(e,t,n,i){function o(c){var l=r(c),u=BN(l);return u}function r(c){var l=vs(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[gE,fE,dE,hE].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,ag),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",pE,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Le("g");Se(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();qe(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=xp([p,r(u)]):p=r(u),z(p,function(h){t.addMarker(h,ag)}),l.allDraggedElements=p,l.differentParents=NN(u)}),e.on("shape.move.move",pE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,gE):l.canExecute&&f&&p.id!==f.id?a(p,hE):a(p,l.canExecute?fE:dE)),On(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;z(u,function(f){t.removeMarker(f,ag)}),p&&rn(p)}),this.makeDraggable=s}mE.$inject=["eventBus","canvas","styles","previewSupport"];function BN(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=rt(e,function(i){return kt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function NN(e){return Y1(ea(e,function(t){return t.parent&&t.parent.id}))!==1}const $N={__depends__:[Wl,Ri,ig,no,wo,Oa],__init__:["move","movePreview"],move:["type",uE],movePreview:["type",mE]};var yE=".djs-palette-toggle",vE=".entry",FN=yE+", "+vE,sg="djs-palette-",jN="shown",cg="open",bE="two-column",HN=1e3;function pn(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}pn.$inject=["eventBus","canvas"],pn.prototype.registerProvider=function(e,t){t||(t=e,e=HN),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},pn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(GN,{})},pn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},pn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=$t(pn.HTML_MARKUP);n.appendChild(i),Rt(n).add(sg+jN),ti.bind(i,FN,"click",function(o){var r=o.delegateTarget;if(xf(r,yE))return e.toggle();e.trigger("click",o)}),$e.bind(i,"mousedown",function(o){o.stopPropagation()}),ti.bind(i,vE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},pn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},pn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Rt(n),a=Rt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(bE,o),a.toggle(sg+bE,o),"open"in e&&(r.toggle(cg,e.open),a.toggle(sg+cg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},pn.prototype._update=function(){var e=Et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();tl(e),z(t,function(n,i){var o=n.group||"default",r=Et("[data-group="+Nr(o)+"]",e);r||(r=$t('<div class="group"></div>'),En(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=$t(a);if(r.appendChild(s),!n.separator&&(En(s,"data-action",i),n.title&&En(s,"title",n.title),n.className&&zN(s,n.className),n.imageUrl)){var c=$t("<img>");En(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},pn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=En(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},pn.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(bn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},pn.prototype._layoutChanged=function(){this._toggleState({})},pn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},pn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},pn.prototype.open=function(){this._toggleState({open:!0})},pn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},pn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},pn.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 o=i.getAttribute("data-action");if(o){var r=Rt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},pn.prototype.isOpen=function(){return Rt(this._container).has(cg)},pn.prototype._getParentContainer=function(){return this._canvas.getContainer()},pn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function zN(e,t){var n=Rt(e),i=ze(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function GN(e,t){var n=t.getPaletteEntries();return bn(n)?n(e):(z(n,function(i,o){e[o]=i}),e)}const VN={__init__:["palette"],palette:["type",pn]};var xE="crosshair",_E="selected",WN="djs-dragging-active-lasso";function fr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Le("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),qe(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 m of h)g.has(m)||t.removeMarker(m,_E);for(const m of g)h.has(m)||t.addMarker(m,_E)}},remove:function(p){this.update(p),p.frame&&rn(p.frame),l(!1)}};function l(p){lt(t.getContainer()).toggle(WN,p)}function u(p){var f=i.getAll();return new Set(Jr(ga(f,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=wE(p),f.add=$l(p),f.lastMarked=new Set(o.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=wE(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if($l(p))return s.activateLasso(p.originalEvent),!0})}fr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],fr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:xE,data:{context:{}},keepSelection:!0})},fr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:xE,data:{context:{}},keepSelection:!0})},fr.prototype._select=function(e){this._selection.select(e)},fr.prototype.select=function(e,t,n=[]){var i=Jr(ga(e,t));this._select([...n,...i])},fr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},fr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function wE(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 UN={__depends__:[Kl,Ns],__init__:["lassoTool"],lassoTool:["type",fr]};var lg=1500,EE="grab";function Va(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var a=this,s=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",lg,function(c){if(Ls(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(lg,function(c){if(!(!SE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(lg,function(c){!SE(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!Ls(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Va.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Va.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:EE,data:{context:n||{}}})},Va.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:EE,data:{context:{reactivate:n}}})},Va.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Va.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function SE(e){return mn("Space",e)}const qN={__depends__:[Kl,Ns],__init__:["handTool"],handTool:["type",Va]};var RE="connect-ok",CE="connect-not-ok";function Wa(e,t,n,i,o,r,a){var s=this;this._dragging=t,this._rules=r,this._mouse=a,o.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?RE:CE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?RE:CE)}),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})}Wa.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Wa.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Wa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Wa.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Wa.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const YN={__depends__:[Qh,no,wo,Kl,Ns],globalConnect:["type",Wa]};function ug(e,t,n,i,o,r,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=o,this._handTool=r,this._globalConnect=a,this._translate=s,e.registerProvider(this)}ug.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],ug.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function m(_){var v=n.createShape(U({type:p},h));t.start(_,v)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}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){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const KN={__depends__:[VN,ql,Vx,UN,qN,YN,Ms],__init__:["paletteProvider"],paletteProvider:["type",ug]};var XN=250;function pg(e,t,n,i,o){de.call(this,e);function r(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);U(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Et('[data-element-id="'+Nr(f.id)+'"]',s.dragGroup);g&&Se(g,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=Et('[data-element-id="'+Nr(u)+'"]',s.dragGroup);p&&Se(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",XN,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}pg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ae(pg,de);const ZN={__depends__:[Oa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",pg]};var QN=1250,fg=40,JN=20,e$=10,ME=20,AE=["x","y"],t$=Math.abs;function PE(e){e.on(["connect.hover","connect.move","connect.end"],QN,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&oi(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&n$(t,r,a$(r)),r&&r$(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ai(o),ot(r,["bpmn:Event","bpmn:Gateway"])&&TE(t,Ai(r)),ot(r,["bpmn:Task","bpmn:SubProcess"])&&i$(t,r),M(a,"bpmn:BoundaryEvent")&&s===a.host&&o$(t)):kE(i,"bpmn:MessageFlow")?(M(o,"bpmn:Event")&&(n.connectionStart=Ai(o)),M(r,"bpmn:Event")&&TE(t,Ai(r))):n.connectionStart=n.initialConnectionStart)})}PE.$inject=["eventBus"];function n$(e,t,n){AE.forEach(function(i){var o=OE(i,t);e[i]<t[i]+n?un(e,i,t[i]+n):e[i]>t[i]+o-n&&un(e,i,t[i]+o-n)})}function i$(e,t){var n=Ai(t);AE.forEach(function(i){s$(e,t,i)&&un(e,i,n[i])})}function o$(e){var t=e.context,n=t.source,i=t.target;if(!c$(t)){var o=Ai(n),r=kn(o,i,-10),a=[];/top|bottom/.test(r)&&a.push("x"),/left|right/.test(r)&&a.push("y"),a.forEach(function(s){var c=e[s],l;t$(c-o[s])<fg&&(c>o[s]?l=o[s]+fg:l=o[s]-fg,un(e,s,l))})}}function TE(e,t){un(e,"x",t.x),un(e,"y",t.y)}function kE(e,t){return e&&e.type===t}function r$(e,t){return Do(t,function(n){return kE(e,n)})}function OE(e,t){return e==="x"?t.width:t.height}function a$(e){return M(e,"bpmn:Task")?e$:JN}function s$(e,t,n){return e[n]>t[n]+ME&&e[n]<t[n]+OE(n,t)-ME}function c$(e){var t=e.hover,n=e.source;return t&&n&&t===n}function dr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}dr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},dr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},dr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},dr.prototype.getSnapLocations=function(){return this._snapLocations},dr.prototype.setSnapLocations=function(e){this._snapLocations=e},dr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new ip,n.initDefaults(this._defaultSnaps)),n};function ip(){this._snapValues={}}ip.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)},ip.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&XI(e[n],o[n],i)},ip.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(o){t.add(i,o)})})};var l$=1250;function ao(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(o){i.initSnap(o)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],l$,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&oi(o.originalEvent))&&!(Ga(o)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(o,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}ao.$inject=["elementRegistry","eventBus","snapping"],ao.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new dr);var r;t.get(i.id)?r=Ai(i,e):r={x:e.x+Ai(i).x,y:e.y+Ai(i).y};var a={x:r.x-i.width/2,y:r.y-i.height/2},s={x:r.x+i.width/2,y:r.y+i.height/2};return o.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),it(i)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},ao.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(o){if(it(o)){it(t)&&e.add("mid",Ai(o));return}if(kt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);z(r,function(a){e.add("mid",a)});return}e.add("mid",Ai(o))}),!Ge(t.x)||!Ge(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ai(t)),e},ao.prototype.getSnapTargets=function(e,t){return v0(t).filter(function(n){return!u$(n)})};function u$(e){return!!e.hidden}var DE=1500;function Ua(e,t){t.invoke(ao,this),e.on(["create.move","create.end"],DE,h$),e.on(["create.move","create.end","shape.move.move","shape.move.end"],DE,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ga(n)&&p$(n,r)})}Ae(Ua,ao),Ua.$inject=["eventBus","injector"],Ua.prototype.initSnap=function(e){var t=ao.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",IE(r,i,e))}),z(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",IE(r,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ua.prototype.addSnapTargetPoints=function(e,t,n){ao.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(r){(d$(r)||f$([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",m0(r)),e.add("bottom-right",y0(r)))});var o=this._elementRegistry;return z(t.incoming,function(r){if(o.get(t.id)){LE(i,r.source)||e.add("mid",We(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),z(t.outgoing,function(r){if(o.get(t.id)){LE(i,r.target)||e.add("mid",We(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ua.prototype.getSnapTargets=function(e,t){return ao.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function p$(e,t){var n=je(t),i=jb(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=We(r),/top/.test(i)?un(e,"y",n.top-a.y):/bottom/.test(i)&&un(e,"y",n.bottom-a.y),/left/.test(i)?un(e,"x",n.left-a.x):/right/.test(i)&&un(e,"x",n.right-a.x)}function f$(e,t){return e.every(function(n){return M(n,t)})}function d$(e){return M(e,"bpmn:SubProcess")&&ut(e)?!0:M(e,"bpmn:Participant")}function h$(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,o=n.right,r=n.bottom,a=n.left;(a&&a>=e.x||o&&o<=e.x)&&un(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&un(e,"y",e.y)}}function LE(e,t){return e.indexOf(t)!==-1}function IE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var g$=1250;function hc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],g$,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&oi(i.originalEvent))&&!Ga(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),v$(s)&&un(i,"x",i.x),b$(s)&&un(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}hc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new dr);var r=BE(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},hc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return z(o,function(r){e.add("corner",y0(r)),e.add("corner",m0(r))}),e.add("corner",BE(t,i)),e},hc.$inject=["eventBus","snapping"],hc.prototype.getSnapTargets=function(e,t){return v0(t).filter(function(n){return!m$(n,e)&&!kt(n)&&!y$(n)&&!it(n)})};function BE(e,t){var n=We(e),i=je(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function m$(e,t){return e.host===t}function y$(e){return!!e.hidden}function v$(e){return e==="n"||e==="s"}function b$(e){return e==="e"||e==="w"}var x$=7,_$=1e3;function hr(e){this._canvas=e,this._asyncHide=wp(Kn(this.hide,this),_$)}hr.$inject=["canvas"],hr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ga(e,"x"),y:Ga(e,"y")};z(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,x$),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),z(["x","y"],function(a){var s=r[a];hn(s)&&un(e,a,s.originValue)})},hr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Le("path");return Se(n,{d:"M0,0 L0,0"}),lt(n).add("djs-snap-line"),qe(t,n),{update:function(i){Ge(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"})}}},hr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},hr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},hr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},hr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const w$={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ao],resizeSnapping:["type",hc],snapping:["type",hr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",PE],createMoveSnapping:["type",Ua]};var NE=300;function Xe(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(Xe.INPUT_SELECTOR,this._container),this._resultsContainer=Et(Xe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Xe.$inject=["canvas","eventBus","selection","translate"],Xe.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ti.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Xe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Xe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Xe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Xe.INPUT_SELECTOR,"keydown",function(n){mn("ArrowUp",n)&&n.preventDefault(),mn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Xe.INPUT_SELECTOR,"keyup",function(n){if(mn("Escape",n))return e.close();if(mn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(mn("ArrowUp",n))return e._scrollToDirection(!0);if(mn("ArrowDown",n))return e._scrollToDirection();mn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Xe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ti.unbind(e.el,e.type,e.listener)})},Xe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(o){return!t._canvas.getRootElements().includes(o.element)}),!n.length){this._selection.select(null);return}n.forEach(function(o){var r=o.element.id,a=t._createResultNode(o,r);t._results[r]={element:o.element,node:a}});var i=Et(Xe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Xe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Xe.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)}},Xe.prototype._clearResults=function(){tl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Xe.prototype._getCurrentResult=function(){return Et(Xe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Xe.prototype._createResultNode=function(e,t){var n=$t(Xe.RESULT_HTML);return e.primaryTokens.length>0&&$E(n,e.primaryTokens,Xe.RESULT_PRIMARY_HTML),$E(n,e.secondaryTokens,Xe.RESULT_SECONDARY_HTML),En(n,Xe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Xe.prototype.registerProvider=function(e){this._searchProvider=e},Xe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Rt(this._canvas.getContainer()).add("djs-search-open"),Rt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Xe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Rt(this._canvas.getContainer()).remove("djs-search-open"),Rt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Xe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Xe.prototype.isOpen=function(){return this._open},Xe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Rt(t).remove(Xe.RESULT_SELECTED_CLASS);var n=En(e,Xe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Rt(e).add(Xe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:NE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Xe.prototype._select=function(e){var t=En(e,Xe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:NE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Xe.prototype._getBoxHtml=function(){const e=$t(Xe.BOX_HTML),t=Et(Xe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function $E(e,t,n){var i=E$(t),o=$t(n);o.innerHTML=i,e.appendChild(o)}function E$(e){var t="";return e.forEach(function(n){var i=U_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+Xe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Xe.CONTAINER_SELECTOR=".djs-search-container",Xe.INPUT_SELECTOR=".djs-search-input input",Xe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Xe.RESULT_SELECTOR=".djs-search-result",Xe.RESULT_SELECTED_CLASS="djs-search-result-selected",Xe.RESULT_SELECTED_SELECTOR="."+Xe.RESULT_SELECTED_CLASS,Xe.RESULT_ID_ATTRIBUTE="data-result-id",Xe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Xe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},OB=900;function uc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",OB,this)}uc.$inject=["popupMenu","distributeElements","translate","rules"],uc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},uc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},uc.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,o={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:I0.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:I0.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const DB={__depends__:[Vh,kB],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Uu],distributeElementsMenuProvider:["type",uc]};var B0="is not a registered action",LB="is already registered";function Ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ti.$inject=["eventBus","injector"],Ti.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=ze(p)?p:u;return r.cut(f.slice())}}}),o&&this.register("stepZoom",function(u){o.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&(ze(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ti.prototype.trigger=function(e,t){if(!this._actions[e])throw eg(e,B0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,o){n._registerAction(o,i)})},Ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw eg(e,LB);this._actions[e]=t},Ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw eg(e,B0);this._actions[e]=void 0},Ti.prototype.getActions=function(){return Object.keys(this._actions)},Ti.prototype.isRegistered=function(e){return!!this._actions[e]};function eg(e,t){return new Error(e+" "+t)}const IB={__init__:["editorActions"],editorActions:["type",Ti]};function qu(e){e.invoke(Ti,this)}Ae(qu,Ti),qu.$inject=["injector"],qu.prototype._registerDefaultActions=function(e){Ti.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],_=g.type;h.length&&(m=rt(h,function(v){return!M(v,"bpmn:Lane")}),l.trigger(m,_))}),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,m;M(g,"bpmn:Collaboration")?m=n.filter(function(_){return M(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!M(_.parent,"bpmn:SubProcess")}),h=an(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const BB={__depends__:[IB],editorActions:["type",qu]};function N0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ot(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}N0.$inject=["eventBus"];function zr(e,t){de.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;Qn(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}zr.$inject=["eventBus","gridSnapping","modeling"],Ae(zr,de),zr.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},zr.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},zr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),U(e,r),e},zr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),U(e,r),e};var NB=2e3;function $0(e,t){e.on(["spaceTool.move","spaceTool.end"],NB,function(n){var i=n.context;if(i.initialized){var o=i.axis,r;o==="x"?(r=t.snapValue(n.dx),n.x=n.x+r-n.dx,n.dx=r):(r=t.snapValue(n.dy),n.y=n.y+r-n.dy,n.dy=r)}})}$0.$inject=["eventBus","gridSnapping"];const $B={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",zr],gridSnappingSpaceToolBehavior:["type",$0]};var Yu=10;function tg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var FB=1200,jB=800;function lr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",jB,function(){o.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],FB,function(r){var a=r.originalEvent;if(!(!o.active||a&&oi(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=zB(r,l,e);p&&(u.offset=p);var f=HB(r,l);f&&U(u,f),Ga(r,l)||o.snapEvent(r,l,u)})}})}lr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);un(e,t,i)},lr.prototype.getGridSpacing=function(){return Yu},lr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=tg(e,Yu);var i,o;return t&&t.min&&(i=t.min,Ge(i)&&(i=tg(i+n,Yu,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Ge(o)&&(o=tg(o+n,Yu,"floor"),e=Math.min(e,o))),e-=n,e},lr.prototype.isActive=function(){return this.active},lr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},lr.prototype.toggleActive=function(){this.setActive(!this.active)},lr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function HB(e,t){var n=e.context,i=n.createConstraints,o=n.resizeConstraints||{},r=n.gridSnappingContext,a=r.snapConstraints;if(a&&a[t])return a[t];a||(a=r.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Ku(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=o.min,l=o.max;return c&&(Ku(t)?j0(s)?a.x.max=c.left:a.x.min=c.right:F0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Ku(t)?j0(s)?a.x.min=l.left:a.x.max=l.right:F0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function zB(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Ge(s[t])||(s||(s=r.snapOffset={}),Ge(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Ku(t)?s[t]+=o[t]+o.width/2:s[t]+=o[t]+o.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=o.width/2:/right/.test(a)&&(s[t]+=o.width/2):/top/.test(a)?s[t]-=o.height/2:/bottom/.test(a)&&(s[t]+=o.height/2)),s[t]}function Ku(e){return e==="x"}function F0(e){return e.indexOf("n")!==-1}function j0(e){return e.indexOf("w")!==-1}const GB={__depends__:[$B],__init__:["gridSnapping"],gridSnapping:["type",lr]};var VB=2e3;function H0(e,t,n){e.on("autoPlace",VB,function(i){var o=i.source,r=We(o),a=i.shape,s=T_(o,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==r[c]&&(s[c]>r[c]?l.min=s[c]:l.max=s[c],M(a,"bpmn:TextAnnotation")&&(WB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}H0.$inject=["eventBus","gridSnapping","elementRegistry"];function WB(e){return e==="x"}var UB=1750;function z0(e,t,n){t.on(["create.start","shape.move.start"],UB,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!M(r,"bpmn:Participant")||!M(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}z0.$inject=["canvas","eventBus","gridSnapping"];var qB=3e3;function Xu(e,t,n){de.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],qB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||YB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Xu.$inject=["eventBus","gridSnapping","modeling"],Ae(Xu,de),Xu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=ZB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function YB(e){return e.length>3}function KB(e){return e==="h"}function XB(e){return e==="v"}function ZB(e,t,n){var i=mo(t,n),o={};return KB(i)&&(o.y=e.snapValue(t.y)),XB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=U({},t,o),n=U({},n,o)),[t,n]}const QB={__depends__:[GB,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",H0],gridSnappingParticipantBehavior:["type",z0],gridSnappingLayoutConnectionBehavior:["type",Xu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",N0]};var JB=30,G0=30;function pc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(M(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(M(o,"bpmn:Participant"))return ut(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(M(o,"bpmn:SubProcess"))return ut(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}pc.$inject=["eventBus","interactionEvents"],pc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},pc.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=xn(e)?{width:JB,height:e.height}:{width:e.width,height:G0};return this._interactionEvents.createBoxHit(t,"all",n),!0},pc.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:G0}),!0};const eN={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",pc]};function Zu(e){e.invoke(Ba,this)}Ae(Zu,Ba),Zu.$inject=["injector"],Zu.prototype.registerBindings=function(e,t){Ba.prototype.registerBindings.call(this,e,t);function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("selectElements",function(i){var o=i.keyEvent;if(e.isKey(["a","A"],o)&&e.isCmd(o))return t.trigger("selectElements"),!0}),n("find",function(i){var o=i.keyEvent;if(e.isKey(["f","F"],o)&&e.isCmd(o))return t.trigger("find"),!0}),n("spaceTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["s","S"],o))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["l","L"],o))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["h","H"],o))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["c","C"],o))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["e","E"],o))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["r","R"],o))return t.trigger("replaceElement",o),!0})};const tN={__depends__:[Ph],__init__:["keyboardBindings"],keyboardBindings:["type",Zu]};var nN={moveSpeed:1,moveSpeedAccelerated:10},iN=1500,V0="left",W0="up",U0="right",q0="down",oN={ArrowLeft:V0,Left:V0,ArrowUp:W0,Up:W0,ArrowRight:U0,Right:U0,ArrowDown:q0,Down:q0},rN={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 Y0(e,t,n,i,o){var r=this;this._config=U({},nN,e||{}),t.addListener(iN,function(a){var s=a.keyEvent,c=oN[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return r.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=o.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=rN[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}Y0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const aN={__depends__:[Ph,Ri],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Y0]};var K0=10;function fc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=UT(u,p,l),c.newBounds=YT(d,f),c.canExecute=o.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=o.computeMinResizeBox(c)),c.resizeConstraints={min:je(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=nv(p),!sN(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}fc.prototype.canResize=function(e){var t=this._rules,n=Ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},fc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=U({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,X0(t,r),"resize",{autoActivate:!0,cursor:cN(r),data:{shape:t,context:o}})},fc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:K0,height:K0},o=Gv(t,e.childrenBoxPadding),KT(n,t,i,o)},fc.$inject=["eventBus","rules","modeling","dragging"];function sN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function X0(e,t){var n=We(e),i=je(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function cN(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 Z0="djs-resizing",Q0="resize-not-ok",lN=500;function J0(e,t,n){function i(r){var a=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,Z0)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),r.canExecute?lt(c).remove(Q0):lt(c).add(Q0)}function o(r){var a=r.shape,s=r.frame;s&&rn(r.frame),t.removeMarker(a,Z0)}e.on("resize.move",lN,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}J0.$inject=["eventBus","canvas","previewSupport"];var Qu=-6,Ju=8,ep=20,dc="djs-resizer",uN=["n","w","s","e","nw","ne","se","sw"];function ur(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&z(a,Kn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}ur.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){Qo(r)&&i.activate(r,e,n)}$e.bind(t,"mousedown",o),$e.bind(t,"touchstart",o)},ur.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=pN(i),a=Le("g");lt(a).add(dc),lt(a).add(dc+"-"+e.id),lt(a).add(dc+"-"+i),qe(o,a);var s=Le("rect");Se(s,{x:-Ju/2+r.x,y:-Ju/2+r.y,width:Ju,height:Ju}),lt(s).add(dc+"-visual"),qe(a,s);var c=Le("rect");return Se(c,{x:-ep/2+r.x,y:-ep/2+r.y,width:ep,height:ep}),lt(c).add(dc+"-hit"),qe(a,c),fl(a,t,n),a},ur.prototype.createResizer=function(e,t){var n=X0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},ur.prototype.addResizer=function(e){var t=this;kt(e)||z(uN,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},ur.prototype.removeResizers=function(){var e=this._getResizersParent();gs(e)},ur.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},ur.$inject=["eventBus","canvas","selection","resize"];function pN(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Qu:e.indexOf("w")!==-1&&(t.x=Qu),e.indexOf("s")!==-1?t.y=-Qu:e.indexOf("n")!==-1&&(t.y=Qu),t}const eE={__depends__:[no,wo,Oa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",fc],resizePreview:["type",J0],resizeHandles:["type",ur]};var fN=2e3;function hc(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],fN,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||ot(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}hc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],hc.prototype.activate=function(e){var t=yi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);U(n,i);var o={},r=n.style||{};return U(r,{backgroundColor:null,border:null}),(ot(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||tE(e))&&U(o,{centerVertically:!0}),Yo(e)&&(U(o,{resizable:!0,autoResize:!0}),U(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(U(o,{resizable:!0,autoResize:!0}),U(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),U(n,{options:o,style:r}),n}},hc.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||gN(e)){var g=xn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};U(r,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(hN(e)){var m=xn(e),_=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};U(r,_),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ot(e,["bpmn:Task","bpmn:CallActivity"])||tE(e))&&(U(r,{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"})),dN(e)&&(U(r,{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 v=1,y=i.width+2*v;if(n.labelTarget&&(U(r,{width:y,height:i.height+2*v,x:i.x-v,y:i.y-v}),U(d,{fontSize:l+"px",lineHeight:u})),Yo(n)&&!gl(n)&&!it(n)){var b=$f(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),w=l,P=Ar.width*a+2*v;U(r,{width:P,height:w+2*v,x:E.x-P/2,y:E.y-w/2-v}),U(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(U(r,{width:i.width+2*v,height:i.height+2*v,x:i.x-v,y:i.y-v,minWidth:30*a,minHeight:10*a}),U(d,{textAlign:"left",paddingTop:xa*a+"px",paddingBottom:xa*a+"px",paddingLeft:xa*a+"px",paddingRight:xa*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},hc.prototype.update=function(e,t,n,i){var o,r;M(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),mN(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function tE(e){return M(e,"bpmn:SubProcess")&&!ut(e)}function dN(e){return M(e,"bpmn:SubProcess")&&ut(e)}function hN(e){return M(e,"bpmn:Participant")&&!ut(e)}function gN(e){return M(e,"bpmn:Participant")&&ut(e)}function mN(e){return!e||!e.trim()}var nE="djs-element-hidden",iE="djs-label-hidden";function oE(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,M(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=Le("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=i.path=Le("path");Se(p,{d:u,strokeWidth:2,stroke:yN(r)}),qe(s,p),qe(o,s),On(s,r.x,r.y)}M(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,nE):(M(r,"bpmn:Task")||M(r,"bpmn:CallActivity")||M(r,"bpmn:SubProcess")||M(r,"bpmn:Participant")||M(r,"bpmn:Lane"))&&t.addMarker(r,iE)}),e.on("directEditing.resize",function(c){if(M(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});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,nE),t.removeMarker(r,iE)),r=void 0,a=void 0,s&&(rn(s),s=void 0)})}oE.$inject=["eventBus","canvas","pathMap"];function yN(e,t){var n=dt(e);return n.get("stroke")||t||"black"}const vN={__depends__:[nh,eE,P0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",hc],labelEditingPreview:["type",oE]};var bN=500,xN=1e3;function ro(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function o(r){YA(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){z(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],bN,function(r){var a=r.element,s=r.gfx,c=Et(".djs-outline",s);c&&i.updateOutline(a,c)})}ro.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(),qe(t,n),this.updateOutline(e,n)),n},ro.prototype._createOutlineGfx=function(){var e=Le("rect");return Se(e,U({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},ro.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},ro.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(o){n=n||o.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},ro.prototype.updateConnectionOutline=function(e,t){var n=an(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})},ro.prototype.registerProvider=function(e,t){t||(t=e,e=xN),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},ro.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ro.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){bn(i.getOutline)&&(t=t||i.getOutline(e))}),t},ro.$inject=["eventBus","styles","elementRegistry"];var tp=6;function ng(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(o){n.isSelected(o.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(o){var r=o.newSelection;i._updateMultiSelectionOutline(r)})}ng.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");gs(t);var n=e.length>1,i=this._canvas.getContainer();if(lt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=_N(an(e)),r=Le("rect");Se(r,U({rx:3},o)),lt(r).add("djs-selection-outline"),qe(t,r)}},ng.$inject=["eventBus","canvas","selection"];function _N(e){return{x:e.x-tp,y:e.y-tp,width:e.width+tp*2,height:e.height+tp*2}}const ig={__depends__:[Ri],__init__:["outline","multiSelectionOutline"],outline:["type",ro],multiSelectionOutline:["type",ng]},rE=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],aE={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},wN=15,np=2;function sE(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>ot(g,rE));if(f.length===1){const g=f[0];it(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(it),h=f.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!ot(p,rE)||!u(p)||(it(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=vs([We(f),We(p)],aE),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),_=ws(m,g);if(!_)return;const y=o.isSelected(f)?c(f):l(f),b=ws(y,g)||We(f);Os(b,_)<wN||(Tf(d,[b,_]),qe(r,d))}function s(){hs(`.${aE.class}`,r).forEach(rn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+pr(f,"x")-np,y:p.y+pr(f,"y")-np,width:pr(f,"width")+np*2,height:pr(f,"height")+np*2};return jf(d,pr(f,"rx"))}if(f.cx){const d=pr(f,"r"),g={x:p.x+pr(f,"cx")-d,y:p.y+pr(f,"cy")-d,width:d*2,height:d*2};return Cv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}sE.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function pr(e,t){return parseFloat(Se(e,t)||0)}const EN={__depends__:[Ri,ig],__init__:["labelLink"],labelLink:["type",sE]};var SN=new Dr("tt");function RN(e){var t=$t('<div class="djs-tooltip-container" />');return Vn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function CN(e,t,n){Vn(e,{left:t+"px",top:n+"px"})}function og(e,t){e.style.display=t===!1?"none":""}var cE="djs-tooltip",rg="."+cE;function Zn(e,t){this._eventBus=e,this._canvas=t,this._ids=SN,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=RN(t.getContainer());var n=this;ti.bind(this._tooltipRoot,rg,"mousedown",function(i){i.stopPropagation()}),ti.bind(this._tooltipRoot,rg,"mouseover",function(i){n.trigger("mouseover",i)}),ti.bind(this._tooltipRoot,rg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Zn.$inject=["eventBus","canvas"],Zn.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},Zn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(En(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Zn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Zn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Zn.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)}},Zn.prototype.remove=function(e){var t=this.get(e);t&&(Xi(t.html),Xi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Zn.prototype.show=function(){og(this._tooltipRoot)},Zn.prototype.hide=function(){og(this._tooltipRoot,!1)},Zn.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},Zn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Qn(n)&&(n=$t(n)),i=$t('<div data-tooltip-id="'+t+'" class="'+cE+'">'),Vn(i,{position:"absolute"}),i.appendChild(n),e.type&&Rt(i).add("djs-tooltip-"+e.type),e.className&&Rt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Zn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;CN(n,t.x,t.y)},Zn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),og(i,o))})},Zn.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 MN={__init__:["tooltips"],tooltips:["type",Zn]};var AN="flow elements must be children of pools/participants",PN="Data object must be placed within a pool/participant.";function lE(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(o,n(AN)):M(a,"bpmn:DataObjectReference")&&i(o,n(PN)))})}lE.$inject=["eventBus","tooltips","translate"];const TN={__depends__:[MN],__init__:["modelingFeedback"],modelingFeedback:["type",lE]};var kN=500,ON=1250,DN=1500,ip=Math.round;function LN(e){return{x:e.x+ip(e.width/2),y:e.y+ip(e.height/2)}}function uE(e,t,n,i,o){function r(s,c,l,u){return o.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",DN,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=IN(u),U(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",ON,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",kN,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=r(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=ip(l.x),l.y=ip(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Qo(s)){var c=Aa(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)&&!lt(s.target).has("djs-hit-no-move")){var p=LN(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}uE.$inject=["eventBus","dragging","modeling","selection","rules"];function IN(e){var t=ea(e,"id");return rt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var pE=499,ag="djs-dragging",fE="drop-ok",dE="drop-not-ok",hE="new-parent",gE="attach-ok";function mE(e,t,n,i){function o(c){var l=r(c),u=BN(l);return u}function r(c){var l=bs(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[gE,fE,dE,hE].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,ag),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",pE,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Le("g");Se(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();qe(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=xp([p,r(u)]):p=r(u),z(p,function(h){t.addMarker(h,ag)}),l.allDraggedElements=p,l.differentParents=NN(u)}),e.on("shape.move.move",pE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,gE):l.canExecute&&f&&p.id!==f.id?a(p,hE):a(p,l.canExecute?fE:dE)),On(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;z(u,function(f){t.removeMarker(f,ag)}),p&&rn(p)}),this.makeDraggable=s}mE.$inject=["eventBus","canvas","styles","previewSupport"];function BN(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=rt(e,function(i){return kt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function NN(e){return Y1(ea(e,function(t){return t.parent&&t.parent.id}))!==1}const $N={__depends__:[Ul,Ri,ig,no,wo,Oa],__init__:["move","movePreview"],move:["type",uE],movePreview:["type",mE]};var yE=".djs-palette-toggle",vE=".entry",FN=yE+", "+vE,sg="djs-palette-",jN="shown",cg="open",bE="two-column",HN=1e3;function pn(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}pn.$inject=["eventBus","canvas"],pn.prototype.registerProvider=function(e,t){t||(t=e,e=HN),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},pn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(GN,{})},pn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},pn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=$t(pn.HTML_MARKUP);n.appendChild(i),Rt(n).add(sg+jN),ti.bind(i,FN,"click",function(o){var r=o.delegateTarget;if(xf(r,yE))return e.toggle();e.trigger("click",o)}),$e.bind(i,"mousedown",function(o){o.stopPropagation()}),ti.bind(i,vE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},pn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},pn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Rt(n),a=Rt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(bE,o),a.toggle(sg+bE,o),"open"in e&&(r.toggle(cg,e.open),a.toggle(sg+cg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},pn.prototype._update=function(){var e=Et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();nl(e),z(t,function(n,i){var o=n.group||"default",r=Et("[data-group="+Nr(o)+"]",e);r||(r=$t('<div class="group"></div>'),En(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=$t(a);if(r.appendChild(s),!n.separator&&(En(s,"data-action",i),n.title&&En(s,"title",n.title),n.className&&zN(s,n.className),n.imageUrl)){var c=$t("<img>");En(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},pn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=En(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},pn.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(bn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},pn.prototype._layoutChanged=function(){this._toggleState({})},pn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},pn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},pn.prototype.open=function(){this._toggleState({open:!0})},pn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},pn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},pn.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 o=i.getAttribute("data-action");if(o){var r=Rt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},pn.prototype.isOpen=function(){return Rt(this._container).has(cg)},pn.prototype._getParentContainer=function(){return this._canvas.getContainer()},pn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function zN(e,t){var n=Rt(e),i=ze(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function GN(e,t){var n=t.getPaletteEntries();return bn(n)?n(e):(z(n,function(i,o){e[o]=i}),e)}const VN={__init__:["palette"],palette:["type",pn]};var xE="crosshair",_E="selected",WN="djs-dragging-active-lasso";function fr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Le("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),qe(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 m of h)g.has(m)||t.removeMarker(m,_E);for(const m of g)h.has(m)||t.addMarker(m,_E)}},remove:function(p){this.update(p),p.frame&&rn(p.frame),l(!1)}};function l(p){lt(t.getContainer()).toggle(WN,p)}function u(p){var f=i.getAll();return new Set(Jr(ga(f,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=wE(p),f.add=Fl(p),f.lastMarked=new Set(o.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=wE(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Fl(p))return s.activateLasso(p.originalEvent),!0})}fr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],fr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:xE,data:{context:{}},keepSelection:!0})},fr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:xE,data:{context:{}},keepSelection:!0})},fr.prototype._select=function(e){this._selection.select(e)},fr.prototype.select=function(e,t,n=[]){var i=Jr(ga(e,t));this._select([...n,...i])},fr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},fr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function wE(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 UN={__depends__:[Xl,$s],__init__:["lassoTool"],lassoTool:["type",fr]};var lg=1500,EE="grab";function Va(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var a=this,s=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",lg,function(c){if(Is(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(lg,function(c){if(!(!SE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(lg,function(c){!SE(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!Is(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Va.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Va.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:EE,data:{context:n||{}}})},Va.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:EE,data:{context:{reactivate:n}}})},Va.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Va.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function SE(e){return mn("Space",e)}const qN={__depends__:[Xl,$s],__init__:["handTool"],handTool:["type",Va]};var RE="connect-ok",CE="connect-not-ok";function Wa(e,t,n,i,o,r,a){var s=this;this._dragging=t,this._rules=r,this._mouse=a,o.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?RE:CE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?RE:CE)}),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})}Wa.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Wa.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Wa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Wa.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Wa.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const YN={__depends__:[Qh,no,wo,Xl,$s],globalConnect:["type",Wa]};function ug(e,t,n,i,o,r,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=o,this._handTool=r,this._globalConnect=a,this._translate=s,e.registerProvider(this)}ug.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],ug.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function m(_){var v=n.createShape(U({type:p},h));t.start(_,v)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}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){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const KN={__depends__:[VN,Yl,Vx,UN,qN,YN,As],__init__:["paletteProvider"],paletteProvider:["type",ug]};var XN=250;function pg(e,t,n,i,o){de.call(this,e);function r(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);U(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Et('[data-element-id="'+Nr(f.id)+'"]',s.dragGroup);g&&Se(g,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=Et('[data-element-id="'+Nr(u)+'"]',s.dragGroup);p&&Se(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",XN,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}pg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ae(pg,de);const ZN={__depends__:[Oa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",pg]};var QN=1250,fg=40,JN=20,e$=10,ME=20,AE=["x","y"],t$=Math.abs;function PE(e){e.on(["connect.hover","connect.move","connect.end"],QN,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&oi(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&n$(t,r,a$(r)),r&&r$(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ai(o),ot(r,["bpmn:Event","bpmn:Gateway"])&&TE(t,Ai(r)),ot(r,["bpmn:Task","bpmn:SubProcess"])&&i$(t,r),M(a,"bpmn:BoundaryEvent")&&s===a.host&&o$(t)):kE(i,"bpmn:MessageFlow")?(M(o,"bpmn:Event")&&(n.connectionStart=Ai(o)),M(r,"bpmn:Event")&&TE(t,Ai(r))):n.connectionStart=n.initialConnectionStart)})}PE.$inject=["eventBus"];function n$(e,t,n){AE.forEach(function(i){var o=OE(i,t);e[i]<t[i]+n?un(e,i,t[i]+n):e[i]>t[i]+o-n&&un(e,i,t[i]+o-n)})}function i$(e,t){var n=Ai(t);AE.forEach(function(i){s$(e,t,i)&&un(e,i,n[i])})}function o$(e){var t=e.context,n=t.source,i=t.target;if(!c$(t)){var o=Ai(n),r=kn(o,i,-10),a=[];/top|bottom/.test(r)&&a.push("x"),/left|right/.test(r)&&a.push("y"),a.forEach(function(s){var c=e[s],l;t$(c-o[s])<fg&&(c>o[s]?l=o[s]+fg:l=o[s]-fg,un(e,s,l))})}}function TE(e,t){un(e,"x",t.x),un(e,"y",t.y)}function kE(e,t){return e&&e.type===t}function r$(e,t){return Do(t,function(n){return kE(e,n)})}function OE(e,t){return e==="x"?t.width:t.height}function a$(e){return M(e,"bpmn:Task")?e$:JN}function s$(e,t,n){return e[n]>t[n]+ME&&e[n]<t[n]+OE(n,t)-ME}function c$(e){var t=e.hover,n=e.source;return t&&n&&t===n}function dr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}dr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},dr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},dr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},dr.prototype.getSnapLocations=function(){return this._snapLocations},dr.prototype.setSnapLocations=function(e){this._snapLocations=e},dr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new op,n.initDefaults(this._defaultSnaps)),n};function op(){this._snapValues={}}op.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},op.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&XI(e[n],o[n],i)},op.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(o){t.add(i,o)})})};var l$=1250;function ao(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(o){i.initSnap(o)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],l$,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&oi(o.originalEvent))&&!(Ga(o)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(o,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}ao.$inject=["elementRegistry","eventBus","snapping"],ao.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new dr);var r;t.get(i.id)?r=Ai(i,e):r={x:e.x+Ai(i).x,y:e.y+Ai(i).y};var a={x:r.x-i.width/2,y:r.y-i.height/2},s={x:r.x+i.width/2,y:r.y+i.height/2};return o.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),it(i)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},ao.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(o){if(it(o)){it(t)&&e.add("mid",Ai(o));return}if(kt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);z(r,function(a){e.add("mid",a)});return}e.add("mid",Ai(o))}),!Ge(t.x)||!Ge(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ai(t)),e},ao.prototype.getSnapTargets=function(e,t){return v0(t).filter(function(n){return!u$(n)})};function u$(e){return!!e.hidden}var DE=1500;function Ua(e,t){t.invoke(ao,this),e.on(["create.move","create.end"],DE,h$),e.on(["create.move","create.end","shape.move.move","shape.move.end"],DE,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Ga(n)&&p$(n,r)})}Ae(Ua,ao),Ua.$inject=["eventBus","injector"],Ua.prototype.initSnap=function(e){var t=ao.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",IE(r,i,e))}),z(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",IE(r,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ua.prototype.addSnapTargetPoints=function(e,t,n){ao.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(r){(d$(r)||f$([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",m0(r)),e.add("bottom-right",y0(r)))});var o=this._elementRegistry;return z(t.incoming,function(r){if(o.get(t.id)){LE(i,r.source)||e.add("mid",We(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),z(t.outgoing,function(r){if(o.get(t.id)){LE(i,r.target)||e.add("mid",We(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ua.prototype.getSnapTargets=function(e,t){return ao.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function p$(e,t){var n=je(t),i=jb(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=We(r),/top/.test(i)?un(e,"y",n.top-a.y):/bottom/.test(i)&&un(e,"y",n.bottom-a.y),/left/.test(i)?un(e,"x",n.left-a.x):/right/.test(i)&&un(e,"x",n.right-a.x)}function f$(e,t){return e.every(function(n){return M(n,t)})}function d$(e){return M(e,"bpmn:SubProcess")&&ut(e)?!0:M(e,"bpmn:Participant")}function h$(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,o=n.right,r=n.bottom,a=n.left;(a&&a>=e.x||o&&o<=e.x)&&un(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&un(e,"y",e.y)}}function LE(e,t){return e.indexOf(t)!==-1}function IE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var g$=1250;function gc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],g$,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&oi(i.originalEvent))&&!Ga(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),v$(s)&&un(i,"x",i.x),b$(s)&&un(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}gc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new dr);var r=BE(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},gc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return z(o,function(r){e.add("corner",y0(r)),e.add("corner",m0(r))}),e.add("corner",BE(t,i)),e},gc.$inject=["eventBus","snapping"],gc.prototype.getSnapTargets=function(e,t){return v0(t).filter(function(n){return!m$(n,e)&&!kt(n)&&!y$(n)&&!it(n)})};function BE(e,t){var n=We(e),i=je(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function m$(e,t){return e.host===t}function y$(e){return!!e.hidden}function v$(e){return e==="n"||e==="s"}function b$(e){return e==="e"||e==="w"}var x$=7,_$=1e3;function hr(e){this._canvas=e,this._asyncHide=wp(Kn(this.hide,this),_$)}hr.$inject=["canvas"],hr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Ga(e,"x"),y:Ga(e,"y")};z(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,x$),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),z(["x","y"],function(a){var s=r[a];hn(s)&&un(e,a,s.originValue)})},hr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Le("path");return Se(n,{d:"M0,0 L0,0"}),lt(n).add("djs-snap-line"),qe(t,n),{update:function(i){Ge(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"})}}},hr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},hr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},hr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},hr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const w$={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ao],resizeSnapping:["type",gc],snapping:["type",hr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",PE],createMoveSnapping:["type",Ua]};var NE=300;function Xe(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(Xe.INPUT_SELECTOR,this._container),this._resultsContainer=Et(Xe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Xe.$inject=["canvas","eventBus","selection","translate"],Xe.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ti.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Xe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Xe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Xe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Xe.INPUT_SELECTOR,"keydown",function(n){mn("ArrowUp",n)&&n.preventDefault(),mn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Xe.INPUT_SELECTOR,"keyup",function(n){if(mn("Escape",n))return e.close();if(mn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(mn("ArrowUp",n))return e._scrollToDirection(!0);if(mn("ArrowDown",n))return e._scrollToDirection();mn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Xe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ti.unbind(e.el,e.type,e.listener)})},Xe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(o){return!t._canvas.getRootElements().includes(o.element)}),!n.length){this._selection.select(null);return}n.forEach(function(o){var r=o.element.id,a=t._createResultNode(o,r);t._results[r]={element:o.element,node:a}});var i=Et(Xe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Xe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Xe.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)}},Xe.prototype._clearResults=function(){nl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Xe.prototype._getCurrentResult=function(){return Et(Xe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Xe.prototype._createResultNode=function(e,t){var n=$t(Xe.RESULT_HTML);return e.primaryTokens.length>0&&$E(n,e.primaryTokens,Xe.RESULT_PRIMARY_HTML),$E(n,e.secondaryTokens,Xe.RESULT_SECONDARY_HTML),En(n,Xe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Xe.prototype.registerProvider=function(e){this._searchProvider=e},Xe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Rt(this._canvas.getContainer()).add("djs-search-open"),Rt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Xe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Rt(this._canvas.getContainer()).remove("djs-search-open"),Rt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Xe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Xe.prototype.isOpen=function(){return this._open},Xe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Rt(t).remove(Xe.RESULT_SELECTED_CLASS);var n=En(e,Xe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Rt(e).add(Xe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:NE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Xe.prototype._select=function(e){var t=En(e,Xe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:NE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Xe.prototype._getBoxHtml=function(){const e=$t(Xe.BOX_HTML),t=Et(Xe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function $E(e,t,n){var i=E$(t),o=$t(n);o.innerHTML=i,e.appendChild(o)}function E$(e){var t="";return e.forEach(function(n){var i=U_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+Xe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Xe.CONTAINER_SELECTOR=".djs-search-container",Xe.INPUT_SELECTOR=".djs-search-input input",Xe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Xe.RESULT_SELECTOR=".djs-search-result",Xe.RESULT_SELECTED_CLASS="djs-search-result-selected",Xe.RESULT_SELECTED_SELECTOR="."+Xe.RESULT_SELECTED_CLASS,Xe.RESULT_ID_ATTRIBUTE="data-result-id",Xe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Xe.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>`,Xe.RESULT_HTML='<div class="djs-search-result"></div>',Xe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Xe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const S$={__depends__:[Ms,bu,Ri],searchPad:["type",Xe]};function dg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}dg.$inject=["elementRegistry","searchPad","canvas","search"],dg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!it(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:yi(i),id:i.id})),e,{keys:["label","id"]}).map(R$)};function R$(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const C$={__depends__:[S$,Xw],__init__:["bpmnSearch"],bpmnSearch:["type",dg]},M$="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",A$="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",P$={width:36,height:50},T$={width:50,height:50};function FE(e,t,n){return Le("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ki=5;function op(e,t){this._styles=t,e.registerProvider(this)}op.$inject=["outline","styles"],op.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(VP(e))return n=Le("rect"),Se(n,U({x:-ki,y:-ki,rx:4,width:e.width+ki*2,height:e.height+ki*2},t)),n;if(!it(e))return M(e,"bpmn:Gateway")?(n=Le("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))):ot(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Le("rect"),Se(n,U({x:-ki,y:-ki,rx:14,width:e.width+ki*2,height:e.height+ki*2},t))):M(e,"bpmn:EndEvent")?(n=Le("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+ki+1},t))):M(e,"bpmn:Event")?(n=Le("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+ki},t))):M(e,"bpmn:DataObjectReference")&&jE(e,"bpmn:DataObjectReference")?n=FE(M$,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&jE(e,"bpmn:DataStoreReference")&&(n=FE(A$,{x:-6,y:-6},t)),n},op.prototype.updateOutline=function(e,t){if(!it(e))return ot(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+ki*2,height:e.height+ki*2}),!0):!!ot(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function jE(e,t){var n;return t==="bpmn:DataObjectReference"?n=P$:t==="bpmn:DataStoreReference"&&(n=T$),e.width===n.width&&e.height===n.height}const k$={__depends__:[ig],__init__:["outlineProvider"],outlineProvider:["type",op]};var O$='<?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 so(e){va.call(this,e)}Ae(so,va),so.Viewer=sr,so.NavigatedViewer=Js,so.prototype.createDiagram=function(){return this.importXML(O$)},so.prototype._interactionModules=[J_,tw,ow],so.prototype._modelingModules=[LI,gu,FI,NI,QI,Qh,oB,PB,Dx,ql,DB,BB,QB,eN,tN,aN,vN,EN,bh,TN,$N,KN,ZN,eE,w$,C$,k$],so.prototype._modules=[].concat(sr.prototype._modules,so.prototype._interactionModules,so.prototype._modelingModules);var rp=50,D$=new Dr,HE={min:.2,max:4},L$=10,I$=.1,B$=250,N$=100,$$=2e3;function In(e,t,n,i,o){var r=this;this._canvas=i,this._elementRegistry=o,this._eventBus=n,this._injector=t,this._config=e||{},this._updateTimeout=null,this._firstDebounceTime=null,this._dirty=!1,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=D$.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||sp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=ap({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);hg(p,r._canvas),r._update()}function s(u){return function(f){var d=gg(f);(!r._state._svgClientRect||sp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=ap({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=j$(g,h),_=r._viewportDom.getBoundingClientRect(),v={x:d.x-_.left+1,y:d.y-_.top+1};U(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:v,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),$e.bind(document,"mousemove",c),$e.bind(document,"mouseup",l)}}function c(u){var p=gg(u);if(r._state.isDragging){(!r._state._svgClientRect||sp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;U(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=GE(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});U(r._overlay.style,{clipPath:h});var m=ap({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);hg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=gg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),U(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),$e.unbind(document,"mousemove",c),$e.unbind(document,"mouseup",l))}$e.bind(this._viewportDom,"mousedown",s(!1)),$e.bind(this._svg,"mousedown",s(!0)),$e.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||sp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!W$(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*U$(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>I$){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=q$(HE,L$*2),m=Math.round(g/h)*h;m+=h*d;var _=Math.pow(10,m);i.zoom(Y$(HE,_),v),r._state.zoomDelta=0;var v=ap({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);hg(v,r._canvas),r._update()}}}),$e.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",B$,function(u){if(!r.isOpen()){r._dirty=!0;return}u.elements.forEach(function(p){r._updateElement(p)}),r._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,f=u.newId;r._updateElementId(p,f)}),n.on("canvas.viewbox.changed",function(){r._state.isDragging||r._update()}),n.on("canvas.resized",function(){document.body.contains(r._parent)&&(r._state.isDragging||r._update(),r._state._svgClientRect=r._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(f){r._addElement(f)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}In.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],In.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Rt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Rt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Rt(o).add("map"),n.appendChild(o);var r=this._svg=Le("svg");Se(r,{width:"100%",height:"100%"}),qe(o,r);var a=this._elementsGroup=Le("g");qe(r,a);var s=this._viewportGroup=Le("g");qe(r,s);var c=this._viewport=Le("rect");lt(c).add("viewport"),qe(s,c),$e.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Rt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Rt(u).add("overlay"),this._parent.appendChild(u)},In.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Ge(this._config.debounceDelay)?this._config.debounceDelay:N$,n=Ge(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:$$,i=Date.now();if(this._firstDebounceTime&&i-this._firstDebounceTime>=n){this._update();return}this._updateTimeout&&clearTimeout(this._updateTimeout),this._firstDebounceTime=this._firstDebounceTime||i,this._updateTimeout=setTimeout(function(){e._update()},t)}},In.prototype._rebuild=function(){this._clear();var e=this._canvas,t=e.getRootElement&&e.getRootElement();if(t&&t.children){var n=this;t.children.forEach(function(i){n._addElement(i)})}},In.prototype._update=function(){if(this.isOpen()){this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=null),this._firstDebounceTime=null;var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(VE(e)){var i,o,r,a,s=n.width-t.width,c=n.height-t.height;t.width<n.width?(i=t.x-s/2,r=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,r=t.width),t.height<n.height?(o=t.y-c/2,a=n.height,t.y+t.height<n.height&&(o=Math.min(0,t.y))):(o=t.y,a=t.height),i=i-rp,o=o-rp,r=r+rp*2,a=a+rp*2,this._lastViewbox={x:i,y:o,width:r,height:a},Se(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Se(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};U(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=GE(l,p);U(this._overlay.style,{clipPath:f})}}},In.prototype.open=function(){U(this._state,{isOpen:!0}),Rt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},In.prototype.close=function(){U(this._state,{isOpen:!1}),Rt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},In.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},In.prototype.isOpen=function(){return this._state.isOpen},In.prototype._updateElement=function(e){try{e.parent!==void 0&&e.parent!==null&&(this._removeElement(e),this._addElement(e))}catch(t){console.warn("Minimap#_updateElement errored",t)}},In.prototype._updateElementId=function(e,t){try{var n=Et("#"+Nr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},In.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},In.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)&&!e.hidden){var n,i,o,r=this._createElement(e),a=Et("#"+Nr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=z$(e);return s!==-1?a?G$(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),F$(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Se(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Se(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},In.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&rn(t)},In.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Uo(t),n)){var i=K$(wf(n));return Se(i,{id:this._prefixId(e.id)}),i}},In.prototype._clear=function(){hs(this._elementsGroup)},In.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function F$(e){return e.waypoints}function j$(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}function ap(e,t,n){var i=t.getBoundingClientRect(),o=H$(n,i.width/i.height),r=zE(e.x,0,i.width,o.x,o.x+o.width),a=zE(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function hg(e,t){var n=t.viewbox(),i=n.width,o=n.height;t.viewbox({x:e.x-i/2,y:e.y-o/2,width:i,height:o})}function H$(e,t){var n=e.width/e.height,i=U({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;U(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;U(i,{x:s,width:a})}return i}function zE(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function z$(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function G$(e,t,n){var i=V$(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function V$(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function sp(e){return e.width===0&&e.height===0}function W$(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var U$=Math.sign||function(e){return e>=0?1:-1};function q$(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10),o=Math.abs(n)+Math.abs(i);return o/t}function Y$(e,t){return Math.max(e.min,Math.min(e.max,t))}function GE(e,t){var n=[co(t.left,t.top),co(t.left+t.width,t.top),co(t.left+t.width,t.top+t.height),co(t.left,t.top+t.height),co(t.left,e.height),co(e.width,e.height),co(e.width,0),co(0,0),co(0,e.height),co(t.left,e.height)].join(", ");return"polygon("+n+")"}function co(e,t){return e+"px "+t+"px"}function VE(e){return Oo(e,function(t){return hn(t)?VE(t):Ge(t)&&isFinite(t)})}function gg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function K$(e){return ds("[id]",e).forEach(function(t){t.remove()}),e}var X$={__init__:["minimap"],minimap:["type",In]};const WE={closed:"미니맵",open:"접기"};class UE{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(Ch,()=>this.rebuild()),t.on("minimap.toggle",o=>this.retitle(o.open)),this.retitle(n.isOpen())}rebuild(){const t=this.minimap;if(!t.isOpen()){t._dirty=!0;return}t._rebuild(),t._update()}retitle(t){const n=this.canvas.getContainer().querySelector(".djs-minimap .toggle");n==null||n.setAttribute("title",t?WE.open:WE.closed)}}pi(UE,"$inject",["eventBus","minimap","canvas"]);const Z$={__depends__:[X$],__init__:["minimapI18n"],minimapI18n:["type",UE]},Q$=me.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=me.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Gp(u);return o("imported",p),{warnings:p}}catch(u){throw o("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return me.onMounted(async()=>{a=new so({container:r.value,moddleExtensions:Lc,additionalModules:[G_,Z$]}),i.xml&&await s(i.xml),o("ready")}),me.watch(()=>i.xml,l=>{l&&a&&s(l)}),me.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(me.openBlock(),me.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),mg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},J$=mg(Q$,[["__scopeId","data-v-7847e007"]]),e5=["title","aria-expanded"],t5=["title","onClick"],n5={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},i5={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},o5={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},r5={key:0,class:"bwl-validation__body"},a5={key:0,class:"bwl-validation__empty"},s5={key:1,class:"bwl-validation__empty"},c5={key:2,class:"bwl-validation__list"},l5=["onClick"],u5={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},p5={class:"bwl-validation__msg"},f5=["title"],d5=mg(me.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=me.computed(()=>N_(n.issues.value,n.describeElement)),o=me.computed(()=>$_(i.value)),r=g=>Ia(g,n.changeScope.value),a=me.computed(()=>Rh(i.value,n.changeScope.value)),s=me.ref({error:!0,warning:!0,info:!0}),c=me.computed(()=>F_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=me.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(me.openBlock(),me.createElementBlock("section",{class:me.normalizeClass(["bwl-validation",{"is-open":l.value}])},[me.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[me.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(me.openBlock(),me.createElementBlock("svg",{class:me.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[me.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=me.createElementVNode("span",null,"검증",-1))],8,e5),me.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=me.withModifiers(()=>{},["stop"]))},[(me.openBlock(),me.createElementBlock(me.Fragment,null,me.renderList(u,m=>me.createElementVNode("button",{key:m,type:"button",class:me.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>f(m)},[(me.openBlock(),me.createElementBlock("svg",n5,[h[4]||(h[4]=me.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(me.openBlock(),me.createElementBlock("path",i5)):(me.openBlock(),me.createElementBlock("path",o5))])),me.createElementVNode("span",null,me.toDisplayString(o.value[m]),1)],10,t5)),64))])]),l.value?(me.openBlock(),me.createElementBlock("div",r5,[i.value.length===0?(me.openBlock(),me.createElementBlock("p",a5,"발견된 문제가 없습니다.")):c.value.length===0?(me.openBlock(),me.createElementBlock("p",s5," 선택한 심각도에 해당하는 항목이 없습니다. ")):(me.openBlock(),me.createElementBlock("ul",c5,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(c.value,m=>(me.openBlock(),me.createElementBlock("li",{key:m.key,class:me.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:_=>d(m)},[h[5]||(h[5]=me.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(me.openBlock(),me.createElementBlock("span",u5,"이번 변경")):me.createCommentVNode("",!0),me.createElementVNode("span",p5,me.toDisplayString(m.message),1),me.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},me.toDisplayString(m.category),9,f5)],10,l5))),128))]))])):me.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),h5={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},g5=["aria-checked","title","data-locale","onClick"],m5={class:"bwl-locale__label"},y5={key:0,class:"bwl-locale__badge"},v5=mg(me.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(r){try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??r}catch{return r}}const o=me.computed(()=>{const r=n.i18n.value;return r?r.locales.map(a=>{const s=r.counts[a]??{untranslated:0,reviewRequested:0},c=a===r.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===r.displayLocale,design:a===r.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(r,a)=>o.value.length?(me.openBlock(),me.createElementBlock("div",h5,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(o.value,s=>(me.openBlock(),me.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:me.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>me.unref(n).setDisplayLocale(s.locale)},[me.createElementVNode("span",m5,me.toDisplayString(s.label),1),s.pending>0?(me.openBlock(),me.createElementBlock("span",y5,me.toDisplayString(s.pending),1)):me.createCommentVNode("",!0)],10,g5))),128))])):me.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ee.ADDABLE_FLOW_NODE_TYPES=_c,ee.APPLY_BPMN_OPS_SCHEMA=yS,ee.BPMN_EVENT_DEFINITION_TYPES=Ec,ee.BPMN_MODDLE_EXTENSIONS=Lc,ee.BWL_MODDLE_SCHEMA=Tg,ee.BWL_NS=Pg,ee.BWL_PREFIX=yp,ee.BWL_REVIEW_REQUEST_TYPE=Rc,ee.BWL_SIDES=vp,ee.BpmnDisplayLocaleSwitcher=v5,ee.BpmnModelerView=J$,ee.BpmnValidationPanel=d5,ee.EDITOR=$M,ee.FLOW_LABEL_INDENT=um,ee.GROUP_BORDER_MIN_RUN=Vp,ee.GROUP_BORDER_NEAR=la,ee.HEADLESS_BPMN_MODULES=D_,ee.HEADLESS_TEXT_METRICS=sa,ee.I18N_DISPLAY_REDRAWN_EVENT=Ch,ee.I18N_NS=J1,ee.I18N_PREFIX=Ig,ee.I18N_REVIEW_REQUESTED_CLASS=H_,ee.I18N_TRANSLATION_TYPE=na,ee.I18N_UNTRANSLATED_CLASS=j_,ee.I18nDisplay=Mh,ee.I18nDisplayModule=G_,ee.IR_EVENT_DEFINITIONS=wc,ee.IR_FLOW_NODE_TYPES=vr,ee.IR_TEXT_LOCALES=Sc,ee.LABEL_FORK_MARGIN=qp,ee.LABEL_SHAPE_MIN_DEPTH=wm,ee.SET_TRANSLATIONS_COMMAND=Cp,ee.SEVERITY_ORDER=Sh,ee.SYMBOLIC_OP_KINDS=Bg,ee.SYMBOLIC_OP_SCHEMA=Ng,ee.SetTranslationsHandler=Mp,ee.TranslationCommands=Pp,ee.TranslationCommandsModule=Tp,ee.UNDO_EPISODE_COMMAND=bp,ee.UPDATE_TRANSLATION_COMMAND=Ac,ee.UpdateTranslationHandler=Rp,ee.applyBpmnOpBatch=Ey,ee.applyBpmnOps=gy,ee.applyLocaleBackfill=VM,ee.approximateTextWidth=ca,ee.auditBpmnGeometry=Rm,ee.auditBpmnGeometryXml=dC,ee.auditBpmnSemantics=mf,ee.auditBpmnSemanticsXml=CM,ee.auditGeometry=pt,ee.auditTargetsOf=Gn,ee.axisSegmentsOf=on,ee.blackBoxNameRect=Wp,ee.buildBpmnOpBatch=LM,ee.buildRegistryIndex=Mm,ee.containerBoundarySegments=pa,ee.countBySeverity=$_,ee.createBpmnEditorController=FM,ee.createBpmnModdle=nm,ee.createHeadlessBpmnModeler=uL,ee.crossedShapesOf=zt,ee.crossingCost=hi,ee.describeProcess=by,ee.describeProcessXml=xM,ee.diffBpmnElements=wy,ee.diffBpmnElementsXml=OM,ee.documentLocalesOf=ts,ee.edgeCrossCount=ss,ee.edgeCrossingPairsOf=$o,ee.edgeCrossingStatsOf=ym,ee.executeAsUndoEpisode=Og,ee.followMovedEdgeLabels=Qm,ee.forwardThreePointCandidates=Hc,ee.geometryFindingKey=ct,ee.inferScriptLocale=vf,ee.installHeadlessBpmnDom=om,ee.irEventDefinitionOf=mp,ee.isAddableFlowNodeType=Mg,ee.isChangeScopeMixed=Rh,ee.isEdgeOverlapFinding=Up,ee.isInChangeScope=Ia,ee.isIrEventDefinition=Ag,ee.isIrFlowNodeType=Cg,ee.isIrTextLocale=G1,ee.labelRectsOf=Fo,ee.labelShapeDepth=Em,ee.labelSlot=xr,ee.lineCrossesLabel=Bi,ee.lineThroughLabel=fm,ee.lineThroughShapeLabel=_m,ee.loadBpmnXml=aa,ee.localeTextsOf=Sp,ee.lowerOps=dy,ee.oppositeOverlapCount=JR,ee.oppositeOverlapOf=lm,ee.planBackEdgeBoundaryClearance=jm,ee.planCrossPoolRoute=Im,ee.planEdgeRepair=Qp,ee.planLabelLineClearance=uf,ee.planLabelPlacement=Km,ee.planLocaleBackfill=GM,ee.planMiddleSegmentShifts=Pm,ee.planOppositeOverlapRepair=zm,ee.planSegmentDetours=jc,ee.planShapeLabelClearance=ty,ee.redockIntroducedDetachedEndpoints=iy,ee.repairIntroducedBoundaryHugging=Hm,ee.repairIntroducedCrossings=Jp,ee.repairIntroducedEdgeCrossings=Tm,ee.repairIntroducedFakeMerges=Vm,ee.repairIntroducedLabelLines=Jm,ee.repairIntroducedOppositeOverlaps=Ym,ee.repairIntroducedShapeLabelLines=ny,ee.repairIntroducedSharedSegmentLabels=ey,ee.rerouteIntroducedCrossPoolEdges=Bm,ee.resolverServicesOf=cy,ee.reviewRequestValuesOf=Ap,ee.reviewRequestsOf=Lo,ee.rootLangOf=Ep,ee.saveBpmnXml=HR,ee.sceneCrossingCost=mm,ee.sceneFromDefinitions=Sm,ee.sceneFromRegistry=Ve,ee.segmentShapeClearance=as,ee.shapesUnderLabel=cs,ee.sharedEndpointCrossingPairsOf=qi,ee.sharedSegmentUnderLabel=Fc,ee.sharedSpansOf=$c,ee.sortPanelIssues=F_,ee.toPanelIssues=N_,ee.touchedElements=DM,ee.translationLocale=Nn,ee.translationsOf=ia,ee.unreadableOverlapCount=di,ee.unreadableOverlapOf=Sr,ee.validateOps=sy,ee.warningMessages=Gp,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
|
|
343
|
+
</div>`,Xe.RESULT_HTML='<div class="djs-search-result"></div>',Xe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Xe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const S$={__depends__:[As,xu,Ri],searchPad:["type",Xe]};function dg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}dg.$inject=["elementRegistry","searchPad","canvas","search"],dg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!it(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:yi(i),id:i.id})),e,{keys:["label","id"]}).map(R$)};function R$(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const C$={__depends__:[S$,Xw],__init__:["bpmnSearch"],bpmnSearch:["type",dg]},M$="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",A$="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",P$={width:36,height:50},T$={width:50,height:50};function FE(e,t,n){return Le("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ki=5;function rp(e,t){this._styles=t,e.registerProvider(this)}rp.$inject=["outline","styles"],rp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(VP(e))return n=Le("rect"),Se(n,U({x:-ki,y:-ki,rx:4,width:e.width+ki*2,height:e.height+ki*2},t)),n;if(!it(e))return M(e,"bpmn:Gateway")?(n=Le("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))):ot(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Le("rect"),Se(n,U({x:-ki,y:-ki,rx:14,width:e.width+ki*2,height:e.height+ki*2},t))):M(e,"bpmn:EndEvent")?(n=Le("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+ki+1},t))):M(e,"bpmn:Event")?(n=Le("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+ki},t))):M(e,"bpmn:DataObjectReference")&&jE(e,"bpmn:DataObjectReference")?n=FE(M$,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&jE(e,"bpmn:DataStoreReference")&&(n=FE(A$,{x:-6,y:-6},t)),n},rp.prototype.updateOutline=function(e,t){if(!it(e))return ot(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+ki*2,height:e.height+ki*2}),!0):!!ot(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function jE(e,t){var n;return t==="bpmn:DataObjectReference"?n=P$:t==="bpmn:DataStoreReference"&&(n=T$),e.width===n.width&&e.height===n.height}const k$={__depends__:[ig],__init__:["outlineProvider"],outlineProvider:["type",rp]};var O$='<?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 so(e){va.call(this,e)}Ae(so,va),so.Viewer=sr,so.NavigatedViewer=ec,so.prototype.createDiagram=function(){return this.importXML(O$)},so.prototype._interactionModules=[J_,tw,ow],so.prototype._modelingModules=[LI,mu,FI,NI,QI,Qh,oB,PB,Dx,Yl,DB,BB,QB,eN,tN,aN,vN,EN,bh,TN,$N,KN,ZN,eE,w$,C$,k$],so.prototype._modules=[].concat(sr.prototype._modules,so.prototype._interactionModules,so.prototype._modelingModules);var ap=50,D$=new Dr,HE={min:.2,max:4},L$=10,I$=.1,B$=250,N$=100,$$=2e3;function In(e,t,n,i,o){var r=this;this._canvas=i,this._elementRegistry=o,this._eventBus=n,this._injector=t,this._config=e||{},this._updateTimeout=null,this._firstDebounceTime=null,this._dirty=!1,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=D$.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||cp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=sp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);hg(p,r._canvas),r._update()}function s(u){return function(f){var d=gg(f);(!r._state._svgClientRect||cp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=sp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=j$(g,h),_=r._viewportDom.getBoundingClientRect(),v={x:d.x-_.left+1,y:d.y-_.top+1};U(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:v,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),$e.bind(document,"mousemove",c),$e.bind(document,"mouseup",l)}}function c(u){var p=gg(u);if(r._state.isDragging){(!r._state._svgClientRect||cp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;U(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=GE(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});U(r._overlay.style,{clipPath:h});var m=sp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);hg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=gg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),U(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),$e.unbind(document,"mousemove",c),$e.unbind(document,"mouseup",l))}$e.bind(this._viewportDom,"mousedown",s(!1)),$e.bind(this._svg,"mousedown",s(!0)),$e.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||cp(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!W$(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*U$(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>I$){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=q$(HE,L$*2),m=Math.round(g/h)*h;m+=h*d;var _=Math.pow(10,m);i.zoom(Y$(HE,_),v),r._state.zoomDelta=0;var v=sp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);hg(v,r._canvas),r._update()}}}),$e.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",B$,function(u){if(!r.isOpen()){r._dirty=!0;return}u.elements.forEach(function(p){r._updateElement(p)}),r._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,f=u.newId;r._updateElementId(p,f)}),n.on("canvas.viewbox.changed",function(){r._state.isDragging||r._update()}),n.on("canvas.resized",function(){document.body.contains(r._parent)&&(r._state.isDragging||r._update(),r._state._svgClientRect=r._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(f){r._addElement(f)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}In.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],In.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Rt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Rt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Rt(o).add("map"),n.appendChild(o);var r=this._svg=Le("svg");Se(r,{width:"100%",height:"100%"}),qe(o,r);var a=this._elementsGroup=Le("g");qe(r,a);var s=this._viewportGroup=Le("g");qe(r,s);var c=this._viewport=Le("rect");lt(c).add("viewport"),qe(s,c),$e.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Rt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Rt(u).add("overlay"),this._parent.appendChild(u)},In.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Ge(this._config.debounceDelay)?this._config.debounceDelay:N$,n=Ge(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:$$,i=Date.now();if(this._firstDebounceTime&&i-this._firstDebounceTime>=n){this._update();return}this._updateTimeout&&clearTimeout(this._updateTimeout),this._firstDebounceTime=this._firstDebounceTime||i,this._updateTimeout=setTimeout(function(){e._update()},t)}},In.prototype._rebuild=function(){this._clear();var e=this._canvas,t=e.getRootElement&&e.getRootElement();if(t&&t.children){var n=this;t.children.forEach(function(i){n._addElement(i)})}},In.prototype._update=function(){if(this.isOpen()){this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=null),this._firstDebounceTime=null;var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(VE(e)){var i,o,r,a,s=n.width-t.width,c=n.height-t.height;t.width<n.width?(i=t.x-s/2,r=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,r=t.width),t.height<n.height?(o=t.y-c/2,a=n.height,t.y+t.height<n.height&&(o=Math.min(0,t.y))):(o=t.y,a=t.height),i=i-ap,o=o-ap,r=r+ap*2,a=a+ap*2,this._lastViewbox={x:i,y:o,width:r,height:a},Se(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Se(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};U(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=GE(l,p);U(this._overlay.style,{clipPath:f})}}},In.prototype.open=function(){U(this._state,{isOpen:!0}),Rt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},In.prototype.close=function(){U(this._state,{isOpen:!1}),Rt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},In.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},In.prototype.isOpen=function(){return this._state.isOpen},In.prototype._updateElement=function(e){try{e.parent!==void 0&&e.parent!==null&&(this._removeElement(e),this._addElement(e))}catch(t){console.warn("Minimap#_updateElement errored",t)}},In.prototype._updateElementId=function(e,t){try{var n=Et("#"+Nr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},In.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},In.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)&&!e.hidden){var n,i,o,r=this._createElement(e),a=Et("#"+Nr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=z$(e);return s!==-1?a?G$(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),F$(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Se(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Se(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},In.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&rn(t)},In.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Uo(t),n)){var i=K$(wf(n));return Se(i,{id:this._prefixId(e.id)}),i}},In.prototype._clear=function(){gs(this._elementsGroup)},In.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function F$(e){return e.waypoints}function j$(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}function sp(e,t,n){var i=t.getBoundingClientRect(),o=H$(n,i.width/i.height),r=zE(e.x,0,i.width,o.x,o.x+o.width),a=zE(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function hg(e,t){var n=t.viewbox(),i=n.width,o=n.height;t.viewbox({x:e.x-i/2,y:e.y-o/2,width:i,height:o})}function H$(e,t){var n=e.width/e.height,i=U({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;U(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;U(i,{x:s,width:a})}return i}function zE(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function z$(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function G$(e,t,n){var i=V$(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function V$(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function cp(e){return e.width===0&&e.height===0}function W$(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var U$=Math.sign||function(e){return e>=0?1:-1};function q$(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10),o=Math.abs(n)+Math.abs(i);return o/t}function Y$(e,t){return Math.max(e.min,Math.min(e.max,t))}function GE(e,t){var n=[co(t.left,t.top),co(t.left+t.width,t.top),co(t.left+t.width,t.top+t.height),co(t.left,t.top+t.height),co(t.left,e.height),co(e.width,e.height),co(e.width,0),co(0,0),co(0,e.height),co(t.left,e.height)].join(", ");return"polygon("+n+")"}function co(e,t){return e+"px "+t+"px"}function VE(e){return Oo(e,function(t){return hn(t)?VE(t):Ge(t)&&isFinite(t)})}function gg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function K$(e){return hs("[id]",e).forEach(function(t){t.remove()}),e}var X$={__init__:["minimap"],minimap:["type",In]};const WE={closed:"미니맵",open:"접기"};class UE{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(Ch,()=>this.rebuild()),t.on("minimap.toggle",o=>this.retitle(o.open)),this.retitle(n.isOpen())}rebuild(){const t=this.minimap;if(!t.isOpen()){t._dirty=!0;return}t._rebuild(),t._update()}retitle(t){const n=this.canvas.getContainer().querySelector(".djs-minimap .toggle");n==null||n.setAttribute("title",t?WE.open:WE.closed)}}pi(UE,"$inject",["eventBus","minimap","canvas"]);const Z$={__depends__:[X$],__init__:["minimapI18n"],minimapI18n:["type",UE]},Q$=me.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=me.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Gp(u);return o("imported",p),{warnings:p}}catch(u){throw o("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return me.onMounted(async()=>{a=new so({container:r.value,moddleExtensions:Ic,additionalModules:[G_,Z$]}),i.xml&&await s(i.xml),o("ready")}),me.watch(()=>i.xml,l=>{l&&a&&s(l)}),me.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(me.openBlock(),me.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),mg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},J$=mg(Q$,[["__scopeId","data-v-7847e007"]]),e5=["title","aria-expanded"],t5=["title","onClick"],n5={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},i5={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},o5={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},r5={key:0,class:"bwl-validation__body"},a5={key:0,class:"bwl-validation__empty"},s5={key:1,class:"bwl-validation__empty"},c5={key:2,class:"bwl-validation__list"},l5=["onClick"],u5={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},p5={class:"bwl-validation__msg"},f5=["title"],d5=mg(me.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=me.computed(()=>N_(n.issues.value,n.describeElement)),o=me.computed(()=>$_(i.value)),r=g=>Ia(g,n.changeScope.value),a=me.computed(()=>Rh(i.value,n.changeScope.value)),s=me.ref({error:!0,warning:!0,info:!0}),c=me.computed(()=>F_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=me.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(me.openBlock(),me.createElementBlock("section",{class:me.normalizeClass(["bwl-validation",{"is-open":l.value}])},[me.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[me.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(me.openBlock(),me.createElementBlock("svg",{class:me.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[me.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=me.createElementVNode("span",null,"검증",-1))],8,e5),me.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=me.withModifiers(()=>{},["stop"]))},[(me.openBlock(),me.createElementBlock(me.Fragment,null,me.renderList(u,m=>me.createElementVNode("button",{key:m,type:"button",class:me.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>f(m)},[(me.openBlock(),me.createElementBlock("svg",n5,[h[4]||(h[4]=me.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(me.openBlock(),me.createElementBlock("path",i5)):(me.openBlock(),me.createElementBlock("path",o5))])),me.createElementVNode("span",null,me.toDisplayString(o.value[m]),1)],10,t5)),64))])]),l.value?(me.openBlock(),me.createElementBlock("div",r5,[i.value.length===0?(me.openBlock(),me.createElementBlock("p",a5,"발견된 문제가 없습니다.")):c.value.length===0?(me.openBlock(),me.createElementBlock("p",s5," 선택한 심각도에 해당하는 항목이 없습니다. ")):(me.openBlock(),me.createElementBlock("ul",c5,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(c.value,m=>(me.openBlock(),me.createElementBlock("li",{key:m.key,class:me.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:_=>d(m)},[h[5]||(h[5]=me.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(me.openBlock(),me.createElementBlock("span",u5,"이번 변경")):me.createCommentVNode("",!0),me.createElementVNode("span",p5,me.toDisplayString(m.message),1),me.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},me.toDisplayString(m.category),9,f5)],10,l5))),128))]))])):me.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),h5={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},g5=["aria-checked","title","data-locale","onClick"],m5={class:"bwl-locale__label"},y5={key:0,class:"bwl-locale__badge"},v5=mg(me.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(r){try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??r}catch{return r}}const o=me.computed(()=>{const r=n.i18n.value;return r?r.locales.map(a=>{const s=r.counts[a]??{untranslated:0,reviewRequested:0},c=a===r.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===r.displayLocale,design:a===r.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(r,a)=>o.value.length?(me.openBlock(),me.createElementBlock("div",h5,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(o.value,s=>(me.openBlock(),me.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:me.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>me.unref(n).setDisplayLocale(s.locale)},[me.createElementVNode("span",m5,me.toDisplayString(s.label),1),s.pending>0?(me.openBlock(),me.createElementBlock("span",y5,me.toDisplayString(s.pending),1)):me.createCommentVNode("",!0)],10,g5))),128))])):me.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ee.ADDABLE_FLOW_NODE_TYPES=wc,ee.APPLY_BPMN_OPS_SCHEMA=yS,ee.BPMN_EVENT_DEFINITION_TYPES=Sc,ee.BPMN_MODDLE_EXTENSIONS=Ic,ee.BWL_MODDLE_SCHEMA=Tg,ee.BWL_NS=Pg,ee.BWL_PREFIX=yp,ee.BWL_REVIEW_REQUEST_TYPE=Cc,ee.BWL_SIDES=vp,ee.BpmnDisplayLocaleSwitcher=v5,ee.BpmnModelerView=J$,ee.BpmnValidationPanel=d5,ee.EDITOR=$M,ee.FLOW_LABEL_INDENT=um,ee.GROUP_BORDER_MIN_RUN=Vp,ee.GROUP_BORDER_NEAR=la,ee.HEADLESS_BPMN_MODULES=D_,ee.HEADLESS_TEXT_METRICS=sa,ee.I18N_DISPLAY_REDRAWN_EVENT=Ch,ee.I18N_NS=J1,ee.I18N_PREFIX=Ig,ee.I18N_REVIEW_REQUESTED_CLASS=H_,ee.I18N_TRANSLATION_TYPE=na,ee.I18N_UNTRANSLATED_CLASS=j_,ee.I18nDisplay=Mh,ee.I18nDisplayModule=G_,ee.IR_EVENT_DEFINITIONS=Ec,ee.IR_FLOW_NODE_TYPES=vr,ee.IR_TEXT_LOCALES=Rc,ee.LABEL_FORK_MARGIN=qp,ee.LABEL_SHAPE_MIN_DEPTH=wm,ee.SET_TRANSLATIONS_COMMAND=Cp,ee.SEVERITY_ORDER=Sh,ee.SYMBOLIC_OP_KINDS=Bg,ee.SYMBOLIC_OP_SCHEMA=Ng,ee.SetTranslationsHandler=Mp,ee.TranslationCommands=Pp,ee.TranslationCommandsModule=Tp,ee.UNDO_EPISODE_COMMAND=bp,ee.UPDATE_TRANSLATION_COMMAND=Pc,ee.UpdateTranslationHandler=Rp,ee.applyBpmnOpBatch=Ey,ee.applyBpmnOps=gy,ee.applyLocaleBackfill=VM,ee.approximateTextWidth=ca,ee.auditBpmnGeometry=Rm,ee.auditBpmnGeometryXml=dC,ee.auditBpmnSemantics=mf,ee.auditBpmnSemanticsXml=CM,ee.auditGeometry=pt,ee.auditTargetsOf=Gn,ee.axisSegmentsOf=on,ee.blackBoxNameRect=Wp,ee.buildBpmnOpBatch=LM,ee.buildRegistryIndex=Mm,ee.containerBoundarySegments=pa,ee.countBySeverity=$_,ee.createBpmnEditorController=FM,ee.createBpmnModdle=nm,ee.createHeadlessBpmnModeler=uL,ee.crossedShapesOf=zt,ee.crossingCost=hi,ee.describeProcess=by,ee.describeProcessXml=xM,ee.diffBpmnElements=wy,ee.diffBpmnElementsXml=OM,ee.documentLocalesOf=ns,ee.edgeCrossCount=cs,ee.edgeCrossingPairsOf=$o,ee.edgeCrossingStatsOf=ym,ee.executeAsUndoEpisode=Og,ee.followMovedEdgeLabels=Qm,ee.forwardThreePointCandidates=zc,ee.geometryFindingKey=ct,ee.inferScriptLocale=vf,ee.installHeadlessBpmnDom=om,ee.irEventDefinitionOf=mp,ee.isAddableFlowNodeType=Mg,ee.isChangeScopeMixed=Rh,ee.isEdgeOverlapFinding=Up,ee.isInChangeScope=Ia,ee.isIrEventDefinition=Ag,ee.isIrFlowNodeType=Cg,ee.isIrTextLocale=G1,ee.labelRectsOf=Fo,ee.labelShapeDepth=Em,ee.labelSlot=xr,ee.lineCrossesLabel=Bi,ee.lineThroughLabel=fm,ee.lineThroughShapeLabel=_m,ee.loadBpmnXml=aa,ee.localeTextsOf=Sp,ee.lowerOps=dy,ee.oppositeOverlapCount=JR,ee.oppositeOverlapOf=lm,ee.planBackEdgeBoundaryClearance=jm,ee.planCrossPoolRoute=Im,ee.planEdgeRepair=Qp,ee.planLabelLineClearance=uf,ee.planLabelPlacement=Km,ee.planLocaleBackfill=GM,ee.planMiddleSegmentShifts=Pm,ee.planOppositeOverlapRepair=zm,ee.planSegmentDetours=Hc,ee.planShapeLabelClearance=ty,ee.redockIntroducedDetachedEndpoints=iy,ee.repairIntroducedBoundaryHugging=Hm,ee.repairIntroducedCrossings=Jp,ee.repairIntroducedEdgeCrossings=Tm,ee.repairIntroducedFakeMerges=Vm,ee.repairIntroducedLabelLines=Jm,ee.repairIntroducedOppositeOverlaps=Ym,ee.repairIntroducedShapeLabelLines=ny,ee.repairIntroducedSharedSegmentLabels=ey,ee.rerouteIntroducedCrossPoolEdges=Bm,ee.resolverServicesOf=cy,ee.reviewRequestValuesOf=Ap,ee.reviewRequestsOf=Lo,ee.rootLangOf=Ep,ee.saveBpmnXml=HR,ee.sceneCrossingCost=mm,ee.sceneFromDefinitions=Sm,ee.sceneFromRegistry=Ve,ee.segmentShapeClearance=ss,ee.shapesUnderLabel=ls,ee.sharedEndpointCrossingPairsOf=qi,ee.sharedSegmentUnderLabel=jc,ee.sharedSpansOf=Fc,ee.sortPanelIssues=F_,ee.toPanelIssues=N_,ee.touchedElements=DM,ee.translationLocale=Nn,ee.translationsOf=ia,ee.unreadableOverlapCount=di,ee.unreadableOverlapOf=Sr,ee.validateOps=sy,ee.warningMessages=Gp,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
|